@pinecone-database/pinecone
Advanced tools
Comparing version 0.0.6 to 0.0.7
@@ -1,2 +0,2 @@ | ||
import { IndexOperationsApi, VectorOperationsApi } from './pinecone-generated-ts'; | ||
import { IndexOperationsApi, VectorOperationsApi } from './pinecone-generated-ts-fetch'; | ||
type PineconeClientConfiguration = { | ||
@@ -17,2 +17,2 @@ environment: string; | ||
export { PineconeClient }; | ||
export { QueryRequest, CreateRequest, UpdateRequest, DeleteRequest, UpsertRequest, Vector, QueryVector, PatchRequest, IndexMeta, CreateCollectionRequest } from './pinecone-generated-ts'; | ||
export { QueryRequest, CreateRequest, UpdateRequest, DeleteRequest, UpsertRequest, Vector, QueryVector, PatchRequest, IndexMeta, CreateCollectionRequest, ScoredVector } from './pinecone-generated-ts-fetch'; |
@@ -44,15 +44,17 @@ "use strict"; | ||
var axios_1 = __importDefault(require("axios")); | ||
var pinecone_generated_ts_1 = require("./pinecone-generated-ts"); | ||
var pinecone_generated_ts_fetch_1 = require("./pinecone-generated-ts-fetch"); | ||
function handler(func, args) { | ||
var _a, _b; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var error_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
var error_1, message; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
case 0: | ||
_a.trys.push([0, 2, , 3]); | ||
_c.trys.push([0, 2, , 3]); | ||
return [4 /*yield*/, func(args)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 1: return [2 /*return*/, _c.sent()]; | ||
case 2: | ||
error_1 = _a.sent(); | ||
throw "PineconeClient: Error calling ".concat(func.name, ": ").concat(error_1); | ||
error_1 = _c.sent(); | ||
message = ((_b = (_a = error_1 === null || error_1 === void 0 ? void 0 : error_1.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message) || null; | ||
throw "PineconeClient: Error calling ".concat(func.name.replace("bound ", ""), ": ").concat(error_1, " ").concat(message ? "(".concat(message, ")") : ''); | ||
case 3: return [2 /*return*/]; | ||
@@ -72,2 +74,3 @@ } | ||
return __generator(this, function (_a) { | ||
Object.defineProperty(descriptor, 'name', { value: prop }); | ||
boundFunction = descriptor.bind(instance); | ||
@@ -84,2 +87,24 @@ return [2 /*return*/, handler(boundFunction, args)]; | ||
} | ||
function attachHandler(instance) { | ||
var _this = this; | ||
var _loop_2 = function (prop) { | ||
var descriptor = instance[prop]; | ||
if (descriptor && typeof descriptor === 'function' && prop !== 'constructor') { | ||
// @ts-ignore | ||
instance[prop] = function (args) { return __awaiter(_this, void 0, void 0, function () { | ||
var boundFunction; | ||
return __generator(this, function (_a) { | ||
Object.defineProperty(descriptor, 'name', { value: prop }); | ||
boundFunction = descriptor.bind(instance); | ||
return [2 /*return*/, handler(boundFunction, args)]; | ||
}); | ||
}); }; | ||
} | ||
}; | ||
for (var _i = 0, _a = Object.keys(Object.getPrototypeOf(instance)); _i < _a.length; _i++) { | ||
var prop = _a[_i]; | ||
_loop_2(prop); | ||
} | ||
return instance; | ||
} | ||
var PineconeClient = /** @class */ (function () { | ||
@@ -141,4 +166,4 @@ function PineconeClient() { | ||
}; | ||
controllerConfiguration = new pinecone_generated_ts_1.Configuration(controllerConfigurationParameters); | ||
indexOperations = new pinecone_generated_ts_1.IndexOperationsApi(controllerConfiguration); | ||
controllerConfiguration = new pinecone_generated_ts_fetch_1.Configuration(controllerConfigurationParameters); | ||
indexOperations = new pinecone_generated_ts_fetch_1.IndexOperationsApi(controllerConfiguration); | ||
exposeMethods(indexOperations, this); | ||
@@ -161,5 +186,5 @@ return [2 /*return*/]; | ||
}; | ||
var indexConfiguration = new pinecone_generated_ts_1.Configuration(indexConfigurationParameters); | ||
var vectorOperations = new pinecone_generated_ts_1.VectorOperationsApi(indexConfiguration); | ||
return vectorOperations; | ||
var indexConfiguration = new pinecone_generated_ts_fetch_1.Configuration(indexConfigurationParameters); | ||
var vectorOperations = new pinecone_generated_ts_fetch_1.VectorOperationsApi(indexConfiguration); | ||
return attachHandler(vectorOperations); | ||
}; | ||
@@ -166,0 +191,0 @@ return PineconeClient; |
{ | ||
"name": "@pinecone-database/pinecone", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "dist/index.js", | ||
@@ -15,5 +15,2 @@ "repository": { | ||
}, | ||
"dependencies": { | ||
"axios": "^1.2.1" | ||
}, | ||
"devDependencies": { | ||
@@ -20,0 +17,0 @@ "@types/node": "^18.11.17", |
@@ -65,3 +65,3 @@ # Pinecone Node.js Client | ||
await client.createIndex(createRequest); | ||
await client.createIndex({ createRequest }); | ||
``` | ||
@@ -72,3 +72,3 @@ | ||
```ts | ||
await client.deleteIndex(indexName); | ||
await client.deleteIndex({ indexName }); | ||
``` | ||
@@ -79,3 +79,3 @@ | ||
```ts | ||
const indexDescription = await client.describeIndex(indexName); | ||
const indexDescription = await client.describeIndex({ indexName }); | ||
``` | ||
@@ -136,3 +136,3 @@ | ||
}; | ||
await client.createCollection(createCollectionRequest); | ||
await client.createCollection({ createCollectionRequest }); | ||
``` | ||
@@ -149,3 +149,3 @@ | ||
```ts | ||
const describeCollection = await client.describeCollection(collection); | ||
const describeCollection = await client.describeCollection({ collectionName }); | ||
``` | ||
@@ -199,3 +199,3 @@ | ||
}; | ||
await index.upsert(upsertRequest); | ||
await index.upsert({ upsertRequest }); | ||
``` | ||
@@ -214,3 +214,3 @@ | ||
const queryResponse = await index.query(queryRequest) | ||
const queryResponse = await index.query({ queryRequest }) | ||
``` | ||
@@ -227,3 +227,3 @@ | ||
}; | ||
await index.update(updateRequest); | ||
await index.update({ updateRequest }); | ||
``` | ||
@@ -234,3 +234,6 @@ | ||
```ts | ||
const fetchResult = await index.fetch([vectorIDs], namespace); | ||
const fetchResult = await index.fetch({ | ||
ids: [vectorIDs], | ||
namespace, | ||
}); | ||
``` | ||
@@ -241,3 +244,6 @@ | ||
```ts | ||
await index.delete1([vectorIDs], false, namespace); | ||
await index.delete1({ | ||
ids: [vectorIDs], | ||
namespace, | ||
}); | ||
``` | ||
@@ -248,3 +254,6 @@ | ||
```ts | ||
await index.delete1([], true, namespace); | ||
await index.delete1({ | ||
deleteAll: true, | ||
namespace, | ||
}); | ||
``` |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
297599
0
107
5346
249
2
- Removedaxios@^1.2.1
- Removedasynckit@0.4.0(transitive)
- Removedaxios@1.7.9(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedform-data@4.0.1(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedproxy-from-env@1.1.0(transitive)