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

metaschema

Package Overview
Dependencies
Maintainers
1
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metaschema - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

38

lib/decorators.js

@@ -42,20 +42,26 @@ 'use strict';

class Log extends Decorator {}
class View extends Decorator {}
module.exports = {
// Field decorators
Enum: (...values) => new Enum(values),
Many: def => new Many(def),
Parent: def => new Parent(def),
Master: def => new Master(def),
Include: def => new Include(def),
// Index decorators
Index: (...values) => new Index(values),
Unique: (...fields) => new Unique(fields),
// Validation function decorator
Validate: fn => Object.setPrototypeOf(fn, Validate),
// Entity decorators
Registry: def => new Registry(def),
Dictionary: def => new Dictionary(def),
System: def => new System(def),
Log: def => new Log(def)
entity: {
// Entity decorators
Registry: def => new Registry(def),
Dictionary: def => new Dictionary(def),
System: def => new System(def),
Log: def => new Log(def),
View: def => new View(def)
},
attribute: {
// Field decorators
Enum: (...values) => new Enum(values),
Many: def => new Many(def),
Parent: def => new Parent(def),
Master: def => new Master(def),
Include: def => new Include(def),
// Index decorators
Index: (...fields) => new Index(fields),
Unique: (...fields) => new Unique(fields),
// Validation function decorator
Validate: fn => Object.setPrototypeOf(fn, Validate)
}
};

@@ -5,2 +5,3 @@ 'use strict';

const fs = require('fs');
const path = require('path');
const { basename } = require('path');

@@ -11,2 +12,4 @@ const metasync = require('metasync');

const decorators = require('./decorators.js');
const moduleDir = path.dirname(__dirname);
const schemasDir = moduleDir + '/schemas/';

@@ -56,3 +59,3 @@ const SCRIPT_TIMEOUT = 2000;

) => {
if (!path.includes('/')) path = './schemas/' + path;
if (!path.includes('/')) path = schemasDir + path;
const schemas = {};

@@ -95,8 +98,12 @@ fs.readdir(path, (err, files) => {

Object.assign(structs, decorators, {
List: category => items => items.map(
item => createInstance(category, item)
)
});
decorators.attribute.List = category => items => items.map(
item => createInstance(category, item)
);
Object.assign(
structs,
decorators.entity,
decorators.attribute
);
const min = (a, b) => (a < b ? a : b);

@@ -245,3 +252,3 @@

loadSchema('./schemas/CategoryField.schema', (err, schema) => {
loadSchema(schemasDir + 'CategoryField.schema', (err, schema) => {
if (err) throw err;

@@ -251,3 +258,3 @@ build({ CategoryField: schema });

loadSchema('./schemas/domains.schema', (err, schema) => {
loadSchema(schemasDir + 'domains.schema', (err, schema) => {
if (err) throw err;

@@ -266,2 +273,3 @@ for (const name in schema) {

categories,
decorators,
createInstance,

@@ -268,0 +276,0 @@ validate,

{
"name": "metaschema",
"version": "0.0.11",
"version": "0.0.12",
"author": "Timur Shemsedinov <timur.shemsedinov@gmail.com>",

@@ -5,0 +5,0 @@ "description": "Metadata Schema and Interface Definition Language (IDL)",

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