Socket
Socket
Sign inDemoInstall

cqrs-eventdenormalizer

Package Overview
Dependencies
Maintainers
2
Versions
169
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cqrs-eventdenormalizer - npm Package Compare versions

Comparing version 1.15.0 to 1.16.0

lib/structure/customLoader.js

17

lib/denormalizer.js

@@ -8,2 +8,3 @@ var debug = require('debug')('denormalizer'),

uuid = require('uuid').v4,
customLoader = require('./structure/customLoader'),
structureLoader = require('./structure/structureLoader'),

@@ -17,2 +18,14 @@ attachLookupFunctions = require('./structure/treeExtender'),

function createStructureLoader (options) {
if (options) {
if (!_.isFunction(options)) {
var err = new Error('"options.structureLoader" is not a valid structure loader method');
debug(err);
throw err;
};
return customLoader(options);
}
return structureLoader;
}
/**

@@ -42,2 +55,4 @@ * Denormalizer constructor

this.structureLoader = createStructureLoader(options.structureLoader);
this.repository = viewmodel.write(options.repository);

@@ -272,3 +287,3 @@

debug('load denormalizer files..');
structureLoader(self.options.denormalizerPath, function (err, tree, warns) {
self.structureLoader(self.options.denormalizerPath, function (err, tree, warns) {
if (err) {

@@ -275,0 +290,0 @@ return callback(err);

2

package.json
{
"author": "adrai",
"name": "cqrs-eventdenormalizer",
"version": "1.15.0",
"version": "1.16.0",
"private": false,

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -301,2 +301,31 @@ # Introduction

## Using custom structure loader function
The built-in structure loader can be replaced with one adapted to your needs.
To do that, you need to include a loading method in the options object passed to the domain constructor.
// options will contain denormalizerPath as well as the as well as a definition object containing all the constructors of the denormalizer components ( Collection, ViewBuilder etc. )
function structureLoader(options) {
const collection = new options.definitions.Collection({
name: 'col'
});
collection.addViewBuilder(new options.definitions.ViewBuilder({
name: 'evt',
aggregate: 'agg',
context: 'ctx'
}, function() {}));
return {
collections: [
collection
]
};
// or more probably
return myExternalLoader(options.denormalizerPath, options.definitions);
}
require('cqrs-eventdenormalizer')({
denormalizerPath: '/path/to/my/files',
structureLoader: structureLoader
});
## Initialization

@@ -303,0 +332,0 @@

@@ -0,1 +1,4 @@

## [v1.16.0](https://github.com/adrai/node-cqrs-eventdenormalizer/compare/v1.15.0...v1.16.0)
- add option to add custom structureLoader implementation
## [v1.15.0](https://github.com/adrai/node-cqrs-eventdenormalizer/compare/v1.14.12...v1.15.0)

@@ -2,0 +5,0 @@ - add useAsId methods to ViewModel and EventExtender [#75](https://github.com/adrai/node-cqrs-eventdenormalizer/pull/75) thanks to [nanov](https://github.com/nanov)

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