@vorlefan/toolkit
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,3 +0,3 @@ | ||
{"D:\\Code\\vorlefan\\toolkit\\src\\nestjs\\inputTransformer.ts": {"path":"D:\\Code\\vorlefan\\toolkit\\src\\nestjs\\inputTransformer.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":50}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":29}},"3":{"start":{"line":8,"column":12},"end":{"line":8,"column":55}},"4":{"start":{"line":9,"column":12},"end":{"line":9,"column":37}},"5":{"start":{"line":20,"column":4},"end":{"line":22,"column":null}},"6":{"start":{"line":21,"column":6},"end":{"line":21,"column":43}},"7":{"start":{"line":23,"column":4},"end":{"line":25,"column":null}},"8":{"start":{"line":24,"column":6},"end":{"line":24,"column":25}},"9":{"start":{"line":26,"column":26},"end":{"line":26,"column":55}},"10":{"start":{"line":27,"column":4},"end":{"line":27,"column":47}},"11":{"start":{"line":34,"column":4},"end":{"line":36,"column":null}},"12":{"start":{"line":35,"column":6},"end":{"line":35,"column":51}},"13":{"start":{"line":38,"column":26},"end":{"line":38,"column":28}},"14":{"start":{"line":40,"column":4},"end":{"line":48,"column":null}},"15":{"start":{"line":41,"column":22},"end":{"line":41,"column":56}},"16":{"start":{"line":42,"column":24},"end":{"line":42,"column":54}},"17":{"start":{"line":44,"column":6},"end":{"line":47,"column":null}},"18":{"start":{"line":45,"column":23},"end":{"line":45,"column":71}},"19":{"start":{"line":46,"column":8},"end":{"line":46,"column":43}},"20":{"start":{"line":50,"column":4},"end":{"line":54,"column":6}},"21":{"start":{"line":58,"column":18},"end":{"line":58,"column":57}},"22":{"start":{"line":59,"column":4},"end":{"line":59,"column":35}},"23":{"start":{"line":66,"column":19},"end":{"line":78,"column":2}},"24":{"start":{"line":80,"column":4},"end":{"line":92,"column":null}},"25":{"start":{"line":81,"column":23},"end":{"line":85,"column":8}},"26":{"start":{"line":87,"column":31},"end":{"line":87,"column":72}},"27":{"start":{"line":88,"column":6},"end":{"line":88,"column":36}},"28":{"start":{"line":90,"column":6},"end":{"line":90,"column":80}},"29":{"start":{"line":91,"column":6},"end":{"line":91,"column":18}},"30":{"start":{"line":6,"column":0},"end":{"line":6,"column":13}}},"fnMap":{"0":{"name":"(anonymous_13)","decl":{"start":{"line":11,"column":2},"end":{"line":11,"column":14}},"loc":{"start":{"line":19,"column":3},"end":{"line":28,"column":3}}},"1":{"name":"(anonymous_14)","decl":{"start":{"line":30,"column":15},"end":{"line":30,"column":30}},"loc":{"start":{"line":32,"column":21},"end":{"line":55,"column":null}}},"2":{"name":"(anonymous_16)","decl":{"start":{"line":57,"column":10},"end":{"line":57,"column":26}},"loc":{"start":{"line":57,"column":42},"end":{"line":60,"column":3}}},"3":{"name":"(anonymous_17)","decl":{"start":{"line":62,"column":16},"end":{"line":62,"column":33}},"loc":{"start":{"line":64,"column":21},"end":{"line":93,"column":null}}}},"branchMap":{"0":{"loc":{"start":{"line":14,"column":4},"end":{"line":14,"column":20}},"type":"default-arg","locations":[{"start":{"line":14,"column":12},"end":{"line":14,"column":20}}]},"1":{"loc":{"start":{"line":20,"column":4},"end":{"line":22,"column":null}},"type":"if","locations":[{"start":{"line":20,"column":4},"end":{"line":22,"column":null}}]},"2":{"loc":{"start":{"line":23,"column":4},"end":{"line":25,"column":null}},"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":25,"column":null}}]},"3":{"loc":{"start":{"line":34,"column":4},"end":{"line":36,"column":null}},"type":"if","locations":[{"start":{"line":34,"column":4},"end":{"line":36,"column":null}}]},"4":{"loc":{"start":{"line":44,"column":6},"end":{"line":47,"column":null}},"type":"if","locations":[{"start":{"line":44,"column":6},"end":{"line":47,"column":null}}]},"5":{"loc":{"start":{"line":59,"column":11},"end":{"line":59,"column":34}},"type":"cond-expr","locations":[{"start":{"line":59,"column":19},"end":{"line":59,"column":27}},{"start":{"line":59,"column":30},"end":{"line":59,"column":34}}]},"6":{"loc":{"start":{"line":87,"column":31},"end":{"line":87,"column":72}},"type":"cond-expr","locations":[{"start":{"line":87,"column":63},"end":{"line":87,"column":65}},{"start":{"line":87,"column":63},"end":{"line":87,"column":72}}]},"7":{"loc":{"start":{"line":87,"column":31},"end":{"line":87,"column":65}},"type":"binary-expr","locations":[{"start":{"line":87,"column":31},"end":{"line":87,"column":65}},{"start":{"line":87,"column":63},"end":{"line":87,"column":65}}]},"8":{"loc":{"start":{"line":88,"column":13},"end":{"line":88,"column":35}},"type":"binary-expr","locations":[{"start":{"line":88,"column":13},"end":{"line":88,"column":29}},{"start":{"line":88,"column":33},"end":{"line":88,"column":35}}]},"9":{"loc":{"start":{"line":90,"column":41},"end":{"line":90,"column":78}},"type":"binary-expr","locations":[{"start":{"line":90,"column":41},"end":{"line":90,"column":61}},{"start":{"line":90,"column":65},"end":{"line":90,"column":78}}]},"10":{"loc":{"start":{"line":90,"column":41},"end":{"line":90,"column":61}},"type":"cond-expr","locations":[{"start":{"line":90,"column":55},"end":{"line":90,"column":57}},{"start":{"line":90,"column":55},"end":{"line":90,"column":61}}]},"11":{"loc":{"start":{"line":90,"column":41},"end":{"line":90,"column":57}},"type":"binary-expr","locations":[{"start":{"line":90,"column":41},"end":{"line":90,"column":57}},{"start":{"line":90,"column":55},"end":{"line":90,"column":57}}]}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":0,"7":1,"8":1,"9":1,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"28":0,"29":0,"30":1},"f":{"0":1,"1":1,"2":1,"3":1},"b":{"0":[1],"1":[0],"2":[1],"3":[1],"4":[1],"5":[1,0],"6":[0,1],"7":[1,1],"8":[1,0],"9":[0,0],"10":[0,0],"11":[0,0]}} | ||
{"D:\\Code\\vorlefan\\toolkit\\src\\nestjs\\inputTransformer.ts": {"path":"D:\\Code\\vorlefan\\toolkit\\src\\nestjs\\inputTransformer.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":50}},"2":{"start":{"line":3,"column":0},"end":{"line":3,"column":29}},"3":{"start":{"line":8,"column":12},"end":{"line":8,"column":55}},"4":{"start":{"line":9,"column":12},"end":{"line":9,"column":42}},"5":{"start":{"line":10,"column":12},"end":{"line":10,"column":45}},"6":{"start":{"line":23,"column":4},"end":{"line":25,"column":null}},"7":{"start":{"line":24,"column":6},"end":{"line":24,"column":53}},"8":{"start":{"line":26,"column":4},"end":{"line":28,"column":null}},"9":{"start":{"line":27,"column":6},"end":{"line":27,"column":43}},"10":{"start":{"line":29,"column":4},"end":{"line":31,"column":null}},"11":{"start":{"line":30,"column":6},"end":{"line":30,"column":25}},"12":{"start":{"line":32,"column":4},"end":{"line":34,"column":null}},"13":{"start":{"line":33,"column":6},"end":{"line":33,"column":49}},"14":{"start":{"line":36,"column":26},"end":{"line":36,"column":55}},"15":{"start":{"line":37,"column":4},"end":{"line":37,"column":47}},"16":{"start":{"line":44,"column":4},"end":{"line":46,"column":null}},"17":{"start":{"line":45,"column":6},"end":{"line":45,"column":51}},"18":{"start":{"line":48,"column":26},"end":{"line":48,"column":28}},"19":{"start":{"line":50,"column":4},"end":{"line":61,"column":null}},"20":{"start":{"line":51,"column":22},"end":{"line":51,"column":56}},"21":{"start":{"line":52,"column":24},"end":{"line":52,"column":54}},"22":{"start":{"line":54,"column":6},"end":{"line":60,"column":null}},"23":{"start":{"line":55,"column":23},"end":{"line":55,"column":71}},"24":{"start":{"line":56,"column":8},"end":{"line":56,"column":43}},"25":{"start":{"line":59,"column":8},"end":{"line":59,"column":49}},"26":{"start":{"line":63,"column":4},"end":{"line":67,"column":6}},"27":{"start":{"line":71,"column":18},"end":{"line":71,"column":57}},"28":{"start":{"line":72,"column":4},"end":{"line":72,"column":35}},"29":{"start":{"line":80,"column":19},"end":{"line":92,"column":2}},"30":{"start":{"line":94,"column":4},"end":{"line":120,"column":null}},"31":{"start":{"line":95,"column":23},"end":{"line":99,"column":8}},"32":{"start":{"line":101,"column":31},"end":{"line":101,"column":72}},"33":{"start":{"line":102,"column":6},"end":{"line":102,"column":36}},"34":{"start":{"line":104,"column":21},"end":{"line":104,"column":43}},"35":{"start":{"line":106,"column":8},"end":{"line":106,"column":61}},"36":{"start":{"line":108,"column":6},"end":{"line":119,"column":null}},"37":{"start":{"line":110,"column":22},"end":{"line":110,"column":52}},"38":{"start":{"line":111,"column":8},"end":{"line":113,"column":10}},"39":{"start":{"line":114,"column":8},"end":{"line":114,"column":32}},"40":{"start":{"line":115,"column":8},"end":{"line":115,"column":74}},"41":{"start":{"line":117,"column":8},"end":{"line":117,"column":57}},"42":{"start":{"line":118,"column":8},"end":{"line":118,"column":20}},"43":{"start":{"line":124,"column":4},"end":{"line":124,"column":61}},"44":{"start":{"line":124,"column":36},"end":{"line":124,"column":59}},"45":{"start":{"line":6,"column":0},"end":{"line":6,"column":13}},"46":{"start":{"line":133,"column":85},"end":{"line":133,"column":39610}},"47":{"start":{"line":133,"column":89},"end":{"line":133,"column":39599}},"48":{"start":{"line":133,"column":39725},"end":{"line":133,"column":39731}},"49":{"start":{"line":133,"column":39846},"end":{"line":133,"column":39852}},"50":{"start":{"line":133,"column":39971},"end":{"line":133,"column":39977}},"51":{"start":{"line":133,"column":40121},"end":{"line":133,"column":40127}}},"fnMap":{"0":{"name":"(anonymous_13)","decl":{"start":{"line":12,"column":2},"end":{"line":12,"column":14}},"loc":{"start":{"line":22,"column":3},"end":{"line":38,"column":3}}},"1":{"name":"(anonymous_14)","decl":{"start":{"line":40,"column":15},"end":{"line":40,"column":30}},"loc":{"start":{"line":42,"column":21},"end":{"line":68,"column":null}}},"2":{"name":"(anonymous_16)","decl":{"start":{"line":70,"column":10},"end":{"line":70,"column":26}},"loc":{"start":{"line":70,"column":42},"end":{"line":73,"column":3}}},"3":{"name":"(anonymous_17)","decl":{"start":{"line":75,"column":16},"end":{"line":75,"column":33}},"loc":{"start":{"line":78,"column":18},"end":{"line":121,"column":null}}},"4":{"name":"(anonymous_19)","decl":{"start":{"line":123,"column":10},"end":{"line":123,"column":15}},"loc":{"start":{"line":123,"column":26},"end":{"line":125,"column":3}}},"5":{"name":"(anonymous_20)","decl":{"start":{"line":124,"column":23},"end":{"line":124,"column":24}},"loc":{"start":{"line":124,"column":36},"end":{"line":124,"column":59}}},"6":{"name":"oo_cm","decl":{"start":{"line":133,"column":77},"end":{"line":133,"column":82}},"loc":{"start":{"line":133,"column":82},"end":{"line":133,"column":39611}}}},"branchMap":{"0":{"loc":{"start":{"line":15,"column":4},"end":{"line":15,"column":25}},"type":"default-arg","locations":[{"start":{"line":15,"column":12},"end":{"line":15,"column":25}}]},"1":{"loc":{"start":{"line":16,"column":4},"end":{"line":16,"column":28}},"type":"default-arg","locations":[{"start":{"line":16,"column":24},"end":{"line":16,"column":28}}]},"2":{"loc":{"start":{"line":23,"column":4},"end":{"line":25,"column":null}},"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":25,"column":null}}]},"3":{"loc":{"start":{"line":26,"column":4},"end":{"line":28,"column":null}},"type":"if","locations":[{"start":{"line":26,"column":4},"end":{"line":28,"column":null}}]},"4":{"loc":{"start":{"line":29,"column":4},"end":{"line":31,"column":null}},"type":"if","locations":[{"start":{"line":29,"column":4},"end":{"line":31,"column":null}}]},"5":{"loc":{"start":{"line":32,"column":4},"end":{"line":34,"column":null}},"type":"if","locations":[{"start":{"line":32,"column":4},"end":{"line":34,"column":null}}]},"6":{"loc":{"start":{"line":44,"column":4},"end":{"line":46,"column":null}},"type":"if","locations":[{"start":{"line":44,"column":4},"end":{"line":46,"column":null}}]},"7":{"loc":{"start":{"line":54,"column":6},"end":{"line":60,"column":null}},"type":"if","locations":[{"start":{"line":54,"column":6},"end":{"line":60,"column":null}}]},"8":{"loc":{"start":{"line":72,"column":11},"end":{"line":72,"column":34}},"type":"cond-expr","locations":[{"start":{"line":72,"column":19},"end":{"line":72,"column":27}},{"start":{"line":72,"column":30},"end":{"line":72,"column":34}}]},"9":{"loc":{"start":{"line":78,"column":4},"end":{"line":78,"column":18}},"type":"default-arg","locations":[{"start":{"line":78,"column":17},"end":{"line":78,"column":18}}]},"10":{"loc":{"start":{"line":101,"column":31},"end":{"line":101,"column":72}},"type":"cond-expr","locations":[{"start":{"line":101,"column":63},"end":{"line":101,"column":65}},{"start":{"line":101,"column":63},"end":{"line":101,"column":72}}]},"11":{"loc":{"start":{"line":101,"column":31},"end":{"line":101,"column":65}},"type":"binary-expr","locations":[{"start":{"line":101,"column":31},"end":{"line":101,"column":65}},{"start":{"line":101,"column":63},"end":{"line":101,"column":65}}]},"12":{"loc":{"start":{"line":102,"column":13},"end":{"line":102,"column":35}},"type":"binary-expr","locations":[{"start":{"line":102,"column":13},"end":{"line":102,"column":29}},{"start":{"line":102,"column":33},"end":{"line":102,"column":35}}]},"13":{"loc":{"start":{"line":104,"column":21},"end":{"line":104,"column":43}},"type":"cond-expr","locations":[{"start":{"line":104,"column":35},"end":{"line":104,"column":37}},{"start":{"line":104,"column":35},"end":{"line":104,"column":43}}]},"14":{"loc":{"start":{"line":104,"column":21},"end":{"line":104,"column":37}},"type":"binary-expr","locations":[{"start":{"line":104,"column":21},"end":{"line":104,"column":37}},{"start":{"line":104,"column":35},"end":{"line":104,"column":37}}]},"15":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":61}},"type":"binary-expr","locations":[{"start":{"line":106,"column":8},"end":{"line":106,"column":44}},{"start":{"line":106,"column":48},"end":{"line":106,"column":61}}]},"16":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":44}},"type":"cond-expr","locations":[{"start":{"line":106,"column":35},"end":{"line":106,"column":37}},{"start":{"line":106,"column":35},"end":{"line":106,"column":44}}]},"17":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":37}},"type":"binary-expr","locations":[{"start":{"line":106,"column":8},"end":{"line":106,"column":37}},{"start":{"line":106,"column":35},"end":{"line":106,"column":37}}]},"18":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":35}},"type":"cond-expr","locations":[{"start":{"line":106,"column":28},"end":{"line":106,"column":30}},{"start":{"line":106,"column":28},"end":{"line":106,"column":35}}]},"19":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":30}},"type":"binary-expr","locations":[{"start":{"line":106,"column":8},"end":{"line":106,"column":30}},{"start":{"line":106,"column":28},"end":{"line":106,"column":30}}]},"20":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":28}},"type":"cond-expr","locations":[{"start":{"line":106,"column":22},"end":{"line":106,"column":24}},{"start":{"line":106,"column":22},"end":{"line":106,"column":28}}]},"21":{"loc":{"start":{"line":106,"column":8},"end":{"line":106,"column":24}},"type":"binary-expr","locations":[{"start":{"line":106,"column":8},"end":{"line":106,"column":24}},{"start":{"line":106,"column":22},"end":{"line":106,"column":24}}]},"22":{"loc":{"start":{"line":108,"column":6},"end":{"line":119,"column":null}},"type":"if","locations":[{"start":{"line":108,"column":6},"end":{"line":119,"column":null}},{"start":{"line":116,"column":13},"end":{"line":119,"column":null}}]},"23":{"loc":{"start":{"line":108,"column":10},"end":{"line":108,"column":42}},"type":"binary-expr","locations":[{"start":{"line":108,"column":10},"end":{"line":108,"column":24}},{"start":{"line":108,"column":28},"end":{"line":108,"column":42}}]},"24":{"loc":{"start":{"line":133,"column":96},"end":{"line":133,"column":39598}},"type":"binary-expr","locations":[{"start":{"line":133,"column":96},"end":{"line":133,"column":133}},{"start":{"line":133,"column":137},"end":{"line":133,"column":39598}}]}},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1,"7":0,"8":1,"9":0,"10":1,"11":1,"12":1,"13":1,"14":1,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":1,"22":1,"23":1,"24":1,"25":1,"26":1,"27":1,"28":1,"29":1,"30":1,"31":1,"32":1,"33":1,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":1,"44":1,"45":1,"46":0,"47":0,"48":1,"49":1,"50":1,"51":1},"f":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":0},"b":{"0":[1],"1":[1],"2":[0],"3":[0],"4":[1],"5":[1],"6":[1],"7":[1],"8":[1,0],"9":[1],"10":[0,1],"11":[1,1],"12":[1,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0]}} | ||
,"D:\\Code\\vorlefan\\toolkit\\test\\const.ts": {"path":"D:\\Code\\vorlefan\\toolkit\\test\\const.ts","statementMap":{"0":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},"1":{"start":{"line":2,"column":0},"end":{"line":2,"column":16}},"2":{"start":{"line":4,"column":13},"end":{"line":4,"column":61}}},"fnMap":{},"branchMap":{"0":{"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":60}},"type":"cond-expr","locations":[{"start":{"line":4,"column":38},"end":{"line":4,"column":40}},{"start":{"line":4,"column":38},"end":{"line":4,"column":60}}]},"1":{"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":40}},"type":"binary-expr","locations":[{"start":{"line":4,"column":26},"end":{"line":4,"column":40}},{"start":{"line":4,"column":38},"end":{"line":4,"column":40}}]},"2":{"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":38}},"type":"cond-expr","locations":[{"start":{"line":4,"column":33},"end":{"line":4,"column":35}},{"start":{"line":4,"column":26},"end":{"line":4,"column":38}}]},"3":{"loc":{"start":{"line":4,"column":26},"end":{"line":4,"column":35}},"type":"binary-expr","locations":[{"start":{"line":4,"column":26},"end":{"line":4,"column":35}},{"start":{"line":4,"column":26},"end":{"line":4,"column":35}}]}},"s":{"0":2,"1":2,"2":2},"f":{},"b":{"0":[0,2],"1":[2,2],"2":[0,2],"3":[2,2]}} | ||
} |
@@ -6,6 +6,8 @@ import { FileInfo } from "../utils/scanFiles"; | ||
protected model: string; | ||
constructor({ apiKey, outputFilename, model, }: { | ||
protected delayBetweenCalls: number; | ||
constructor({ apiKey, outputFilename, model, delayBetweenCalls, }: { | ||
apiKey: string; | ||
outputFilename?: string; | ||
model?: string; | ||
delayBetweenCalls?: number; | ||
}); | ||
@@ -15,2 +17,3 @@ transformInputs(inputs: Map<string, FileInfo>, outputDir: string): Promise<void>; | ||
private generateZodSchema; | ||
private sleep; | ||
} |
@@ -40,5 +40,10 @@ "use strict"; | ||
class InputTransformer { | ||
constructor({ apiKey, outputFilename, model = "gpt-3.5-turbo", }) { | ||
constructor({ apiKey, outputFilename, model = "gpt-4o-mini", delayBetweenCalls = 1000, // delay in milliseconds | ||
}) { | ||
this.outputFilename = "input-forms.tsx"; | ||
this.model = "gpt-3.5-turbo"; | ||
this.model = "gpt-4o-mini"; | ||
this.delayBetweenCalls = 1000; // default to 1 second | ||
if (!apiKey) { | ||
throw new Error("OpenAI API key is required."); | ||
} | ||
if (outputFilename) { | ||
@@ -50,2 +55,5 @@ this.outputFilename = outputFilename; | ||
} | ||
if (delayBetweenCalls !== undefined) { | ||
this.delayBetweenCalls = delayBetweenCalls; | ||
} | ||
const configuration = new openai_1.Configuration({ apiKey }); | ||
@@ -66,5 +74,7 @@ this.openai = new openai_1.OpenAIApi(configuration); | ||
combinedContent += schema + "\n\n"; | ||
// Wait between API calls to avoid rate limits | ||
yield this.sleep(this.delayBetweenCalls); | ||
} | ||
} | ||
fs.writeFileSync(path.join(outputDir, "input-forms.tsx"), combinedContent, "utf-8"); | ||
fs.writeFileSync(path.join(outputDir, this.outputFilename), combinedContent, "utf-8"); | ||
}); | ||
@@ -76,4 +86,4 @@ } | ||
} | ||
generateZodSchema(content, className) { | ||
var _a, _b; | ||
generateZodSchema(content, className, retryCount = 0) { | ||
var _a, _b, _c, _d, _e; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -103,8 +113,22 @@ const prompt = ` | ||
catch (error) { | ||
console.error("OpenAI API error:", ((_b = error.response) === null || _b === void 0 ? void 0 : _b.data) || error.message); | ||
throw error; | ||
const status = (_b = error.response) === null || _b === void 0 ? void 0 : _b.status; | ||
const errorMessage = ((_e = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.error) === null || _e === void 0 ? void 0 : _e.message) || error.message; | ||
if (status === 429 && retryCount < 5) { | ||
// Rate limit exceeded, wait and retry | ||
const delay = Math.pow(2, retryCount) * 1000; // Exponential backoff | ||
console.warn(`Rate limit exceeded. Waiting ${delay}ms before retrying...`); | ||
yield this.sleep(delay); | ||
return this.generateZodSchema(content, className, retryCount + 1); | ||
} | ||
else { | ||
console.error("OpenAI API error:", errorMessage); | ||
throw error; | ||
} | ||
} | ||
}); | ||
} | ||
sleep(ms) { | ||
return new Promise((resolve) => setTimeout(resolve, ms)); | ||
} | ||
} | ||
exports.InputTransformer = InputTransformer; |
{ | ||
"name": "@vorlefan/toolkit", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A general-purpose toolkit for Node.js applications.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76810
916