• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 19099233262

05 Nov 2025 10:38AM UTC coverage: 77.75% (+1.4%) from 76.389%
19099233262

Pull #774

github

web-flow
Merge 528b46699 into 76df298f8
Pull Request #774: feat: vector buckets

2021 of 2925 branches covered (69.09%)

Branch coverage included in aggregate %.

3428 of 3935 new or added lines in 58 files covered. (87.12%)

31 existing lines in 3 files now uncovered.

24588 of 31299 relevant lines covered (78.56%)

91.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.25
/src/http/plugins/vector.ts
1
import fastifyPlugin from 'fastify-plugin'
1✔
2
import { FastifyInstance } from 'fastify'
1✔
3
import { getTenantConfig, multitenantKnex } from '@internal/database'
1✔
4
import {
1✔
5
  createS3VectorClient,
1✔
6
  KnexVectorMetadataDB,
1✔
7
  VectorStoreManager,
1✔
8
  S3Vector,
1✔
9
} from '@storage/protocols/vector'
1✔
10
import { getConfig } from '../../config'
1✔
11
import { ERRORS } from '@internal/errors'
1✔
12
import { KnexShardStoreFactory, ShardCatalog, SingleShard } from '@internal/sharding'
1✔
13

1✔
14
declare module 'fastify' {
1✔
15
  interface FastifyRequest {
1✔
16
    s3Vector: VectorStoreManager
1✔
17
  }
1✔
18
}
1✔
19

1✔
20
const s3VectorClient = createS3VectorClient()
1✔
21
const s3VectorAdapter = new S3Vector(s3VectorClient)
1✔
22

1✔
23
export const s3vector = fastifyPlugin(async function (fastify: FastifyInstance) {
1✔
24
  fastify.addHook('preHandler', async (req) => {
122✔
25
    const { isMultitenant, vectorS3Buckets, vectorMaxBucketsCount, vectorMaxIndexesCount } =
88✔
26
      getConfig()
88✔
27

88✔
28
    if (!vectorS3Buckets || vectorS3Buckets.length === 0) {
88!
NEW
29
      throw ERRORS.FeatureNotEnabled('vector', 'Vector service not configured')
×
NEW
30
    }
×
31

88✔
32
    let maxBucketCount = vectorMaxBucketsCount
88✔
33
    let maxIndexCount = vectorMaxIndexesCount
88✔
34

88✔
35
    if (isMultitenant) {
88!
NEW
36
      const { features } = await getTenantConfig(req.tenantId)
×
NEW
37
      maxBucketCount = features?.vectorBuckets?.maxBuckets || vectorMaxBucketsCount
×
NEW
38
      maxIndexCount = features?.vectorBuckets?.maxIndexes || vectorMaxIndexesCount
×
NEW
39
    }
×
40

88✔
41
    const db = req.db.pool.acquire()
88✔
42
    const store = new KnexVectorMetadataDB(db)
88✔
43
    const shard = isMultitenant
88✔
44
      ? new ShardCatalog(new KnexShardStoreFactory(multitenantKnex))
88!
45
      : new SingleShard({
88✔
46
          shardKey: vectorS3Buckets[0],
88✔
47
          capacity: 10000,
88✔
48
        })
88✔
49

88✔
50
    req.s3Vector = new VectorStoreManager(s3VectorAdapter, store, shard, {
88✔
51
      tenantId: req.tenantId,
88✔
52
      maxBucketCount: maxBucketCount,
88✔
53
      maxIndexCount: maxIndexCount,
88✔
54
    })
88✔
55
  })
122✔
56
})
122✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc