Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
5278437
add: vectordb sdk support.
ItzNotABug Feb 11, 2026
db8916d
Merge branch 'feat-documentsdb' into feat-vectordb
premtsd-code Mar 16, 2026
f38a9bc
fix: rename vectordb to vectorsdb for naming consistency.
premtsd-code Mar 16, 2026
61c1e82
fix: vectorsdb collection pages use correct SDK endpoints
premtsd-code Mar 18, 2026
218be14
fix: guard mock suggestions for vectorsdb, optimize fold scan
premtsd-code Mar 18, 2026
5d0e4ff
vectorsdb collection page and empty state bugs
premtsd-code Mar 20, 2026
a1ec42b
merge feat-documentsdb and fix SDK type errors
premtsd-code Mar 20, 2026
1bfe064
(fix): vectorsdb review fixes — index creation, SDK embeddings, fold …
premtsd-code Mar 21, 2026
8accb15
(chore): update console SDK to 04899af with rebuilt types
premtsd-code Mar 21, 2026
6df70db
Merge remote-tracking branch 'origin/feat-documentsdb' into feat-vect…
premtsd-code Mar 21, 2026
d89fad8
Merge remote-tracking branch 'origin/feat-documentsdb' into feat-vect…
premtsd-code Mar 21, 2026
b259318
(fix): import Columns type from correct module in sheetOptions
premtsd-code Mar 21, 2026
d735f7f
(fix): remove databaseType param from suggestColumns call
premtsd-code Mar 21, 2026
51b499a
(chore): update console SDK to 2291c59 with rebuilt dist
premtsd-code Mar 21, 2026
8c29b65
Merge remote-tracking branch 'origin/feat-documentsdb' into feat-vect…
premtsd-code Mar 21, 2026
2a5aa4d
(fix): embedding fold preview with inline values, vectorsdb sample da…
premtsd-code Mar 22, 2026
3482580
add vectorsdb document-level activity logs
premtsd-code Mar 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@ai-sdk/svelte": "^1.1.24",
"@appwrite.io/console": "github:appwrite/sdk-for-console#2291c59",
"@appwrite.io/console": "github:appwrite/sdk-for-console#6b7d06d",
"@appwrite.io/pink-icons": "0.25.0",
"@appwrite.io/pink-icons-svelte": "https://pkg.vc/-/@appwrite/@appwrite.io/pink-icons-svelte@bfe7ce3",
"@appwrite.io/pink-legacy": "^1.0.3",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
title: 'DocumentsDB',
subtitle:
'Store flexible data without a fixed schema. Best for unstructured data and simple querying.'
},
{
type: 'vectorsdb',
title: 'VectorsDB',
subtitle:
'Store data as vectors to find similar results. Best for semantic search and recommendations.'
}
];

Expand Down Expand Up @@ -276,7 +282,7 @@
{/snippet}

