Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

feat: add runtime API version property #1575

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions src/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { FunctionResult } from './utils/format_result.js'
import type { Route } from './utils/routes.js'

interface ManifestFunction {
buildData?: Record<string, unknown>
invocationMode?: InvocationMode
mainFile: string
name: string
Expand Down Expand Up @@ -55,13 +56,15 @@ const formatFunctionForManifest = ({
routes,
runtime,
runtimeVersion,
runtimeAPIVersion,
schedule,
}: FunctionResult): ManifestFunction => {
const manifestFunction: ManifestFunction = {
bundler,
displayName,
generator,
invocationMode,
buildData: { runtimeAPIVersion },
mainFile,
name,
runtimeVersion,
Expand Down
3 changes: 2 additions & 1 deletion tests/v2api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => {
},
})

expect.assertions(files.length + 1)
expect.assertions(files.length + 2)

for (const file of files) {
switch (file.name) {
Expand Down Expand Up @@ -256,6 +256,7 @@ describe.runIf(semver.gte(nodeVersion, '18.13.0'))('V2 functions API', () => {
const manifestString = await readFile(manifestPath, { encoding: 'utf8' })
const manifest = JSON.parse(manifestString)
expect(manifest.functions[0].routes[0].methods).toEqual(['GET', 'POST'])
expect(manifest.functions[0].buildData.runtimeAPIVersion).toEqual(2)
})

test('Flags invalid values of the `path` in-source configuration property as user errors', async () => {
Expand Down