• 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

12.5
/src/http/routes/object/createObject.ts
1
import fastifyMultipart from '@fastify/multipart'
2
import { FastifyInstance, RequestGenericInterface } from 'fastify'
3
import { FromSchema } from 'json-schema-to-ts'
4
import { createDefaultSchema } from '../../routes-helper'
5
import { ROUTE_OPERATIONS } from '../operations'
6

7
const createObjectParamsSchema = {
2✔
8
  type: 'object',
9
  properties: {
10
    bucketName: { type: 'string', examples: ['avatars'] },
11
    '*': { type: 'string', examples: ['folder/cat.png'] },
12
  },
13
  required: ['bucketName', '*'],
14
} as const
15
const successResponseSchema = {
2✔
16
  type: 'object',
17
  properties: {
18
    Id: {
19
      type: 'string',
20
    },
21
    Key: {
22
      type: 'string',
23
      examples: ['avatars/folder/cat.png'],
24
    },
25
  },
26
  required: ['Key'],
27
}
28
interface createObjectRequestInterface extends RequestGenericInterface {
29
  Params: FromSchema<typeof createObjectParamsSchema>
30
  Headers: {
31
    authorization: string
32
    'content-type': string
33
    'cache-control'?: string
34
    'x-upsert'?: string
35
    'x-robots-tag'?: string
36
  }
37
}
38

39
export default async function routes(fastify: FastifyInstance) {
UNCOV
40
  const summary = 'Upload a new object'
×
41

UNCOV
42
  const schema = createDefaultSchema(successResponseSchema, {
×
43
    params: createObjectParamsSchema,
44
    summary,
45
    tags: ['object'],
46
  })
47

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

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

UNCOV
63
  fastify.post<createObjectRequestInterface>(
×
64
    '/:bucketName/*',
65
    {
66
      schema,
67
      config: {
68
        operation: { type: ROUTE_OPERATIONS.CREATE_OBJECT },
69
      },
70
    },
71
    async (request, response) => {
UNCOV
72
      const { bucketName } = request.params
×
UNCOV
73
      const objectName = request.params['*']
×
74

UNCOV
75
      const isUpsert = request.headers['x-upsert'] === 'true'
×
UNCOV
76
      const owner = request.owner
×
77

UNCOV
78
      const { objectMetadata, path, id } = await request.storage
×
79
        .from(bucketName)
80
        .uploadFromRequest(request, {
81
          objectName,
82
          signal: request.signals.body.signal,
83
          owner,
84
          isUpsert,
85
        })
86

UNCOV
87
      return response.status(objectMetadata?.httpStatusCode ?? 200).send({
×
88
        Id: id,
89
        Key: path,
90
      })
91
    }
92
  )
93
}
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