{#snippet selectDatabaseType(disabled = false)}
<Layout.Grid columns={2} columnsS={1}>
<Layout.Grid columns={3} columnsS={1}>
{#each databaseTypes as databaseType}
<div class="card-selector">
<Card.Selector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import type {
Models,
OrderBy,
TablesDBIndexType,
DocumentsDBIndexType
DocumentsDBIndexType,
VectorsDBIndexType
} from '@appwrite.io/console';

export type DatabaseSdkResult = {
Expand All @@ -35,6 +36,7 @@ export type DatabaseSdkResult = {
entityId: string;
name: string;
databaseType?: DatabaseType;
dimension?: number /* vectorsDB specific */;
}) => Promise<Entity>;
getEntity: (params: {
databaseId: string;
Expand All @@ -53,6 +55,15 @@ export type DatabaseSdkResult = {
entityId: string;
databaseType?: DatabaseType;
}) => Promise<{}>;
updateEntity: (params: {
databaseId: string;
entityId: string;
name?: string;
permissions?: string[];
documentSecurity?: boolean;
enabled?: boolean;
databaseType?: DatabaseType;
}) => Promise<Entity>;
createRecord: (params: {
databaseId: string;
entityId: string;
Expand Down Expand Up @@ -98,8 +109,30 @@ export type DatabaseSdkResult = {
orders?: OrderBy[];
databaseType?: DatabaseType;
}) => Promise<Index>;
deleteIndex: (params: {
databaseId: string;
entityId: string;
key: string;
databaseType?: DatabaseType;
}) => Promise<{}>;
};

/**
* Returns the raw DocumentsDB or VectorsDB SDK service for a given database type.
* Use in load functions (.ts) where Svelte runes aren't available.
*/
export function getCollectionService(region: string, project: string, type: DatabaseType) {
const projectSdk = sdk.forProject(region, project);
switch (type) {
case 'documentsdb':
return projectSdk.documentsDB;
case 'vectorsdb':
return projectSdk.vectorsDB;
default:
throw new Error(`Unsupported collection database type: ${type}`);
}
}

export function useDatabaseSdk(
regionOrPage: string | Page,
projectOrTerminology: string | TerminologyResult,
Expand Down Expand Up @@ -131,19 +164,19 @@ export function useDatabaseSdk(
case 'documentsdb': {
return await baseSdk.documentsDB.create(params);
}
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
return await baseSdk.vectorsDB.create(params);
}
default:
throw new Error('Unknown database type');
}
},

async list(params): Promise<Models.DatabaseList> {
const results = await Promise.all([
baseSdk.tablesDB.list(params)

// not available just yet!
// baseSdk.documentsDB.list(params),
baseSdk.tablesDB.list(params),
baseSdk.documentsDB.list(params),
baseSdk.vectorsDB.list(params)
]);

return results.reduce(
Expand Down Expand Up @@ -173,8 +206,15 @@ export function useDatabaseSdk(

return toSupportiveEntity(table);
}
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
const collection = await baseSdk.vectorsDB.createCollection({
...params,
dimension: params.dimension,
collectionId: params.entityId
});

return toSupportiveEntity(collection);
}
default:
throw new Error('Unknown database type');
}
Expand All @@ -192,8 +232,10 @@ export function useDatabaseSdk(
await baseSdk.documentsDB.listCollections(params);
return { total, entities: collections.map(toSupportiveEntity) };
}
case 'vectorsdb':
throw new Error(`Database type not supported yet`);
case 'vectorsdb': {
const { total, collections } = await baseSdk.vectorsDB.listCollections(params);
return { total, entities: collections.map(toSupportiveEntity) };
}
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -217,8 +259,14 @@ export function useDatabaseSdk(

return toSupportiveEntity(collection);
}
case 'vectorsdb':
throw new Error(`Database type not supported yet`);
case 'vectorsdb': {
const collection = await baseSdk.vectorsDB.getCollection({
databaseId: params.databaseId,
collectionId: params.entityId
});

return toSupportiveEntity(collection);
}
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -232,7 +280,7 @@ export function useDatabaseSdk(
case 'documentsdb':
return await baseSdk.documentsDB.delete(params);
case 'vectorsdb':
throw new Error('Database type not supported yet');
return await baseSdk.vectorsDB.delete(params);
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -252,7 +300,51 @@ export function useDatabaseSdk(
collectionId: params.entityId
});
case 'vectorsdb':
throw new Error('Database type not supported yet');
return await baseSdk.vectorsDB.deleteCollection({
databaseId: params.databaseId,
collectionId: params.entityId
});
default:
throw new Error(`Unknown database type`);
}
},

