0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-17 22:31:28 -05:00

refactor: upgrade packages (#5739)

* refactor: upgrade packages

* refactor: fix type issues

* refactor: fix koa-guard
This commit is contained in:
Gao Sun 2024-04-18 14:32:12 +08:00 committed by GitHub
parent 26c215fbdc
commit e1d5b8a72a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
47 changed files with 2011 additions and 1612 deletions

View file

@ -56,11 +56,11 @@
},
"prettier": "@silverhand/eslint-config/.prettierrc",
"dependencies": {
"@microsoft/applicationinsights-clickanalytics-js": "^3.0.2",
"@microsoft/applicationinsights-react-js": "^17.0.0",
"@microsoft/applicationinsights-web": "^3.0.2",
"@microsoft/applicationinsights-clickanalytics-js": "^3.1.2",
"@microsoft/applicationinsights-react-js": "^17.1.2",
"@microsoft/applicationinsights-web": "^3.1.2",
"@silverhand/essentials": "^2.9.0",
"applicationinsights": "^2.7.0"
"applicationinsights": "^2.9.5"
},
"peerDependencies": {
"history": "^5.3.0",

View file

@ -108,7 +108,7 @@ export class AppInsightsReact {
// @see https://github.com/microsoft/ApplicationInsights-JS#example-setting-cloud-role-name
// @see https://github.com/microsoft/ApplicationInsights-node.js/blob/a573e40fc66981c6a3106bdc5b783d1d94f64231/Schema/PublicSchema/ContextTagKeys.bond#L83
/* eslint-disable @silverhand/fp/no-mutation */
item.tags = [...(item.tags ?? []), { 'ai.cloud.role': cloudRole }];
item.tags = { ...item.tags, 'ai.cloud.role': cloudRole };
/* eslint-enable @silverhand/fp/no-mutation */
});

View file

@ -21,7 +21,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -29,7 +29,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
},

View file

@ -20,7 +20,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -28,7 +28,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
},

View file

@ -58,7 +58,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -66,7 +66,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -58,7 +58,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -66,7 +66,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -60,7 +60,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -68,7 +68,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -61,7 +61,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -69,7 +69,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -60,7 +60,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -68,7 +68,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -60,7 +60,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -68,7 +68,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -60,7 +60,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -68,7 +68,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -60,7 +60,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -68,7 +68,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -61,7 +61,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -69,7 +69,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -6,7 +6,7 @@
"dependencies": {
"@logto/connector-kit": "workspace:^3.0.0",
"@silverhand/essentials": "^2.9.0",
"fast-xml-parser": "^4.2.5",
"fast-xml-parser": "^4.3.6",
"got": "^14.0.0",
"samlify": "2.8.11",
"snakecase-keys": "^8.0.0",
@ -61,7 +61,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -69,7 +69,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -20,7 +20,7 @@
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/nodemailer": "^6.4.7",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -28,7 +28,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
},

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.11.20",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -59,7 +59,7 @@
"@silverhand/eslint-config": "5.0.0",
"@silverhand/ts-config": "5.0.0",
"@types/node": "^20.10.4",
"@types/supertest": "^6.0.1",
"@types/supertest": "^6.0.2",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.44.0",
"lint-staged": "^15.0.2",
@ -67,7 +67,7 @@
"prettier": "^3.0.0",
"rollup": "^4.12.0",
"rollup-plugin-output-size": "^1.3.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3",
"vitest": "^1.4.0"
}

View file

