adorn-api 1.1.12 → 1.1.14

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 (43) hide show
  1. package/README.md +614 -913
  2. package/dist/adapter/express/controllers.d.ts +3 -1
  3. package/dist/adapter/express/controllers.js +4 -1
  4. package/dist/adapter/express/index.js +5 -1
  5. package/dist/adapter/express/types.d.ts +3 -0
  6. package/dist/adapter/fastify/controllers.d.ts +3 -1
  7. package/dist/adapter/fastify/controllers.js +2 -25
  8. package/dist/adapter/fastify/index.js +7 -1
  9. package/dist/adapter/fastify/types.d.ts +3 -0
  10. package/dist/adapter/metal-orm/index.d.ts +1 -1
  11. package/dist/adapter/metal-orm/types.d.ts +23 -0
  12. package/dist/adapter/native/controllers.d.ts +3 -0
  13. package/dist/adapter/native/controllers.js +2 -25
  14. package/dist/adapter/native/index.js +14 -1
  15. package/dist/adapter/native/types.d.ts +3 -0
  16. package/dist/core/auth.d.ts +33 -3
  17. package/dist/core/auth.js +74 -22
  18. package/dist/core/openapi.d.ts +2 -0
  19. package/dist/core/openapi.js +19 -1
  20. package/examples/bearer-auth-swagger/app.ts +28 -0
  21. package/examples/bearer-auth-swagger/auth.controller.ts +45 -0
  22. package/examples/bearer-auth-swagger/index.ts +20 -0
  23. package/examples/bearer-auth-swagger/session.dtos.ts +19 -0
  24. package/package.json +3 -1
  25. package/src/adapter/express/controllers.ts +23 -18
  26. package/src/adapter/express/index.ts +12 -1
  27. package/src/adapter/express/types.ts +13 -10
  28. package/src/adapter/fastify/controllers.ts +16 -41
  29. package/src/adapter/fastify/index.ts +27 -13
  30. package/src/adapter/fastify/types.ts +13 -10
  31. package/src/adapter/metal-orm/index.ts +3 -0
  32. package/src/adapter/metal-orm/types.ts +25 -0
  33. package/src/adapter/native/controllers.ts +16 -41
  34. package/src/adapter/native/index.ts +28 -15
  35. package/src/adapter/native/types.ts +13 -10
  36. package/src/core/auth.ts +134 -56
  37. package/src/core/openapi.ts +22 -1
  38. package/tests/e2e/bearer-auth.e2e.test.ts +158 -0
  39. package/tests/typecheck/query-params.typecheck.ts +42 -0
  40. package/tests/unit/auth.test.ts +96 -12
  41. package/tests/unit/openapi-parameters.test.ts +54 -6
  42. package/tsconfig.typecheck.json +8 -0
  43. package/vitest.config.ts +47 -7
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": ".",
5
+ "noEmit": true
6
+ },
7
+ "include": ["src/**/*.ts", "tests/typecheck/**/*.ts"]
8
+ }
package/vitest.config.ts CHANGED
@@ -1,14 +1,54 @@
1
+ import path from "node:path";
2
+ import fs from "node:fs";
3
+ import * as ts from "typescript";
1
4
  import { defineConfig } from "vitest/config";
2
5
 
6
+ function transpileSourcePlugin() {
7
+ return {
8
+ name: "transpile-source",
9
+ enforce: "pre",
10
+ load(id: string) {
11
+ const cleanId = id.split(/[?#]/)[0];
12
+ const normalizedId = cleanId.split(path.sep).join("/");
13
+ if (
14
+ !normalizedId.includes("/src/") &&
15
+ !normalizedId.includes("/examples/") &&
16
+ !normalizedId.includes("/tests/")
17
+ ) {
18
+ return undefined;
19
+ }
20
+ if (!normalizedId.endsWith(".ts") && !normalizedId.endsWith(".tsx")) {
21
+ return undefined;
22
+ }
23
+
24
+ const code = fs.readFileSync(cleanId, "utf8");
25
+ const result = ts.transpileModule(code, {
26
+ compilerOptions: {
27
+ target: ts.ScriptTarget.ES2022,
28
+ module: ts.ModuleKind.ESNext,
29
+ moduleResolution: ts.ModuleResolutionKind.Node,
30
+ experimentalDecorators: false,
31
+ emitDecoratorMetadata: false,
32
+ useDefineForClassFields: true,
33
+ esModuleInterop: true,
34
+ sourceMap: true
35
+ },
36
+ fileName: cleanId
37
+ });
38
+
39
+ return {
40
+ code: result.outputText,
41
+ map: result.sourceMapText ? JSON.parse(result.sourceMapText) : undefined
42
+ };
43
+ }
44
+ };
45
+ }
46
+
3
47
  export default defineConfig({
48
+ plugins: [transpileSourcePlugin()],
4
49
  test: {
5
50
  environment: "node",
6
- include: ["src/**/*.test.ts", "tests/**/*.test.ts"],
7
- pool: "forks",
8
- poolOptions: {
9
- forks: {
10
- singleFork: true
11
- }
12
- }
51
+ pool: "threads",
52
+ include: ["src/**/*.test.ts", "tests/**/*.test.ts"]
13
53
  }
14
54
  });