async updateEntity(params) {
switch (type ?? params.databaseType) {
case 'legacy': /* databases api */
case 'tablesdb':
return toSupportiveEntity(
await baseSdk.tablesDB.updateTable({
databaseId: params.databaseId,
tableId: params.entityId,
name: params.name,
permissions: params.permissions,
rowSecurity: params.documentSecurity,
enabled: params.enabled
})
);
case 'documentsdb':
return toSupportiveEntity(
await baseSdk.documentsDB.updateCollection({
databaseId: params.databaseId,
collectionId: params.entityId,
name: params.name,
permissions: params.permissions,
documentSecurity: params.documentSecurity,
enabled: params.enabled
})
);
case 'vectorsdb':
return toSupportiveEntity(
await baseSdk.vectorsDB.updateCollection({
databaseId: params.databaseId,
collectionId: params.entityId,
name: params.name,
permissions: params.permissions,
documentSecurity: params.documentSecurity,
enabled: params.enabled
})
);
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -277,8 +369,15 @@ export function useDatabaseSdk(
data: params.data,
permissions: params.permissions
});
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
return await baseSdk.vectorsDB.createDocument({
databaseId: params.databaseId,
collectionId: params.entityId,
documentId: params.recordId,
data: params.data,
permissions: params.permissions
});
}
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -303,8 +402,15 @@ export function useDatabaseSdk(
data: params.data,
permissions: params.permissions
});
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
return await baseSdk.vectorsDB.upsertDocument({
databaseId: params.databaseId,
collectionId: params.entityId,
documentId: params.recordId,
data: params.data,
permissions: params.permissions
});
}
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -327,8 +433,14 @@ export function useDatabaseSdk(
documentId: params.recordId,
permissions: params.permissions
});
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
return await baseSdk.vectorsDB.upsertDocument({
databaseId: params.databaseId,
collectionId: params.entityId,
documentId: params.recordId,
permissions: params.permissions
});
}
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -353,8 +465,19 @@ export function useDatabaseSdk(
});
return toSupportiveRecord(document);
}
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
if (!params.recordId) {
throw new Error('Record ID is required to delete a VectorsDB document');
}

const document = await baseSdk.vectorsDB.deleteDocument({
databaseId: params.databaseId,
collectionId: params.entityId,
documentId: params.recordId
});

return toSupportiveRecord(document);
}
default:
throw new Error(`Unknown database type`);
}
Expand All @@ -379,8 +502,15 @@ export function useDatabaseSdk(
});
return { total, records: documents.map(toSupportiveRecord) };
}
case 'vectorsdb':
throw new Error('Database type not supported yet');
case 'vectorsdb': {
const { total, documents } = await baseSdk.vectorsDB.deleteDocuments({
databaseId: params.databaseId,
collectionId: params.entityId,
queries: params.queries
});

return { total, records: documents.map(toSupportiveRecord) };
}
default:
throw new Error(`Unknown database type`);
}
Expand Down Expand Up @@ -413,8 +543,45 @@ export function useDatabaseSdk(
});
return toSupportiveIndex(index);
}
case 'vectorsdb': {
const index = await baseSdk.vectorsDB.createIndex({
databaseId: params.databaseId,
collectionId: params.entityId,
key: params.key,
type: params.type as VectorsDBIndexType,
attributes: params.attributes,
lengths: params.lengths,
orders: params.orders
});

return toSupportiveIndex(index);
}
default:
throw new Error(`Unknown database type`);
}
},

async deleteIndex(params) {
switch (type ?? params.databaseType) {
case 'legacy': /* databases api */
case 'tablesdb':
return await baseSdk.tablesDB.deleteIndex({
databaseId: params.databaseId,
tableId: params.entityId,
key: params.key
});
case 'documentsdb':
return await baseSdk.documentsDB.deleteIndex({
databaseId: params.databaseId,
collectionId: params.entityId,
key: params.key
});
case 'vectorsdb':
throw new Error('Database type not supported yet');
return await baseSdk.vectorsDB.deleteIndex({
databaseId: params.databaseId,
collectionId: params.entityId,
key: params.key
});
default:
throw new Error(`Unknown database type`);
}
Expand Down
Loading
Loading