noodl-loader
Version:
Loader for noodl applications
26 lines • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const yaml_1 = tslib_1.__importDefault(require("yaml"));
const constants_1 = require("../../constants");
const extractVideos = (key, node, path, { cadlEndpoint, createAsset }) => {
if (yaml_1.default.isMap(node)) {
if (node.has('path')) {
const type = node.get('type', false);
if (type === 'video') {
const value = node.get('path', false);
const url = value.startsWith('http')
? value
: `${cadlEndpoint === null || cadlEndpoint === void 0 ? void 0 : cadlEndpoint.assetsUrl}${value}`;
const assetId = url;
createAsset({
type: constants_1.ExtractType.Asset,
id: assetId,
props: { type, path: value, url },
});
}
}
}
};
exports.default = extractVideos;
//# sourceMappingURL=extract-videos.js.map