@startupjs/backend
Advanced tools
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) | ||
} | ||
} |
{ | ||
"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" | ||
} |
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
23959
18
533
+ Added@aws-sdk/client-cognito-identity@3.658.0(transitive)
+ Added@aws-sdk/client-sso@3.658.0(transitive)
+ Added@aws-sdk/client-sso-oidc@3.658.0(transitive)
+ Added@aws-sdk/client-sts@3.658.0(transitive)
+ Added@aws-sdk/core@3.658.0(transitive)
+ Added@aws-sdk/credential-provider-cognito-identity@3.658.0(transitive)
+ Added@aws-sdk/credential-provider-http@3.654.0(transitive)
+ Added@aws-sdk/credential-provider-ini@3.658.0(transitive)
+ Added@aws-sdk/credential-provider-node@3.658.0(transitive)
+ Added@aws-sdk/credential-provider-sso@3.658.0(transitive)
+ Added@aws-sdk/credential-providers@3.658.0(transitive)
+ Added@startupjs/schema@0.56.0-alpha.50(transitive)
+ Added@types/node@22.7.0(transitive)
+ Addedajv@8.17.1(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-uri@3.0.1(transitive)
+ Addedjson-schema-traverse@1.0.0(transitive)
+ Addedrequire-from-string@2.0.2(transitive)
- Removed@aws-sdk/client-cognito-identity@3.658.1(transitive)
- Removed@aws-sdk/client-sso@3.658.1(transitive)
- Removed@aws-sdk/client-sso-oidc@3.658.1(transitive)
- Removed@aws-sdk/client-sts@3.658.1(transitive)
- Removed@aws-sdk/core@3.658.1(transitive)
- Removed@aws-sdk/credential-provider-cognito-identity@3.658.1(transitive)
- Removed@aws-sdk/credential-provider-http@3.658.1(transitive)
- Removed@aws-sdk/credential-provider-ini@3.658.1(transitive)
- Removed@aws-sdk/credential-provider-node@3.658.1(transitive)
- Removed@aws-sdk/credential-provider-sso@3.658.1(transitive)
- Removed@aws-sdk/credential-providers@3.658.1(transitive)
- Removed@types/node@22.7.4(transitive)