UNPKG

@webiny/api-headless-cms-ddb

Version:

DynamoDB storage operations plugin for Headless CMS API.

33 lines (31 loc) 911 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default; Object.defineProperty(exports, "__esModule", { value: true }); exports.getMappedPlugins = void 0; var _error = _interopRequireDefault(require("@webiny/error")); const getMappedPlugins = params => { const { plugins: pluginsContainer, type, property } = params; const plugins = pluginsContainer.byType(type); if (plugins.length === 0) { return {}; } return plugins.reduce((collection, plugin) => { const key = plugin[property]; if (typeof key !== "string") { throw new _error.default("Property to map the plugins on must be a string.", "PLUGIN_PROPERTY_ERROR", { type, property }); } collection[key] = plugin; return collection; }, {}); }; exports.getMappedPlugins = getMappedPlugins; //# sourceMappingURL=mapPlugins.js.map