UNPKG

668 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.ApiExtension = void 0;
4const constants_1 = require("../constants");
5const helpers_1 = require("./helpers");
6const lodash_1 = require("lodash");
7function ApiExtension(extensionKey, extensionProperties) {
8 if (!extensionKey.startsWith('x-')) {
9 throw new Error('Extension key is not prefixed. Please ensure you prefix it with `x-`.');
10 }
11 const extensionObject = {
12 [extensionKey]: lodash_1.clone(extensionProperties)
13 };
14 return helpers_1.createMixedDecorator(constants_1.DECORATORS.API_EXTENSION, extensionObject);
15}
16exports.ApiExtension = ApiExtension;