Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/release.beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
- run: npm install --global npm@10
node-version: '24'
- run: npm install --global npm@11
- run: npm ci
- uses: JS-DevTools/npm-publish@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: '22'
- run: npm install --global npm@10
node-version: '24'
- run: npm install --global npm@11
- run: npm ci
- uses: JS-DevTools/npm-publish@v4
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:

strategy:
matrix:
node: ['22', '24']
node: ['24']
os: [macos-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
- run: npm install -g npm@10
- run: npm install -g npm@11
- run: npm ci
- run: npm install -g .
- run: npm test
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- **[BREAKING]** API Hosting runtime version from Node.js 18 to [Node.js 22](https://nodejs.org/en/blog/announcements/v22-release-announce)
- Require minimum [Node.js 22](https://nodejs.org/en/blog/announcements/v22-release-announce)
- **[BREAKING]** API Hosting runtime version from Node.js 18 to [Node.js 24](https://nodejs.org/en/blog/release/v24.11.0)
- Require minimum [Node.js 24](https://nodejs.org/en/blog/release/v24.11.0)

### Removed

Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

## Requirements

- [Node.js](https://nodejs.org/) 22.0 or newer
- NPM 10.0 or newer
- [Node.js](https://nodejs.org/) 24.0 or newer
- NPM 11.0 or newer

## Installation

Expand Down
4 changes: 2 additions & 2 deletions docs/api/environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

## Execution Environment

- Code executes within a Linux environment with [Node.js 22](https://nodejs.org/dist/latest-v22.x/docs/api/)
- Code executes within a Linux environment with [Node.js 24](https://nodejs.org/dist/latest-v24.x/docs/api/)

- If you use features not available in this version of Node.js, transpile before deployment. NPM packages using native binaries can be installed using docker:

```
docker run -it --rm -v ${PWD}:/app -w /app node:22 npm install
docker run -it --rm -v ${PWD}:/app -w /app node:24 npm install
```

* The environment your code executes in is arbitrarily destroyed between requests
Expand Down
11 changes: 2 additions & 9 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@ const compat = new FlatCompat({

export default [
{
ignores: [
'**/node_modules',
'**/examples',
'**/docs',
'**/dist',
'**/my-serverless',
],
ignores: ['./node_modules/**', './examples/**', './docs/**', './dist/**'],
},
...pluginMicrosoftSdl.configs.recommended,
...compat.extends(
Expand All @@ -42,8 +36,7 @@ export default [
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: 'commonjs',
ecmaVersion: 2024,

parserOptions: { project: './tsconfig.eslint.json' },
},
Expand Down
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type OneBlinkAPIHostingRequest<T = void> = {
url: {
host: string
hostname: string
params: { [id: string]: string }
params: Record<string, string | undefined>
pathname: string
protocol: 'http:' | 'https:'
query: Record<string, string | string[]>
Expand Down
26 changes: 10 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"recursive-copy": "^2.0.14",
"s3-sync-client": "^4.3.1",
"temp": "^0.9.4",
"uniloc": "^0.3.0",
"update-notifier": "^7.3.1",
"valid-url": "^1.0.9",
"write-json-file": "^7.0.0"
Expand All @@ -63,6 +62,7 @@
"@types/mime-types": "^3.0.1",
"@types/minimist": "^1.2.5",
"@types/morgan": "^1.9.10",
"@types/node": "^24.10.8",
"@types/object-merge": "^2.5.3",
"@types/temp": "^0.9.4",
"@types/update-notifier": "^6.0.8",
Expand All @@ -87,8 +87,8 @@
"test": "test"
},
"engines": {
"node": ">=22",
"npm": ">=10"
"node": ">=24",
"npm": ">=11"
},
"exports": "./index.js",
"files": [
Expand Down
24 changes: 9 additions & 15 deletions src/api/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { URLPattern } from 'url'
import type { RouteConfiguration } from './types.js'

import uniloc from 'uniloc'

import BmResponse from './bm-response.js'
import {
OneBlinkAPIHostingHandler,
Expand Down Expand Up @@ -34,7 +33,7 @@
module: string,
method: string,
): Promise<OneBlinkAPIHostingHandler<In, Out> | void> {
const handler: { default: any; [key: string]: any } = await import(module)

Check warning on line 36 in src/api/handlers.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 36 in src/api/handlers.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 36 in src/api/handlers.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on macos-latest

Unexpected any. Specify a different type

Check warning on line 36 in src/api/handlers.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on macos-latest

Unexpected any. Specify a different type

Check warning on line 36 in src/api/handlers.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on windows-latest

Unexpected any. Specify a different type

Check warning on line 36 in src/api/handlers.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on windows-latest

Unexpected any. Specify a different type

if (handler) {
if (method && typeof handler[method] === 'function') {
Expand All @@ -49,24 +48,19 @@
route: string,
routeConfigs: RouteConfiguration[],
): RouteConfiguration {
const unilocRoutes = routeConfigs.reduce<Record<string, string>>(
(memo, r) => {
memo[r.route] = `GET ${r.route.replace(/{/g, ':').replace(/}/g, '')}`
return memo
},
{},
)
const unilocRouter = uniloc(unilocRoutes)
const unilocRoute = unilocRouter.lookup(route, 'GET')
const routeConfig = routeConfigs.find((routeConfig) => {
const urlPattern = new URLPattern({
pathname: routeConfig.route.replace(/\{([^}]+)\}/g, ':$1'),
})
const result = urlPattern.exec(route)
routeConfig.params = result?.pathname.groups
return result
})
Comment on lines -52 to +58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite difficult to review, does it work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit tests says it does :)


const routeConfig = routeConfigs.find(
(routeConfig) => routeConfig.route === unilocRoute.name,
)
if (!routeConfig) {
throw new Error(`Route has not been implemented: ${route}`)
}

routeConfig.params = unilocRoute.options
return routeConfig
}

Expand Down
6 changes: 2 additions & 4 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@

export type HandlerConfiguration<In = void, Out = void> = {
handler: OneBlinkAPIHostingHandler<In, Out> | void
params: {
[id: string]: string
}
params: Record<string, string | undefined>
}

export type Headers = OneBlinkAPIHostingRequest['headers']
Expand Down Expand Up @@ -78,13 +76,13 @@
queryStringParameters: Record<string, string> | null
}

export type MapObject = Record<string, any>

Check warning on line 79 in src/api/types.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on ubuntu-latest

Unexpected any. Specify a different type

Check warning on line 79 in src/api/types.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on macos-latest

Unexpected any. Specify a different type

Check warning on line 79 in src/api/types.ts

View workflow job for this annotation

GitHub Actions / Test Node.js 24 on windows-latest

Unexpected any. Specify a different type

export type Protocol = OneBlinkAPIHostingRequest['url']['protocol']

export type RouteConfiguration = APITypes.APIEnvironmentRoute & {
timeout?: number
params?: { [id: string]: string }
params?: Record<string, string | undefined>
}

export type ScheduledFunctionConfiguration = Omit<
Expand Down
2 changes: 1 addition & 1 deletion src/api/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const METHODS: Array<string> = [
const DEFAULT_TIMEOUT_SECONDS = 15

export default {
AWS_LAMBDA_RUNTIME: 'nodejs22.x',
AWS_LAMBDA_RUNTIME: 'nodejs24.x',
DEFAULT_CORS: {
CREDENTIALS,
EXPOSED_HEADERS,
Expand Down
1 change: 0 additions & 1 deletion src/types/uniloc.d.ts

This file was deleted.

6 changes: 3 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "ES2023" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "Node16" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"target": "ES2024" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
"module": "nodenext" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"lib": [
"ES2023"
"ES2024"
] /* Specify library files to be included in the compilation. */,
// "allowJs": true /* Allow javascript files to be compiled. */,
// "checkJs": true, /* Report errors in .js files. */
Expand Down
Loading