🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

openai-node-fetch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openai-node-fetch - npm Package Compare versions

Comparing version
3.2.1
to
3.2.2
+4
-1
dist/base.js

@@ -15,5 +15,8 @@ "use strict";

*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = void 0;
const redaxios_1 = require("redaxios");
const redaxios_1 = __importDefault(require("redaxios"));
exports.BASE_PATH = "https://api.openai.com/v1".replace(/\/+$/, "");

@@ -20,0 +23,0 @@ /**

+22
-37

@@ -15,11 +15,2 @@ "use strict";

*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -48,11 +39,9 @@ exports.createRequestFunction = exports.toPathString = exports.serializeDataIfNeeded = exports.setSearchParams = exports.setOAuthToObject = exports.setBearerAuthToObject = exports.setBasicAuthToObject = exports.setApiKeyToObject = exports.assertParamExists = exports.DUMMY_BASE_URL = void 0;

*/
const setApiKeyToObject = function (object, keyParamName, configuration) {
return __awaiter(this, void 0, void 0, function* () {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? yield configuration.apiKey(keyParamName)
: yield configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
});
const setApiKeyToObject = async function (object, keyParamName, configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
};

@@ -74,11 +63,9 @@ exports.setApiKeyToObject = setApiKeyToObject;

*/
const setBearerAuthToObject = function (object, configuration) {
return __awaiter(this, void 0, void 0, function* () {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? yield configuration.accessToken()
: yield configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
});
const setBearerAuthToObject = async function (object, configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
};

@@ -90,11 +77,9 @@ exports.setBearerAuthToObject = setBearerAuthToObject;

*/
const setOAuthToObject = function (object, name, scopes, configuration) {
return __awaiter(this, void 0, void 0, function* () {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? yield configuration.accessToken(name, scopes)
: yield configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
});
const setOAuthToObject = async function (object, name, scopes, configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
};

@@ -160,3 +145,3 @@ exports.setOAuthToObject = setOAuthToObject;

return (axios = globalAxios, basePath = BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, axiosArgs.options), { url: ((configuration === null || configuration === void 0 ? void 0 : configuration.basePath) || basePath) + axiosArgs.url });
const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url };
return axios.request(axiosRequestArgs);

@@ -163,0 +148,0 @@ };

@@ -31,3 +31,7 @@ "use strict";

}
this.baseOptions.headers = Object.assign({ 'User-Agent': `OpenAI/NodeJS/${packageJson.version}`, 'Authorization': `Bearer ${this.apiKey}` }, this.baseOptions.headers);
this.baseOptions.headers = {
'User-Agent': `OpenAI/NodeJS/${packageJson.version}`,
'Authorization': `Bearer ${this.apiKey}`,
...this.baseOptions.headers,
};
if (this.organization) {

@@ -34,0 +38,0 @@ this.baseOptions.headers['OpenAI-Organization'] = this.organization;

{
"name": "openai-node-fetch",
"version": "3.2.1",
"version": "3.2.2",
"description": "Node.js library for the OpenAI API",

@@ -24,10 +24,9 @@ "repository": {

"dependencies": {
"form-data": "^4.0.0",
"redaxios": "^0.5.1"
"axios": "^0.26.0",
"form-data": "^4.0.0"
},
"devDependencies": {
"@types/node": "^12.11.5",
"change-package-name": "^1.0.5",
"typescript": "^4.9.5"
"typescript": "^3.6.4"
}
}
{
"compilerOptions": {
"declaration": true,
"target": "es6",
"target": "es2021",
"module": "commonjs",
"esModuleInterop": true,
"noImplicitAny": true,

@@ -7,0 +8,0 @@ "outDir": "dist",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display