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

@startupjs/sharedb-schema

Package Overview
Dependencies
Maintainers
8
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@startupjs/sharedb-schema - npm Package Compare versions

Comparing version 0.32.1 to 0.33.0-alpha.4

14

lib/Schema.js

@@ -10,2 +10,3 @@ const ZSchema = require('z-schema')

this.backend = backend
this.model = backend.createModel()
this.options = options

@@ -25,2 +26,3 @@ this.schemas = schemas

snapshot: { data: newDoc },
id: docId,
collection,

@@ -40,4 +42,12 @@ op: opData

const rootSchema = this.schemas[collection]
let rootSchema = this.schemas[collection]
if (rootSchema.factory) {
const $doc = this.model._scope(`${collection}.${docId}`)
await $doc.subscribe()
// get model from factory like in @startupjs/orm: https://github.com/startupjs/startupjs/blob/master/packages/orm/lib/index.js#L77
const factoryModel = rootSchema($doc, this.model)
rootSchema = { type: 'object', properties: factoryModel.constructor.schema }
}
if (!rootSchema) {

@@ -102,3 +112,3 @@ // throw error if current collenction have no schema

this.validator.validate(snapshotData, this.schemas[collectionName])
this.validator.validate(snapshotData, schema)
const _errors = this.validator.getLastErrors()

@@ -105,0 +115,0 @@

4

package.json
{
"name": "@startupjs/sharedb-schema",
"version": "0.32.1",
"version": "0.33.0-alpha.4",
"description": "Racer plugin for schema validation module for ShareDB",

@@ -33,3 +33,3 @@ "main": "lib/index.js",

},
"gitHead": "d56aff2fb9adcc686a08f037e20ff5f67a858336"
"gitHead": "57947aca55fe27bb09e4d13287d3ad1425c12049"
}
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