@medplum/definitions
Version:
Medplum Data Definitions
3 lines (2 loc) • 2.17 kB
JavaScript
;var a=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var j=(e,r)=>{for(var t in r)a(e,t,{get:r[t],enumerable:!0})},T=(e,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of E(r))!g.call(e,o)&&o!==t&&a(e,o,{get:()=>r[o],enumerable:!(s=y(r,o))||s.enumerable});return e};var _=e=>T(a({},"__esModule",{value:!0}),e);var L={};j(L,{SEARCH_PARAMETER_BUNDLE_FILES:()=>P,STRUCTURE_DEFINITION_BUNDLE_FILES:()=>x,TERMINOLOGY_BUNDLE_FILES:()=>S,getDataDir:()=>u,getDefinitionResource:()=>v,readJson:()=>h,readJsonAsync:()=>R});module.exports=_(L);var m=require("fs"),l=require("node:fs"),d=require("node:fs/promises"),n=require("node:path"),p=require("node:url"),c={},D=Object.freeze([]);function h(e){let r=(0,n.resolve)(u(),e);return JSON.parse((0,m.readFileSync)(r,"utf8"))}async function R(e){let r=(0,n.resolve)(u(),e),t=await(0,d.readFile)(r,"utf8");return JSON.parse(t)}var f;function u(){if(f)return f;let e=N(),r=["./","../","./cjs/","./esm/"];for(let t of r){let s=(0,n.resolve)(e,t),o=(0,n.resolve)(s,"fhir");if((0,l.existsSync)(o))return f=s,s}throw new Error("No data directory found")}function N(){if(typeof __dirname<"u")return(0,n.resolve)(__dirname);if(c.url)return(0,n.resolve)((0,n.dirname)((0,p.fileURLToPath)(c.url)));throw new Error("No data directory found")}var P=["fhir/r4/search-parameters.json","fhir/r4/search-parameters-medplum.json","fhir/r4/search-parameters-uscore.json"],x=["fhir/r4/profiles-types.json","fhir/r4/profiles-resources.json","fhir/r4/profiles-medplum.json","fhir/r4/profiles-others.json"],S=["fhir/r4/v2-tables.json","fhir/r4/v3-codesystems.json","fhir/r4/valuesets.json","fhir/r4/valuesets-medplum.json","fhir/r4/valuesets-medplum-generated.json"];function v(e,r,t){let s=h(e);for(let o of s.entry??D){let i=o.resource;if(i?.resourceType===r&&i.url===t)return i}throw new Error(`Missing definition resource: ${r}?url=${t}`)}0&&(module.exports={SEARCH_PARAMETER_BUNDLE_FILES,STRUCTURE_DEFINITION_BUNDLE_FILES,TERMINOLOGY_BUNDLE_FILES,getDataDir,getDefinitionResource,readJson,readJsonAsync});
//# sourceMappingURL=index.cjs.map