@ -26,9 +26,9 @@
},
"dependencies": {
"@authenio/samlify-node-xmllint": "^2.0.0",
"@aws-sdk/client-s3": "^3.315.0",
"@azure/storage-blob": "^12.13.0",
"@google-cloud/storage": "^7.3.0",
"@aws-sdk/client-s3": "^3.556.0",
"@azure/storage-blob": "^12.17.0",
"@google-cloud/storage": "^7.10.0",
"@koa/cors": "^5.0.0",
"@logto/affiliate": "^0.1.0",
"@logto/app-insights": "workspace:^1.4.0",
@ -56,7 +56,7 @@
"deepmerge": "^4.2.2",
"dotenv": "^16.0.0",
"etag": "^1.8.1",
"fast-xml-parser": "^4.2.5",
"fast-xml-parser": "^4.3.6",
"find-up": "^7.0.0",
"got": "^14.0.0",
"hash-wasm": "^4.9.0",
@ -65,18 +65,18 @@
"iconv-lite": "0.6.3",
"jose": "^5.0.0",
"koa": "^2.13.1",
"koa-body": "^5.0.0",
"koa-body": "^6.0.1",
"koa-compose": "^4.1.0",
"koa-compress": "^5.1.0",
"koa-logger": "^3.2.1",
"koa-mount": "^4.0.0",
"koa-proxies": "^0.12.1",
"koa-proxies": "^0.12.4",
"koa-router": "^12.0.0",
"koa-send": "^5.0.1",
"ky": "^1.2.3",
"lru-cache": "^10.0.0",
"nanoid": "^5.0.1",
"oidc-provider": "^8.2.2",
"oidc-provider": "^8.4.5",
"openapi-types": "^12.1.3",
"otplib": "^12.0.1",
"p-retry": "^6.0.0",
@ -106,12 +106,12 @@
"@types/koa-send": "^4.1.3",
"@types/koa__cors": "^5.0.0",
"@types/node": "^20.9.5",
"@types/oidc-provider": "^8.0.0",
"@types/oidc-provider": "^8.4.4",
"@types/pluralize": "^0.0.33",
"@types/qrcode": "^1.5.2",
"@types/semver": "^7.3.12",
"@types/sinon": "^17.0.0",
"@types/supertest": "^6.0.0",
"@types/supertest": "^6.0.2",
"eslint": "^8.44.0",
"jest": "^29.7.0",
"jest-matcher-specific-error": "^1.0.0",
@ -122,7 +122,7 @@
"nodemon": "^3.0.0",
"prettier": "^3.0.0",
"sinon": "^17.0.0",
"supertest": "^6.2.2",
"supertest": "^6.3.4",
"typescript": "^5.3.3"
},
"engines": {

View file

@ -1,12 +1,10 @@
declare module 'koa-body' {
import type { MiddlewareType } from 'koa';
import type { IKoaBodyOptions } from 'node_modules/koa-body';
import type { KoaBodyMiddlewareOptions } from 'node_modules/koa-body/types';
declare function koaBody<
export function koaBody<
StateT = Record<string, unknown>,
ContextT = Record<string, unknown>,
ResponseBodyT = unknown,
>(options?: IKoaBodyOptions): MiddlewareType<StateT, ContextT, ResponseBodyT>;
export = koaBody;
>(options?: Partial<KoaBodyMiddlewareOptions>): MiddlewareType<StateT, ContextT, ResponseBodyT>;
}

View file

@ -1,9 +1,5 @@
import type { CustomClientMetadata } from '@logto/schemas';
import Provider from 'oidc-provider';
declare module 'oidc-provider' {
export interface AllClientMetadata extends CustomClientMetadata {}
// Have to do this to make TypeScript happy since `@types/` packages are default CJS
export = Provider;
}

View file

@ -1,6 +1,6 @@
import { conditional } from '@silverhand/essentials';
import type { Context } from 'koa';
import type { InteractionResults } from 'oidc-provider';
import type { InteractionResults, PromptDetail } from 'oidc-provider';
import type Provider from 'oidc-provider';
import { z } from 'zod';
@ -64,7 +64,7 @@ const missingScopesGuard = z.object({
missingResourceScopes: z.object({}).catchall(z.string().array()).optional(),
});
export const getMissingScopes = (prompt: Provider.PromptDetail) => {
export const getMissingScopes = (prompt: PromptDetail) => {
return missingScopesGuard.parse(prompt.details);
};

View file

@ -7,9 +7,9 @@ import ServerError from '#src/errors/ServerError/index.js';
import { emptyMiddleware, createContextWithRouteParameters } from '#src/utils/test-utils.js';
const { jest } = import.meta;
const { mockEsmDefault } = createMockUtils(jest);
const { mockEsm } = createMockUtils(jest);
mockEsmDefault('koa-body', () => emptyMiddleware);
mockEsm('koa-body', () => ({ koaBody: emptyMiddleware }));
const { default: koaGuard, isGuardMiddleware } = await import('./koa-guard.js');
describe('koaGuardMiddleware', () => {
@ -237,5 +237,22 @@ describe('koaGuardMiddleware', () => {
expect(ctx.guard.query).toHaveProperty('foo', '2');
expect(ctx.guard.params).toHaveProperty('foo', '1');
});
it('should fallback to empty object when no body is provided', async () => {
const ctx = {
...baseCtx,
request: {
...baseCtx.request,
body: undefined,
},
guard: {
...defaultGuard,
body: { foo: '1' },
},
};
await koaGuard({ body: z.object({ foo: z.string().optional() }) })(ctx, next);
expect(ctx.guard.body).toEqual({});
});
});
});

View file

@ -2,7 +2,7 @@ import { appInsights } from '@logto/app-insights/node';
import type { Optional } from '@silverhand/essentials';
import { has } from '@silverhand/essentials';
import type { MiddlewareType } from 'koa';
import koaBody from 'koa-body';
import { koaBody } from 'koa-body';
import type { IMiddleware, IRouterParamContext } from 'koa-router';
import type { ZodType, ZodTypeDef } from 'zod';
@ -155,7 +155,7 @@ export default function koaGuard<
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions, no-restricted-syntax
ctx.guard = {
query: tryParse('query', query, ctx.request.query),
body: tryParse('body', body, ctx.request.body),
body: tryParse('body', body, ctx.request.body ?? {}), // Fallback to empty object since it's the original behavior of koa-body@5
params: tryParse('params', params, ctx.params),
files: tryParse('files', files, ctx.request.files),
} as GuardedRequest<GuardQueryT, GuardBodyT, GuardParametersT, GuardFilesT>; // Have to do this since it's too complicated for TS

