@7-docs/edge
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -12,3 +12,3 @@ export const listModels = async ({ token }) => { | ||
throw new Error(error.message); | ||
return data.data; | ||
return data; | ||
}; |
import type { CreateRequest } from '@pinecone-database/pinecone/dist/pinecone-generated-ts-fetch'; | ||
type CreateIndex = (options: { | ||
url: string; | ||
environment: string; | ||
token: string; | ||
@@ -5,0 +5,0 @@ body: CreateRequest; |
import { getControllerUrl } from '../util.js'; | ||
export const createIndex = async ({ url, token, body }) => { | ||
const response = await fetch(getControllerUrl(url), { | ||
export const createIndex = async ({ environment, token, body }) => { | ||
const response = await fetch(getControllerUrl(environment), { | ||
headers: { | ||
@@ -5,0 +5,0 @@ Accept: 'application/json', |
type ListIndexes = (options: { | ||
url: string; | ||
environment: string; | ||
token: string; | ||
@@ -4,0 +4,0 @@ }) => Promise<string[]>; |
import { getControllerUrl } from '../util.js'; | ||
export const listIndexes = async ({ url, token }) => { | ||
const response = await fetch(getControllerUrl(url), { | ||
export const listIndexes = async ({ environment, token }) => { | ||
const response = await fetch(getControllerUrl(environment), { | ||
headers: { | ||
@@ -5,0 +5,0 @@ Accept: 'application/json', |
import type { ScoredVector } from '@pinecone-database/pinecone'; | ||
export declare const ensureProtocol: (url: string) => string; | ||
export declare const sortByScoreDesc: (a: ScoredVector, b: ScoredVector) => number; | ||
export declare const getControllerUrl: (url: string) => string; | ||
export declare const getControllerUrl: (environment: string) => string; |
export const ensureProtocol = (url) => url.replace(/^(https:\/\/)?/, 'https://'); | ||
export const sortByScoreDesc = (a, b) => (a.score && b.score ? b.score - a.score : 0); | ||
const getEnvironmentFromUrl = (url) => { | ||
const m = url.match(/(?<=svc\.)([a-z0-9-]+)(?=\.pinecone)/); | ||
if (m) | ||
return m[0]; | ||
}; | ||
export const getControllerUrl = (url) => { | ||
const environment = getEnvironmentFromUrl(url); | ||
return `https://controller.${environment}.pinecone.io/databases`; | ||
}; | ||
export const getControllerUrl = (environment) => `https://controller.${environment}.pinecone.io/databases`; |
{ | ||
"name": "@7-docs/edge", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Dependency-free package for 7-docs to query your content from anywhere JavaScript can run", | ||
@@ -38,3 +38,3 @@ "homepage": "https://github.com/7-docs/7-docs", | ||
"dependencies": { | ||
"@7-docs/shared": "0.1.2" | ||
"@7-docs/shared": "0.1.3" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
23236
46
525
+ Added@7-docs/shared@0.1.3(transitive)
- Removed@7-docs/shared@0.1.2(transitive)
Updated@7-docs/shared@0.1.3