diff --git a/packages/main/src/hono.ts b/packages/main/src/hono.ts index bc8343b..9f829ef 100644 --- a/packages/main/src/hono.ts +++ b/packages/main/src/hono.ts @@ -4,7 +4,7 @@ import { createMiddleware } from 'hono/factory'; import type { HttpTriggerOptions, InvocationContext, NammathamTrigger } from './types'; -import { Nammatham } from '../dist/main'; +import { Nammatham } from './main'; type HonoEnv = { Variables: { diff --git a/packages/main/src/nammatham.ts b/packages/main/src/nammatham.ts index 3ed7826..2cb8a5c 100644 --- a/packages/main/src/nammatham.ts +++ b/packages/main/src/nammatham.ts @@ -25,22 +25,24 @@ export class Nammatham implements NammathamTrigger { } this.functions.push({ name: camelCase(options.name ?? options.route), - bindings: [ - { - type: 'httpTrigger', - // TODO: Add Support default value by configuring in options - authLevel: options.authLevel ?? 'function', - route: options.route, - direction: 'in', - name: 'req', - methods: options.methods ?? ['GET', 'POST', 'PUT', 'DELETE'], - }, - { - type: 'http', - direction: 'out', - name: 'res', - }, - ], + metadata: { + bindings: [ + { + type: 'httpTrigger', + // TODO: Add Support default value by configuring in options + authLevel: options.authLevel ?? 'function', + route: options.route, + direction: 'in', + name: 'req', + methods: options.methods ?? ['GET', 'POST', 'PUT', 'DELETE'], + }, + { + type: 'http', + direction: 'out', + name: 'res', + }, + ], + }, }); return this; } diff --git a/packages/main/src/types.ts b/packages/main/src/types.ts index 8060204..f2472c9 100644 --- a/packages/main/src/types.ts +++ b/packages/main/src/types.ts @@ -6,10 +6,13 @@ export interface AzureFunctionBindings extends Record { name: string; } +export interface AzureFunctionMetadata extends Record { + bindings: AzureFunctionBindings[]; +} + export interface NammathamFunction { name: string; - metadata?: Record; - bindings: AzureFunctionBindings[]; + metadata?: AzureFunctionMetadata; } export type HttpMethods = 'GET' | 'POST' | 'PUT' | 'DELETE';