@loopback/openapi-spec-builder 4.0.0-alpha.8 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +57 -28
  3. package/dist/index.d.ts +18 -0
  4. package/dist/index.js +26 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/openapi-spec-builder.d.ts +188 -0
  7. package/dist/openapi-spec-builder.js +352 -0
  8. package/dist/openapi-spec-builder.js.map +1 -0
  9. package/package.json +37 -27
  10. package/src/index.ts +24 -0
  11. package/src/openapi-spec-builder.ts +394 -0
  12. package/CHANGELOG.md +0 -12
  13. package/api-docs/apple-touch-icon-114x114-precomposed.png +0 -0
  14. package/api-docs/apple-touch-icon-144x144-precomposed.png +0 -0
  15. package/api-docs/apple-touch-icon-57x57-precomposed.png +0 -0
  16. package/api-docs/apple-touch-icon-72x72-precomposed.png +0 -0
  17. package/api-docs/apple-touch-icon-precomposed.png +0 -0
  18. package/api-docs/apple-touch-icon.png +0 -0
  19. package/api-docs/css/bootstrap.min.css +0 -9
  20. package/api-docs/css/code-themes/arta.css +0 -158
  21. package/api-docs/css/code-themes/ascetic.css +0 -50
  22. package/api-docs/css/code-themes/brown_paper.css +0 -104
  23. package/api-docs/css/code-themes/brown_papersq.png +0 -0
  24. package/api-docs/css/code-themes/dark.css +0 -103
  25. package/api-docs/css/code-themes/default.css +0 -135
  26. package/api-docs/css/code-themes/far.css +0 -111
  27. package/api-docs/css/code-themes/github.css +0 -127
  28. package/api-docs/css/code-themes/googlecode.css +0 -144
  29. package/api-docs/css/code-themes/idea.css +0 -121
  30. package/api-docs/css/code-themes/ir_black.css +0 -104
  31. package/api-docs/css/code-themes/magula.css +0 -121
  32. package/api-docs/css/code-themes/monokai.css +0 -114
  33. package/api-docs/css/code-themes/pojoaque.css +0 -104
  34. package/api-docs/css/code-themes/pojoaque.jpg +0 -0
  35. package/api-docs/css/code-themes/rainbow.css +0 -114
  36. package/api-docs/css/code-themes/school_book.css +0 -111
  37. package/api-docs/css/code-themes/school_book.png +0 -0
  38. package/api-docs/css/code-themes/sl-theme.css +0 -45
  39. package/api-docs/css/code-themes/solarized_dark.css +0 -88
  40. package/api-docs/css/code-themes/solarized_light.css +0 -88
  41. package/api-docs/css/code-themes/sunburst.css +0 -158
  42. package/api-docs/css/code-themes/tomorrow-night-blue.css +0 -52
  43. package/api-docs/css/code-themes/tomorrow-night-bright.css +0 -51
  44. package/api-docs/css/code-themes/tomorrow-night-eighties.css +0 -51
  45. package/api-docs/css/code-themes/tomorrow-night.css +0 -52
  46. package/api-docs/css/code-themes/tomorrow.css +0 -49
  47. package/api-docs/css/code-themes/vs.css +0 -86
  48. package/api-docs/css/code-themes/xcode.css +0 -154
  49. package/api-docs/css/code-themes/zenburn.css +0 -115
  50. package/api-docs/css/main.css +0 -139
  51. package/api-docs/favicon.ico +0 -0
  52. package/api-docs/fonts/0ihfXUL2emPh0ROJezvraLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  53. package/api-docs/fonts/OsJ2DjdpjqFRVUSto6IffLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  54. package/api-docs/fonts/_aijTyevf54tkVDLy-dlnLO3LdcAZYWl9Si6vvxL-qU.woff +0 -0
  55. package/api-docs/index.html +0 -1021
  56. package/api-docs/js/main.js +0 -19
  57. package/api-docs/js/vendor/bootstrap.min.js +0 -6
  58. package/api-docs/js/vendor/jquery-1.10.1.min.js +0 -6
  59. package/api-docs/js/vendor/jquery.scrollTo-1.4.3.1.js +0 -218
  60. package/api-docs/js/vendor/modernizr-2.6.2-respond-1.1.0.min.js +0 -11
  61. package/dist/src/index.d.ts +0 -1
  62. package/dist/src/index.js +0 -11
  63. package/dist/src/index.js.map +0 -1
  64. package/dist/src/openapi-spec-builder.d.ts +0 -82
  65. package/dist/src/openapi-spec-builder.js +0 -138
  66. package/dist/src/openapi-spec-builder.js.map +0 -1
  67. package/dist6/src/index.d.ts +0 -1
  68. package/dist6/src/index.js +0 -11
  69. package/dist6/src/index.js.map +0 -1
  70. package/dist6/src/openapi-spec-builder.d.ts +0 -82
  71. package/dist6/src/openapi-spec-builder.js +0 -138
  72. package/dist6/src/openapi-spec-builder.js.map +0 -1
  73. package/index.d.ts +0 -6
  74. package/index.js +0 -9
