Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v22 is for Tai #2214

Merged
merged 103 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
66853e1
Changing trigger branches in workflows.
RobinTail Nov 26, 2024
5b7df35
Drop Node 18 (#2063)
RobinTail Nov 26, 2024
486abcd
Merge branch 'master' into make-v22
RobinTail Nov 26, 2024
9e4535d
rm redundant import
RobinTail Nov 27, 2024
e4d6c14
Merge branch 'master' into make-v22
RobinTail Dec 1, 2024
e32e63a
Merge branch 'master' into make-v22
RobinTail Dec 1, 2024
429e0e3
Cleanup migration for v22.
RobinTail Dec 1, 2024
67b0b74
Merge branch 'master' into make-v22
RobinTail Dec 1, 2024
2ec5a75
Cleanup compat test for migration.
RobinTail Dec 1, 2024
5221f86
Drop `provider()` overload having 3 arguments (#2206)
RobinTail Dec 1, 2024
a7d9ce9
Merge branch 'master' into make-v22
RobinTail Dec 2, 2024
2d6ca34
Merge branch 'master' into make-v22
RobinTail Dec 2, 2024
8d216ae
Drop `splitResponse` (#2228)
RobinTail Dec 2, 2024
0723eaf
Merge branch 'master' into make-v22
RobinTail Dec 2, 2024
6f6f993
Merge branch 'master' into make-v22
RobinTail Dec 2, 2024
f5e5302
Merge branch 'master' into make-v22
RobinTail Dec 3, 2024
3dde002
Merge branch 'master' into make-v22
RobinTail Dec 3, 2024
599db21
Merge branch 'master' into make-v22
RobinTail Dec 3, 2024
294f300
Merge branch 'master' into make-v22
RobinTail Dec 3, 2024
b832b2b
Merge branch 'master' into make-v22
RobinTail Dec 3, 2024
2b730fe
Merge branch 'master' into make-v22
RobinTail Dec 4, 2024
d7ba0aa
Merge branch 'master' into make-v22
RobinTail Dec 8, 2024
a929dea
Merge branch 'master' into make-v22
RobinTail Dec 9, 2024
026318d
Merge branch 'master' into make-v22
RobinTail Dec 9, 2024
5d5eb72
Merge branch 'master' into make-v22
RobinTail Dec 9, 2024
297ebcb
Merge branch 'master' into make-v22
RobinTail Dec 10, 2024
293995e
Merge branch 'master' into make-v22
RobinTail Dec 11, 2024
ab21595
Merge branch 'master' into make-v22
RobinTail Dec 11, 2024
0ee26e7
Merge branch 'master' into make-v22
RobinTail Dec 14, 2024
e2492a1
Merge branch 'master' into make-v22
RobinTail Dec 15, 2024
a8bed37
Merge branch 'master' into make-v22
RobinTail Dec 20, 2024
dc0494d
Drop `jsonEndpoints` (#2259)
RobinTail Dec 20, 2024
9cc7bcf
Merge branch 'master' into make-v22
RobinTail Dec 20, 2024
251cb20
Merge branch 'master' into make-v22
RobinTail Dec 20, 2024
44ad5a8
Update CHANGELOG.md
RobinTail Dec 21, 2024
eee45fe
Update CHANGELOG.md
RobinTail Dec 21, 2024
52b6eb6
SECURITY: planning for feb'25
RobinTail Dec 22, 2024
f14a92e
Merge branch 'master' into make-v22
RobinTail Dec 24, 2024
b035594
Merge branch 'master' into make-v22
RobinTail Dec 26, 2024
0f531ee
Merge branch 'master' into make-v22
RobinTail Dec 26, 2024
b215590
Dedicated to Tai’Vion Lathan.
RobinTail Dec 27, 2024
a26caaa
Merge branch 'master' into make-v22
RobinTail Dec 28, 2024
778a57a
Merge branch 'master' into make-v22
RobinTail Dec 29, 2024
ae76f9f
Merge branch 'master' into make-v22
RobinTail Dec 31, 2024
e106558
Merge branch 'master' into make-v22
RobinTail Dec 31, 2024
3734948
Merge branch 'master' into make-v22
RobinTail Dec 31, 2024
bdf12da
Drop `MethodPath` type (#2276)
RobinTail Dec 31, 2024
2ed233f
Merge branch 'master' into make-v22
RobinTail Jan 1, 2025
4d51d3a
Merge branch 'master' into make-v22
RobinTail Jan 1, 2025
78b3ba0
Merge branch 'master' into make-v22
RobinTail Jan 1, 2025
ec11bd5
Add eslint rule for makePromise().
RobinTail Jan 3, 2025
26e7afe
Minor: using Partial for makeParams() for consistency.
RobinTail Jan 3, 2025
4144294
Allow explicit types for makeTypeParams().
RobinTail Jan 3, 2025
646bac8
Allow type params on `makeArrowFn()` (#2281)
RobinTail Jan 3, 2025
3da9c16
Also allow params as an object on makeArrowFn().
RobinTail Jan 3, 2025
a74832e
Revert "Also allow params as an object on makeArrowFn()."
RobinTail Jan 3, 2025
1b7b1bd
Fix: optional last arg for makeArrowFn()
RobinTail Jan 3, 2025
97cc884
Merge branch 'master' into make-v22
RobinTail Jan 4, 2025
595a833
Changelog: migration guide.
RobinTail Jan 4, 2025
3959e49
22.0.0-beta.1
RobinTail Jan 4, 2025
35851ff
Merge branch 'master' into make-v22
RobinTail Jan 5, 2025
26967cb
Minor: line split in migration.
RobinTail Jan 5, 2025
df2dc1c
Merge branch 'master' into make-v22
RobinTail Jan 5, 2025
4184232
Moving tags to augmentation (#2284)
RobinTail Jan 5, 2025
61531c2
22.0.0-beta.2
RobinTail Jan 5, 2025
76e8d11
Merge branch 'master' into make-v22
RobinTail Jan 6, 2025
2a4d52f
Organizing Typescipt API (#2287)
RobinTail Jan 6, 2025
8535b8b
Merge branch 'master' into make-v22
RobinTail Jan 6, 2025
0d31e1d
Improve consistency of Typescript API (#2288)
RobinTail Jan 7, 2025
1c479cd
Fix: simpler expression for Integration (#2290)
RobinTail Jan 8, 2025
042b15b
Merge branch 'master' into make-v22
RobinTail Jan 9, 2025
faa19fb
Rev: Security: not deprecating v18 - will do it in April.
RobinTail Jan 11, 2025
32cac4d
Merge branch 'master' into make-v22
RobinTail Jan 11, 2025
2fe07af
Merge branch 'master' into make-v22
RobinTail Jan 12, 2025
9bf42f1
ref(v22): Integration base (#2299)
RobinTail Jan 13, 2025
0bd6289
Merge branch 'master' into make-v22
RobinTail Jan 13, 2025
ebf8b47
ref(v22): `parseRequest()` and `substitute()` functions (#2303)
RobinTail Jan 13, 2025
22c36a2
22.0.0-beta.3
RobinTail Jan 13, 2025
ea01e08
ref(v22): makeParam and makeParams API methods adjustment (#2305)
RobinTail Jan 13, 2025
87821ca
fix(v22): Integration cleanup and constraints adjustments (#2306)
RobinTail Jan 13, 2025
d2ea9ae
ref(v22): Minimizing ids (#2307)
RobinTail Jan 14, 2025
adeb8d8
Merge branch 'master' into make-v22
RobinTail Jan 14, 2025
d97a25d
Adjusting client constructor (#2312)
RobinTail Jan 14, 2025
e1b1e71
Minor: imports diff reduction.
RobinTail Jan 14, 2025
88a0a66
Renaming `ExpressZodAPIClient` to just `Client` (#2313)
RobinTail Jan 14, 2025
f3e1450
ref(v22): makePublicClass() arguments (#2314)
RobinTail Jan 15, 2025
d01bd80
Fix: comment.
RobinTail Jan 15, 2025
b1c3d03
Fix: makeUsageStatements() to return just nodes.
RobinTail Jan 15, 2025
c73ba3e
22.0.0-beta.4
RobinTail Jan 15, 2025
e99f451
Merge branch 'master' into make-v22
RobinTail Jan 15, 2025
057945e
Merge branch 'master' into make-v22
RobinTail Jan 17, 2025
e581b67
Merge branch 'master' into make-v22
RobinTail Jan 17, 2025
c351b32
Merge branch 'master' into make-v22
RobinTail Jan 18, 2025
aade841
Merge branch 'master' into make-v22
RobinTail Jan 18, 2025
b543c30
Merge branch 'master' into make-v22
RobinTail Jan 18, 2025
773c417
Changelog: Apply suggestions from code review
RobinTail Jan 18, 2025
e3aaf56
Merge branch 'master' into make-v22
RobinTail Jan 19, 2025
6bfa296
`Endpoint::getSecurity()` to return an array of containers (#2333)
RobinTail Jan 22, 2025
3354109
Merge branch 'master' into make-v22
RobinTail Jan 22, 2025
aa3bf02
Merge branch 'master' into make-v22
RobinTail Jan 23, 2025
d8f8192
feat(v22): Handle all headers (#2337)
RobinTail Jan 24, 2025
3f500e7
rev: trigger branches, no more prs
RobinTail Jan 24, 2025
131e4bb
Merge branch 'master' into make-v22
RobinTail Jan 24, 2025
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/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ name: "CodeQL"

on:
push:
branches: [ master, v18, v19, v20 ]
branches: [ master, v19, v20, v21, make-v22 ]
RobinTail marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
# The branches below must be a subset of the branches above
branches: [ master, v18, v19, v20 ]
branches: [ master, v19, v20, v21, make-v22 ]
RobinTail marked this conversation as resolved.
Show resolved Hide resolved
schedule:
- cron: '26 8 * * 1'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/minor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- uses: fregante/setup-git-user@v2
- run: |
yarn install
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ name: Node.js CI

on:
push:
branches: [ master, v18, v19, v20 ]
branches: [ master, v19, v20, v21, make-v22 ]
RobinTail marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: [ master, v18, v19, v20 ]
branches: [ master, v19, v20, v21, make-v22 ]
RobinTail marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [18.18.0, 18.x, 20.9.0, 20.x, 22.0.0, 22.x]
node-version: [20.9.0, 20.x, 22.0.0, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- name: Get yarn cache dir
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: npm publish --provenance --tag ${{ inputs.tag }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/patch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
- uses: fregante/setup-git-user@v2
- run: |
yarn install
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: OpenAPI Validation

on:
push:
branches: [ master, v18, v19, v20 ]
branches: [ master, v19, v20, v21, make-v22 ]
RobinTail marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: [ master, v18, v19, v20 ]
branches: [ master, v19, v20, v21, make-v22 ]
RobinTail marked this conversation as resolved.
Show resolved Hide resolved


jobs:
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## Version 22

### v22.0.0

- Minimum supported Node versions: 20.9.0 and 22.0.0;
RobinTail marked this conversation as resolved.
Show resolved Hide resolved
- `BuiltinLogger::profile()` behavior changed for picoseconds: expressing them through nanoseconds;
- Changes to client generated by `Integration`:
- The overload of `ExpressZodAPIClient::provide()` having 3 arguments and the `Provider` type are removed.
RobinTail marked this conversation as resolved.
Show resolved Hide resolved

## Version 21

### v21.2.1
Expand Down
139 changes: 74 additions & 65 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,79 @@ const peformanceConcerns = [
},
];

const tsFactoryConcerns = [
{
selector: "Identifier[name='createConditionalExpression']",
message: "use makeTernary() helper",
},
{
selector: "Identifier[name='createArrowFunction']",
message: "use makeArrowFn() helper",
},
{
selector: "Identifier[name='createTypeParameterDeclaration']",
message: "use makeTypeParams() helper",
},
{
selector: "Identifier[name='createInterfaceDeclaration']",
message: "use makePublicInterface() helper",
},
{
selector: "Identifier[name='createClassDeclaration']",
message: "use makePublicClass() helper",
},
{
selector: "Identifier[name='createMethodDeclaration']",
message: "use makePublicMethod() helper",
},
{
selector: "Identifier[name='createTypeAliasDeclaration']",
message: "use makePublicType() or makePublicLiteralType() helpers",
},
{
selector: "Identifier[name='createVariableStatement']",
message: "use makeConst() helper",
},
{
selector: "Identifier[name='createArrayBindingPattern']",
message: "use makeDeconstruction() helper",
},
{
selector: "Identifier[name='createPropertySignature']",
message: "use makeInterfaceProp() helper",
},
{
selector: "Identifier[name='createConstructorDeclaration']",
message: "use makeEmptyInitializingConstructor() helper",
},
{
selector: "Identifier[name='createParameterDeclaration']",
message: "use makeParam() or makeParams() helpers",
},
{
selector:
"CallExpression[callee.property.name='createCallExpression']" +
"[arguments.0.callee.property.name='createPropertyAccessExpression']",
message: "use makePropCall() helper",
},
{
selector: "Identifier[name='AmpersandAmpersandToken']",
message: "use makeAnd() helper",
},
{
selector: "Identifier[name='EqualsEqualsEqualsToken']",
message: "use makeEqual() helper",
},
{
selector: "Identifier[name='createTemplateExpression']",
message: "use makeTemplate() helper",
},
{
selector: "Identifier[name='createNewExpression']",
message: "use makeNew() helper",
},
];

export default tsPlugin.config(
{
languageOptions: { globals: globals.node },
Expand Down Expand Up @@ -76,71 +149,7 @@ export default tsPlugin.config(
name: "source/integration",
files: ["src/integration.ts"],
rules: {
"no-restricted-syntax": [
"warn",
{
selector: "Identifier[name='createConditionalExpression']",
message: "use makeTernary() helper",
},
{
selector: "Identifier[name='createArrowFunction']",
message: "use makeArrowFn() helper",
},
{
selector: "Identifier[name='createTypeParameterDeclaration']",
message: "use makeTypeParams() helper",
},
{
selector: "Identifier[name='createInterfaceDeclaration']",
message: "use makePublicInterface() helper",
},
{
selector: "Identifier[name='createClassDeclaration']",
message: "use makePublicClass() helper",
},
{
selector: "Identifier[name='createMethodDeclaration']",
message: "use makePublicMethod() helper",
},
{
selector: "Identifier[name='createTypeAliasDeclaration']",
message: "use makePublicType() or makePublicLiteralType() helpers",
},
{
selector: "Identifier[name='createVariableDeclarationList']",
message: "use makeConst() helper",
},
{
selector: "Identifier[name='createArrayBindingPattern']",
message: "use makeDeconstruction() helper",
},
{
selector: "Identifier[name='createPropertySignature']",
message: "use makeInterfaceProp() helper",
},
{
selector: "Identifier[name='createConstructorDeclaration']",
message: "use makeEmptyInitializingConstructor() helper",
},
{
selector: "Identifier[name='createParameterDeclaration']",
message: "use makeParam() or makeParams() helpers",
},
{
selector:
"CallExpression[callee.property.name='createCallExpression']" +
"[arguments.0.callee.property.name='createPropertyAccessExpression']",
message: "use makePropCall() helper",
},
{
selector: "Identifier[name='AmpersandAmpersandToken']",
message: "use makeAnd() helper",
},
{
selector: "Identifier[name='EqualsEqualsEqualsToken']",
message: "use makeEqual() helper",
},
],
"no-restricted-syntax": ["warn", ...tsFactoryConcerns],
},
},
{
Expand Down
31 changes: 7 additions & 24 deletions example/example.client.ts
RobinTail marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -204,49 +204,32 @@ export type Implementation = (

export class ExpressZodAPIClient {
constructor(protected readonly implementation: Implementation) {}
/** @deprecated use the overload with 2 arguments instead */
public provide<M extends Method, P extends Path>(
method: M,
path: P,
params: `${M} ${P}` extends keyof Input
? Input[`${M} ${P}`]
: Record<string, any>,
): Promise<
`${M} ${P}` extends keyof Response ? Response[`${M} ${P}`] : unknown
>;
public provide<K extends MethodPath>(
request: K,
params: Input[K],
): Promise<Response[K]>;
public provide(
...args:
| [string, string, Record<string, any>]
| [string, Record<string, any>]
) {
const [method, path, params] = (
args.length === 2 ? [...args[0].split(/ (.+)/, 2), args[1]] : args
) as [Method, Path, Record<string, any>];
): Promise<Response[K]> {
const [method, path] = request.split(/ (.+)/, 2) as [Method, Path];
return this.implementation(
method,
Object.keys(params).reduce(
(acc, key) => acc.replace(`:${key}`, params[key]),
(acc, key) =>
acc.replace(`:${key}`, (params as Record<string, any>)[key]),
path,
),
Object.keys(params).reduce(
(acc, key) =>
Object.assign(
acc,
!path.includes(`:${key}`) && { [key]: params[key] },
!path.includes(`:${key}`) && {
[key]: (params as Record<string, any>)[key],
},
),
{},
),
);
}
}

/** @deprecated will be removed in v22 */
export type Provider = ExpressZodAPIClient["provide"];

// Usage example:
/*
export const exampleImplementation: Implementation = async (
Expand Down
2 changes: 1 addition & 1 deletion example/example.documentation.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: Example API
version: 21.2.0
version: 22.0.0-beta.0
paths:
/v1/user/retrieve:
get:
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-zod-api",
"version": "21.2.0",
"version": "22.0.0-beta.0",
"description": "A Typescript framework to help you get an API server up and running with I/O schema validation and custom middlewares in minutes.",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -72,7 +72,7 @@
"*.md"
],
"engines": {
"node": "^18.18.0 || ^20.9.0 || ^22.0.0"
"node": "^20.9.0 || ^22.0.0"
},
"dependencies": {
"ansis": "^3.2.0",
Expand Down Expand Up @@ -115,7 +115,7 @@
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.0",
"@eslint/eslintrc": "^3",
"@tsconfig/node18": "^18.2.1",
"@tsconfig/node20": "^20.1.4",
"@types/compression": "^1.7.5",
"@types/cors": "^2.8.14",
"@types/depd": "^1.1.36",
Expand Down
Loading