diff --git a/examples/azure-functions-minimal/package.json b/examples/azure-functions-minimal/package.json index ea21d5d5..4f8a995d 100644 --- a/examples/azure-functions-minimal/package.json +++ b/examples/azure-functions-minimal/package.json @@ -12,7 +12,7 @@ "author": "Thada Wangthammang", "license": "MIT", "dependencies": { - "nammatham": "2.0.0-alpha.12", + "nammatham": "2.0.0-alpha.13", "@azure/functions": "^4.1.0" }, "devDependencies": { diff --git a/examples/azure-functions-timer-trigger/package.json b/examples/azure-functions-timer-trigger/package.json index ab58ab6e..24c4d4ef 100644 --- a/examples/azure-functions-timer-trigger/package.json +++ b/examples/azure-functions-timer-trigger/package.json @@ -12,7 +12,7 @@ "author": "Thada Wangthammang", "license": "MIT", "dependencies": { - "nammatham": "2.0.0-alpha.12", + "nammatham": "2.0.0-alpha.13", "@azure/functions": "^4.1.0" }, "devDependencies": { diff --git a/examples/azure-functions-with-inversify/package.json b/examples/azure-functions-with-inversify/package.json index 3d1a8238..e5039cdf 100644 --- a/examples/azure-functions-with-inversify/package.json +++ b/examples/azure-functions-with-inversify/package.json @@ -14,7 +14,7 @@ "dependencies": { "@azure/functions": "^4.1.0", "@di-extra/inversify": "^0.2.0", - "nammatham": "2.0.0-alpha.12", + "nammatham": "2.0.0-alpha.13", "inversify": "^6.0.2", "reflect-metadata": "^0.2.1" }, diff --git a/examples/azure-functions-with-test/package.json b/examples/azure-functions-with-test/package.json index 397454a7..2a9ea72b 100644 --- a/examples/azure-functions-with-test/package.json +++ b/examples/azure-functions-with-test/package.json @@ -13,7 +13,7 @@ "license": "MIT", "dependencies": { "@azure/functions": "^4.1.0", - "nammatham": "2.0.0-alpha.12" + "nammatham": "2.0.0-alpha.13" }, "devDependencies": { "cross-env": "^7.0.3", diff --git a/examples/azure-functions-with-trpc/package.json b/examples/azure-functions-with-trpc/package.json index b0af8a53..558695aa 100644 --- a/examples/azure-functions-with-trpc/package.json +++ b/examples/azure-functions-with-trpc/package.json @@ -15,8 +15,8 @@ "license": "MIT", "dependencies": { "@azure/functions": "^4.1.0", - "nammatham": "2.0.0-alpha.12", - "@nammatham/trpc-azure-functions": "2.0.0-alpha.12", + "nammatham": "2.0.0-alpha.13", + "@nammatham/trpc-azure-functions": "2.0.0-alpha.13", "@trpc/client": "^10.45.0", "@trpc/server": "^10.45.0", "trpc-azure-functions-adapter": "0.0.5" diff --git a/examples/azure-functions/package.json b/examples/azure-functions/package.json index 642bde2c..818806d2 100644 --- a/examples/azure-functions/package.json +++ b/examples/azure-functions/package.json @@ -12,7 +12,7 @@ "author": "Thada Wangthammang", "license": "MIT", "dependencies": { - "nammatham": "2.0.0-alpha.12", + "nammatham": "2.0.0-alpha.13", "@azure/functions": "^4.1.0" }, "devDependencies": { diff --git a/package.json b/package.json index 3799308c..de3652fe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@nammatham/monorepo", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "Azure Function Nodejs Lightweight framework with Dependency Injection", "scripts": { "test": "vitest", diff --git a/packages/azure-functions/README.md b/packages/azure-functions/README.md index fbd5b82a..2ffe6a22 100644 --- a/packages/azure-functions/README.md +++ b/packages/azure-functions/README.md @@ -16,6 +16,8 @@ Type-safe Serverless Library for Azure Functions and friends > > Note: [Nammatham v1](https://www.npmjs.com/package/nammatham) is currently in maintenance mode. no new features are actively being developed +You're reading v2 docs + | Version | Status | Azure Functions
Node.js Lib | Branch | Build Status | | ------- | ----------- | ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -37,19 +39,16 @@ Nammatham (นามธรรม in Thai, pronounced `/naam ma tham/`, means **a npm install nammatham@alpha ``` -You can also install independently -```bash -npm install @nammatham/core @nammatham/azure-functions @nammatham/express -``` - ### Example You can see [examples](examples) or follow the minimal app getting started below: +> `initNammatham.create()` is a factory function for creating Nammatham App, it's a wrapper for Azure Functions App. + ```typescript -import { initNammatham, AzureFunctionsAdapter, expressPlugin } from "nammatham"; +import { initNammatham, expressPlugin } from 'nammatham'; -const n = initNammatham.create(new AzureFunctionsAdapter()); +const n = initNammatham.create(); const func = n.func; const app = n.app; @@ -57,11 +56,11 @@ const helloFunction = func .httpGet('hello', { route: 'hello-world', }) - .handler(async ({trigger, context}) => { - context.log('HTTP trigger function processed a request.'); - context.debug(`Http function processed request for url "${trigger.url}"`); - const name = trigger.query.get('name') || (await trigger.text()) || 'world'; - return { body: `Hello, ${name}!` }; + .handler(async c => { + c.context.log('HTTP trigger function processed a request.'); + c.context.debug(`Http function processed request for url "${c.trigger.url}"`); + const name = c.trigger.query.get('name') || (await c.trigger.text()) || 'world'; + return c.text(`Hello, ${name}!`); }); app.addFunctions(helloFunction); diff --git a/packages/azure-functions/package.json b/packages/azure-functions/package.json index 2e56afc7..2f920263 100644 --- a/packages/azure-functions/package.json +++ b/packages/azure-functions/package.json @@ -1,6 +1,6 @@ { "name": "@nammatham/azure-functions", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "Type-safe Serverless Library for Azure Functions and friends", "main": "dist/main.js", "types": "dist/main.d.ts", @@ -21,7 +21,7 @@ "license": "MIT", "dependencies": { "@azure/functions": "^4.1.0", - "@nammatham/core": "2.0.0-alpha.12", + "@nammatham/core": "2.0.0-alpha.13", "colorette": "^2.0.20", "express": "^4.18.2", "undici": "5.20.0", diff --git a/packages/core/README.md b/packages/core/README.md index fbd5b82a..2ffe6a22 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -16,6 +16,8 @@ Type-safe Serverless Library for Azure Functions and friends > > Note: [Nammatham v1](https://www.npmjs.com/package/nammatham) is currently in maintenance mode. no new features are actively being developed +You're reading v2 docs + | Version | Status | Azure Functions
Node.js Lib | Branch | Build Status | | ------- | ----------- | ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -37,19 +39,16 @@ Nammatham (นามธรรม in Thai, pronounced `/naam ma tham/`, means **a npm install nammatham@alpha ``` -You can also install independently -```bash -npm install @nammatham/core @nammatham/azure-functions @nammatham/express -``` - ### Example You can see [examples](examples) or follow the minimal app getting started below: +> `initNammatham.create()` is a factory function for creating Nammatham App, it's a wrapper for Azure Functions App. + ```typescript -import { initNammatham, AzureFunctionsAdapter, expressPlugin } from "nammatham"; +import { initNammatham, expressPlugin } from 'nammatham'; -const n = initNammatham.create(new AzureFunctionsAdapter()); +const n = initNammatham.create(); const func = n.func; const app = n.app; @@ -57,11 +56,11 @@ const helloFunction = func .httpGet('hello', { route: 'hello-world', }) - .handler(async ({trigger, context}) => { - context.log('HTTP trigger function processed a request.'); - context.debug(`Http function processed request for url "${trigger.url}"`); - const name = trigger.query.get('name') || (await trigger.text()) || 'world'; - return { body: `Hello, ${name}!` }; + .handler(async c => { + c.context.log('HTTP trigger function processed a request.'); + c.context.debug(`Http function processed request for url "${c.trigger.url}"`); + const name = c.trigger.query.get('name') || (await c.trigger.text()) || 'world'; + return c.text(`Hello, ${name}!`); }); app.addFunctions(helloFunction); diff --git a/packages/core/package.json b/packages/core/package.json index 1c5fb760..c1ff5198 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@nammatham/core", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "Type-safe Serverless Library for Azure Functions and friends", "main": "dist/main.js", "types": "dist/main.d.ts", diff --git a/packages/express/README.md b/packages/express/README.md index fbd5b82a..2ffe6a22 100644 --- a/packages/express/README.md +++ b/packages/express/README.md @@ -16,6 +16,8 @@ Type-safe Serverless Library for Azure Functions and friends > > Note: [Nammatham v1](https://www.npmjs.com/package/nammatham) is currently in maintenance mode. no new features are actively being developed +You're reading v2 docs + | Version | Status | Azure Functions
Node.js Lib | Branch | Build Status | | ------- | ----------- | ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -37,19 +39,16 @@ Nammatham (นามธรรม in Thai, pronounced `/naam ma tham/`, means **a npm install nammatham@alpha ``` -You can also install independently -```bash -npm install @nammatham/core @nammatham/azure-functions @nammatham/express -``` - ### Example You can see [examples](examples) or follow the minimal app getting started below: +> `initNammatham.create()` is a factory function for creating Nammatham App, it's a wrapper for Azure Functions App. + ```typescript -import { initNammatham, AzureFunctionsAdapter, expressPlugin } from "nammatham"; +import { initNammatham, expressPlugin } from 'nammatham'; -const n = initNammatham.create(new AzureFunctionsAdapter()); +const n = initNammatham.create(); const func = n.func; const app = n.app; @@ -57,11 +56,11 @@ const helloFunction = func .httpGet('hello', { route: 'hello-world', }) - .handler(async ({trigger, context}) => { - context.log('HTTP trigger function processed a request.'); - context.debug(`Http function processed request for url "${trigger.url}"`); - const name = trigger.query.get('name') || (await trigger.text()) || 'world'; - return { body: `Hello, ${name}!` }; + .handler(async c => { + c.context.log('HTTP trigger function processed a request.'); + c.context.debug(`Http function processed request for url "${c.trigger.url}"`); + const name = c.trigger.query.get('name') || (await c.trigger.text()) || 'world'; + return c.text(`Hello, ${name}!`); }); app.addFunctions(helloFunction); diff --git a/packages/express/package.json b/packages/express/package.json index 729d3250..2c4d04c0 100644 --- a/packages/express/package.json +++ b/packages/express/package.json @@ -1,6 +1,6 @@ { "name": "@nammatham/express", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "Type-safe Serverless Library for Azure Functions and friends", "main": "dist/main.js", "types": "dist/main.d.ts", @@ -20,7 +20,7 @@ "author": "Thada Wangthammang", "license": "MIT", "dependencies": { - "@nammatham/core": "2.0.0-alpha.12", + "@nammatham/core": "2.0.0-alpha.13", "@types/express": "^4.17.21", "colorette": "^2.0.20", "express": "^4.18.2" diff --git a/packages/main/README.md b/packages/main/README.md index fbd5b82a..2ffe6a22 100644 --- a/packages/main/README.md +++ b/packages/main/README.md @@ -16,6 +16,8 @@ Type-safe Serverless Library for Azure Functions and friends > > Note: [Nammatham v1](https://www.npmjs.com/package/nammatham) is currently in maintenance mode. no new features are actively being developed +You're reading v2 docs + | Version | Status | Azure Functions
Node.js Lib | Branch | Build Status | | ------- | ----------- | ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -37,19 +39,16 @@ Nammatham (นามธรรม in Thai, pronounced `/naam ma tham/`, means **a npm install nammatham@alpha ``` -You can also install independently -```bash -npm install @nammatham/core @nammatham/azure-functions @nammatham/express -``` - ### Example You can see [examples](examples) or follow the minimal app getting started below: +> `initNammatham.create()` is a factory function for creating Nammatham App, it's a wrapper for Azure Functions App. + ```typescript -import { initNammatham, AzureFunctionsAdapter, expressPlugin } from "nammatham"; +import { initNammatham, expressPlugin } from 'nammatham'; -const n = initNammatham.create(new AzureFunctionsAdapter()); +const n = initNammatham.create(); const func = n.func; const app = n.app; @@ -57,11 +56,11 @@ const helloFunction = func .httpGet('hello', { route: 'hello-world', }) - .handler(async ({trigger, context}) => { - context.log('HTTP trigger function processed a request.'); - context.debug(`Http function processed request for url "${trigger.url}"`); - const name = trigger.query.get('name') || (await trigger.text()) || 'world'; - return { body: `Hello, ${name}!` }; + .handler(async c => { + c.context.log('HTTP trigger function processed a request.'); + c.context.debug(`Http function processed request for url "${c.trigger.url}"`); + const name = c.trigger.query.get('name') || (await c.trigger.text()) || 'world'; + return c.text(`Hello, ${name}!`); }); app.addFunctions(helloFunction); diff --git a/packages/main/package.json b/packages/main/package.json index eb8d6aac..8671888a 100644 --- a/packages/main/package.json +++ b/packages/main/package.json @@ -1,6 +1,6 @@ { "name": "nammatham", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "Type-safe Serverless Library for Azure Functions and friends", "main": "dist/main.js", "types": "dist/main.d.ts", @@ -47,9 +47,9 @@ "author": "Thada Wangthammang", "license": "MIT", "dependencies": { - "@nammatham/core": "2.0.0-alpha.12", - "@nammatham/azure-functions": "2.0.0-alpha.12", - "@nammatham/express": "2.0.0-alpha.12" + "@nammatham/core": "2.0.0-alpha.13", + "@nammatham/azure-functions": "2.0.0-alpha.13", + "@nammatham/express": "2.0.0-alpha.13" }, "repository": { "type": "git", diff --git a/packages/trpc-azure-functions/README.md b/packages/trpc-azure-functions/README.md index fbd5b82a..2ffe6a22 100644 --- a/packages/trpc-azure-functions/README.md +++ b/packages/trpc-azure-functions/README.md @@ -16,6 +16,8 @@ Type-safe Serverless Library for Azure Functions and friends > > Note: [Nammatham v1](https://www.npmjs.com/package/nammatham) is currently in maintenance mode. no new features are actively being developed +You're reading v2 docs + | Version | Status | Azure Functions
Node.js Lib | Branch | Build Status | | ------- | ----------- | ----------------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -37,19 +39,16 @@ Nammatham (นามธรรม in Thai, pronounced `/naam ma tham/`, means **a npm install nammatham@alpha ``` -You can also install independently -```bash -npm install @nammatham/core @nammatham/azure-functions @nammatham/express -``` - ### Example You can see [examples](examples) or follow the minimal app getting started below: +> `initNammatham.create()` is a factory function for creating Nammatham App, it's a wrapper for Azure Functions App. + ```typescript -import { initNammatham, AzureFunctionsAdapter, expressPlugin } from "nammatham"; +import { initNammatham, expressPlugin } from 'nammatham'; -const n = initNammatham.create(new AzureFunctionsAdapter()); +const n = initNammatham.create(); const func = n.func; const app = n.app; @@ -57,11 +56,11 @@ const helloFunction = func .httpGet('hello', { route: 'hello-world', }) - .handler(async ({trigger, context}) => { - context.log('HTTP trigger function processed a request.'); - context.debug(`Http function processed request for url "${trigger.url}"`); - const name = trigger.query.get('name') || (await trigger.text()) || 'world'; - return { body: `Hello, ${name}!` }; + .handler(async c => { + c.context.log('HTTP trigger function processed a request.'); + c.context.debug(`Http function processed request for url "${c.trigger.url}"`); + const name = c.trigger.query.get('name') || (await c.trigger.text()) || 'world'; + return c.text(`Hello, ${name}!`); }); app.addFunctions(helloFunction); diff --git a/packages/trpc-azure-functions/package.json b/packages/trpc-azure-functions/package.json index 9f27b59c..9e279411 100644 --- a/packages/trpc-azure-functions/package.json +++ b/packages/trpc-azure-functions/package.json @@ -1,6 +1,6 @@ { "name": "@nammatham/trpc-azure-functions", - "version": "2.0.0-alpha.12", + "version": "2.0.0-alpha.13", "description": "Type-safe Serverless Library for Azure Functions and friends", "main": "dist/main.js", "types": "dist/main.d.ts", @@ -21,9 +21,9 @@ "license": "MIT", "dependencies": { "@azure/functions": "^4.1.0", - "@nammatham/core": "2.0.0-alpha.12", - "@nammatham/azure-functions": "2.0.0-alpha.12", - "@nammatham/express": "2.0.0-alpha.12", + "@nammatham/core": "2.0.0-alpha.13", + "@nammatham/azure-functions": "2.0.0-alpha.13", + "@nammatham/express": "2.0.0-alpha.13", "@trpc/server": "^10.45.0", "express": "^4.18.2", "trpc-azure-functions-adapter": "0.0.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index eb9c6b72..fd969aa7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -72,7 +72,7 @@ importers: specifier: ^4.1.0 version: 4.1.0 nammatham: - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/main devDependencies: cross-env: @@ -94,7 +94,7 @@ importers: specifier: ^4.1.0 version: 4.1.0 nammatham: - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/main devDependencies: cross-env: @@ -116,7 +116,7 @@ importers: specifier: ^4.1.0 version: 4.1.0 nammatham: - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/main devDependencies: cross-env: @@ -144,7 +144,7 @@ importers: specifier: ^6.0.2 version: 6.0.2 nammatham: - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/main reflect-metadata: specifier: ^0.2.1 @@ -169,7 +169,7 @@ importers: specifier: ^4.1.0 version: 4.1.0 nammatham: - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/main devDependencies: cross-env: @@ -191,7 +191,7 @@ importers: specifier: ^4.1.0 version: 4.1.0 '@nammatham/trpc-azure-functions': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/trpc-azure-functions '@trpc/client': specifier: ^10.45.0 @@ -200,7 +200,7 @@ importers: specifier: ^10.45.0 version: 10.45.0 nammatham: - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../../packages/main trpc-azure-functions-adapter: specifier: 0.0.5 @@ -225,7 +225,7 @@ importers: specifier: ^4.1.0 version: 4.1.0 '@nammatham/core': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../core colorette: specifier: ^2.0.20 @@ -271,7 +271,7 @@ importers: packages/express: dependencies: '@nammatham/core': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../core '@types/express': specifier: ^4.17.21 @@ -286,13 +286,13 @@ importers: packages/main: dependencies: '@nammatham/azure-functions': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../azure-functions '@nammatham/core': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../core '@nammatham/express': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../express packages/trpc-azure-functions: @@ -301,13 +301,13 @@ importers: specifier: ^4.1.0 version: 4.1.0 '@nammatham/azure-functions': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../azure-functions '@nammatham/core': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../core '@nammatham/express': - specifier: 2.0.0-alpha.12 + specifier: 2.0.0-alpha.13 version: link:../express '@trpc/server': specifier: ^10.45.0