@@ -1,11 +0,0 @@
1
- /* Modernizr 2.6.2 (Custom Build) | MIT & BSD
2
- * Build: http://modernizr.com/download/#-fontface-backgroundsize-borderimage-borderradius-boxshadow-flexbox-hsla-multiplebgs-opacity-rgba-textshadow-cssanimations-csscolumns-generatedcontent-cssgradients-cssreflections-csstransforms-csstransforms3d-csstransitions-applicationcache-canvas-canvastext-draganddrop-hashchange-history-audio-video-indexeddb-input-inputtypes-localstorage-postmessage-sessionstorage-websockets-websqldatabase-webworkers-geolocation-inlinesvg-smil-svg-svgclippaths-touch-webgl-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-load
3
- */
4
- ;window.Modernizr=function(a,b,c){function D(a){j.cssText=a}function E(a,b){return D(n.join(a+";")+(b||""))}function F(a,b){return typeof a===b}function G(a,b){return!!~(""+a).indexOf(b)}function H(a,b){for(var d in a){var e=a[d];if(!G(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function I(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:F(f,"function")?f.bind(d||b):f}return!1}function J(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+p.join(d+" ")+d).split(" ");return F(b,"string")||F(b,"undefined")?H(e,b):(e=(a+" "+q.join(d+" ")+d).split(" "),I(e,b,c))}function K(){e.input=function(c){for(var d=0,e=c.length;d<e;d++)u[c[d]]=c[d]in k;return u.list&&(u.list=!!b.createElement("datalist")&&!!a.HTMLDataListElement),u}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),e.inputtypes=function(a){for(var d=0,e,f,h,i=a.length;d<i;d++)k.setAttribute("type",f=a[d]),e=k.type!=="text",e&&(k.value=l,k.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(f)&&k.style.WebkitAppearance!==c?(g.appendChild(k),h=b.defaultView,e=h.getComputedStyle&&h.getComputedStyle(k,null).WebkitAppearance!=="textfield"&&k.offsetHeight!==0,g.removeChild(k)):/^(search|tel)$/.test(f)||(/^(url|email)$/.test(f)?e=k.checkValidity&&k.checkValidity()===!1:e=k.value!=l)),t[a[d]]=!!e;return t}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k=b.createElement("input"),l=":)",m={}.toString,n=" -webkit- -moz- -o- -ms- ".split(" "),o="Webkit Moz O ms",p=o.split(" "),q=o.toLowerCase().split(" "),r={svg:"http://www.w3.org/2000/svg"},s={},t={},u={},v=[],w=v.slice,x,y=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["&#173;",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},z=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b).matches;var d;return y("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},A=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=F(e[d],"function"),F(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),B={}.hasOwnProperty,C;!F(B,"undefined")&&!F(B.call,"undefined")?C=function(a,b){return B.call(a,b)}:C=function(a,b){return b in a&&F(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=w.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(w.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(w.call(arguments)))};return e}),s.flexbox=function(){return J("flexWrap")},s.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},s.canvastext=function(){return!!e.canvas&&!!F(b.createElement("canvas").getContext("2d").fillText,"function")},s.webgl=function(){return!!a.WebGLRenderingContext},s.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:y(["@media (",n.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},s.geolocation=function(){return"geolocation"in navigator},s.postmessage=function(){return!!a.postMessage},s.websqldatabase=function(){return!!a.openDatabase},s.indexedDB=function(){return!!J("indexedDB",a)},s.hashchange=function(){return A("hashchange",a)&&(b.documentMode===c||b.documentMode>7)},s.history=function(){return!!a.history&&!!history.pushState},s.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},s.websockets=function(){return"WebSocket"in a||"MozWebSocket"in a},s.rgba=function(){return D("background-color:rgba(150,255,150,.5)"),G(j.backgroundColor,"rgba")},s.hsla=function(){return D("background-color:hsla(120,40%,100%,.5)"),G(j.backgroundColor,"rgba")||G(j.backgroundColor,"hsla")},s.multiplebgs=function(){return D("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(j.background)},s.backgroundsize=function(){return J("backgroundSize")},s.borderimage=function(){return J("borderImage")},s.borderradius=function(){return J("borderRadius")},s.boxshadow=function(){return J("boxShadow")},s.textshadow=function(){return b.createElement("div").style.textShadow===""},s.opacity=function(){return E("opacity:.55"),/^0.55$/.test(j.opacity)},s.cssanimations=function(){return J("animationName")},s.csscolumns=function(){return J("columnCount")},s.cssgradients=function(){var a="background-image:",b="gradient(linear,left top,right bottom,from(#9f9),to(white));",c="linear-gradient(left top,#9f9, white);";return D((a+"-webkit- ".split(" ").join(b+a)+n.join(c+a)).slice(0,-a.length)),G(j.backgroundImage,"gradient")},s.cssreflections=function(){return J("boxReflect")},s.csstransforms=function(){return!!J("transform")},s.csstransforms3d=function(){var a=!!J("perspective");return a&&"webkitPerspective"in g.style&&y("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},s.csstransitions=function(){return J("transition")},s.fontface=function(){var a;return y('@font-face {font-family:"font";src:url("https://")}',function(c,d){var e=b.getElementById("smodernizr"),f=e.sheet||e.styleSheet,g=f?f.cssRules&&f.cssRules[0]?f.cssRules[0].cssText:f.cssText||"":"";a=/src/i.test(g)&&g.indexOf(d.split(" ")[0])===0}),a},s.generatedcontent=function(){var a;return y(["#",h,"{font:0/0 a}#",h,':after{content:"',l,'";visibility:hidden;font:3px/1 a}'].join(""),function(b){a=b.offsetHeight>=3}),a},s.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},s.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},s.localstorage=function(){try{return localStorage.setItem(h,h),localStorage.removeItem(h),!0}catch(a){return!1}},s.sessionstorage=function(){try{return sessionStorage.setItem(h,h),sessionStorage.removeItem(h),!0}catch(a){return!1}},s.webworkers=function(){return!!a.Worker},s.applicationcache=function(){return!!a.applicationCache},s.svg=function(){return!!b.createElementNS&&!!b.createElementNS(r.svg,"svg").createSVGRect},s.inlinesvg=function(){var a=b.createElement("div");return a.innerHTML="<svg/>",(a.firstChild&&a.firstChild.namespaceURI)==r.svg},s.smil=function(){return!!b.createElementNS&&/SVGAnimate/.test(m.call(b.createElementNS(r.svg,"animate")))},s.svgclippaths=function(){return!!b.createElementNS&&/SVGClipPath/.test(m.call(b.createElementNS(r.svg,"clipPath")))};for(var L in s)C(s,L)&&(x=L.toLowerCase(),e[x]=s[L](),v.push((e[x]?"":"no-")+x));return e.input||K(),e.addTest=function(a,b){if(typeof a=="object")for(var d in a)C(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},D(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function p(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return r.shivMethods?n(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+l().join().replace(/\w+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(r,b.frag)}function q(a){a||(a=b);var c=m(a);return r.shivCSS&&!f&&!c.hasCSS&&(c.hasCSS=!!k(a,"article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}")),j||p(a,c),a}var c=a.html5||{},d=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,e=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,f,g="_html5shiv",h=0,i={},j;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=n,e._domPrefixes=q,e._cssomPrefixes=p,e.mq=z,e.hasEvent=A,e.testProp=function(a){return H([a])},e.testAllProps=J,e.testStyles=y,e.prefixed=function(a,b,c){return b?J(a,b,c):J(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+v.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))};
5
-
6
- /*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
7
- /*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
8
- window.matchMedia=window.matchMedia||(function(e,f){var c,a=e.documentElement,b=a.firstElementChild||a.firstChild,d=e.createElement("body"),g=e.createElement("div");g.id="mq-test-1";g.style.cssText="position:absolute;top:-100em";d.style.background="none";d.appendChild(g);return function(h){g.innerHTML='&shy;<style media="'+h+'"> #mq-test-1 { width: 42px; }</style>';a.insertBefore(d,b);c=g.offsetWidth==42;a.removeChild(d);return{matches:c,media:h}}})(document);
9
-
10
- /*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
11
- (function(e){e.respond={};respond.update=function(){};respond.mediaQueriesSupported=e.matchMedia&&e.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return}var w=e.document,s=w.documentElement,i=[],k=[],q=[],o={},h=30,f=w.getElementsByTagName("head")[0]||s,g=w.getElementsByTagName("base")[0],b=f.getElementsByTagName("link"),d=[],a=function(){var D=b,y=D.length,B=0,A,z,C,x;for(;B<y;B++){A=D[B],z=A.href,C=A.media,x=A.rel&&A.rel.toLowerCase()==="stylesheet";if(!!z&&x&&!o[z]){if(A.styleSheet&&A.styleSheet.rawCssText){m(A.styleSheet.rawCssText,z,C);o[z]=true}else{if((!/^([a-zA-Z:]*\/\/)/.test(z)&&!g)||z.replace(RegExp.$1,"").split("/")[0]===e.location.host){d.push({href:z,media:C})}}}}u()},u=function(){if(d.length){var x=d.shift();n(x.href,function(y){m(y,x.href,x.media);o[x.href]=true;u()})}},m=function(I,x,z){var G=I.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),J=G&&G.length||0,x=x.substring(0,x.lastIndexOf("/")),y=function(K){return K.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+x+"$2$3")},A=!J&&z,D=0,C,E,F,B,H;if(x.length){x+="/"}if(A){J=1}for(;D<J;D++){C=0;if(A){E=z;k.push(y(I))}else{E=G[D].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1;k.push(RegExp.$2&&y(RegExp.$2))}B=E.split(",");H=B.length;for(;C<H;C++){F=B[C];i.push({media:F.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:k.length-1,hasquery:F.indexOf("(")>-1,minw:F.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:F.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}}j()},l,r,v=function(){var z,A=w.createElement("div"),x=w.body,y=false;A.style.cssText="position:absolute;font-size:1em;width:1em";if(!x){x=y=w.createElement("body");x.style.background="none"}x.appendChild(A);s.insertBefore(x,s.firstChild);z=A.offsetWidth;if(y){s.removeChild(x)}else{x.removeChild(A)}z=p=parseFloat(z);return z},p,j=function(I){var x="clientWidth",B=s[x],H=w.compatMode==="CSS1Compat"&&B||w.body[x]||B,D={},G=b[b.length-1],z=(new Date()).getTime();if(I&&l&&z-l<h){clearTimeout(r);r=setTimeout(j,h);return}else{l=z}for(var E in i){var K=i[E],C=K.minw,J=K.maxw,A=C===null,L=J===null,y="em";if(!!C){C=parseFloat(C)*(C.indexOf(y)>-1?(p||v()):1)}if(!!J){J=parseFloat(J)*(J.indexOf(y)>-1?(p||v()):1)}if(!K.hasquery||(!A||!L)&&(A||H>=C)&&(L||H<=J)){if(!D[K.media]){D[K.media]=[]}D[K.media].push(k[K.rules])}}for(var E in q){if(q[E]&&q[E].parentNode===f){f.removeChild(q[E])}}for(var E in D){var M=w.createElement("style"),F=D[E].join("\n");M.type="text/css";M.media=E;f.insertBefore(M,G.nextSibling);if(M.styleSheet){M.styleSheet.cssText=F}else{M.appendChild(w.createTextNode(F))}q.push(M)}},n=function(x,z){var y=c();if(!y){return}y.open("GET",x,true);y.onreadystatechange=function(){if(y.readyState!=4||y.status!=200&&y.status!=304){return}z(y.responseText)};if(y.readyState==4){return}y.send(null)},c=(function(){var x=false;try{x=new XMLHttpRequest()}catch(y){x=new ActiveXObject("Microsoft.XMLHTTP")}return function(){return x}})();a();respond.update=a;function t(){j(true)}if(e.addEventListener){e.addEventListener("resize",t,false)}else{if(e.attachEvent){e.attachEvent("onresize",t)}}})(this);
@@ -1 +0,0 @@
1
- export * from './openapi-spec-builder';
package/dist/src/index.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/openapi-spec
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- function __export(m) {
7
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
8
- }
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- __export(require("./openapi-spec-builder"));
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sCAAsC;AACtC,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,4CAAuC"}
@@ -1,82 +0,0 @@
1
- import { ExtensionValue, OpenApiSpec, OperationObject, ResponseObject, ParameterObject } from '@loopback/openapi-spec';
2
- /**
3
- * Create a new instance of OpenApiSpecBuilder.
4
- *
5
- * @param basePath The base path on which the API is served.
6
- */
7
- export declare function anOpenApiSpec(): OpenApiSpecBuilder;
8
- /**
9
- * Create a new instance of OperationSpecBuilder.
10
- */
11
- export declare function anOperationSpec(): OperationSpecBuilder;
12
- export interface Extendable {
13
- [extension: string]: ExtensionValue;
14
- }
15
- export declare class BuilderBase<T extends Extendable> {
16
- protected _spec: T;
17
- constructor(initialSpec: T);
18
- /**
19
- * Add a custom (extension) property to the spec object.
20
- *
21
- * @param key The property name starting with "x-".
22
- * @param value The property value.
23
- */
24
- withExtension(key: string, value: ExtensionValue): this;
25
- /**
26
- * Build the spec object.
27
- */
28
- build(): T;
29
- }
30
- /**
31
- * A builder for creating OpenApiSpec documents.
32
- */
33
- export declare class OpenApiSpecBuilder extends BuilderBase<OpenApiSpec> {
34
- /**
35
- * @param basePath The base path on which the API is served.
36
- */
37
- constructor();
38
- /**
39
- * Define a new OperationObject at the given path and verb (method).
40
- *
41
- * @param verb The HTTP verb.
42
- * @param path The path relative to basePath.
43
- * @param spec Additional specification of the operation.
44
- */
45
- withOperation(verb: string, path: string, spec: OperationObject | OperationSpecBuilder): this;
46
- /**
47
- * Define a new operation that returns a string response.
48
- *
49
- * @param verb The HTTP verb.
50
- * @param path The path relative to basePath.
51
- * @param operationName The name of the controller method implementing
52
- * this operation (`x-operation-name` field).
53
- */
54
- withOperationReturningString(verb: string, path: string, operationName?: string): this;
55
- }
56
- /**
57
- * A builder for creating OperationObject specifications.
58
- */
59
- export declare class OperationSpecBuilder extends BuilderBase<OperationObject> {
60
- constructor();
61
- /**
62
- * Describe a response for a given HTTP status code.
63
- * @param status HTTP status code or string "default"
64
- * @param responseSpec Specification of the response
65
- */
66
- withResponse(status: number | 'default', responseSpec: ResponseObject): this;
67
- withStringResponse(status?: number | 'default'): this;
68
- /**
69
- * Describe a parameter accepted by the operation.
70
- * Note that parameters are positional in OpenAPI Spec, therefore
71
- * the first call of `withParameter` defines the first parameter,
72
- * the second call defines the second parameter, etc.
73
- * @param parameterSpec
74
- */
75
- withParameter(parameterSpec: ParameterObject): this;
76
- /**
77
- * Define the operation name (controller method name).
78
- *
79
- * @param name The name of the controller method implementing this operation.
80
- */
81
- withOperationName(name: string): this;
82
- }
@@ -1,138 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const assert = require("assert");
8
- const openapi_spec_1 = require("@loopback/openapi-spec");
9
- /**
10
- * Create a new instance of OpenApiSpecBuilder.
11
- *
12
- * @param basePath The base path on which the API is served.
13
- */
14
- function anOpenApiSpec() {
15
- return new OpenApiSpecBuilder();
16
- }
17
- exports.anOpenApiSpec = anOpenApiSpec;
18
- /**
19
- * Create a new instance of OperationSpecBuilder.
20
- */
21
- function anOperationSpec() {
22
- return new OperationSpecBuilder();
23
- }
24
- exports.anOperationSpec = anOperationSpec;
25
- class BuilderBase {
26
- constructor(initialSpec) {
27
- this._spec = initialSpec;
28
- }
29
- /**
30
- * Add a custom (extension) property to the spec object.
31
- *
32
- * @param key The property name starting with "x-".
33
- * @param value The property value.
34
- */
35
- withExtension(key, value) {
36
- assert(key.startsWith('x-'), `Invalid extension ${key}, extension keys must be prefixed with "x-"`);
37
- this._spec[key] = value;
38
- return this;
39
- }
40
- /**
41
- * Build the spec object.
42
- */
43
- build() {
44
- // TODO(bajtos): deep-clone
45
- return this._spec;
46
- }
47
- }
48
- exports.BuilderBase = BuilderBase;
49
- /**
50
- * A builder for creating OpenApiSpec documents.
51
- */
52
- class OpenApiSpecBuilder extends BuilderBase {
53
- /**
54
- * @param basePath The base path on which the API is served.
55
- */
56
- constructor() {
57
- super(openapi_spec_1.createEmptyApiSpec());
58
- }
59
- /**
60
- * Define a new OperationObject at the given path and verb (method).
61
- *
62
- * @param verb The HTTP verb.
63
- * @param path The path relative to basePath.
64
- * @param spec Additional specification of the operation.
65
- */
66
- withOperation(verb, path, spec) {
67
- if (spec instanceof OperationSpecBuilder)
68
- spec = spec.build();
69
- if (!this._spec.paths[path])
70
- this._spec.paths[path] = {};
71
- this._spec.paths[path][verb] = spec;
72
- return this;
73
- }
74
- /**
75
- * Define a new operation that returns a string response.
76
- *
77
- * @param verb The HTTP verb.
78
- * @param path The path relative to basePath.
79
- * @param operationName The name of the controller method implementing
80
- * this operation (`x-operation-name` field).
81
- */
82
- withOperationReturningString(verb, path, operationName) {
83
- const spec = anOperationSpec().withStringResponse(200);
84
- if (operationName)
85
- spec.withOperationName(operationName);
86
- return this.withOperation(verb, path, spec);
87
- }
88
- }
89
- exports.OpenApiSpecBuilder = OpenApiSpecBuilder;
90
- /**
91
- * A builder for creating OperationObject specifications.
92
- */
93
- class OperationSpecBuilder extends BuilderBase {
94
- constructor() {
95
- super({
96
- responses: {},
97
- });
98
- }
99
- /**
100
- * Describe a response for a given HTTP status code.
101
- * @param status HTTP status code or string "default"
102
- * @param responseSpec Specification of the response
103
- */
104
- withResponse(status, responseSpec) {
105
- // OpenAPI spec uses string indices, i.e. 200 OK uses "200" as the index
106
- this._spec.responses[status.toString()] = responseSpec;
107
- return this;
108
- }
109
- withStringResponse(status = 200) {
110
- return this.withResponse(status, {
111
- description: 'The string result.',
112
- schema: { type: 'string' },
113
- });
114
- }
115
- /**
116
- * Describe a parameter accepted by the operation.
117
- * Note that parameters are positional in OpenAPI Spec, therefore
118
- * the first call of `withParameter` defines the first parameter,
119
- * the second call defines the second parameter, etc.
120
- * @param parameterSpec
121
- */
122
- withParameter(parameterSpec) {
123
- if (!this._spec.parameters)
124
- this._spec.parameters = [];
125
- this._spec.parameters.push(parameterSpec);
126
- return this;
127
- }
128
- /**
129
- * Define the operation name (controller method name).
130
- *
131
- * @param name The name of the controller method implementing this operation.
132
- */
133
- withOperationName(name) {
134
- return this.withExtension('x-operation-name', name);
135
- }
136
- }
137
- exports.OperationSpecBuilder = OperationSpecBuilder;
138
- //# sourceMappingURL=openapi-spec-builder.js.map
@@ -1 +0,0 @@
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,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,IAAY;QAC5B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AA9CD,oDA8CC"}
@@ -1 +0,0 @@
1
- export * from './openapi-spec-builder';
@@ -1,11 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: @loopback/openapi-spec
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- function __export(m) {
7
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
8
- }
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- __export(require("./openapi-spec-builder"));
11
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sCAAsC;AACtC,+CAA+C;AAC/C,gEAAgE;;;;;AAEhE,4CAAuC"}
@@ -1,82 +0,0 @@
1
- import { ExtensionValue, OpenApiSpec, OperationObject, ResponseObject, ParameterObject } from '@loopback/openapi-spec';
2
- /**
3
- * Create a new instance of OpenApiSpecBuilder.
4
- *
5
- * @param basePath The base path on which the API is served.
6
- */
7
- export declare function anOpenApiSpec(): OpenApiSpecBuilder;
8
- /**
9
- * Create a new instance of OperationSpecBuilder.
10
- */
11
- export declare function anOperationSpec(): OperationSpecBuilder;
12
- export interface Extendable {
13
- [extension: string]: ExtensionValue;
14
- }
15
- export declare class BuilderBase<T extends Extendable> {
16
- protected _spec: T;
17
- constructor(initialSpec: T);
18
- /**
19
- * Add a custom (extension) property to the spec object.
20
- *
21
- * @param key The property name starting with "x-".
22
- * @param value The property value.
23
- */
24
- withExtension(key: string, value: ExtensionValue): this;
25
- /**
26
- * Build the spec object.
27
- */
28
- build(): T;
29
- }
30
- /**
31
- * A builder for creating OpenApiSpec documents.
32
- */
33
- export declare class OpenApiSpecBuilder extends BuilderBase<OpenApiSpec> {
34
- /**
35
- * @param basePath The base path on which the API is served.
36
- */
37
- constructor();
38
- /**
39
- * Define a new OperationObject at the given path and verb (method).
40
- *
41
- * @param verb The HTTP verb.
42
- * @param path The path relative to basePath.
43
- * @param spec Additional specification of the operation.
44
- */
45
- withOperation(verb: string, path: string, spec: OperationObject | OperationSpecBuilder): this;
46
- /**
47
- * Define a new operation that returns a string response.
48
- *
49
- * @param verb The HTTP verb.
50
- * @param path The path relative to basePath.
51
- * @param operationName The name of the controller method implementing
52
- * this operation (`x-operation-name` field).
53
- */
54
- withOperationReturningString(verb: string, path: string, operationName?: string): this;
55
- }
56
- /**
57
- * A builder for creating OperationObject specifications.
58
- */
59
- export declare class OperationSpecBuilder extends BuilderBase<OperationObject> {
60
- constructor();
61
- /**
62
- * Describe a response for a given HTTP status code.
63
- * @param status HTTP status code or string "default"
64
- * @param responseSpec Specification of the response
65
- */
66
- withResponse(status: number | 'default', responseSpec: ResponseObject): this;
67
- withStringResponse(status?: number | 'default'): this;
68
- /**
69
- * Describe a parameter accepted by the operation.
70
- * Note that parameters are positional in OpenAPI Spec, therefore
71
- * the first call of `withParameter` defines the first parameter,
72
- * the second call defines the second parameter, etc.
73
- * @param parameterSpec
74
- */
75
- withParameter(parameterSpec: ParameterObject): this;
76
- /**
77
- * Define the operation name (controller method name).
78
- *
79
- * @param name The name of the controller method implementing this operation.
80
- */
81
- withOperationName(name: string): this;
82
- }
@@ -1,138 +0,0 @@
1
- "use strict";
2
- // Copyright IBM Corp. 2013,2017. All Rights Reserved.
3
- // Node module: loopback
4
- // This file is licensed under the MIT License.
5
- // License text available at https://opensource.org/licenses/MIT
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const assert = require("assert");
8
- const openapi_spec_1 = require("@loopback/openapi-spec");
9
- /**
10
- * Create a new instance of OpenApiSpecBuilder.
11
- *
12
- * @param basePath The base path on which the API is served.
13
- */
14
- function anOpenApiSpec() {
15
- return new OpenApiSpecBuilder();
16
- }
17
- exports.anOpenApiSpec = anOpenApiSpec;
18
- /**
19
- * Create a new instance of OperationSpecBuilder.
20
- */
21
- function anOperationSpec() {
22
- return new OperationSpecBuilder();
23
- }
24
- exports.anOperationSpec = anOperationSpec;
25
- class BuilderBase {
26
- constructor(initialSpec) {
27
- this._spec = initialSpec;
28
- }
29
- /**
30
- * Add a custom (extension) property to the spec object.
31
- *
32
- * @param key The property name starting with "x-".
33
- * @param value The property value.
34
- */
35
- withExtension(key, value) {
36
- assert(key.startsWith('x-'), `Invalid extension ${key}, extension keys must be prefixed with "x-"`);
37
- this._spec[key] = value;
38
- return this;
39
- }
40
- /**
41
- * Build the spec object.
42
- */
43
- build() {
44
- // TODO(bajtos): deep-clone
45
- return this._spec;
46
- }
47
- }
48
- exports.BuilderBase = BuilderBase;
49
- /**
50
- * A builder for creating OpenApiSpec documents.
51
- */
52
- class OpenApiSpecBuilder extends BuilderBase {
53
- /**
54
- * @param basePath The base path on which the API is served.
55
- */
56
- constructor() {
57
- super(openapi_spec_1.createEmptyApiSpec());
58
- }
59
- /**
60
- * Define a new OperationObject at the given path and verb (method).
61
- *
62
- * @param verb The HTTP verb.
63
- * @param path The path relative to basePath.
64
- * @param spec Additional specification of the operation.
65
- */
66
- withOperation(verb, path, spec) {
67
- if (spec instanceof OperationSpecBuilder)
68
- spec = spec.build();
69
- if (!this._spec.paths[path])
70
- this._spec.paths[path] = {};
71
- this._spec.paths[path][verb] = spec;
72
- return this;
73
- }
74
- /**
75
- * Define a new operation that returns a string response.
76
- *
77
- * @param verb The HTTP verb.
78
- * @param path The path relative to basePath.
79
- * @param operationName The name of the controller method implementing
80
- * this operation (`x-operation-name` field).
81
- */
82
- withOperationReturningString(verb, path, operationName) {
83
- const spec = anOperationSpec().withStringResponse(200);
84
- if (operationName)
85
- spec.withOperationName(operationName);
86
- return this.withOperation(verb, path, spec);
87
- }
88
- }
89
- exports.OpenApiSpecBuilder = OpenApiSpecBuilder;
90
- /**
91
- * A builder for creating OperationObject specifications.
92
- */
93
- class OperationSpecBuilder extends BuilderBase {
94
- constructor() {
95
- super({
96
- responses: {},
97
- });
98
- }
99
- /**
100
- * Describe a response for a given HTTP status code.
101
- * @param status HTTP status code or string "default"
102
- * @param responseSpec Specification of the response
103
- */
104
- withResponse(status, responseSpec) {
105
- // OpenAPI spec uses string indices, i.e. 200 OK uses "200" as the index
106
- this._spec.responses[status.toString()] = responseSpec;
107
- return this;
108
- }
109
- withStringResponse(status = 200) {
110
- return this.withResponse(status, {
111
- description: 'The string result.',
112
- schema: { type: 'string' },
113
- });
114
- }
115
- /**
116
- * Describe a parameter accepted by the operation.
117
- * Note that parameters are positional in OpenAPI Spec, therefore
118
- * the first call of `withParameter` defines the first parameter,
119
- * the second call defines the second parameter, etc.
120
- * @param parameterSpec
121
- */
122
- withParameter(parameterSpec) {
123
- if (!this._spec.parameters)
124
- this._spec.parameters = [];
125
- this._spec.parameters.push(parameterSpec);
126
- return this;
127
- }
128
- /**
129
- * Define the operation name (controller method name).
130
- *
131
- * @param name The name of the controller method implementing this operation.
132
- */
133
- withOperationName(name) {
134
- return this.withExtension('x-operation-name', name);
135
- }
136
- }
137
- exports.OperationSpecBuilder = OperationSpecBuilder;
138
- //# sourceMappingURL=openapi-spec-builder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openapi-spec-builder.js","sourceRoot":"","sources":["../../src/openapi-spec-builder.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,wBAAwB;AACxB,+CAA+C;AAC/C,gEAAgE;;AAEhE,iCAAiC;AACjC,yDAOgC;AAEhC;;;;GAIG;AACH;IACE,MAAM,CAAC,IAAI,kBAAkB,EAAE,CAAC;AAClC,CAAC;AAFD,sCAEC;AAED;;GAEG;AACH;IACE,MAAM,CAAC,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC;AAFD,0CAEC;AAMD;IAGE,YAAY,WAAc;QACxB,IAAI,CAAC,KAAK,GAAG,WAAW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AAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF;AA5CD,gDA4CC;AAED;;GAEG;AACH,0BAAkC,SAAQ,WAA4B;IACpE;QACE,KAAK,CAAC;YACJ,SAAS,EAAE,EAAE;SACd,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,YAAY,CAAC,MAA0B,EAAE,YAA4B;QACnE,wEAAwE;QACxE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,GAAG,YAAY,CAAC;QACvD,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB,CAAC,SAA6B,GAAG;QACjD,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YAC/B,WAAW,EAAE,oBAAoB;YACjC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACzB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,aAA8B;QAC1C,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;YAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,CAAC;QACvD,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC;IACd,CAAC;IAED;;;;OAIG;IACH,iBAAiB,CAAC,IAAY;QAC5B,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACF;AA9CD,oDA8CC"}
package/index.d.ts DELETED
@@ -1,6 +0,0 @@
1
- // Copyright IBM Corp. 2017. All Rights Reserved.
2
- // Node module: @loopback/openapi-spec-builder
3
- // This file is licensed under the MIT License.
4
- // License text available at https://opensource.org/licenses/MIT
5
-
6
- export * from './dist/src';
package/index.js DELETED
@@ -1,9 +0,0 @@
1
- // Copyright IBM Corp. 2017. All Rights Reserved.
2
- // Node module: @loopback/testlab
3
- // This file is licensed under the MIT License.
4
- // License text available at https://opensource.org/licenses/MIT
5
-
6
- const nodeMajorVersion = +process.versions.node.split('.')[0];
7
- module.exports = nodeMajorVersion >= 7 ?
8
- require('./dist/src') :
9
- require('./dist6/src');