@eduzz/miau-client 0.0.8 → 0.0.10
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.
- package/.turbo/turbo-build$colon$types.log +1 -1
- package/.turbo/turbo-build.log +4 -4
- package/.turbo/turbo-prepublish.log +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +2 -2
- package/dist/miau-types/types/Permission.d.ts +1 -0
- package/package.json +2 -2
- package/src/MiauMiddleware.ts +4 -2
- package/src/types/index.d.ts +9 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @eduzz/miau-client@0.0.
|
|
2
|
+
> @eduzz/miau-client@0.0.10 build /home/runner/work/eduzz-miau/eduzz-miau/packages/client
|
|
3
3
|
> esbuild src/index.ts --bundle --sourcemap --platform=node --target=es2020 --outfile=dist/index.js
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
dist/index.js 437.
|
|
7
|
-
dist/index.js.map 733.
|
|
6
|
+
dist/index.js 437.6kb
|
|
7
|
+
dist/index.js.map 733.5kb
|
|
8
8
|
|
|
9
|
-
⚡ Done in
|
|
9
|
+
⚡ Done in 333ms
|
package/dist/index.js
CHANGED
|
@@ -11838,8 +11838,9 @@ var miauMiddleware = (miauService) => {
|
|
|
11838
11838
|
}
|
|
11839
11839
|
const publicKey = await miauService.getPublicKey(decodedToken.header.kid);
|
|
11840
11840
|
const appToken = import_jsonwebtoken2.default.verify(token, publicKey, { algorithms: ["RS256"] });
|
|
11841
|
-
req.
|
|
11842
|
-
const permission = await miauService.getPermissions(req.
|
|
11841
|
+
req.miauApplication = { id: appToken?.id, name: appToken?.name };
|
|
11842
|
+
const permission = await miauService.getPermissions(req.miauApplication.id);
|
|
11843
|
+
req.miauMetadata = permission?.metadata || {};
|
|
11843
11844
|
const resources = permission?.resources || [];
|
|
11844
11845
|
const isAllowed = resources.some((resource) => {
|
|
11845
11846
|
return resource.method.toLowerCase() === req.method.toLowerCase() && wildcardToRegex(resource.path).test(req.path.toLowerCase());
|