View file

@ -1,5 +1,5 @@
import type Provider from 'oidc-provider';
import { type KoaContextWithOIDC } from 'oidc-provider';
import type { TTLFunction, KoaContextWithOIDC } from 'oidc-provider';
/**
* Keep the default pre-checks from oidc-provider.
@ -7,7 +7,7 @@ import { type KoaContextWithOIDC } from 'oidc-provider';
* @see {@link https://github.com/panva/node-oidc-provider/blob/d6edf2a0b9efc777081e6f9cc358a0677ccd9897/docs/README.md#ttl | ttl's default value}
*/
const refreshTokenTtl = (
...[ctx, token, client]: Parameters<Provider.TTLFunction<InstanceType<Provider['RefreshToken']>>>
...[ctx, token, client]: Parameters<TTLFunction<InstanceType<Provider['RefreshToken']>>>
) => {
if (
ctx.oidc.entities.RotatedRefreshToken &&

View file

@ -19,6 +19,8 @@
* The commit hash of the original file is `cf2069cbb31a6a855876e95157372d25dde2511c`.
*/
import { type X509Certificate } from 'node:crypto';
import { UserScope, buildOrganizationUrn } from '@logto/core-kit';
import { type Optional, isKeyInObject, cond } from '@silverhand/essentials';
import type Provider from 'oidc-provider';
@ -117,7 +119,7 @@ export const buildHandler: (
throw new InvalidGrant('refresh token is expired');
}
let cert: Optional<string>;
let cert: Optional<string | X509Certificate>;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- the original code uses `||`
if (client.tlsClientCertificateBoundAccessTokens || refreshToken['x5t#S256']) {
cert = getCertificate(ctx);

View file

@ -17,7 +17,7 @@ import {
} from '@logto/schemas';
import { conditional, trySafe, tryThat } from '@silverhand/essentials';
import i18next from 'i18next';
import koaBody from 'koa-body';
import { koaBody } from 'koa-body';
import Provider, { errors } from 'oidc-provider';
import snakecaseKeys from 'snakecase-keys';

View file

@ -1,8 +1,7 @@
import { ReservedResource } from '@logto/core-kit';
import { type Resource } from '@logto/schemas';
import { trySafe, type Nullable } from '@silverhand/essentials';
import { type KoaContextWithOIDC } from 'oidc-provider';
import type Provider from 'oidc-provider';
import { type ResourceServer, type KoaContextWithOIDC } from 'oidc-provider';
import { type EnvSet } from '#src/env-set/index.js';
import type Libraries from '#src/tenants/Libraries.js';
@ -14,7 +13,7 @@ const isReservedResource = (indicator: string): indicator is ReservedResource =>
export const getSharedResourceServerData = (
envSet: EnvSet
): Pick<Provider.ResourceServer, 'accessTokenFormat' | 'jwt'> => ({
): Pick<ResourceServer, 'accessTokenFormat' | 'jwt'> => ({
accessTokenFormat: 'jwt',
jwt: {
sign: { alg: envSet.oidc.jwkSigningAlg },

View file

@ -4,22 +4,41 @@
*/
import type Koa from 'koa';
import koaBody from 'koa-body';
import { koaBody } from 'koa-body';
import Router from 'koa-router';
import { z } from 'zod';
import RequestError from '#src/errors/RequestError/index.js';
import assertThat from '#src/utils/assert-that.js';
// Edited from https://stackoverflow.com/a/74743075/12514940
function isStringRecord(object: unknown): object is Record<string, string> {
if (typeof object !== 'object' || object === null) {
return false;
}
if (Array.isArray(object)) {
return false;
}
if (Object.getOwnPropertySymbols(object).length > 0) {
return false;
}
return Object.getOwnPropertyNames(object).every(
// @ts-expect-error This is a type guard
(property) => typeof object[property] === 'string'
);
}
function callbackRoutes<T extends Router>(router: T) {
router.post('/callback/:connectorId', koaBody(), async (ctx) => {
assertThat(
typeof ctx.request.body === 'object' && ctx.request.body !== null,
new RequestError('oidc.invalid_request')
);
const parsed = z.record(z.string()).safeParse(ctx.request.body);
assertThat(parsed.success, new RequestError('oidc.invalid_request'));
ctx.status = 303;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
ctx.set('Location', ctx.request.path + '?' + new URLSearchParams(ctx.request.body).toString());
ctx.set('Location', ctx.request.path + '?' + new URLSearchParams(parsed.data).toString());
});
}

3370
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff