@orkestrel/middleware 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +21 -3
  2. package/package.json +15 -15
package/README.md CHANGED
@@ -22,10 +22,28 @@ npm install @orkestrel/middleware @orkestrel/server
22
22
  - ESM core (`.`); a CJS node face (`./server`) for the node-bound batteries
23
23
  (`createStatic`, `createMultipart`)
24
24
 
25
- ## Status
25
+ ## Usage
26
26
 
27
- The public API is defined in `PROPOSAL.md` and not yet implemented — this
28
- package currently ships no runtime code.
27
+ ```ts
28
+ import { createBoundary, createSecurity } from '@orkestrel/middleware'
29
+ import type { IdentifierState } from '@orkestrel/middleware'
30
+ import { compose } from '@orkestrel/server'
31
+
32
+ interface State extends IdentifierState {}
33
+
34
+ const boundary = createBoundary({ expose: false })
35
+ const security = createSecurity({ hsts: true })
36
+
37
+ const handle = compose<State>([boundary, security], async (_request, context) => {
38
+ return Response.json({ identifier: context.state.identifier })
39
+ })
40
+ ```
41
+
42
+ Each battery is a typed `options => MiddlewareHandler<TState>` factory that composes with
43
+ the others through the frozen `@orkestrel/server` seam — mount boundary, telemetry,
44
+ compression, security headers, CORS, rate limiting, sessions (with `MemorySessionStore` or
45
+ `DatabaseSessionStore` over `@orkestrel/database`), CSRF, static files, and multipart uploads
46
+ in any combination, scoped with `only()` / `except()` where needed.
29
47
 
30
48
  ## Guides
31
49
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orkestrel/middleware",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "Batteries for the @orkestrel/server middleware seam — boundary, telemetry, compression, security, CORS, rate limiting, sessions, CSRF, static files, and multipart uploads as typed factories. Part of the @orkestrel line.",
5
5
  "keywords": [
6
6
  "compression",
@@ -61,7 +61,7 @@
61
61
  "copy": "node -e \"const fs=require('node:fs'),p=require('node:path'),a=process.argv[1],b=process.argv[2];fs.mkdirSync(p.dirname(b),{recursive:true});fs.cpSync(a,b,{force:true});console.log('Copied: '+a+' to '+b)\"",
62
62
  "tmp:txt": "node -e \"const fs=require('node:fs'),p=require('node:path');function walk(d){for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory()){walk(f)}else if(!e.name.endsWith('.md')&&!e.name.endsWith('.txt')){const t=f+'.txt';if(!fs.existsSync(t)){fs.renameSync(f,t)}else{console.warn('Skipping '+f+' — target exists: '+t)}}}}try{walk('tmp')}catch(e){if(e.code!=='ENOENT')throw e}\"",
63
63
  "lint": "oxlint --config .oxlintrc.json --fix .",
64
- "check": "tsc --noEmit --project tsconfig.json",
64
+ "check": "tsc --noEmit --project tsconfig.json && npm run check:src",
65
65
  "check:src": "npm run check:src:core && npm run check:src:server",
66
66
  "check:src:core": "tsc --noEmit -p configs/src/tsconfig.core.json",
67
67
  "check:src:server": "tsc --noEmit -p configs/src/tsconfig.server.json",
@@ -77,20 +77,20 @@
77
77
  "build:src": "npm run build:src:core && npm run build:src:server",
78
78
  "build:src:core": "vite build --config configs/src/vite.core.config.ts && npm run copy dist/src/core/index.d.ts dist/src/core/index.d.cts",
79
79
  "build:src:server": "vite build --config configs/src/vite.server.config.ts && npm run copy dist/src/server/index.d.ts dist/src/server/index.d.cts",
80
- "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run check:src && npm run build && npm test"
80
+ "prepublishOnly": "npm run format:check && npm run lint:check && npm run check && npm run build && npm test"
81
81
  },
82
82
  "dependencies": {
83
- "@orkestrel/abort": "^0.0.1",
84
- "@orkestrel/budget": "^0.0.1",
85
- "@orkestrel/contract": "^0.0.1",
86
- "@orkestrel/timeout": "^0.0.1"
83
+ "@orkestrel/abort": "^0.0.3",
84
+ "@orkestrel/budget": "^0.0.3",
85
+ "@orkestrel/contract": "^0.0.5",
86
+ "@orkestrel/timeout": "^0.0.3"
87
87
  },
88
88
  "devDependencies": {
89
- "@microsoft/api-extractor": "^7.58.10",
90
- "@orkestrel/database": "^0.0.3",
91
- "@orkestrel/guide": "^0.0.1",
92
- "@orkestrel/router": "^0.0.2",
93
- "@orkestrel/server": "^0.0.4",
89
+ "@microsoft/api-extractor": "^7.58.11",
90
+ "@orkestrel/database": "^0.0.5",
91
+ "@orkestrel/guide": "^0.0.5",
92
+ "@orkestrel/router": "^0.0.4",
93
+ "@orkestrel/server": "^0.0.6",
94
94
  "@types/node": "^26.1.1",
95
95
  "@vitest/browser-playwright": "^4.1.10",
96
96
  "oxfmt": "^0.59.0",
@@ -101,8 +101,8 @@
101
101
  "vitest": "^4.1.10"
102
102
  },
103
103
  "peerDependencies": {
104
- "@orkestrel/database": "^0.0.3",
105
- "@orkestrel/server": "^0.0.4"
104
+ "@orkestrel/database": "^0.0.5",
105
+ "@orkestrel/server": "^0.0.6"
106
106
  },
107
107
  "peerDependenciesMeta": {
108
108
  "@orkestrel/database": {
@@ -110,6 +110,6 @@
110
110
  }
111
111
  },
112
112
  "engines": {
113
- "node": ">=24"
113
+ "node": ">=22"
114
114
  }
115
115
  }