@singlestore/elegance-sdk
Advanced tools
Comparing version 0.0.9 to 0.0.10
{ | ||
"name": "@singlestore/elegance-sdk", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"license": "Apache-2.0", | ||
@@ -47,3 +47,2 @@ "main": "./dist/index.js", | ||
"dependencies": { | ||
"bson-objectid": "^2.0.4", | ||
"csv-parser": "3.0.0", | ||
@@ -50,0 +49,0 @@ "mongodb": "^5.8.0", |
'use strict'; | ||
var OpenAI = require('openai'); | ||
var csvParser = require('csv-parser'); | ||
var pdf = require('pdf-parse/lib/pdf-parse'); | ||
var mongodb = require('mongodb'); | ||
@@ -12,4 +10,2 @@ var mysql2 = require('mysql2'); | ||
var OpenAI__default = /*#__PURE__*/_interopDefault(OpenAI); | ||
var csvParser__default = /*#__PURE__*/_interopDefault(csvParser); | ||
var pdf__default = /*#__PURE__*/_interopDefault(pdf); | ||
@@ -86,18 +82,23 @@ var __defProp = Object.defineProperty; | ||
} | ||
// src/server/utils/csv.ts | ||
function csvStringToArray(csvString) { | ||
return new Promise((resolve, reject) => { | ||
const data = []; | ||
const stream = csvParser__default.default(); | ||
stream.on("data", (row) => { | ||
const text = Object.entries(row).map(([key, value]) => `\\${key}: ${value}`).join(""); | ||
data.push(text); | ||
return __async(this, null, function* () { | ||
const csvParser = (yield import('csv-parser')).default; | ||
return new Promise((resolve, reject) => { | ||
const data = []; | ||
const stream = csvParser(); | ||
stream.on("data", (row) => { | ||
const text = Object.entries(row).map(([key, value]) => `\\${key}: ${value}`).join(""); | ||
data.push(text); | ||
}); | ||
stream.on("end", () => { | ||
resolve(data); | ||
}); | ||
stream.on("error", (error) => { | ||
reject(error); | ||
}); | ||
stream.write(csvString); | ||
stream.end(); | ||
}); | ||
stream.on("end", () => { | ||
resolve(data); | ||
}); | ||
stream.on("error", (error) => { | ||
reject(error); | ||
}); | ||
stream.write(csvString); | ||
stream.end(); | ||
}); | ||
@@ -121,5 +122,8 @@ } | ||
} | ||
// src/server/utils/pdf.ts | ||
function pdfBufferToString(buffer) { | ||
return __async(this, null, function* () { | ||
return (yield pdf__default.default(buffer)).text; | ||
const pdf = (yield import('pdf-parse/lib/pdf-parse')).default; | ||
return (yield pdf(buffer)).text; | ||
}); | ||
@@ -126,0 +130,0 @@ } |
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
121014
6
2793
+ Added@types/node@18.19.6522.9.3(transitive)
+ Addedopenai@4.73.0(transitive)
+ Addedundici-types@6.19.8(transitive)
- Removedbson-objectid@^2.0.4
- Removed@types/node@18.19.6622.10.0(transitive)
- Removedbson-objectid@2.0.4(transitive)
- Removedopenai@4.73.1(transitive)
- Removedundici-types@6.20.0(transitive)