Comparing version 0.0.1-4bffd04f to 0.0.1-5d08a14a
@@ -32,6 +32,2 @@ "use strict"; | ||
var _isomorphicFetch = require("isomorphic-fetch"); | ||
var _isomorphicFetch2 = _interopRequireDefault(_isomorphicFetch); | ||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } | ||
@@ -157,3 +153,3 @@ | ||
_context.next = 30; | ||
return (0, _isomorphicFetch2.default)("/" + encodeURIComponent(_next), { | ||
return (0, _util.serverFetch)("/" + encodeURIComponent(_next), { | ||
method: "POST", | ||
@@ -160,0 +156,0 @@ body: (0, _jsonStableStringify2.default)(signedAction), |
@@ -8,17 +8,18 @@ "use strict"; | ||
var _ajv = require("ajv"); | ||
var _zSchema = require("z-schema"); | ||
var _ajv2 = _interopRequireDefault(_ajv); | ||
var _zSchema2 = _interopRequireDefault(_zSchema); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var ajv = new _ajv2.default({ allErrors: true }); | ||
var validator = new _zSchema2.default(); // import Ajv from "ajv"; | ||
// const ajv = new Ajv({ allErrors: true }); | ||
function queueReducer(state, action) { | ||
if (state.game.queue && state.game.queue.length > 0) { | ||
var schema = state.game.queue[0]; | ||
var validate = ajv.compile(schema); | ||
var valid = validate(action); | ||
// const validate = ajv.compile(schema); | ||
var valid = validator.validate(action, schema); | ||
if (!valid) { | ||
throw new Error(JSON.stringify({ action: action, errors: validate.errors }, null, 2)); | ||
throw new Error(JSON.stringify({ action: action, errors: validator.getLastErrors() }, null, 2)); | ||
} | ||
@@ -25,0 +26,0 @@ } |
{ | ||
"name": "cardcore", | ||
"version": "0.0.1-4bffd04f", | ||
"version": "0.0.1-5d08a14a", | ||
"description": "Core functions for cards", | ||
@@ -14,4 +14,14 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@streamplace/ssb-keys": "^7.0.16", | ||
"ajv": "^6.5.2" | ||
"@cardcore/client": "0.0.1-5d08a14a", | ||
"@cardcore/game": "0.0.1-5d08a14a", | ||
"@cardcore/util": "0.0.1-5d08a14a", | ||
"@streamplace/ssb-keys": "7.0.20", | ||
"ajv": "^6.5.2", | ||
"babel-runtime": "^6.26.0", | ||
"isomorphic-fetch": "^2.2.1", | ||
"json-stable-stringify": "^1.0.1", | ||
"redux": "^4.0.0", | ||
"redux-immutable-state-invariant": "^2.1.0", | ||
"redux-thunk": "^2.3.0", | ||
"z-schema": "^3.23.0" | ||
}, | ||
@@ -21,3 +31,3 @@ "scripts": { | ||
}, | ||
"gitHead": "4bffd04fa73be20816bbb166afb41334993ed83e" | ||
"gitHead": "5d08a14a0991da4337e23f394863ba0ba271d235" | ||
} |
// import signalhub from "signalhub"; | ||
import * as gameActions from "@cardcore/game"; | ||
import { CLIENT_LOAD_STATE_DONE, clientPoll } from "@cardcore/client"; | ||
import { hashState } from "@cardcore/util"; | ||
import { hashState, serverFetch } from "@cardcore/util"; | ||
import ssbKeys from "@streamplace/ssb-keys"; | ||
import stringify from "json-stable-stringify"; | ||
import fetch from "isomorphic-fetch"; | ||
@@ -79,3 +78,3 @@ export const REMOTE_ACTION = Symbol("REMOTE_ACTION"); | ||
}); | ||
const res = await fetch(`/${encodeURIComponent(next)}`, { | ||
const res = await serverFetch(`/${encodeURIComponent(next)}`, { | ||
method: "POST", | ||
@@ -82,0 +81,0 @@ body: stringify(signedAction), |
@@ -1,3 +0,5 @@ | ||
import Ajv from "ajv"; | ||
const ajv = new Ajv({ allErrors: true }); | ||
// import Ajv from "ajv"; | ||
// const ajv = new Ajv({ allErrors: true }); | ||
import ZSchema from "z-schema"; | ||
const validator = new ZSchema(); | ||
@@ -7,7 +9,8 @@ export default function queueReducer(state, action) { | ||
const schema = state.game.queue[0]; | ||
const validate = ajv.compile(schema); | ||
const valid = validate(action); | ||
// const validate = ajv.compile(schema); | ||
const valid = validator.validate(action, schema); | ||
if (!valid) { | ||
throw new Error( | ||
JSON.stringify({ action, errors: validate.errors }, null, 2) | ||
JSON.stringify({ action, errors: validator.getLastErrors() }, null, 2) | ||
); | ||
@@ -14,0 +17,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
66439
0
12
+ Addedbabel-runtime@^6.26.0
+ Addedisomorphic-fetch@^2.2.1
+ Addedjson-stable-stringify@^1.0.1
+ Addedredux@^4.0.0
+ Addedredux-thunk@^2.3.0
+ Addedz-schema@^3.23.0
+ Added@babel/runtime@7.26.0(transitive)
+ Added@cardcore/client@0.0.1-5d08a14a(transitive)
+ Added@cardcore/game@0.0.1-5d08a14a(transitive)
+ Added@cardcore/util@0.0.1-5d08a14a(transitive)
+ Added@streamplace/ssb-keys@7.0.20(transitive)
+ Addedbabel-runtime@6.26.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addedcore-js@2.6.12(transitive)
+ Addedencoding@0.1.13(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedinvariant@2.2.4(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjson-stringify-safe@5.0.1(transitive)
+ Addedlodash.get@4.4.2(transitive)
+ Addedlodash.isequal@4.5.0(transitive)
+ Addedloose-envify@1.4.0(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedredux@4.2.1(transitive)
+ Addedredux-immutable-state-invariant@2.1.0(transitive)
+ Addedredux-thunk@2.4.2(transitive)
+ Addedregenerator-runtime@0.11.10.14.1(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedvalidator@10.11.0(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)
+ Addedz-schema@3.25.1(transitive)
- Removed@streamplace/ssb-keys@7.0.21(transitive)
Updated@streamplace/ssb-keys@7.0.20