Socket
Socket
Sign inDemoInstall

@startupjs/backend

Package Overview
Dependencies
Maintainers
6
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@startupjs/backend - npm Package Compare versions

Comparing version 0.56.0-alpha.47 to 0.56.0-alpha.49

40

index.js

@@ -8,2 +8,3 @@ import ShareDbAccess, {

import { ROOT_MODULE as MODULE } from '@startupjs/registry'
import { transformSchema } from '@startupjs/schema'
import isArray from 'lodash/isArray.js'

@@ -180,40 +181,1 @@ import isPlainObject from 'lodash/isPlainObject.js'

}
// allow schema to be specified in a simplified format - as "properties" themselves
// and also with 'required' being part of each property
function transformSchema (schema, { collectionName } = {}) {
schema = JSON.parse(JSON.stringify(schema))
// if schema is not an object, assume it's in a simplified format
if (schema.type !== 'object') {
schema = {
type: 'object',
properties: schema,
required: Object.keys(schema).filter(
// gather all required fields
// (only if explicitly set to a boolean `true` to not interfere with object's 'required' array)
key => schema[key] && schema[key].required === true
),
additionalProperties: false
}
}
stripExtraUiKeywords(schema)
schema = MODULE.reduceHook('transformSchema', schema, { collectionName })
return schema
}
// traverse type 'object' and type 'array' recursively
// and remove extra keywords (like a boolean 'require') from all objects in schema
// WARNING: this is self-mutating
function stripExtraUiKeywords (schema) {
if (schema.type === 'object') {
for (const key in schema.properties) {
const property = schema.properties[key]
if (isPlainObject(property)) {
if (typeof property.required === 'boolean') delete property.required
stripExtraUiKeywords(property)
}
}
} else if (schema.type === 'array') {
stripExtraUiKeywords(schema.items)
}
}

5

package.json
{
"name": "@startupjs/backend",
"version": "0.56.0-alpha.47",
"version": "0.56.0-alpha.49",
"description": "Create new ShareDB backend instance",

@@ -13,2 +13,3 @@ "type": "module",

"@startupjs/registry": "^0.56.0-alpha.47",
"@startupjs/schema": "^0.56.0-alpha.49",
"@startupjs/server-aggregate": "^0.56.0-alpha.0",

@@ -33,3 +34,3 @@ "@startupjs/sharedb-access": "^0.56.0-alpha.0",

},
"gitHead": "a27cd738a659cd7e27e8791dca092bfd769afabc"
"gitHead": "bbc05c4dee1174065cbd3b8a5a8454a821337927"
}
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