@0x/json-schemas
Advanced tools
Comparing version 5.1.0 to 5.2.0
[ | ||
{ | ||
"version": "5.2.0", | ||
"changes": [ | ||
{ | ||
"note": "Add `exchangeProxyMetaTransactionSchema`", | ||
"pr": 2657 | ||
} | ||
], | ||
"timestamp": 1603231564 | ||
}, | ||
{ | ||
"version": "5.1.0", | ||
@@ -4,0 +14,0 @@ "changes": [ |
@@ -8,2 +8,6 @@ <!-- | ||
## v5.2.0 - _October 20, 2020_ | ||
* Add `exchangeProxyMetaTransactionSchema` (#2657) | ||
## v5.1.0 - _July 15, 2020_ | ||
@@ -10,0 +14,0 @@ |
"use strict"; | ||
var __values = (this && this.__values) || function (o) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; | ||
if (m) return m.call(o); | ||
return { | ||
next: function () { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var jsonschema_1 = require("jsonschema"); | ||
var values = require("lodash.values"); | ||
var schemas_1 = require("./schemas"); | ||
const jsonschema_1 = require("jsonschema"); | ||
const values = require("lodash.values"); | ||
const schemas_1 = require("./schemas"); | ||
/** | ||
* A validator for [JSON-schemas](http://json-schema.org/) | ||
*/ | ||
var SchemaValidator = /** @class */ (function () { | ||
class SchemaValidator { | ||
static _assertSchemaDefined(schema) { | ||
if (schema === undefined) { | ||
throw new Error(`Cannot add undefined schema`); | ||
} | ||
} | ||
/** | ||
* Instantiates a SchemaValidator instance | ||
*/ | ||
function SchemaValidator() { | ||
var e_1, _a; | ||
constructor() { | ||
this._validator = new jsonschema_1.Validator(); | ||
try { | ||
for (var _b = __values(values(schemas_1.schemas)), _c = _b.next(); !_c.done; _c = _b.next()) { | ||
var schema = _c.value; | ||
SchemaValidator._assertSchemaDefined(schema); | ||
this._validator.addSchema(schema, schema.id); | ||
} | ||
for (const schema of values(schemas_1.schemas)) { | ||
SchemaValidator._assertSchemaDefined(schema); | ||
this._validator.addSchema(schema, schema.id); | ||
} | ||
catch (e_1_1) { e_1 = { error: e_1_1 }; } | ||
finally { | ||
try { | ||
if (_c && !_c.done && (_a = _b.return)) _a.call(_b); | ||
} | ||
finally { if (e_1) throw e_1.error; } | ||
} | ||
} | ||
SchemaValidator._assertSchemaDefined = function (schema) { | ||
if (schema === undefined) { | ||
throw new Error("Cannot add undefined schema"); | ||
} | ||
}; | ||
/** | ||
@@ -52,6 +31,6 @@ * Add a schema to the validator. All schemas and sub-schemas must be added to | ||
*/ | ||
SchemaValidator.prototype.addSchema = function (schema) { | ||
addSchema(schema) { | ||
SchemaValidator._assertSchemaDefined(schema); | ||
this._validator.addSchema(schema, schema.id); | ||
}; | ||
} | ||
// In order to validate a complex JS object using jsonschema, we must replace any complex | ||
@@ -67,7 +46,7 @@ // sub-types (e.g BigNumber) with a simpler string representation. Since BigNumber and other | ||
*/ | ||
SchemaValidator.prototype.validate = function (instance, schema) { | ||
validate(instance, schema) { | ||
SchemaValidator._assertSchemaDefined(schema); | ||
var jsonSchemaCompatibleObject = JSON.parse(JSON.stringify(instance)); | ||
const jsonSchemaCompatibleObject = JSON.parse(JSON.stringify(instance)); | ||
return this._validator.validate(jsonSchemaCompatibleObject, schema); | ||
}; | ||
} | ||
/** | ||
@@ -79,9 +58,8 @@ * Check whether an instance properly adheres to a JSON schema | ||
*/ | ||
SchemaValidator.prototype.isValid = function (instance, schema) { | ||
var isValid = this.validate(instance, schema).errors.length === 0; | ||
isValid(instance, schema) { | ||
const isValid = this.validate(instance, schema).errors.length === 0; | ||
return isValid; | ||
}; | ||
return SchemaValidator; | ||
}()); | ||
} | ||
} | ||
exports.SchemaValidator = SchemaValidator; | ||
//# sourceMappingURL=schema_validator.js.map |
@@ -825,2 +825,42 @@ export declare const schemas: { | ||
}; | ||
exchangeProxyMetaTransactionSchema: { | ||
"id": string; | ||
"properties": { | ||
"signer": { | ||
"$ref": string; | ||
}; | ||
"sender": { | ||
"$ref": string; | ||
}; | ||
"minGasPrice": { | ||
"$ref": string; | ||
}; | ||
"maxGasPrice": { | ||
"$ref": string; | ||
}; | ||
"expirationTimeSeconds": { | ||
"$ref": string; | ||
}; | ||
"salt": { | ||
"$ref": string; | ||
}; | ||
"callData": { | ||
"$ref": string; | ||
}; | ||
"value": { | ||
"$ref": string; | ||
}; | ||
"feeToken": { | ||
"$ref": string; | ||
}; | ||
"feeAmount": { | ||
"$ref": string; | ||
}; | ||
"domain": { | ||
"$ref": string; | ||
}; | ||
}; | ||
"required": string[]; | ||
"type": string; | ||
}; | ||
wholeNumberSchema: { | ||
@@ -827,0 +867,0 @@ "id": string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var addressSchema = require("../schemas/address_schema.json"); | ||
var assetPairsRequestOptsSchema = require("../schemas/asset_pairs_request_opts_schema.json"); | ||
var blockParamSchema = require("../schemas/block_param_schema.json"); | ||
var blockRangeSchema = require("../schemas/block_range_schema.json"); | ||
var callDataSchema = require("../schemas/call_data_schema.json"); | ||
var ecSignatureParameterSchema = require("../schemas/ec_signature_parameter_schema.json"); | ||
var ecSignatureSchema = require("../schemas/ec_signature_schema.json"); | ||
var eip712DomainSchema = require("../schemas/eip712_domain_schema.json"); | ||
var eip712TypedDataSchema = require("../schemas/eip712_typed_data_schema.json"); | ||
var hexSchema = require("../schemas/hex_schema.json"); | ||
var indexFilterValuesSchema = require("../schemas/index_filter_values_schema.json"); | ||
var jsNumber = require("../schemas/js_number_schema.json"); | ||
var numberSchema = require("../schemas/number_schema.json"); | ||
var orderCancellationRequestsSchema = require("../schemas/order_cancel_schema.json"); | ||
var orderConfigRequestSchema = require("../schemas/order_config_request_schema.json"); | ||
var orderFillOrKillRequestsSchema = require("../schemas/order_fill_or_kill_requests_schema.json"); | ||
var orderFillRequestsSchema = require("../schemas/order_fill_requests_schema.json"); | ||
var orderHashSchema = require("../schemas/order_hash_schema.json"); | ||
var orderSchema = require("../schemas/order_schema.json"); | ||
var orderBookRequestSchema = require("../schemas/orderbook_request_schema.json"); | ||
var ordersRequestOptsSchema = require("../schemas/orders_request_opts_schema.json"); | ||
var ordersSchema = require("../schemas/orders_schema.json"); | ||
var pagedRequestOptsSchema = require("../schemas/paged_request_opts_schema.json"); | ||
var paginatedCollectionSchema = require("../schemas/paginated_collection_schema.json"); | ||
var relayerApiAssetDataPairsResponseSchema = require("../schemas/relayer_api_asset_data_pairs_response_schema.json"); | ||
var relayerApiAssetDataPairsSchema = require("../schemas/relayer_api_asset_data_pairs_schema.json"); | ||
var relayerApiAssetDataTradeInfoSchema = require("../schemas/relayer_api_asset_data_trade_info_schema.json"); | ||
var relayerApiErrorResponseSchema = require("../schemas/relayer_api_error_response_schema.json"); | ||
var relayerApiFeeRecipientsResponseSchema = require("../schemas/relayer_api_fee_recipients_response_schema.json"); | ||
var relayerApiOrderConfigPayloadSchema = require("../schemas/relayer_api_order_config_payload_schema.json"); | ||
var relayerApiOrderConfigResponseSchema = require("../schemas/relayer_api_order_config_response_schema.json"); | ||
var relayerApiOrderSchema = require("../schemas/relayer_api_order_schema.json"); | ||
var relayerApiOrderbookResponseSchema = require("../schemas/relayer_api_orderbook_response_schema.json"); | ||
var relayerApiOrdersChannelSubscribePayloadSchema = require("../schemas/relayer_api_orders_channel_subscribe_payload_schema.json"); | ||
var relayerApiOrdersChannelSubscribeSchema = require("../schemas/relayer_api_orders_channel_subscribe_schema.json"); | ||
var relayerApiOrdersChannelUpdateSchema = require("../schemas/relayer_api_orders_channel_update_response_schema.json"); | ||
var relayerApiOrdersResponseSchema = require("../schemas/relayer_api_orders_response_schema.json"); | ||
var relayerApiOrdersSchema = require("../schemas/relayer_api_orders_schema.json"); | ||
var signedOrderSchema = require("../schemas/signed_order_schema.json"); | ||
var signedOrdersSchema = require("../schemas/signed_orders_schema.json"); | ||
var tokenSchema = require("../schemas/token_schema.json"); | ||
var txDataSchema = require("../schemas/tx_data_schema.json"); | ||
var wholeNumberSchema = require("../schemas/whole_number_schema.json"); | ||
var zeroExTransactionSchema = require("../schemas/zero_ex_transaction_schema.json"); | ||
const addressSchema = require("../schemas/address_schema.json"); | ||
const assetPairsRequestOptsSchema = require("../schemas/asset_pairs_request_opts_schema.json"); | ||
const blockParamSchema = require("../schemas/block_param_schema.json"); | ||
const blockRangeSchema = require("../schemas/block_range_schema.json"); | ||
const callDataSchema = require("../schemas/call_data_schema.json"); | ||
const ecSignatureParameterSchema = require("../schemas/ec_signature_parameter_schema.json"); | ||
const ecSignatureSchema = require("../schemas/ec_signature_schema.json"); | ||
const eip712DomainSchema = require("../schemas/eip712_domain_schema.json"); | ||
const eip712TypedDataSchema = require("../schemas/eip712_typed_data_schema.json"); | ||
const exchangeProxyMetaTransactionSchema = require("../schemas/exchange_proxy_meta_transaction_schema.json"); | ||
const hexSchema = require("../schemas/hex_schema.json"); | ||
const indexFilterValuesSchema = require("../schemas/index_filter_values_schema.json"); | ||
const jsNumber = require("../schemas/js_number_schema.json"); | ||
const numberSchema = require("../schemas/number_schema.json"); | ||
const orderCancellationRequestsSchema = require("../schemas/order_cancel_schema.json"); | ||
const orderConfigRequestSchema = require("../schemas/order_config_request_schema.json"); | ||
const orderFillOrKillRequestsSchema = require("../schemas/order_fill_or_kill_requests_schema.json"); | ||
const orderFillRequestsSchema = require("../schemas/order_fill_requests_schema.json"); | ||
const orderHashSchema = require("../schemas/order_hash_schema.json"); | ||
const orderSchema = require("../schemas/order_schema.json"); | ||
const orderBookRequestSchema = require("../schemas/orderbook_request_schema.json"); | ||
const ordersRequestOptsSchema = require("../schemas/orders_request_opts_schema.json"); | ||
const ordersSchema = require("../schemas/orders_schema.json"); | ||
const pagedRequestOptsSchema = require("../schemas/paged_request_opts_schema.json"); | ||
const paginatedCollectionSchema = require("../schemas/paginated_collection_schema.json"); | ||
const relayerApiAssetDataPairsResponseSchema = require("../schemas/relayer_api_asset_data_pairs_response_schema.json"); | ||
const relayerApiAssetDataPairsSchema = require("../schemas/relayer_api_asset_data_pairs_schema.json"); | ||
const relayerApiAssetDataTradeInfoSchema = require("../schemas/relayer_api_asset_data_trade_info_schema.json"); | ||
const relayerApiErrorResponseSchema = require("../schemas/relayer_api_error_response_schema.json"); | ||
const relayerApiFeeRecipientsResponseSchema = require("../schemas/relayer_api_fee_recipients_response_schema.json"); | ||
const relayerApiOrderConfigPayloadSchema = require("../schemas/relayer_api_order_config_payload_schema.json"); | ||
const relayerApiOrderConfigResponseSchema = require("../schemas/relayer_api_order_config_response_schema.json"); | ||
const relayerApiOrderSchema = require("../schemas/relayer_api_order_schema.json"); | ||
const relayerApiOrderbookResponseSchema = require("../schemas/relayer_api_orderbook_response_schema.json"); | ||
const relayerApiOrdersChannelSubscribePayloadSchema = require("../schemas/relayer_api_orders_channel_subscribe_payload_schema.json"); | ||
const relayerApiOrdersChannelSubscribeSchema = require("../schemas/relayer_api_orders_channel_subscribe_schema.json"); | ||
const relayerApiOrdersChannelUpdateSchema = require("../schemas/relayer_api_orders_channel_update_response_schema.json"); | ||
const relayerApiOrdersResponseSchema = require("../schemas/relayer_api_orders_response_schema.json"); | ||
const relayerApiOrdersSchema = require("../schemas/relayer_api_orders_schema.json"); | ||
const signedOrderSchema = require("../schemas/signed_order_schema.json"); | ||
const signedOrdersSchema = require("../schemas/signed_orders_schema.json"); | ||
const tokenSchema = require("../schemas/token_schema.json"); | ||
const txDataSchema = require("../schemas/tx_data_schema.json"); | ||
const wholeNumberSchema = require("../schemas/whole_number_schema.json"); | ||
const zeroExTransactionSchema = require("../schemas/zero_ex_transaction_schema.json"); | ||
exports.schemas = { | ||
numberSchema: numberSchema, | ||
addressSchema: addressSchema, | ||
callDataSchema: callDataSchema, | ||
hexSchema: hexSchema, | ||
ecSignatureParameterSchema: ecSignatureParameterSchema, | ||
ecSignatureSchema: ecSignatureSchema, | ||
eip712DomainSchema: eip712DomainSchema, | ||
eip712TypedDataSchema: eip712TypedDataSchema, | ||
indexFilterValuesSchema: indexFilterValuesSchema, | ||
orderCancellationRequestsSchema: orderCancellationRequestsSchema, | ||
orderFillOrKillRequestsSchema: orderFillOrKillRequestsSchema, | ||
orderFillRequestsSchema: orderFillRequestsSchema, | ||
orderHashSchema: orderHashSchema, | ||
orderSchema: orderSchema, | ||
signedOrderSchema: signedOrderSchema, | ||
signedOrdersSchema: signedOrdersSchema, | ||
ordersSchema: ordersSchema, | ||
blockParamSchema: blockParamSchema, | ||
blockRangeSchema: blockRangeSchema, | ||
tokenSchema: tokenSchema, | ||
jsNumber: jsNumber, | ||
pagedRequestOptsSchema: pagedRequestOptsSchema, | ||
ordersRequestOptsSchema: ordersRequestOptsSchema, | ||
orderBookRequestSchema: orderBookRequestSchema, | ||
orderConfigRequestSchema: orderConfigRequestSchema, | ||
assetPairsRequestOptsSchema: assetPairsRequestOptsSchema, | ||
txDataSchema: txDataSchema, | ||
paginatedCollectionSchema: paginatedCollectionSchema, | ||
relayerApiErrorResponseSchema: relayerApiErrorResponseSchema, | ||
relayerApiFeeRecipientsResponseSchema: relayerApiFeeRecipientsResponseSchema, | ||
relayerApiOrderSchema: relayerApiOrderSchema, | ||
relayerApiOrdersSchema: relayerApiOrdersSchema, | ||
relayerApiOrderConfigPayloadSchema: relayerApiOrderConfigPayloadSchema, | ||
relayerApiOrderConfigResponseSchema: relayerApiOrderConfigResponseSchema, | ||
relayerApiOrderbookResponseSchema: relayerApiOrderbookResponseSchema, | ||
relayerApiAssetDataPairsResponseSchema: relayerApiAssetDataPairsResponseSchema, | ||
relayerApiAssetDataTradeInfoSchema: relayerApiAssetDataTradeInfoSchema, | ||
relayerApiOrdersChannelSubscribeSchema: relayerApiOrdersChannelSubscribeSchema, | ||
relayerApiOrdersChannelSubscribePayloadSchema: relayerApiOrdersChannelSubscribePayloadSchema, | ||
relayerApiOrdersChannelUpdateSchema: relayerApiOrdersChannelUpdateSchema, | ||
relayerApiOrdersResponseSchema: relayerApiOrdersResponseSchema, | ||
relayerApiAssetDataPairsSchema: relayerApiAssetDataPairsSchema, | ||
zeroExTransactionSchema: zeroExTransactionSchema, | ||
wholeNumberSchema: wholeNumberSchema, | ||
numberSchema, | ||
addressSchema, | ||
callDataSchema, | ||
hexSchema, | ||
ecSignatureParameterSchema, | ||
ecSignatureSchema, | ||
eip712DomainSchema, | ||
eip712TypedDataSchema, | ||
indexFilterValuesSchema, | ||
orderCancellationRequestsSchema, | ||
orderFillOrKillRequestsSchema, | ||
orderFillRequestsSchema, | ||
orderHashSchema, | ||
orderSchema, | ||
signedOrderSchema, | ||
signedOrdersSchema, | ||
ordersSchema, | ||
blockParamSchema, | ||
blockRangeSchema, | ||
tokenSchema, | ||
jsNumber, | ||
pagedRequestOptsSchema, | ||
ordersRequestOptsSchema, | ||
orderBookRequestSchema, | ||
orderConfigRequestSchema, | ||
assetPairsRequestOptsSchema, | ||
txDataSchema, | ||
paginatedCollectionSchema, | ||
relayerApiErrorResponseSchema, | ||
relayerApiFeeRecipientsResponseSchema, | ||
relayerApiOrderSchema, | ||
relayerApiOrdersSchema, | ||
relayerApiOrderConfigPayloadSchema, | ||
relayerApiOrderConfigResponseSchema, | ||
relayerApiOrderbookResponseSchema, | ||
relayerApiAssetDataPairsResponseSchema, | ||
relayerApiAssetDataTradeInfoSchema, | ||
relayerApiOrdersChannelSubscribeSchema, | ||
relayerApiOrdersChannelSubscribePayloadSchema, | ||
relayerApiOrdersChannelUpdateSchema, | ||
relayerApiOrdersResponseSchema, | ||
relayerApiAssetDataPairsSchema, | ||
zeroExTransactionSchema, | ||
exchangeProxyMetaTransactionSchema, | ||
wholeNumberSchema, | ||
}; | ||
//# sourceMappingURL=schemas.js.map |
{ | ||
"name": "@0x/json-schemas", | ||
"version": "5.1.0", | ||
"version": "5.2.0", | ||
"engines": { | ||
@@ -37,3 +37,3 @@ "node": ">=6.12" | ||
"type": "git", | ||
"url": "https://github.com/0xProject/0x-monorepo.git" | ||
"url": "https://github.com/0xProject/tools.git" | ||
}, | ||
@@ -43,8 +43,8 @@ "author": "", | ||
"bugs": { | ||
"url": "https://github.com/0xProject/0x-monorepo/issues" | ||
"url": "https://github.com/0xProject/tools/issues" | ||
}, | ||
"homepage": "https://github.com/0xProject/0x-monorepo/packages/json-schemas/README.md", | ||
"homepage": "https://github.com/0xProject/tools/packages/json-schemas/README.md", | ||
"dependencies": { | ||
"@0x/typescript-typings": "^5.1.1", | ||
"@types/node": "*", | ||
"@0x/typescript-typings": "^5.1.2", | ||
"@types/node": "12.12.54", | ||
"jsonschema": "^1.2.0", | ||
@@ -55,4 +55,4 @@ "lodash.values": "^4.3.0" | ||
"@0x/ts-doc-gen": "^0.0.22", | ||
"@0x/tslint-config": "^4.1.0", | ||
"@0x/utils": "^5.5.1", | ||
"@0x/tslint-config": "^4.1.1", | ||
"@0x/utils": "^5.6.0", | ||
"@types/lodash.foreach": "^4.5.3", | ||
@@ -76,3 +76,3 @@ "@types/lodash.values": "^4.3.3", | ||
}, | ||
"gitHead": "b5eb1c9ee809f14e0377658400584e9f02b7b8ef" | ||
"gitHead": "aa9db6309768cc7f25ceb4a1e352e123426b8fef" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
81221
62
2494
1
- Removed@types/node@22.10.7(transitive)
- Removedundici-types@6.20.0(transitive)
Updated@types/node@12.12.54