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

supabase / storage / 25738155938

12 May 2026 01:38PM UTC coverage: 39.251% (-35.1%) from 74.366%
25738155938

Pull #1094

github

web-flow
Merge 0f3efcca0 into defbbb616
Pull Request #1094: feat: embedded vector store

2188 of 6152 branches covered (35.57%)

Branch coverage included in aggregate %.

88 of 280 new or added lines in 6 files covered. (31.43%)

3689 existing lines in 165 files now uncovered.

4312 of 10408 relevant lines covered (41.43%)

34.74 hits per line

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

18.75
/src/http/routes/object/uploadSignedObject.ts
1
import fastifyMultipart from '@fastify/multipart'
2
import { FastifyInstance } from 'fastify'
3
import { FromSchema } from 'json-schema-to-ts'
4
import { ROUTE_OPERATIONS } from '../operations'
5

6
const uploadSignedObjectParamsSchema = {
2✔
7
  type: 'object',
8
  properties: {
9
    bucketName: { type: 'string', examples: ['avatars'] },
10
    '*': { type: 'string', examples: ['folder/cat.png'] },
11
  },
12
  required: ['bucketName', '*'],
13
} as const
14

15
const uploadSignedObjectQSSchema = {
2✔
16
  type: 'object',
17
  properties: {
18
    token: {
19
      type: 'string',
20
      examples: [
21
        'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJidWNrZXQyL3B1YmxpYy9zYWRjYXQtdXBsb2FkMjMucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.uBQcXzuvXxfw-9WgzWMBfE_nR3VOgpvfZe032sfLSSk',
22
      ],
23
    },
24
  },
25
  required: ['token'],
26
} as const
27

28
const successResponseSchema = {
2✔
29
  type: 'object',
30
  properties: {
31
    Key: { type: 'string', examples: ['avatars/folder/cat.png'] },
32
  },
33
  required: ['Key'],
34
}
35

36
interface UploadSignedObjectRequestInterface {
37
  Params: FromSchema<typeof uploadSignedObjectParamsSchema>
38
  Querystring: FromSchema<typeof uploadSignedObjectQSSchema>
39
  Headers: {
40
    range?: string
41
  }
42
}
43

44
export default async function routes(fastify: FastifyInstance) {
UNCOV
45
  const summary = 'Uploads an object via a presigned URL'
×
46

UNCOV
47
  fastify.register(fastifyMultipart, {
×
48
    limits: {
49
      fields: 10,
50
      files: 1,
51
    },
52
    throwFileSizeLimit: false,
53
  })
54

UNCOV
55
  fastify.addContentTypeParser(
×
56
    ['application/json', 'text/plain'],
57
    function (request, payload, done) {
58
      done(null)
×
59
    }
60
  )
61

UNCOV
62
  fastify.put<UploadSignedObjectRequestInterface>(
×
63
    '/upload/sign/:bucketName/*',
64
    {
65
      // @todo add success response schema here
66
      schema: {
67
        params: uploadSignedObjectParamsSchema,
68
        querystring: uploadSignedObjectQSSchema,
69
        summary,
70
        response: {
71
          200: { description: 'Successful response', ...successResponseSchema },
72
          '4xx': { $ref: 'errorSchema#', description: 'Error response' },
73
        },
74
        tags: ['object'],
75
      },
76
      config: {
77
        operation: { type: ROUTE_OPERATIONS.UPLOAD_SIGN_OBJECT },
78
      },
79
    },
80
    async (request, response) => {
81
      // Validate sender
UNCOV
82
      const { token } = request.query
×
UNCOV
83
      const { bucketName } = request.params
×
UNCOV
84
      const objectName = request.params['*']
×
85

UNCOV
86
      const { owner, upsert } = await request.storage
×
87
        .from(bucketName)
88
        .verifyObjectSignature(token, objectName)
89

UNCOV
90
      const { objectMetadata, path } = await request.storage
×
91
        .asSuperUser()
92
        .from(bucketName)
93
        .uploadFromRequest(request, {
94
          owner,
95
          objectName,
96
          isUpsert: upsert,
97
          signal: request.signals.body.signal,
98
        })
99

UNCOV
100
      return response.status(objectMetadata?.httpStatusCode ?? 200).send({
×
101
        Key: path,
102
      })
103
    }
104
  )
105
}
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