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

supabase / storage / 30832958929

03 Aug 2026 04:36PM UTC coverage: 53.989% (-26.5%) from 80.494%
30832958929

Pull #1292

github

web-flow
Merge 477971401 into 42e86a3a7
Pull Request #1292: feat: new queing system

3711 of 7412 branches covered (50.07%)

Branch coverage included in aggregate %.

140 of 337 new or added lines in 38 files covered. (41.54%)

3365 existing lines in 150 files now uncovered.

6941 of 12318 relevant lines covered (56.35%)

77.58 hits per line

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

53.33
/src/http/plugins/storage.ts
1
import { createStorageBackend, StorageBackendAdapter } from '@storage/backend'
2
import type { Database } from '@storage/database'
3
import { StoragePgDB } from '@storage/database'
4
import { PassThroughLocation, TenantLocation } from '@storage/locator'
5
import { Storage } from '@storage/storage'
6
import fastifyPlugin from 'fastify-plugin'
7
import { getConfig } from '../../config'
8

9
declare module 'fastify' {
10
  interface FastifyRequest {
11
    storage: Storage
12
    backend: StorageBackendAdapter
13
  }
14
}
15

16
const { storageBackendType, storageS3Bucket } = getConfig()
9✔
17

18
const storageBackend = createStorageBackend(storageBackendType)
9✔
19

20
// TenantLocation is immutable so singleton not to allocate per request.
21
const tenantLocation = new TenantLocation(storageS3Bucket)
9✔
22

23
export const storage = fastifyPlugin(
9✔
24
  async function storagePlugin(fastify) {
25
    fastify.decorateRequest('storage')
74✔
26
    fastify.addHook('preHandler', async (request) => {
74✔
UNCOV
27
      const databaseOptions = {
×
28
        tenantId: request.tenantId,
29
        host: request.headers['x-forwarded-host'] as string,
30
        reqId: request.id,
31
        sbReqId: request.sbReqId,
32
        latestMigration: request.latestMigration,
33
      }
34

UNCOV
35
      const database: Database = new StoragePgDB(request.db, databaseOptions)
×
36

UNCOV
37
      const location = request.isIcebergBucket
×
38
        ? new PassThroughLocation(request.internalIcebergBucketName!)
39
        : tenantLocation
40

UNCOV
41
      request.backend = storageBackend
×
UNCOV
42
      request.storage = new Storage(storageBackend, database, location)
×
43
    })
44

45
    fastify.addHook('onClose', async () => {
74✔
46
      storageBackend.close()
74✔
47
    })
48
  },
49
  { name: 'storage-init' }
50
)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc