Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cardcore

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cardcore - npm Package Compare versions

Comparing version 0.0.1-4bffd04f to 0.0.1-5d08a14a

6

dist/game-middleware.js

@@ -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),

15

dist/queue-reducer.js

@@ -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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc