'use strict'; var pluginSpaceConfigure = require('@flatfile/plugin-space-configure'); var pluginConvertJsonSchema = require('@flatfile/plugin-convert-json-schema'); var p = require('js-yaml'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var p__default = /*#__PURE__*/_interopDefault(p); async function i(o,e){let s=(await g(o)).map(r=>p__default.default.load(r)),f=await Promise.all(o.map(async(r,l)=>{let a=s[l],c=await pluginConvertJsonSchema.generateFields(a);return {name:r?.name||a.title,...a?.description&&{description:a.description},fields:c,...r}})),n={workbooks:[{name:e?.workbookConfig?.name||"YAML Schema Workbook",sheets:f}],...e?.workbookConfig};return e?.debug&&console.dir(n,{depth:null}),n}async function g(o){let e=o.map(async t=>await u(t.sourceUrl));return await Promise.all(e)}async function u(o){try{let e=await fetch(o);if(!e.ok)throw new Error(`API returned status ${e.status}: ${e.statusText}`);return await e.text()}catch(e){throw new Error(`Error fetching external reference: ${e.message}`)}}function w(o,e,t){return pluginSpaceConfigure.configureSpace(()=>i(o,e),t)} exports.configureSpaceWithYamlSchema = w; exports.generateSetup = i; //# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map