@o3r/core
Version:
Core of the Otter Framework
39 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ngGenerateStore = void 0;
const schematics_1 = require("@angular-devkit/schematics");
const schematics_2 = require("@o3r/schematics");
/**
* Create an Otter store
* @param options
*/
function ngGenerateStoreFn(options) {
const parameterToChildSchematics = Object.entries(options)
.reduce((acc, [key, value]) => {
acc[key] = value === null ? undefined : value;
return acc;
}, {});
switch (options.storeType) {
case 'simple-sync': {
return (0, schematics_1.schematic)('store-simple-sync', parameterToChildSchematics);
}
case 'simple-async': {
return (0, schematics_1.schematic)('store-simple-async', parameterToChildSchematics);
}
case 'entity-async': {
return (0, schematics_1.schematic)('store-entity-async', parameterToChildSchematics);
}
case 'entity-sync': {
return (0, schematics_1.schematic)('store-entity-sync', parameterToChildSchematics);
}
default: {
return (0, schematics_1.schematic)('store-entity-async', parameterToChildSchematics);
}
}
}
/**
* Create an Otter store
* @param options
*/
exports.ngGenerateStore = (0, schematics_2.createOtterSchematic)(ngGenerateStoreFn);
//# sourceMappingURL=index.js.map