openapi-sync 2.1.11 → 2.1.13
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.
- package/README.md +30 -25
- package/bin/cli.js +1 -0
- package/db.json +1 -1
- package/dist/chunk-6GQNHE6A.mjs +1 -0
- package/dist/chunk-ALDCDVEN.mjs +10 -0
- package/dist/helpers.d.mts +14 -0
- package/dist/helpers.d.ts +14 -0
- package/dist/helpers.js +10 -0
- package/dist/helpers.mjs +1 -0
- package/dist/index.d.mts +3 -17
- package/dist/index.d.ts +3 -17
- package/dist/index.js +30 -30
- package/dist/index.mjs +35 -44
- package/dist/regex.d.mts +4 -0
- package/dist/regex.d.ts +4 -0
- package/dist/regex.js +1 -0
- package/dist/regex.mjs +1 -0
- package/package.json +18 -28
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var b=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(o,r)=>(typeof require!="undefined"?require:o)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var c=(e,o,r)=>new Promise((A,z)=>{var Z=a=>{try{t(r.next(a))}catch($){z($)}},_=a=>{try{t(r.throw(a))}catch($){z($)}},t=a=>a.done?A(a.value):Promise.resolve(a.value).then(Z,_);t((r=r.apply(e,o)).next())});var l=/^[A-Za-z_$][A-Za-z0-9_$]*$/,m=/[A-Za-z0-9_$]/;export{b as a,c as b,l as c,m as d};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import{d as f}from"./chunk-6GQNHE6A.mjs";import*as a from"js-yaml";var d=n=>["object"].includes(typeof n)&&!(n instanceof Blob),u=n=>{try{return a.load(n),!0}catch(s){let e=s;if(e instanceof a.YAMLException)return!1;throw e}},h=n=>{if(u(n)){let s=a.load(n),e=JSON.stringify(s,null,2);return JSON.parse(e)}},p=n=>n.substring(0,1).toUpperCase()+n.substring(1),m=(n,s)=>{let e=n.split("/"),i=`${p(s)}`,o=[];return e.forEach(r=>{if(r[0]==="{"&&r[r.length-1]==="}"){let t=r.replace(/{/,"").replace(/}/,"");o.push(t),r=`$${t}`}else if(r[0]==="<"&&r[r.length-1]===">"){let t=r.replace(/</,"").replace(/>/,"");o.push(t),r=`$${t}`}else if(r[0]===":"){let t=r.replace(/:/,"");o.push(t),r=`$${t}`}let l="";r.split("").forEach(t=>{let c=t;f.test(t)||(c="/"),l+=c}),l.split("/").forEach(t=>{i+=p(t)})}),{name:i,variables:o,pathParts:e}},g=(n,s=1)=>{let e="{",i=Object.keys(n);for(let o=0;o<i.length;o++){let r=i[o],l=n[r];if(e+=`
|
|
2
|
+
`+" ".repeat(s)+r+": ",Array.isArray(l)){e+="[";for(let t=0;t<l.length;t++){let c=l[t];typeof c=="object"&&c!==null?e+=g(c,s+1):e+=typeof c=="string"?`"${c}"`:c,t<l.length-1&&(e+=", ")}e+="]"}else typeof l=="object"&&l!==null?e+=""+g(l,s+1):e+=l.split(`
|
|
3
|
+
`).filter(t=>t.trim()!=="").join(`
|
|
4
|
+
${" ".repeat(s)}`);o<i.length-1&&(e+=", ")}return e+=`
|
|
5
|
+
${" ".repeat(s-1)}}`,e},$=(n,s=1)=>`
|
|
6
|
+
\`\`\`typescript
|
|
7
|
+
${" ".repeat(s)} ${n.split(`
|
|
8
|
+
`).filter(e=>e.trim()!=="").join(`
|
|
9
|
+
${" ".repeat(s)} `)}
|
|
10
|
+
\`\`\``;function j(n,s){return s.split(".").reduce((i,o)=>i&&i[o]!==void 0?i[o]:void 0,n)}export{d as a,u as b,h as c,p as d,m as e,g as f,$ as g,j as h};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const isJson: (value: any) => boolean;
|
|
2
|
+
declare const isYamlString: (fileContent: string) => boolean;
|
|
3
|
+
declare const yamlStringToJson: (fileContent: string) => any;
|
|
4
|
+
declare const capitalize: (text: string) => string;
|
|
5
|
+
declare const getEndpointDetails: (path: string, method: string) => {
|
|
6
|
+
name: string;
|
|
7
|
+
variables: string[];
|
|
8
|
+
pathParts: string[];
|
|
9
|
+
};
|
|
10
|
+
declare const JSONStringify: (obj: Record<string, any>, indent?: number) => string;
|
|
11
|
+
declare const renderTypeRefMD: (typeRef: string, indent?: number) => string;
|
|
12
|
+
declare function getNestedValue<T>(obj: object, path: string): T | undefined;
|
|
13
|
+
|
|
14
|
+
export { JSONStringify, capitalize, getEndpointDetails, getNestedValue, isJson, isYamlString, renderTypeRefMD, yamlStringToJson };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const isJson: (value: any) => boolean;
|
|
2
|
+
declare const isYamlString: (fileContent: string) => boolean;
|
|
3
|
+
declare const yamlStringToJson: (fileContent: string) => any;
|
|
4
|
+
declare const capitalize: (text: string) => string;
|
|
5
|
+
declare const getEndpointDetails: (path: string, method: string) => {
|
|
6
|
+
name: string;
|
|
7
|
+
variables: string[];
|
|
8
|
+
pathParts: string[];
|
|
9
|
+
};
|
|
10
|
+
declare const JSONStringify: (obj: Record<string, any>, indent?: number) => string;
|
|
11
|
+
declare const renderTypeRefMD: (typeRef: string, indent?: number) => string;
|
|
12
|
+
declare function getNestedValue<T>(obj: object, path: string): T | undefined;
|
|
13
|
+
|
|
14
|
+
export { JSONStringify, capitalize, getEndpointDetails, getNestedValue, isJson, isYamlString, renderTypeRefMD, yamlStringToJson };
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";var $=Object.create;var p=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var j=(e,n)=>{for(var t in n)p(e,t,{get:n[t],enumerable:!0})},u=(e,n,t,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of d(n))!b.call(e,r)&&r!==t&&p(e,r,{get:()=>n[r],enumerable:!(i=h(n,r))||i.enumerable});return e};var N=(e,n,t)=>(t=e!=null?$(x(e)):{},u(n||!e||!e.__esModule?p(t,"default",{value:e,enumerable:!0}):t,e)),S=e=>u(p({},"__esModule",{value:!0}),e);var k={};j(k,{JSONStringify:()=>g,capitalize:()=>f,getEndpointDetails:()=>E,getNestedValue:()=>T,isJson:()=>z,isYamlString:()=>m,renderTypeRefMD:()=>J,yamlStringToJson:()=>A});module.exports=S(k);var y=/[A-Za-z0-9_$]/;var c=N(require("js-yaml")),z=e=>["object"].includes(typeof e)&&!(e instanceof Blob),m=e=>{try{return c.load(e),!0}catch(n){let t=n;if(t instanceof c.YAMLException)return!1;throw t}},A=e=>{if(m(e)){let n=c.load(e),t=JSON.stringify(n,null,2);return JSON.parse(t)}},f=e=>e.substring(0,1).toUpperCase()+e.substring(1),E=(e,n)=>{let t=e.split("/"),i=`${f(n)}`,r=[];return t.forEach(o=>{if(o[0]==="{"&&o[o.length-1]==="}"){let s=o.replace(/{/,"").replace(/}/,"");r.push(s),o=`$${s}`}else if(o[0]==="<"&&o[o.length-1]===">"){let s=o.replace(/</,"").replace(/>/,"");r.push(s),o=`$${s}`}else if(o[0]===":"){let s=o.replace(/:/,"");r.push(s),o=`$${s}`}let l="";o.split("").forEach(s=>{let a=s;y.test(s)||(a="/"),l+=a}),l.split("/").forEach(s=>{i+=f(s)})}),{name:i,variables:r,pathParts:t}},g=(e,n=1)=>{let t="{",i=Object.keys(e);for(let r=0;r<i.length;r++){let o=i[r],l=e[o];if(t+=`
|
|
2
|
+
`+" ".repeat(n)+o+": ",Array.isArray(l)){t+="[";for(let s=0;s<l.length;s++){let a=l[s];typeof a=="object"&&a!==null?t+=g(a,n+1):t+=typeof a=="string"?`"${a}"`:a,s<l.length-1&&(t+=", ")}t+="]"}else typeof l=="object"&&l!==null?t+=""+g(l,n+1):t+=l.split(`
|
|
3
|
+
`).filter(s=>s.trim()!=="").join(`
|
|
4
|
+
${" ".repeat(n)}`);r<i.length-1&&(t+=", ")}return t+=`
|
|
5
|
+
${" ".repeat(n-1)}}`,t},J=(e,n=1)=>`
|
|
6
|
+
\`\`\`typescript
|
|
7
|
+
${" ".repeat(n)} ${e.split(`
|
|
8
|
+
`).filter(t=>t.trim()!=="").join(`
|
|
9
|
+
${" ".repeat(n)} `)}
|
|
10
|
+
\`\`\``;function T(e,n){return n.split(".").reduce((i,r)=>i&&i[r]!==void 0?i[r]:void 0,e)}0&&(module.exports={JSONStringify,capitalize,getEndpointDetails,getNestedValue,isJson,isYamlString,renderTypeRefMD,yamlStringToJson});
|
package/dist/helpers.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-ALDCDVEN.mjs";import"./chunk-6GQNHE6A.mjs";export{f as JSONStringify,d as capitalize,e as getEndpointDetails,h as getNestedValue,a as isJson,b as isYamlString,g as renderTypeRefMD,c as yamlStringToJson};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Method } from 'axios';
|
|
2
|
+
export { JSONStringify, capitalize, getEndpointDetails, getNestedValue, isJson, isYamlString, renderTypeRefMD, yamlStringToJson } from './helpers.mjs';
|
|
3
|
+
export { variableName, variableNameChar } from './regex.mjs';
|
|
2
4
|
|
|
3
5
|
type IOpenApiSpec = Record<"openapi", string> & Record<string, any>;
|
|
4
6
|
type IOpenApSchemaSpec = {
|
|
@@ -149,24 +151,8 @@ type IOpenApiSecuritySchemes = {
|
|
|
149
151
|
};
|
|
150
152
|
};
|
|
151
153
|
|
|
152
|
-
declare const isJson: (value: any) => boolean;
|
|
153
|
-
declare const isYamlString: (fileContent: string) => boolean;
|
|
154
|
-
declare const yamlStringToJson: (fileContent: string) => any;
|
|
155
|
-
declare const capitalize: (text: string) => string;
|
|
156
|
-
declare const getEndpointDetails: (path: string, method: string) => {
|
|
157
|
-
name: string;
|
|
158
|
-
variables: string[];
|
|
159
|
-
pathParts: string[];
|
|
160
|
-
};
|
|
161
|
-
declare const JSONStringify: (obj: Record<string, any>, indent?: number) => string;
|
|
162
|
-
declare const renderTypeRefMD: (typeRef: string, indent?: number) => string;
|
|
163
|
-
declare function getNestedValue<T>(obj: object, path: string): T | undefined;
|
|
164
|
-
|
|
165
|
-
declare const variableName: RegExp;
|
|
166
|
-
declare const variableNameChar: RegExp;
|
|
167
|
-
|
|
168
154
|
declare const Init: (options?: {
|
|
169
155
|
refetchInterval?: number;
|
|
170
156
|
}) => Promise<void>;
|
|
171
157
|
|
|
172
|
-
export { type IConfig, type IConfigDoc, type IConfigExclude, type IConfigFolderSplit, type IConfigInclude, type IConfigReplaceWord, type IOpenApSchemaSpec, type IOpenApiMediaTypeSpec, type IOpenApiParameterSpec, type IOpenApiRequestBodySpec, type IOpenApiResponseSpec, type IOpenApiSecuritySchemes, type IOpenApiSpec, Init
|
|
158
|
+
export { type IConfig, type IConfigDoc, type IConfigExclude, type IConfigFolderSplit, type IConfigInclude, type IConfigReplaceWord, type IOpenApSchemaSpec, type IOpenApiMediaTypeSpec, type IOpenApiParameterSpec, type IOpenApiRequestBodySpec, type IOpenApiResponseSpec, type IOpenApiSecuritySchemes, type IOpenApiSpec, Init };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Method } from 'axios';
|
|
2
|
+
export { JSONStringify, capitalize, getEndpointDetails, getNestedValue, isJson, isYamlString, renderTypeRefMD, yamlStringToJson } from './helpers.js';
|
|
3
|
+
export { variableName, variableNameChar } from './regex.js';
|
|
2
4
|
|
|
3
5
|
type IOpenApiSpec = Record<"openapi", string> & Record<string, any>;
|
|
4
6
|
type IOpenApSchemaSpec = {
|
|
@@ -149,24 +151,8 @@ type IOpenApiSecuritySchemes = {
|
|
|
149
151
|
};
|
|
150
152
|
};
|
|
151
153
|
|
|
152
|
-
declare const isJson: (value: any) => boolean;
|
|
153
|
-
declare const isYamlString: (fileContent: string) => boolean;
|
|
154
|
-
declare const yamlStringToJson: (fileContent: string) => any;
|
|
155
|
-
declare const capitalize: (text: string) => string;
|
|
156
|
-
declare const getEndpointDetails: (path: string, method: string) => {
|
|
157
|
-
name: string;
|
|
158
|
-
variables: string[];
|
|
159
|
-
pathParts: string[];
|
|
160
|
-
};
|
|
161
|
-
declare const JSONStringify: (obj: Record<string, any>, indent?: number) => string;
|
|
162
|
-
declare const renderTypeRefMD: (typeRef: string, indent?: number) => string;
|
|
163
|
-
declare function getNestedValue<T>(obj: object, path: string): T | undefined;
|
|
164
|
-
|
|
165
|
-
declare const variableName: RegExp;
|
|
166
|
-
declare const variableNameChar: RegExp;
|
|
167
|
-
|
|
168
154
|
declare const Init: (options?: {
|
|
169
155
|
refetchInterval?: number;
|
|
170
156
|
}) => Promise<void>;
|
|
171
157
|
|
|
172
|
-
export { type IConfig, type IConfigDoc, type IConfigExclude, type IConfigFolderSplit, type IConfigInclude, type IConfigReplaceWord, type IOpenApSchemaSpec, type IOpenApiMediaTypeSpec, type IOpenApiParameterSpec, type IOpenApiRequestBodySpec, type IOpenApiResponseSpec, type IOpenApiSecuritySchemes, type IOpenApiSpec, Init
|
|
158
|
+
export { type IConfig, type IConfigDoc, type IConfigExclude, type IConfigFolderSplit, type IConfigInclude, type IConfigReplaceWord, type IOpenApSchemaSpec, type IOpenApiMediaTypeSpec, type IOpenApiParameterSpec, type IOpenApiRequestBodySpec, type IOpenApiResponseSpec, type IOpenApiSecuritySchemes, type IOpenApiSpec, Init };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var Ot=Object.create;var
|
|
2
|
-
`+" ".repeat(i)+
|
|
1
|
+
"use strict";var Ot=Object.create;var oe=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var jt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var xt=(n,i)=>{for(var e in i)oe(n,e,{get:i[e],enumerable:!0})},ge=(n,i,e,j)=>{if(i&&typeof i=="object"||typeof i=="function")for(let O of bt(i))!Ct.call(n,O)&&O!==e&&oe(n,O,{get:()=>i[O],enumerable:!(j=It(i,O))||j.enumerable});return n};var q=(n,i,e)=>(e=n!=null?Ot(jt(n)):{},ge(i||!n||!n.__esModule?oe(e,"default",{value:n,enumerable:!0}):e,n)),At=n=>ge(oe({},"__esModule",{value:!0}),n);var ae=(n,i,e)=>new Promise((j,O)=>{var x=C=>{try{c(e.next(C))}catch(f){O(f)}},E=C=>{try{c(e.throw(C))}catch(f){O(f)}},c=C=>C.done?j(C.value):Promise.resolve(C.value).then(x,E);c((e=e.apply(n,i)).next())});var wt={};xt(wt,{Init:()=>St,JSONStringify:()=>Z,capitalize:()=>V,getEndpointDetails:()=>he,getNestedValue:()=>Tt,isJson:()=>$e,isYamlString:()=>et,renderTypeRefMD:()=>ee,variableName:()=>Et,variableNameChar:()=>ye,yamlStringToJson:()=>fe});module.exports=At(wt);var P=q(require("fs")),F=q(require("path"));var Et=/^[A-Za-z_$][A-Za-z0-9_$]*$/,ye=/[A-Za-z0-9_$]/;var g=q(require("js-yaml")),$e=n=>["object"].includes(typeof n)&&!(n instanceof Blob),et=n=>{try{return g.load(n),!0}catch(i){let e=i;if(e instanceof g.YAMLException)return!1;throw e}},fe=n=>{if(et(n)){let i=g.load(n),e=JSON.stringify(i,null,2);return JSON.parse(e)}},V=n=>n.substring(0,1).toUpperCase()+n.substring(1),he=(n,i)=>{let e=n.split("/"),j=`${V(i)}`,O=[];return e.forEach(x=>{if(x[0]==="{"&&x[x.length-1]==="}"){let c=x.replace(/{/,"").replace(/}/,"");O.push(c),x=`$${c}`}else if(x[0]==="<"&&x[x.length-1]===">"){let c=x.replace(/</,"").replace(/>/,"");O.push(c),x=`$${c}`}else if(x[0]===":"){let c=x.replace(/:/,"");O.push(c),x=`$${c}`}let E="";x.split("").forEach(c=>{let C=c;ye.test(c)||(C="/"),E+=C}),E.split("/").forEach(c=>{j+=V(c)})}),{name:j,variables:O,pathParts:e}},Z=(n,i=1)=>{let e="{",j=Object.keys(n);for(let O=0;O<j.length;O++){let x=j[O],E=n[x];if(e+=`
|
|
2
|
+
`+" ".repeat(i)+x+": ",Array.isArray(E)){e+="[";for(let c=0;c<E.length;c++){let C=E[c];typeof C=="object"&&C!==null?e+=Z(C,i+1):e+=typeof C=="string"?`"${C}"`:C,c<E.length-1&&(e+=", ")}e+="]"}else typeof E=="object"&&E!==null?e+=""+Z(E,i+1):e+=E.split(`
|
|
3
3
|
`).filter(c=>c.trim()!=="").join(`
|
|
4
4
|
${" ".repeat(i)}`);O<j.length-1&&(e+=", ")}return e+=`
|
|
5
5
|
${" ".repeat(i-1)}}`,e},ee=(n,i=1)=>`
|
|
@@ -7,50 +7,50 @@ ${" ".repeat(i-1)}}`,e},ee=(n,i=1)=>`
|
|
|
7
7
|
${" ".repeat(i)} ${n.split(`
|
|
8
8
|
`).filter(e=>e.trim()!=="").join(`
|
|
9
9
|
${" ".repeat(i)} `)}
|
|
10
|
-
\`\`\``;function Tt(n,i){return i.split(".").reduce((j,O)=>j&&j[O]!==void 0?j[O]:void 0,n)}var
|
|
10
|
+
\`\`\``;function Tt(n,i){return i.split(".").reduce((j,O)=>j&&j[O]!==void 0?j[O]:void 0,n)}var at=q(require("lodash.isequal")),Ie=q(require("lodash.get")),it=q(require("axios")),lt=q(require("axios-retry")),pe=require("@redocly/openapi-core");var tt=q(require("path")),ie=q(require("fs")),le=tt.default.join(__dirname,"../","../db.json");ie.default.existsSync(le)||ie.default.writeFileSync(le,"{}");var ce={};try{ce=require(le)}catch(n){ce={}}var te=ce||{},rt=n=>{ie.default.writeFileSync(le,JSON.stringify(n))},st=(n,i)=>{te[n]=i,rt(te)},nt=n=>te[n],ot=()=>{te={},rt(te)};var pt=require("curl-generator");var re=process.cwd(),Oe={},mt=it.default.create({timeout:6e4});(0,lt.default)(mt,{retries:20,retryCondition:n=>n.code==="ECONNABORTED"||n.message.includes("Network Error"),retryDelay:n=>n*1e3});var dt=(n,i,e,j)=>ae(null,null,function*(){var Ae,Ee,Te,Se,we,Ne;let O=yield mt.get(n),x=yield(0,pe.createConfig)({extends:["minimal"]}),E=JSON.stringify($e(O.data)?O.data:fe(O.data)),c=yield(0,pe.bundleFromString)({source:E,config:x}),C=F.default.join((e==null?void 0:e.folder)||"",i),f=c.bundle.parsed,B={},de=s=>{var r,I;if((r=e==null?void 0:e.folderSplit)!=null&&r.customFolder){let $=e.folderSplit.customFolder(s);if(console.log("customFolder",$),$)return $}return(I=e==null?void 0:e.folderSplit)!=null&&I.byTags&&s.tags&&s.tags.length>0?s.tags[0].toLowerCase().replace(/\s+/g,"-"):"default"},je=typeof(e==null?void 0:e.server)=="string"?e==null?void 0:e.server:((Ee=(Ae=f==null?void 0:f.servers)==null?void 0:Ae[(e==null?void 0:e.server)||0])==null?void 0:Ee.url)||"",L=typeof((Se=(Te=e==null?void 0:e.types)==null?void 0:Te.name)==null?void 0:Se.prefix)=="string"?e==null?void 0:e.types.name.prefix:"I",$t=typeof((Ne=(we=e==null?void 0:e.endpoints)==null?void 0:we.name)==null?void 0:Ne.prefix)=="string"?e==null?void 0:e.endpoints.name.prefix:"",Ce=(s,r)=>{var $,o;let I=V(s);if((o=($=e==null?void 0:e.types)==null?void 0:$.name)!=null&&o.format){let p=e==null?void 0:e.types.name.format("shared",{name:s},I);if(p)return`${L}${p}`}return`${L}${I}`},U=(s,r,I,$,o,p=0)=>{let h="",a="",l="";if(r){if(r.$ref)if(r.$ref[0]==="#"){let m=(r.$ref||"").split("/");m.shift(),[...m].pop();let w=(0,Ie.default)(s,m,null);if(w){w!=null&&w.name&&(h=w.name),a=m[m.length-1];let N=Ce(a);N.includes(".")&&(N=N.split(".").map((z,Y)=>Y===0?z:`["${z}"]`).join("")),l+=`${o!=null&&o.noSharedImport?"":"Shared."}${N}`}}else l+="";else if(r.anyOf)l+=`(${r.anyOf.map(m=>U(s,m,"",$,o)).filter(m=>!!m).join("|")})`;else if(r.oneOf)l+=`(${r.oneOf.map(m=>U(s,m,"",$,o)).filter(m=>!!m).join("|")})`;else if(r.allOf)l+=`(${r.allOf.map(m=>U(s,m,"",$,o)).filter(m=>!!m).join("&")})`;else if(r.items)l+=`${U(s,r.items,"",!1,o)}[]`;else if(r.properties){let m=Object.keys(r.properties),b=r.required||[],S="";m.forEach(w=>{var X,z,Y,Q,se,D;let N="";!((z=(X=e==null?void 0:e.types)==null?void 0:X.doc)!=null&&z.disable)&&((Q=(Y=r.properties)==null?void 0:Y[w])!=null&&Q.description)&&(N=" * "+((se=r.properties)==null?void 0:se[w].description.split(`
|
|
11
11
|
`).filter(ne=>ne.trim()!=="").join(`
|
|
12
12
|
*${" ".repeat(1)}`))),S+=(N?`/**
|
|
13
13
|
${N}
|
|
14
14
|
*/
|
|
15
|
-
`:"")+`${U(s,(D=r.properties)==null?void 0:D[w],w,b.includes(w),
|
|
16
|
-
${" ".repeat(p)}${S}${" ".repeat(p)}}`:l+="{[k: string]: any}"}else if(r.enum&&r.enum.length>0)r.enum.length>1&&(l+="("),r.enum.map(
|
|
17
|
-
`:""}`:""},W=(s,r)=>{let I="",$="",
|
|
18
|
-
`);
|
|
19
|
-
${
|
|
20
|
-
}`:
|
|
15
|
+
`:"")+`${U(s,(D=r.properties)==null?void 0:D[w],w,b.includes(w),o,p+1)}`}),S.length>0?l+=`{
|
|
16
|
+
${" ".repeat(p)}${S}${" ".repeat(p)}}`:l+="{[k: string]: any}"}else if(r.enum&&r.enum.length>0)r.enum.length>1&&(l+="("),r.enum.map(m=>JSON.stringify(m)).filter(m=>!!m).forEach((m,b)=>{l+=`${b===0?"":"|"}${m}`}),r.enum.length>1&&(l+=")");else if(r.type){let m=b=>{let S="";if(typeof b=="string")["string","integer","number","array","boolean","null"].includes(b)?["integer","number"].includes(b)?S+="number":b==="array"?S+="any[]":S+=b:b==="object"&&(r.additionalProperties?S+=`{[k: string]: ${U(s,r.additionalProperties,"",!0,o)||"any"}}`:S+="{[k: string]: any}");else if(Array.isArray(b)){let w=b.map(N=>m(N));w.filter(N=>N!==""),w.length>1&&(S+="("+w.join("|")+")")}else S+="any";return S};l=m(r.type)}}else l="string";let u=h||I;o!=null&&o.useComponentName&&!u&&(u=a);let T=u?` "${u}"${$?"":"?"}: `:"",t=r!=null&&r.nullable?" | null":"";return l.length>0?`${T}${l}${t}${u?`;
|
|
17
|
+
`:""}`:""},W=(s,r)=>{let I="",$="",o="";if(r){if(r.$ref)if(r.$ref[0]==="#"){let p=(r.$ref||"").split("/");p.shift();let a=(0,Ie.default)(s,p,null);a&&(a!=null&&a.name&&(I=a.name),$=p[p.length-1],o+=W(s,a))}else o+="";else if(r.anyOf)o+=W(s,r.anyOf[0]);else if(r.oneOf)o+=W(s,r.oneOf[0]);else if(r.allOf)o+=`{${r.allOf.map(p=>`...(${W(s,p)})`).join(",")}}`;else if(r.items)o+=`[${W(s,r.items)}]`;else if(r.properties){let a=Object.keys(r.properties).map(l=>{var u;return` "${l}": ${W(s,(u=r.properties)==null?void 0:u[l])}`}).join(`,
|
|
18
|
+
`);a.length>0?o+=`{
|
|
19
|
+
${a}
|
|
20
|
+
}`:o+="{}"}else if(r.enum&&r.enum.length>0)r.enum.length>1&&(o+=r.enum[0]);else if(r.type)if(r.example)o+=JSON.stringify(r.example);else{let p=h=>{let a="";if(typeof h=="string")["string","integer","number","array","boolean","null"].includes(h)?["integer","number"].includes(h)?a+="123":h==="array"?a+="[]":h==="boolean"?a+="true":h==="null"?a+="null":a+=`"${h}"`:h==="object"&&(a+="{}");else if(Array.isArray(h)){let l=h.map(u=>p(u));l.filter(u=>u!==""),l.length>1&&(a+=l.join("|"))}else a+="any";return a};o=p(r.type)}}else o="string";return o};j&&!isNaN(j)&&j>0&&(process.env.NODE_ENV&&["production","prod","test","staging"].includes(process.env.NODE_ENV)||(Oe[i]&&clearTimeout(Oe[i]),Oe[i]=setTimeout(()=>dt(n,i,e,j),j)));let ft=nt(i);if((0,at.default)(ft,f))return;st(i,f);let ue="",H="",G={};f.components&&Object.keys(f.components).forEach(s=>{if(["schemas","responses","parameters","examples","requestBodies","headers","links","callbacks"].includes(s)){let r=f.components[s],I={},$={};Object.keys(r).forEach(p=>{var l;let h=(l=r[p])!=null&&l.schema?r[p].schema:r[p],a=`${U(f,h,"",!0,{noSharedImport:!0,useComponentName:["parameters"].includes(s)})}`;if(a){let u=p.split("."),T=I,t=$;for(let m=0;m<u.length;m++){let b=u[m];m<u.length-1?(b in T||(T[b]={},t[b]={}),T=T[b],t=t[b]):(T[b]=a,t[b]=h)}}}),Object.keys(I).forEach(p=>{var u,T,t,m;let h=Ce(p),a=I[p],l="";!((T=(u=e==null?void 0:e.types)==null?void 0:u.doc)!=null&&T.disable)&&p in r&&((t=r[p])!=null&&t.description)&&(l=" * "+r[p].description.split(`
|
|
21
21
|
`).filter(b=>b.trim()!=="").join(`
|
|
22
|
-
*${" ".repeat(1)}`)),G[p]=((
|
|
22
|
+
*${" ".repeat(1)}`)),G[p]=((m=G[p])!=null?m:"")+(l?`/**
|
|
23
23
|
${l}
|
|
24
24
|
*/
|
|
25
|
-
`:"")+"export type "+
|
|
26
|
-
`})}});let
|
|
27
|
-
${
|
|
28
|
-
`;e!=null&&e.folderSplit?
|
|
29
|
-
`;e!=null&&e.folderSplit?
|
|
30
|
-
`;e!=null&&e.folderSplit?
|
|
31
|
-
- Scopes: [\`${
|
|
25
|
+
`:"")+"export type "+h+" = "+(typeof a=="string"?a:Z(a))+`;
|
|
26
|
+
`})}});let xe=s=>{let r="";if(s.content){let I=Object.keys(s.content);I[0]&&s.content[I[0]].schema&&(r+=`${U(f,s.content[I[0]].schema,"")}`)}return r},ht=s=>{var r,I,$,o,p;if((I=(r=e==null?void 0:e.endpoints)==null?void 0:r.value)!=null&&I.replaceWords&&Array.isArray(e==null?void 0:e.endpoints.value.replaceWords)){let h=s;return(p=(o=($=e==null?void 0:e.endpoints)==null?void 0:$.value)==null?void 0:o.replaceWords)==null||p.forEach((a,l)=>{let u=new RegExp(a.replace,"g");h=h.replace(u,a.with||"")}),h}else return s},ct=(s,r,I=[])=>{var p,h;let $=(p=e==null?void 0:e.endpoints)==null?void 0:p.exclude,o=(h=e==null?void 0:e.endpoints)==null?void 0:h.include;if(o){let a=o.tags&&o.tags.length>0?I.some(u=>o.tags.includes(u)):!0,l=o.endpoints&&o.endpoints.length>0?o.endpoints.some(u=>{let T=!u.method||u.method.toLowerCase()===r.toLowerCase();return u.path?s===u.path&&T:u.regex?new RegExp(u.regex).test(s)&&T:!1}):!0;if(!a||!l)return!0}return!!($&&($.tags&&$.tags.length>0&&I.some(l=>$.tags.includes(l))||$.endpoints&&$.endpoints.length>0&&$.endpoints.some(l=>{let u=!l.method||l.method.toLowerCase()===r.toLowerCase();return l.path?s===l.path&&u:l.regex?new RegExp(l.regex).test(s)&&u:!1})))};if(Object.keys(f.paths||{}).forEach(s=>{let r=f.paths[s];Object.keys(r).forEach($=>{var ne,Re,ve,Fe,ke,qe,Pe,Be,Je,Me,Ue,Le,ze,Ke,Ve,We,Ye,Ge,Qe,Ze,He,Xe,De,_e;let o=$,p=he(s,o),h=((ne=r[o])==null?void 0:ne.tags)||[];if(ct(s,o,h))return;let a=r[o],l=de({method:o,path:s,summary:a==null?void 0:a.summary,operationId:a==null?void 0:a.operationId,tags:h,parameters:a==null?void 0:a.parameters,requestBody:a==null?void 0:a.requestBody,responses:a==null?void 0:a.responses});B[l]||(B[l]={endpoints:"",types:""});let u=((ve=(Re=e==null?void 0:e.endpoints)==null?void 0:Re.value)!=null&&ve.includeServer?je:"")+p.pathParts.map(y=>(y[0]==="{"&&y[y.length-1]==="}"?y=`\${${y.replace(/{/,"").replace(/}/,"")}}`:y[0]==="<"&&y[y.length-1]===">"?y=`\${${y.replace(/</,"").replace(/>/,"")}}`:y[0]===":"&&(y=`\${${y.replace(/:/,"")}}`),y)).join("/"),T=`"${u}"`;p.variables.length>0&&(T=`(${p.variables.map(d=>`${d}:string`).join(",")})=> \`${u}\``),T=ht(T);let t=r[o],m="";if(t!=null&&t.parameters&&((t==null?void 0:t.parameters).forEach((d,R)=>{(d.$ref||d.in==="query"&&d.name)&&(m+=`${U(f,d.$ref?d:d.schema,d.name||"",d.required)}`)}),m)){m=`{
|
|
27
|
+
${m}}`;let d=`${p.name}Query`;if((ke=(Fe=e==null?void 0:e.types)==null?void 0:Fe.name)!=null&&ke.useOperationId&&(t!=null&&t.operationId)&&(d=`${t.operationId}Query`),d=V(`${L}${d}`),(Pe=(qe=e==null?void 0:e.types)==null?void 0:qe.name)!=null&&Pe.format){let J=e==null?void 0:e.types.name.format("endpoint",{code:"",type:"query",method:o,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},d);J&&(d=`${L}${J}`)}let R=`export type ${d} = ${m};
|
|
28
|
+
`;e!=null&&e.folderSplit?B[l].types+=R:H+=R}let b=t==null?void 0:t.requestBody,S="";if(b&&(S=xe(b),S)){let y=`${p.name}DTO`;if((Je=(Be=e==null?void 0:e.types)==null?void 0:Be.name)!=null&&Je.useOperationId&&(t!=null&&t.operationId)&&(y=`${t.operationId}DTO`),y=V(`${L}${y}`),(Ue=(Me=e==null?void 0:e.types)==null?void 0:Me.name)!=null&&Ue.format){let R=e==null?void 0:e.types.name.format("endpoint",{code:"",type:"dto",method:o,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},y);R&&(y=`${L}${R}`)}let d=`export type ${y} = ${S};
|
|
29
|
+
`;e!=null&&e.folderSplit?B[l].types+=d:H+=d}let w={},N="";if(t!=null&&t.responses){let y=t==null?void 0:t.responses;Object.keys(y).forEach(R=>{var J,M,v,k;if(N=xe(y[R]),w[R]=N,N){let A=`${p.name}${R}Response`;if((M=(J=e==null?void 0:e.types)==null?void 0:J.name)!=null&&M.useOperationId&&(t!=null&&t.operationId)&&(A=`${t.operationId}${R}Response`),A=V(`${L}${A}`),(k=(v=e==null?void 0:e.types)==null?void 0:v.name)!=null&&k.format){let _=e==null?void 0:e.types.name.format("endpoint",{code:R,type:"response",method:o,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},A);_&&(A=`${L}${_}`)}let K=`export type ${A} = ${N};
|
|
30
|
+
`;e!=null&&e.folderSplit?B[l].types+=K:H+=K}})}let X=y=>!y||!y.length?"":y.map(d=>Object.entries(d).map(([J,M])=>{let v=J,k="";return Array.isArray(M)&&M.length&&(k=`
|
|
31
|
+
- Scopes: [\`${M.join("`, `")}\`]`,v=`**${v}**`),`
|
|
32
32
|
- ${v}${k}`}).join("")).join(`
|
|
33
|
-
`),z=t!=null&&t.security?X(t.security):"",Y="";if(!((ze=(Le=e==null?void 0:e.endpoints)==null?void 0:Le.doc)!=null&&ze.disable)){let y="";if((Ve=(Ke=e==null?void 0:e.endpoints)==null?void 0:Ke.doc)!=null&&Ve.showCurl){let
|
|
34
|
-
--cert client-certificate.crt --key client-private-key.key --cacert ca-certificate.crt`:A.type==="apiKey"?
|
|
33
|
+
`),z=t!=null&&t.security?X(t.security):"",Y="";if(!((ze=(Le=e==null?void 0:e.endpoints)==null?void 0:Le.doc)!=null&&ze.disable)){let y="";if((Ve=(Ke=e==null?void 0:e.endpoints)==null?void 0:Ke.doc)!=null&&Ve.showCurl){let d={},R="",J="";(We=t.requestBody)!=null&&We.content&&Object.keys(t.requestBody.content).forEach(k=>{let A=t.requestBody.content[k].schema;if(A){Array.isArray(d["Content-type"])?d["Content-type"].push(k):d["Content-type"]=[k];let K=W(f,A);K&&(R=K)}}),t!=null&&t.security&&t.security.forEach(v=>{Object.keys(v).forEach(k=>{var K,_;let A=(_=(K=f.components)==null?void 0:K.securitySchemes)==null?void 0:_[k];A&&(A.type==="mutualTLS"?J+=`
|
|
34
|
+
--cert client-certificate.crt --key client-private-key.key --cacert ca-certificate.crt`:A.type==="apiKey"?d[(A==null?void 0:A.name)||"X-API-KEY"]="{API_KEY_VALUE}":d.Authorization=`${(A==null?void 0:A.scheme)==="basic"?"Basic":"Bearer"} {${(A==null?void 0:A.scheme)==="basic"?"VALUE":"TOKEN"}}`)})});let M={};Object.keys(d).forEach(v=>{Array.isArray(d[v])?M[v]=d[v].join("; "):M[v]=d[v]}),y=`
|
|
35
35
|
\`\`\`bash
|
|
36
|
-
${(0,pt.CurlGenerator)({url:je+s,method:
|
|
36
|
+
${(0,pt.CurlGenerator)({url:je+s,method:o.toUpperCase(),headers:M,body:R})}${J}
|
|
37
37
|
\`\`\``}Y=`/**${t!=null&&t.description?`
|
|
38
38
|
* ${t==null?void 0:t.description} `:""}
|
|
39
|
-
* **Method**: \`${
|
|
39
|
+
* **Method**: \`${o.toUpperCase()}\`
|
|
40
40
|
* **Summary**: ${(t==null?void 0:t.summary)||""}
|
|
41
41
|
* **Tags**: [${((Ye=t==null?void 0:t.tags)==null?void 0:Ye.join(", "))||""}]
|
|
42
|
-
* **OperationId**: ${(t==null?void 0:t.operationId)||""} ${
|
|
43
|
-
* **Query**: ${ee(
|
|
42
|
+
* **OperationId**: ${(t==null?void 0:t.operationId)||""} ${m?`
|
|
43
|
+
* **Query**: ${ee(m)} `:""}${S?`
|
|
44
44
|
* **DTO**: ${ee(S)} `:""}${N?`
|
|
45
|
-
* **Response**: ${Object.entries(w).map(([
|
|
46
|
-
- **${
|
|
45
|
+
* **Response**: ${Object.entries(w).map(([d,R])=>`
|
|
46
|
+
- **${d}**: ${ee(R,2)} `).join("")}`:""}${z?`
|
|
47
47
|
* **Security**: ${z}
|
|
48
48
|
`:""}${y}
|
|
49
49
|
*/
|
|
50
|
-
`}let Q=(Qe=(Ge=e==null?void 0:e.endpoints)==null?void 0:Ge.name)!=null&&Qe.useOperationId&&((Ze=t==null?void 0:t.operationId)==null?void 0:Ze.length)>0?t.operationId:`${p.name}`;if((Xe=(He=e==null?void 0:e.endpoints)==null?void 0:He.name)!=null&&Xe.format){let y=e==null?void 0:e.endpoints.name.format({method:
|
|
51
|
-
`;e!=null&&e.folderSplit?
|
|
50
|
+
`}let Q=(Qe=(Ge=e==null?void 0:e.endpoints)==null?void 0:Ge.name)!=null&&Qe.useOperationId&&((Ze=t==null?void 0:t.operationId)==null?void 0:Ze.length)>0?t.operationId:`${p.name}`;if((Xe=(He=e==null?void 0:e.endpoints)==null?void 0:He.name)!=null&&Xe.format){let y=e==null?void 0:e.endpoints.name.format({method:o,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},Q);y&&(Q=y)}let se={method:`"${o}"`,operationId:`"${t==null?void 0:t.operationId}"`,url:T,tags:(t==null?void 0:t.tags)||[]},D=`${Y}export const ${$t}${Q} = ${((_e=(De=e==null?void 0:e.endpoints)==null?void 0:De.value)==null?void 0:_e.type)==="object"?Z(se):T};
|
|
51
|
+
`;e!=null&&e.folderSplit?B[l].endpoints+=D:ue+=D})}),e!=null&&e.folderSplit){for(let[s,r]of Object.entries(B))if(r.endpoints||r.types){let I=F.default.join(C,s);if(r.endpoints){let $=F.default.join(re,I,"endpoints.ts");yield P.default.promises.mkdir(F.default.dirname($),{recursive:!0}),yield P.default.promises.writeFile($,r.endpoints)}if(r.types){let $=F.default.join(re,I,"types.ts");yield P.default.promises.mkdir(F.default.dirname($),{recursive:!0});let o=Object.values(G).length>0?`import * as Shared from "../shared";
|
|
52
52
|
|
|
53
|
-
${r.types}`:r.types;yield
|
|
54
|
-
`))}if(H.length>0){let s=F.default.join(re,
|
|
53
|
+
${r.types}`:r.types;yield P.default.promises.writeFile($,o)}}}if(ue.length>0){let s=F.default.join(re,C,"endpoints.ts");yield P.default.promises.mkdir(F.default.dirname(s),{recursive:!0}),yield P.default.promises.writeFile(s,ue)}if(Object.values(G).length>0){let s=F.default.join(re,C,e!=null&&e.folderSplit?"":"types","shared.ts");yield P.default.promises.mkdir(F.default.dirname(s),{recursive:!0}),yield P.default.promises.writeFile(s,Object.values(G).join(`
|
|
54
|
+
`))}if(H.length>0){let s=F.default.join(re,C,"types","index.ts");yield P.default.promises.mkdir(F.default.dirname(s),{recursive:!0}),yield P.default.promises.writeFile(s,`${Object.values(G).length>0?`import * as Shared from "./shared";
|
|
55
55
|
|
|
56
|
-
`:""}${H}`)}}),ut=
|
|
56
|
+
`:""}${H}`)}}),ut=dt;var me=q(require("path")),yt=q(require("fs"));var be=process.cwd(),St=n=>ae(null,null,function*(){let i;try{require("esbuild-register")}catch(f){throw f}let e=me.default.join(be,"openapi.sync.js"),j=me.default.join(be,"openapi.sync.ts"),O=me.default.join(be,"openapi.sync.json"),x=[e,j,O];try{for(let f of x)yt.default.existsSync(f)&&(i=require(f),Object.keys(i).length===1&&i.default&&(i=i.default))}catch(f){console.log(f)}typeof i=="function"&&(i=i());let E=i;if(!E)throw new Error("No config found");let c=Object.keys(E.api),C=n&&"refetchInterval"in n&&!isNaN(n==null?void 0:n.refetchInterval)?n.refetchInterval:E.refetchInterval;ot();for(let f=0;f<c.length;f+=1){let B=c[f],de=E.api[B];ut(de,B,E,C)}});0&&(module.exports={Init,JSONStringify,capitalize,getEndpointDetails,getNestedValue,isJson,isYamlString,renderTypeRefMD,variableName,variableNameChar,yamlStringToJson});
|
package/dist/index.mjs
CHANGED
|
@@ -1,56 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
${
|
|
5
|
-
${" ".repeat(d-1)}}`,e},ae=(o,d=1)=>`
|
|
6
|
-
\`\`\`typescript
|
|
7
|
-
${" ".repeat(d)} ${o.split(`
|
|
8
|
-
`).filter(e=>e.trim()!=="").join(`
|
|
9
|
-
${" ".repeat(d)} `)}
|
|
10
|
-
\`\`\``;function jt(o,d){return d.split(".").reduce((C,A)=>C&&C[A]!==void 0?C[A]:void 0,o)}import{isEqual as dt}from"lodash";import mt from"axios";import ut from"axios-retry";import{bundleFromString as yt,createConfig as $t}from"@redocly/openapi-core";import pt from"path";import pe from"fs";var oe=pt.join(__dirname,"../","../db.json");pe.existsSync(oe)||pe.writeFileSync(oe,"{}");var de={};try{de=D(oe)}catch(o){de={}}var ee=de||{},Xe=o=>{pe.writeFileSync(oe,JSON.stringify(o))},De=(o,d)=>{ee[o]=d,Xe(ee)},_e=o=>ee[o],ge=()=>{ee={},Xe(ee)};import{CurlGenerator as ft}from"curl-generator";var te=process.cwd(),me={},tt=mt.create({timeout:6e4});ut(tt,{retries:20,retryCondition:o=>o.code==="ECONNABORTED"||o.message.includes("Network Error"),retryDelay:o=>o*1e3});var rt=(o,d,e,C)=>ne(null,null,function*(){var ce,Oe,Ie,be,je,xe;let A=yield tt.get(o),j=yield $t({extends:["minimal"]}),E=JSON.stringify(Qe(A.data)?A.data:Ze(A.data)),c=yield yt({source:E,config:j}),b=F.join((e==null?void 0:e.folder)||"",d),h=c.bundle.parsed,q={},ie=s=>{var r,O;if((r=e==null?void 0:e.folderSplit)!=null&&r.customFolder){let $=e.folderSplit.customFolder(s);if(console.log("customFolder",$),$)return $}return(O=e==null?void 0:e.folderSplit)!=null&&O.byTags&&s.tags&&s.tags.length>0?s.tags[0].toLowerCase().replace(/\s+/g,"-"):"default"},$e=typeof(e==null?void 0:e.server)=="string"?e==null?void 0:e.server:((Oe=(ce=h==null?void 0:h.servers)==null?void 0:ce[(e==null?void 0:e.server)||0])==null?void 0:Oe.url)||"",U=typeof((be=(Ie=e==null?void 0:e.types)==null?void 0:Ie.name)==null?void 0:be.prefix)=="string"?e==null?void 0:e.types.name.prefix:"I",nt=typeof((xe=(je=e==null?void 0:e.endpoints)==null?void 0:je.name)==null?void 0:xe.prefix)=="string"?e==null?void 0:e.endpoints.name.prefix:"",fe=(s,r)=>{var $,n;let O=W(s);if((n=($=e==null?void 0:e.types)==null?void 0:$.name)!=null&&n.format){let l=e==null?void 0:e.types.name.format("shared",{name:s},O);if(l)return`${U}${l}`}return`${U}${O}`},M=(s,r,O,$,n,l=0)=>{let f="",a="",i="";if(r){if(r.$ref)if(r.$ref[0]==="#"){let p=(r.$ref||"").split("/");p.shift(),[...p].pop();let S=p,w=et.get(s,S,null);if(w){w!=null&&w.name&&(f=w.name),a=p[p.length-1];let N=fe(a);N.includes(".")&&(N=N.split(".").map((L,V)=>V===0?L:`["${L}"]`).join("")),i+=`${n!=null&&n.noSharedImport?"":"Shared."}${N}`}}else i+="";else if(r.anyOf)i+=`(${r.anyOf.map(p=>M(s,p,"",$,n)).filter(p=>!!p).join("|")})`;else if(r.oneOf)i+=`(${r.oneOf.map(p=>M(s,p,"",$,n)).filter(p=>!!p).join("|")})`;else if(r.allOf)i+=`(${r.allOf.map(p=>M(s,p,"",$,n)).filter(p=>!!p).join("&")})`;else if(r.items)i+=`${M(s,r.items,"",!1,n)}[]`;else if(r.properties){let p=Object.keys(r.properties),I=r.required||[],S="";p.forEach(w=>{var Z,L,V,G,re,H;let N="";!((L=(Z=e==null?void 0:e.types)==null?void 0:Z.doc)!=null&&L.disable)&&((G=(V=r.properties)==null?void 0:V[w])!=null&&G.description)&&(N=" * "+((re=r.properties)==null?void 0:re[w].description.split(`
|
|
11
|
-
`).filter(se=>se.trim()!=="").join(`
|
|
12
|
-
*${" ".repeat(1)}`))),S+=(N?`/**
|
|
13
|
-
${N}
|
|
1
|
+
import{a as Qe,b as ft,c as ze,d as X,e as Ye,f as pe,g as re,h as Ot}from"./chunk-ALDCDVEN.mjs";import{a as H,b as te,c as $t,d as ht}from"./chunk-6GQNHE6A.mjs";import v from"fs";import T from"path";import pt from"lodash.isequal";import _e from"lodash.get";import it from"axios";import lt from"axios-retry";import{bundleFromString as dt,createConfig as mt}from"@redocly/openapi-core";import ot from"path";import ie from"fs";var se=ot.join(__dirname,"../","../db.json");ie.existsSync(se)||ie.writeFileSync(se,"{}");var le={};try{le=H(se)}catch(I){le={}}var Z=le||{},He=I=>{ie.writeFileSync(se,JSON.stringify(I))},Xe=(I,b)=>{Z[I]=b,He(Z)},Ze=I=>Z[I],De=()=>{Z={},He(Z)};import{CurlGenerator as ut}from"curl-generator";var D=process.cwd(),de={},ge=it.create({timeout:6e4});lt(ge,{retries:20,retryCondition:I=>I.code==="ECONNABORTED"||I.message.includes("Network Error"),retryDelay:I=>I*1e3});var et=(I,b,e,B)=>te(null,null,function*(){var fe,Oe,Ie,je,be,Ce;let W=yield ge.get(I),ne=yield mt({extends:["minimal"]}),M=JSON.stringify(Qe(W.data)?W.data:ze(W.data)),_=yield dt({source:M,config:ne}),K=T.join((e==null?void 0:e.folder)||"",b),h=_.bundle.parsed,R={},ae=s=>{var r,$;if((r=e==null?void 0:e.folderSplit)!=null&&r.customFolder){let u=e.folderSplit.customFolder(s);if(console.log("customFolder",u),u)return u}return($=e==null?void 0:e.folderSplit)!=null&&$.byTags&&s.tags&&s.tags.length>0?s.tags[0].toLowerCase().replace(/\s+/g,"-"):"default"},ye=typeof(e==null?void 0:e.server)=="string"?e==null?void 0:e.server:((Oe=(fe=h==null?void 0:h.servers)==null?void 0:fe[(e==null?void 0:e.server)||0])==null?void 0:Oe.url)||"",q=typeof((je=(Ie=e==null?void 0:e.types)==null?void 0:Ie.name)==null?void 0:je.prefix)=="string"?e==null?void 0:e.types.name.prefix:"I",rt=typeof((Ce=(be=e==null?void 0:e.endpoints)==null?void 0:be.name)==null?void 0:Ce.prefix)=="string"?e==null?void 0:e.endpoints.name.prefix:"",$e=(s,r)=>{var u,n;let $=X(s);if((n=(u=e==null?void 0:e.types)==null?void 0:u.name)!=null&&n.format){let p=e==null?void 0:e.types.name.format("shared",{name:s},$);if(p)return`${q}${p}`}return`${q}${$}`},F=(s,r,$,u,n,p=0)=>{let y="",a="",o="";if(r){if(r.$ref)if(r.$ref[0]==="#"){let i=(r.$ref||"").split("/");i.shift(),[...i].pop();let c=_e(s,i,null);if(c){c!=null&&c.name&&(y=c.name),a=i[i.length-1];let x=$e(a);x.includes(".")&&(x=x.split(".").map((P,J)=>J===0?P:`["${P}"]`).join("")),o+=`${n!=null&&n.noSharedImport?"":"Shared."}${x}`}}else o+="";else if(r.anyOf)o+=`(${r.anyOf.map(i=>F(s,i,"",u,n)).filter(i=>!!i).join("|")})`;else if(r.oneOf)o+=`(${r.oneOf.map(i=>F(s,i,"",u,n)).filter(i=>!!i).join("|")})`;else if(r.allOf)o+=`(${r.allOf.map(i=>F(s,i,"",u,n)).filter(i=>!!i).join("&")})`;else if(r.items)o+=`${F(s,r.items,"",!1,n)}[]`;else if(r.properties){let i=Object.keys(r.properties),f=r.required||[],C="";i.forEach(c=>{var Q,P,J,V,g,z;let x="";!((P=(Q=e==null?void 0:e.types)==null?void 0:Q.doc)!=null&&P.disable)&&((V=(J=r.properties)==null?void 0:J[c])!=null&&V.description)&&(x=" * "+((g=r.properties)==null?void 0:g[c].description.split(`
|
|
2
|
+
`).filter(ee=>ee.trim()!=="").join(`
|
|
3
|
+
*${" ".repeat(1)}`))),C+=(x?`/**
|
|
4
|
+
${x}
|
|
14
5
|
*/
|
|
15
|
-
`:"")+`${
|
|
16
|
-
${" ".repeat(
|
|
17
|
-
`:""}`:""},
|
|
6
|
+
`:"")+`${F(s,(z=r.properties)==null?void 0:z[c],c,f.includes(c),n,p+1)}`}),C.length>0?o+=`{
|
|
7
|
+
${" ".repeat(p)}${C}${" ".repeat(p)}}`:o+="{[k: string]: any}"}else if(r.enum&&r.enum.length>0)r.enum.length>1&&(o+="("),r.enum.map(i=>JSON.stringify(i)).filter(i=>!!i).forEach((i,f)=>{o+=`${f===0?"":"|"}${i}`}),r.enum.length>1&&(o+=")");else if(r.type){let i=f=>{let C="";if(typeof f=="string")["string","integer","number","array","boolean","null"].includes(f)?["integer","number"].includes(f)?C+="number":f==="array"?C+="any[]":C+=f:f==="object"&&(r.additionalProperties?C+=`{[k: string]: ${F(s,r.additionalProperties,"",!0,n)||"any"}}`:C+="{[k: string]: any}");else if(Array.isArray(f)){let c=f.map(x=>i(x));c.filter(x=>x!==""),c.length>1&&(C+="("+c.join("|")+")")}else C+="any";return C};o=i(r.type)}}else o="string";let d=y||$;n!=null&&n.useComponentName&&!d&&(d=a);let j=d?` "${d}"${u?"":"?"}: `:"",t=r!=null&&r.nullable?" | null":"";return o.length>0?`${j}${o}${t}${d?`;
|
|
8
|
+
`:""}`:""},U=(s,r)=>{let $="",u="",n="";if(r){if(r.$ref)if(r.$ref[0]==="#"){let p=(r.$ref||"").split("/");p.shift();let a=_e(s,p,null);a&&(a!=null&&a.name&&($=a.name),u=p[p.length-1],n+=U(s,a))}else n+="";else if(r.anyOf)n+=U(s,r.anyOf[0]);else if(r.oneOf)n+=U(s,r.oneOf[0]);else if(r.allOf)n+=`{${r.allOf.map(p=>`...(${U(s,p)})`).join(",")}}`;else if(r.items)n+=`[${U(s,r.items)}]`;else if(r.properties){let a=Object.keys(r.properties).map(o=>{var d;return` "${o}": ${U(s,(d=r.properties)==null?void 0:d[o])}`}).join(`,
|
|
18
9
|
`);a.length>0?n+=`{
|
|
19
10
|
${a}
|
|
20
|
-
}`:n+="{}"}else if(r.enum&&r.enum.length>0)r.enum.length>1&&(n+=r.enum[0]);else if(r.type)if(r.example)n+=JSON.stringify(r.example);else{let
|
|
21
|
-
`).filter(
|
|
22
|
-
*${" ".repeat(1)}`)),
|
|
23
|
-
${
|
|
11
|
+
}`:n+="{}"}else if(r.enum&&r.enum.length>0)r.enum.length>1&&(n+=r.enum[0]);else if(r.type)if(r.example)n+=JSON.stringify(r.example);else{let p=y=>{let a="";if(typeof y=="string")["string","integer","number","array","boolean","null"].includes(y)?["integer","number"].includes(y)?a+="123":y==="array"?a+="[]":y==="boolean"?a+="true":y==="null"?a+="null":a+=`"${y}"`:y==="object"&&(a+="{}");else if(Array.isArray(y)){let o=y.map(d=>p(d));o.filter(d=>d!==""),o.length>1&&(a+=o.join("|"))}else a+="any";return a};n=p(r.type)}}else n="string";return n};B&&!isNaN(B)&&B>0&&(process.env.NODE_ENV&&["production","prod","test","staging"].includes(process.env.NODE_ENV)||(de[b]&&clearTimeout(de[b]),de[b]=setTimeout(()=>et(I,b,e,B),B)));let st=Ze(b);if(pt(st,h))return;Xe(b,h);let oe="",G="",L={};h.components&&Object.keys(h.components).forEach(s=>{if(["schemas","responses","parameters","examples","requestBodies","headers","links","callbacks"].includes(s)){let r=h.components[s],$={},u={};Object.keys(r).forEach(p=>{var o;let y=(o=r[p])!=null&&o.schema?r[p].schema:r[p],a=`${F(h,y,"",!0,{noSharedImport:!0,useComponentName:["parameters"].includes(s)})}`;if(a){let d=p.split("."),j=$,t=u;for(let i=0;i<d.length;i++){let f=d[i];i<d.length-1?(f in j||(j[f]={},t[f]={}),j=j[f],t=t[f]):(j[f]=a,t[f]=y)}}}),Object.keys($).forEach(p=>{var d,j,t,i;let y=$e(p),a=$[p],o="";!((j=(d=e==null?void 0:e.types)==null?void 0:d.doc)!=null&&j.disable)&&p in r&&((t=r[p])!=null&&t.description)&&(o=" * "+r[p].description.split(`
|
|
12
|
+
`).filter(f=>f.trim()!=="").join(`
|
|
13
|
+
*${" ".repeat(1)}`)),L[p]=((i=L[p])!=null?i:"")+(o?`/**
|
|
14
|
+
${o}
|
|
24
15
|
*/
|
|
25
|
-
`:"")+"export type "+
|
|
26
|
-
`})}});let he=s=>{let r="";if(s.content){let
|
|
27
|
-
${
|
|
28
|
-
`;e!=null&&e.folderSplit?
|
|
29
|
-
`;e!=null&&e.folderSplit?
|
|
30
|
-
`;e!=null&&e.folderSplit?
|
|
31
|
-
- Scopes: [\`${
|
|
32
|
-
- ${
|
|
33
|
-
`),
|
|
34
|
-
--cert client-certificate.crt --key client-private-key.key --cacert ca-certificate.crt`:
|
|
16
|
+
`:"")+"export type "+y+" = "+(typeof a=="string"?a:pe(a))+`;
|
|
17
|
+
`})}});let he=s=>{let r="";if(s.content){let $=Object.keys(s.content);$[0]&&s.content[$[0]].schema&&(r+=`${F(h,s.content[$[0]].schema,"")}`)}return r},nt=s=>{var r,$,u,n,p;if(($=(r=e==null?void 0:e.endpoints)==null?void 0:r.value)!=null&&$.replaceWords&&Array.isArray(e==null?void 0:e.endpoints.value.replaceWords)){let y=s;return(p=(n=(u=e==null?void 0:e.endpoints)==null?void 0:u.value)==null?void 0:n.replaceWords)==null||p.forEach((a,o)=>{let d=new RegExp(a.replace,"g");y=y.replace(d,a.with||"")}),y}else return s},at=(s,r,$=[])=>{var p,y;let u=(p=e==null?void 0:e.endpoints)==null?void 0:p.exclude,n=(y=e==null?void 0:e.endpoints)==null?void 0:y.include;if(n){let a=n.tags&&n.tags.length>0?$.some(d=>n.tags.includes(d)):!0,o=n.endpoints&&n.endpoints.length>0?n.endpoints.some(d=>{let j=!d.method||d.method.toLowerCase()===r.toLowerCase();return d.path?s===d.path&&j:d.regex?new RegExp(d.regex).test(s)&&j:!1}):!0;if(!a||!o)return!0}return!!(u&&(u.tags&&u.tags.length>0&&$.some(o=>u.tags.includes(o))||u.endpoints&&u.endpoints.length>0&&u.endpoints.some(o=>{let d=!o.method||o.method.toLowerCase()===r.toLowerCase();return o.path?s===o.path&&d:o.regex?new RegExp(o.regex).test(s)&&d:!1})))};if(Object.keys(h.paths||{}).forEach(s=>{let r=h.paths[s];Object.keys(r).forEach(u=>{var ee,ce,xe,Ae,Ee,Te,we,Re,Se,Ne,ve,Fe,qe,Pe,ke,Be,Me,Ue,Je,Ke,Le,Ve,We,Ge;let n=u,p=Ye(s,n),y=((ee=r[n])==null?void 0:ee.tags)||[];if(at(s,n,y))return;let a=r[n],o=ae({method:n,path:s,summary:a==null?void 0:a.summary,operationId:a==null?void 0:a.operationId,tags:y,parameters:a==null?void 0:a.parameters,requestBody:a==null?void 0:a.requestBody,responses:a==null?void 0:a.responses});R[o]||(R[o]={endpoints:"",types:""});let d=((xe=(ce=e==null?void 0:e.endpoints)==null?void 0:ce.value)!=null&&xe.includeServer?ye:"")+p.pathParts.map(m=>(m[0]==="{"&&m[m.length-1]==="}"?m=`\${${m.replace(/{/,"").replace(/}/,"")}}`:m[0]==="<"&&m[m.length-1]===">"?m=`\${${m.replace(/</,"").replace(/>/,"")}}`:m[0]===":"&&(m=`\${${m.replace(/:/,"")}}`),m)).join("/"),j=`"${d}"`;p.variables.length>0&&(j=`(${p.variables.map(l=>`${l}:string`).join(",")})=> \`${d}\``),j=nt(j);let t=r[n],i="";if(t!=null&&t.parameters&&((t==null?void 0:t.parameters).forEach((l,A)=>{(l.$ref||l.in==="query"&&l.name)&&(i+=`${F(h,l.$ref?l:l.schema,l.name||"",l.required)}`)}),i)){i=`{
|
|
18
|
+
${i}}`;let l=`${p.name}Query`;if((Ee=(Ae=e==null?void 0:e.types)==null?void 0:Ae.name)!=null&&Ee.useOperationId&&(t!=null&&t.operationId)&&(l=`${t.operationId}Query`),l=X(`${q}${l}`),(we=(Te=e==null?void 0:e.types)==null?void 0:Te.name)!=null&&we.format){let S=e==null?void 0:e.types.name.format("endpoint",{code:"",type:"query",method:n,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},l);S&&(l=`${q}${S}`)}let A=`export type ${l} = ${i};
|
|
19
|
+
`;e!=null&&e.folderSplit?R[o].types+=A:G+=A}let f=t==null?void 0:t.requestBody,C="";if(f&&(C=he(f),C)){let m=`${p.name}DTO`;if((Se=(Re=e==null?void 0:e.types)==null?void 0:Re.name)!=null&&Se.useOperationId&&(t!=null&&t.operationId)&&(m=`${t.operationId}DTO`),m=X(`${q}${m}`),(ve=(Ne=e==null?void 0:e.types)==null?void 0:Ne.name)!=null&&ve.format){let A=e==null?void 0:e.types.name.format("endpoint",{code:"",type:"dto",method:n,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},m);A&&(m=`${q}${A}`)}let l=`export type ${m} = ${C};
|
|
20
|
+
`;e!=null&&e.folderSplit?R[o].types+=l:G+=l}let c={},x="";if(t!=null&&t.responses){let m=t==null?void 0:t.responses;Object.keys(m).forEach(A=>{var S,N,E,w;if(x=he(m[A]),c[A]=x,x){let O=`${p.name}${A}Response`;if((N=(S=e==null?void 0:e.types)==null?void 0:S.name)!=null&&N.useOperationId&&(t!=null&&t.operationId)&&(O=`${t.operationId}${A}Response`),O=X(`${q}${O}`),(w=(E=e==null?void 0:e.types)==null?void 0:E.name)!=null&&w.format){let Y=e==null?void 0:e.types.name.format("endpoint",{code:A,type:"response",method:n,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},O);Y&&(O=`${q}${Y}`)}let k=`export type ${O} = ${x};
|
|
21
|
+
`;e!=null&&e.folderSplit?R[o].types+=k:G+=k}})}let Q=m=>!m||!m.length?"":m.map(l=>Object.entries(l).map(([S,N])=>{let E=S,w="";return Array.isArray(N)&&N.length&&(w=`
|
|
22
|
+
- Scopes: [\`${N.join("`, `")}\`]`,E=`**${E}**`),`
|
|
23
|
+
- ${E}${w}`}).join("")).join(`
|
|
24
|
+
`),P=t!=null&&t.security?Q(t.security):"",J="";if(!((qe=(Fe=e==null?void 0:e.endpoints)==null?void 0:Fe.doc)!=null&&qe.disable)){let m="";if((ke=(Pe=e==null?void 0:e.endpoints)==null?void 0:Pe.doc)!=null&&ke.showCurl){let l={},A="",S="";(Be=t.requestBody)!=null&&Be.content&&Object.keys(t.requestBody.content).forEach(w=>{let O=t.requestBody.content[w].schema;if(O){Array.isArray(l["Content-type"])?l["Content-type"].push(w):l["Content-type"]=[w];let k=U(h,O);k&&(A=k)}}),t!=null&&t.security&&t.security.forEach(E=>{Object.keys(E).forEach(w=>{var k,Y;let O=(Y=(k=h.components)==null?void 0:k.securitySchemes)==null?void 0:Y[w];O&&(O.type==="mutualTLS"?S+=`
|
|
25
|
+
--cert client-certificate.crt --key client-private-key.key --cacert ca-certificate.crt`:O.type==="apiKey"?l[(O==null?void 0:O.name)||"X-API-KEY"]="{API_KEY_VALUE}":l.Authorization=`${(O==null?void 0:O.scheme)==="basic"?"Basic":"Bearer"} {${(O==null?void 0:O.scheme)==="basic"?"VALUE":"TOKEN"}}`)})});let N={};Object.keys(l).forEach(E=>{Array.isArray(l[E])?N[E]=l[E].join("; "):N[E]=l[E]}),m=`
|
|
35
26
|
\`\`\`bash
|
|
36
|
-
${
|
|
37
|
-
\`\`\``}
|
|
27
|
+
${ut({url:ye+s,method:n.toUpperCase(),headers:N,body:A})}${S}
|
|
28
|
+
\`\`\``}J=`/**${t!=null&&t.description?`
|
|
38
29
|
* ${t==null?void 0:t.description} `:""}
|
|
39
30
|
* **Method**: \`${n.toUpperCase()}\`
|
|
40
31
|
* **Summary**: ${(t==null?void 0:t.summary)||""}
|
|
41
32
|
* **Tags**: [${((Me=t==null?void 0:t.tags)==null?void 0:Me.join(", "))||""}]
|
|
42
|
-
* **OperationId**: ${(t==null?void 0:t.operationId)||""} ${
|
|
43
|
-
* **Query**: ${
|
|
44
|
-
* **DTO**: ${
|
|
45
|
-
* **Response**: ${Object.entries(
|
|
46
|
-
- **${
|
|
47
|
-
* **Security**: ${
|
|
48
|
-
`:""}${
|
|
33
|
+
* **OperationId**: ${(t==null?void 0:t.operationId)||""} ${i?`
|
|
34
|
+
* **Query**: ${re(i)} `:""}${C?`
|
|
35
|
+
* **DTO**: ${re(C)} `:""}${x?`
|
|
36
|
+
* **Response**: ${Object.entries(c).map(([l,A])=>`
|
|
37
|
+
- **${l}**: ${re(A,2)} `).join("")}`:""}${P?`
|
|
38
|
+
* **Security**: ${P}
|
|
39
|
+
`:""}${m}
|
|
49
40
|
*/
|
|
50
|
-
`}let
|
|
51
|
-
`;e!=null&&e.folderSplit?
|
|
41
|
+
`}let V=(Je=(Ue=e==null?void 0:e.endpoints)==null?void 0:Ue.name)!=null&&Je.useOperationId&&((Ke=t==null?void 0:t.operationId)==null?void 0:Ke.length)>0?t.operationId:`${p.name}`;if((Ve=(Le=e==null?void 0:e.endpoints)==null?void 0:Le.name)!=null&&Ve.format){let m=e==null?void 0:e.endpoints.name.format({method:n,path:s,summary:t==null?void 0:t.summary,operationId:t==null?void 0:t.operationId},V);m&&(V=m)}let g={method:`"${n}"`,operationId:`"${t==null?void 0:t.operationId}"`,url:j,tags:(t==null?void 0:t.tags)||[]},z=`${J}export const ${rt}${V} = ${((Ge=(We=e==null?void 0:e.endpoints)==null?void 0:We.value)==null?void 0:Ge.type)==="object"?pe(g):j};
|
|
42
|
+
`;e!=null&&e.folderSplit?R[o].endpoints+=z:oe+=z})}),e!=null&&e.folderSplit){for(let[s,r]of Object.entries(R))if(r.endpoints||r.types){let $=T.join(K,s);if(r.endpoints){let u=T.join(D,$,"endpoints.ts");yield v.promises.mkdir(T.dirname(u),{recursive:!0}),yield v.promises.writeFile(u,r.endpoints)}if(r.types){let u=T.join(D,$,"types.ts");yield v.promises.mkdir(T.dirname(u),{recursive:!0});let n=Object.values(L).length>0?`import * as Shared from "../shared";
|
|
52
43
|
|
|
53
|
-
${r.types}`:r.types;yield
|
|
54
|
-
`))}if(
|
|
44
|
+
${r.types}`:r.types;yield v.promises.writeFile(u,n)}}}if(oe.length>0){let s=T.join(D,K,"endpoints.ts");yield v.promises.mkdir(T.dirname(s),{recursive:!0}),yield v.promises.writeFile(s,oe)}if(Object.values(L).length>0){let s=T.join(D,K,e!=null&&e.folderSplit?"":"types","shared.ts");yield v.promises.mkdir(T.dirname(s),{recursive:!0}),yield v.promises.writeFile(s,Object.values(L).join(`
|
|
45
|
+
`))}if(G.length>0){let s=T.join(D,K,"types","index.ts");yield v.promises.mkdir(T.dirname(s),{recursive:!0}),yield v.promises.writeFile(s,`${Object.values(L).length>0?`import * as Shared from "./shared";
|
|
55
46
|
|
|
56
|
-
`:""}${
|
|
47
|
+
`:""}${G}`)}}),tt=et;import me from"path";import yt from"fs";var ue=process.cwd(),Jt=I=>te(null,null,function*(){let b;try{H("esbuild-register")}catch(h){throw h}let e=me.join(ue,"openapi.sync.js"),B=me.join(ue,"openapi.sync.ts"),W=me.join(ue,"openapi.sync.json"),ne=[e,B,W];try{for(let h of ne)yt.existsSync(h)&&(b=H(h),Object.keys(b).length===1&&b.default&&(b=b.default))}catch(h){console.log(h)}typeof b=="function"&&(b=b());let M=b;if(!M)throw new Error("No config found");let _=Object.keys(M.api),K=I&&"refetchInterval"in I&&!isNaN(I==null?void 0:I.refetchInterval)?I.refetchInterval:M.refetchInterval;De();for(let h=0;h<_.length;h+=1){let R=_[h],ae=M.api[R];tt(ae,R,M,K)}});export{Jt as Init,pe as JSONStringify,X as capitalize,Ye as getEndpointDetails,Ot as getNestedValue,Qe as isJson,ft as isYamlString,re as renderTypeRefMD,$t as variableName,ht as variableNameChar,ze as yamlStringToJson};
|
package/dist/regex.d.mts
ADDED
package/dist/regex.d.ts
ADDED
package/dist/regex.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var Z=Object.prototype.hasOwnProperty;var _=(e,a)=>{for(var o in a)t(e,o,{get:a[o],enumerable:!0})},b=(e,a,o,$)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of A(a))!Z.call(e,r)&&r!==o&&t(e,r,{get:()=>a[r],enumerable:!($=z(a,r))||$.enumerable});return e};var c=e=>b(t({},"__esModule",{value:!0}),e);var m={};_(m,{variableName:()=>i,variableNameChar:()=>l});module.exports=c(m);var i=/^[A-Za-z_$][A-Za-z0-9_$]*$/,l=/[A-Za-z0-9_$]/;0&&(module.exports={variableName,variableNameChar});
|
package/dist/regex.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as a,d as b}from"./chunk-6GQNHE6A.mjs";export{a as variableName,b as variableNameChar};
|