oc 0.50.56 → 0.50.57-beta.0

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 (54) hide show
  1. package/.turbo/turbo-build.log +16 -18
  2. package/.turbo/turbo-lint.log +2 -2
  3. package/.turbo/turbo-test-silent.log +28 -46
  4. package/.turbo/turbo-test.log +17 -19
  5. package/CHANGELOG.md +6 -0
  6. package/dist/components/oc-client/_package/package.json +1 -38
  7. package/dist/index.d.ts +1 -0
  8. package/dist/registry/domain/extract-package.d.ts +3 -2
  9. package/dist/registry/domain/http-server/express-adapter.d.ts +2 -0
  10. package/dist/registry/domain/http-server/express-adapter.js +196 -0
  11. package/dist/registry/domain/http-server/types.d.ts +99 -0
  12. package/dist/registry/domain/http-server/types.js +2 -0
  13. package/dist/registry/domain/options-sanitiser.js +13 -0
  14. package/dist/registry/domain/server-adapter.d.ts +4 -0
  15. package/dist/registry/domain/server-adapter.js +20 -0
  16. package/dist/registry/domain/validators/uploaded-package.d.ts +5 -4
  17. package/dist/registry/index.d.ts +2 -2
  18. package/dist/registry/index.js +14 -16
  19. package/dist/registry/middleware/base-url-handler.d.ts +3 -2
  20. package/dist/registry/middleware/base-url-handler.js +3 -4
  21. package/dist/registry/middleware/compression.d.ts +2 -2
  22. package/dist/registry/middleware/compression.js +1 -1
  23. package/dist/registry/middleware/cors.d.ts +3 -2
  24. package/dist/registry/middleware/cors.js +7 -8
  25. package/dist/registry/middleware/discovery-handler.d.ts +3 -2
  26. package/dist/registry/middleware/discovery-handler.js +3 -4
  27. package/dist/registry/middleware/index.d.ts +2 -2
  28. package/dist/registry/middleware/index.js +39 -36
  29. package/dist/registry/router.d.ts +2 -2
  30. package/dist/registry/router.js +33 -27
  31. package/dist/registry/routes/component-info.d.ts +2 -2
  32. package/dist/registry/routes/component-info.js +1 -1
  33. package/dist/registry/routes/component-preview.d.ts +2 -2
  34. package/dist/registry/routes/component.d.ts +2 -2
  35. package/dist/registry/routes/component.js +3 -5
  36. package/dist/registry/routes/components.d.ts +2 -2
  37. package/dist/registry/routes/components.js +3 -1
  38. package/dist/registry/routes/dependencies.d.ts +2 -2
  39. package/dist/registry/routes/helpers/get-component-fallback.d.ts +3 -3
  40. package/dist/registry/routes/helpers/get-component.d.ts +1 -1
  41. package/dist/registry/routes/history.d.ts +2 -2
  42. package/dist/registry/routes/history.js +1 -1
  43. package/dist/registry/routes/index.d.ts +2 -2
  44. package/dist/registry/routes/plugins.d.ts +2 -2
  45. package/dist/registry/routes/publish.d.ts +2 -2
  46. package/dist/registry/routes/static-redirector.d.ts +3 -2
  47. package/dist/registry/routes/static-redirector.js +8 -12
  48. package/dist/registry/routes/validate.d.ts +2 -2
  49. package/dist/types.d.ts +8 -0
  50. package/package.json +6 -6
  51. package/dist/registry/middleware/file-uploads.d.ts +0 -2
  52. package/dist/registry/middleware/file-uploads.js +0 -23
  53. package/dist/registry/middleware/request-handler.d.ts +0 -2
  54. package/dist/registry/middleware/request-handler.js +0 -30
@@ -1,18 +1,16 @@
1
-
2
- 
3
- > oc@0.50.56 prebuild
4
- > rimraf dist
5
-
6
- ⠙
7
- > oc@0.50.56 build
8
- > npm run lint && tsc && node tasks/build.js
9
-
10
- ⠙
11
- > oc@0.50.56 lint
12
- > npx @biomejs/biome check preview src test tasks
13
-
14
- ⠙⠹Checked 133 files in 31ms. No fixes applied.
15
- ⠙⠙Building client
16
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/src/components/oc-client/
17
- Client has been built and packaged 👍
18
- ⠙
1
+
2
+ > oc@0.50.56 prebuild
3
+ > rimraf dist
4
+
5
+
6
+ > oc@0.50.56 build
7
+ > npm run lint && tsc && node tasks/build.js
8
+
9
+
10
+ > oc@0.50.56 lint
11
+ > npx @biomejs/biome check preview src test tasks
12
+
13
+ Checked 134 files in 57ms. No fixes applied.
14
+ Building client
15
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/src/components/oc-client/
16
+ Client has been built and packaged 👍
@@ -1,5 +1,5 @@
1
1
 
2
- > oc@0.50.47 lint
2
+ > oc@0.50.56 lint
3
3
  > npx @biomejs/biome check preview src test tasks
4
4
 
5
- Checked 128 files in 33ms. No fixes applied.
5
+ Checked 133 files in 80ms. No fixes applied.
@@ -1,46 +1,28 @@
1
-
2
- 
3
- > oc@0.50.56 test-silent
4
- > npm run build && node tasks/mochaTest.js --silent
5
-
6
-
7
- > oc@0.50.56 prebuild
8
- > rimraf dist
9
-
10
- ⠙
11
- > oc@0.50.56 build
12
- > npm run lint && tsc && node tasks/build.js
13
-
14
- ⠙
15
- > oc@0.50.56 lint
16
- > npx @biomejs/biome check preview src test tasks
17
-
18
- ⠙⠹Checked 133 files in 32ms. No fixes applied.
19
- ⠙⠙Building client
20
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/src/components/oc-client/
21
- Client has been built and packaged 👍
22
- ⠙compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/circular-json-error
23
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/container-with-multiple-nested
24
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/container-with-nested
25
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/empty
26
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world
27
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world-custom-cookies
28
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world-custom-headers
29
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/jade-filters
30
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/language
31
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/lodash-component
32
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/no-containers
33
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/welcome
34
- compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/welcome-with-optional-parameters
35
- Test components packaged 👍
36
-
37
- [?25l [..........................................................................................................] [.........................................................................................................] [▬........................................................................................................] [▬▬.......................................................................................................] [▬▬▬......................................................................................................] [▬▬▬▬.....................................................................................................] [▬▬▬▬▬....................................................................................................] [▬▬▬▬▬▬...................................................................................................] [▬▬▬▬▬▬▬..................................................................................................] [▬▬▬▬▬▬▬▬.................................................................................................] [▬▬▬▬▬▬▬▬▬................................................................................................] [▬▬▬▬▬▬▬▬▬▬...............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬..............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬.............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................................................................](node:97429) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
38
- (Use `node --trace-deprecation ...` to show where the warning was created)
39
-  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................................................................]compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world
40
-  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................](node:97429) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
41
-  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........](node:97429) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
42
-  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬][?25h
43
-
44
-   927 passing (8s)
45
-
46
- ⠙
1
+
2
+ > oc@0.50.56 test-silent
3
+ > node tasks/mochaTest.js --silent
4
+
5
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/circular-json-error
6
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/container-with-multiple-nested
7
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/container-with-nested
8
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/empty
9
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world
10
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world-custom-cookies
11
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world-custom-headers
12
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/jade-filters
13
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/language
14
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/lodash-component
15
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/no-containers
16
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/welcome
17
+ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/welcome-with-optional-parameters
18
+ Test components packaged 👍
19
+
20
+ (node:84202) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
21
+ (Use `node --trace-warnings ...` to show where the warning was created)
22
+ (node:84202) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
23
+
24
+ (node:84202) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
25
+
26
+
27
+ 937 passing (8s)
28
+
@@ -1,19 +1,17 @@
1
-
2
- 
3
- > oc@0.50.55 test
4
- > npm run build && node tasks/mochaTest.js
5
-
6
-
7
- > oc@0.50.55 prebuild
8
- > rimraf dist
9
-
10
- ⠙
11
- > oc@0.50.55 build
12
- > npm run lint && tsc && node tasks/build.js
13
-
14
- ⠙
15
- > oc@0.50.55 lint
16
- > npx @biomejs/biome check preview src test tasks
17
-
18
- ⠙⠹⠸⠼Checked 133 files in 91ms. No fixes applied.
19
- ⠙⠙
1
+
2
+ > oc@0.50.56 test
3
+ > npm run build && node tasks/mochaTest.js
4
+
5
+
6
+ > oc@0.50.56 prebuild
7
+ > rimraf dist
8
+
9
+
10
+ > oc@0.50.56 build
11
+ > npm run lint && tsc && node tasks/build.js
12
+
13
+
14
+ > oc@0.50.56 lint
15
+ > npx @biomejs/biome check preview src test tasks
16
+
17
+ Checked 133 files in 118ms. No fixes applied.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Change Log
2
2
 
3
+ ## 0.50.57
4
+
5
+ ### Patch Changes
6
+
7
+ - e3dce96: export types for http adapters
8
+
3
9
  ## 0.50.56
4
10
 
5
11
  ### Patch Changes
@@ -1,38 +1 @@
1
- {
2
- "name": "oc-client",
3
- "description": "The OpenComponents client-side javascript client",
4
- "version": "0.50.56",
5
- "repository": "https://github.com/opencomponents/oc/tree/master/components/oc-client",
6
- "author": "Matteo Figus <matteofigus@gmail.com>",
7
- "oc": {
8
- "container": false,
9
- "renderInfo": false,
10
- "minify": false,
11
- "parameters": {},
12
- "files": {
13
- "template": {
14
- "type": "oc-template-es6",
15
- "hashKey": "c4abb6bf4dc6657fb718a45b64bd6b2cb92e874a",
16
- "src": "template.js",
17
- "version": "2.0.0",
18
- "minOcVersion": "0.50.18",
19
- "size": 2752
20
- },
21
- "static": [
22
- "src"
23
- ],
24
- "dataProvider": {
25
- "type": "node.js",
26
- "hashKey": "620aa4d6457f2972e6d53d8b8b572b9fcb5aa0d3",
27
- "src": "server.js",
28
- "size": 644
29
- }
30
- },
31
- "version": "0.50.56",
32
- "packaged": true,
33
- "date": 1783178172523
34
- },
35
- "devDependencies": {
36
- "oc-template-es6-compiler": "^8.0.0"
37
- }
38
- }
1
+ {"name":"oc-client","description":"The OpenComponents client-side javascript client","version":"0.50.56","repository":"https://github.com/opencomponents/oc/tree/master/components/oc-client","author":"Matteo Figus <matteofigus@gmail.com>","oc":{"container":false,"renderInfo":false,"minify":false,"parameters":{},"files":{"template":{"type":"oc-template-es6","hashKey":"c4abb6bf4dc6657fb718a45b64bd6b2cb92e874a","src":"template.js","version":"2.0.0","minOcVersion":"0.50.18","size":2752},"static":["src"],"dataProvider":{"type":"node.js","hashKey":"620aa4d6457f2972e6d53d8b8b572b9fcb5aa0d3","src":"server.js","size":644}},"version":"0.50.56","packaged":true,"date":1783485695012},"devDependencies":{"oc-template-es6-compiler":"^8.0.0"}}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as Client } from 'oc-client';
2
2
  export { default as cli } from './cli/programmatic-api';
3
3
  export { default as Registry, RegistryOptions } from './registry';
4
+ export type { CookieOptions, ExpressMiddleware, HttpServerAdapter, Method, OcHandler, OcRequest, OcResponse, UploadedFile } from './registry/domain/http-server/types';
4
5
  export type { Plugin, PluginContext } from './types';
@@ -1,6 +1,7 @@
1
1
  import type { Component } from '../../types';
2
- export default function extractPackage(files: Express.Multer.File[] | {
3
- [fieldname: string]: Express.Multer.File[];
2
+ import type { UploadedFile } from './http-server/types';
3
+ export default function extractPackage(files: UploadedFile[] | {
4
+ [fieldname: string]: UploadedFile[];
4
5
  }, tarExtractMode: number): Promise<{
5
6
  outputFolder: string;
6
7
  packageJson: Component;
@@ -0,0 +1,2 @@
1
+ import type { HttpServerAdapter } from './types';
2
+ export default function createExpressAdapter(options?: unknown): HttpServerAdapter;
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = createExpressAdapter;
7
+ const node_http_1 = __importDefault(require("node:http"));
8
+ const cookie_parser_1 = __importDefault(require("cookie-parser"));
9
+ const errorhandler_1 = __importDefault(require("errorhandler"));
10
+ const express_1 = __importDefault(require("express"));
11
+ const morgan_1 = __importDefault(require("morgan"));
12
+ const multer_1 = __importDefault(require("multer"));
13
+ const response_time_1 = __importDefault(require("response-time"));
14
+ const expressMiddleware = Symbol('expressMiddleware');
15
+ const ocResponseSym = Symbol('ocResponse');
16
+ const ocParamsSym = Symbol('ocParams');
17
+ function stream(readable) {
18
+ readable.pipe(this.raw);
19
+ }
20
+ function normaliseParams(raw) {
21
+ const params = { ...raw };
22
+ const splat = raw['splat'];
23
+ if (Array.isArray(splat)) {
24
+ params['splat'] = splat.join('/');
25
+ }
26
+ return params;
27
+ }
28
+ function createExpressAdapter(options) {
29
+ const adapterOptions = options;
30
+ return new ExpressHttpServerAdapter(typeof adapterOptions === 'object' ? adapterOptions.port : adapterOptions);
31
+ }
32
+ class ExpressHttpServerAdapter {
33
+ name = 'express';
34
+ app;
35
+ server;
36
+ serverErrorHandlers = [];
37
+ constructor(port) {
38
+ this.app = (0, express_1.default)();
39
+ if (typeof port !== 'undefined') {
40
+ this.app.set('port', port);
41
+ }
42
+ this.app.set('json spaces', 0);
43
+ this.app.set('etag', 'strong');
44
+ }
45
+ enableBodyParser(opts) {
46
+ this.app.use(express_1.default.json({
47
+ inflate: true,
48
+ limit: opts.limit
49
+ }));
50
+ this.app.use(express_1.default.urlencoded({
51
+ extended: true,
52
+ limit: opts.limit
53
+ }));
54
+ }
55
+ enableCookies() {
56
+ this.app.use((0, cookie_parser_1.default)());
57
+ }
58
+ enableFileUploads(opts) {
59
+ const upload = (0, multer_1.default)({
60
+ limits: {
61
+ fieldSize: 10
62
+ },
63
+ storage: multer_1.default.diskStorage({
64
+ destination: opts.tempDir,
65
+ filename: (_req, file, cb) => cb(null, opts.filename(file.originalname))
66
+ })
67
+ });
68
+ this.app.use(upload.any());
69
+ }
70
+ enableRequestTiming(onDone) {
71
+ this.app.use((0, response_time_1.default)((req, res, time) => {
72
+ onDone(this.toOcRequest(req), this.toOcResponse(res), time);
73
+ }));
74
+ }
75
+ enableLogging(opts) {
76
+ this.app.use((0, morgan_1.default)('dev', {
77
+ skip: (req, res) => opts.skip(this.toOcRequest(req), this.toOcResponse(res))
78
+ }));
79
+ }
80
+ enableErrorHandler() {
81
+ this.app.use((0, errorhandler_1.default)());
82
+ }
83
+ use(handler) {
84
+ this.app.use(this.toExpressHandler(handler, true));
85
+ }
86
+ route(method, path, id, handlers) {
87
+ const setRouteId = (req, _res, next) => {
88
+ req.routeId = id;
89
+ next();
90
+ };
91
+ this.app[method](path, setRouteId, ...handlers.map((handler) => this.toExpressHandler(handler)));
92
+ }
93
+ fromConnect(handler) {
94
+ const wrapped = (req, res) => new Promise((resolve, reject) => {
95
+ handler(req.raw ?? req, res.raw ?? res, (err) => {
96
+ if (err) {
97
+ reject(err);
98
+ }
99
+ else {
100
+ resolve();
101
+ }
102
+ });
103
+ });
104
+ wrapped[expressMiddleware] = handler;
105
+ return wrapped;
106
+ }
107
+ listen(opts, cb) {
108
+ this.server = node_http_1.default.createServer(this.app);
109
+ this.server.timeout = opts.timeout;
110
+ if (opts.keepAliveTimeout) {
111
+ this.server.keepAliveTimeout = opts.keepAliveTimeout;
112
+ }
113
+ for (const handler of this.serverErrorHandlers) {
114
+ this.server.on('error', handler);
115
+ }
116
+ this.server.listen(opts.port, cb);
117
+ }
118
+ onServerError(cb) {
119
+ this.serverErrorHandlers.push(cb);
120
+ this.server?.on('error', cb);
121
+ }
122
+ close(cb) {
123
+ this.server?.close(cb);
124
+ }
125
+ isListening() {
126
+ return !!this.server?.listening;
127
+ }
128
+ native() {
129
+ return this.app;
130
+ }
131
+ httpServer() {
132
+ if (!this.server) {
133
+ throw new Error('HTTP server has not been started');
134
+ }
135
+ return this.server;
136
+ }
137
+ toExpressHandler(handler, continueWhenNotSent = false) {
138
+ const native = handler[expressMiddleware];
139
+ if (native) {
140
+ return native;
141
+ }
142
+ return (req, res, next) => {
143
+ let result;
144
+ try {
145
+ result = handler(this.toOcRequest(req), this.toOcResponse(res));
146
+ }
147
+ catch (err) {
148
+ next(err);
149
+ return;
150
+ }
151
+ if (result && typeof result.then === 'function') {
152
+ result
153
+ .then(() => {
154
+ if (continueWhenNotSent && !res.headersSent) {
155
+ next();
156
+ }
157
+ })
158
+ .catch(next);
159
+ }
160
+ else if (continueWhenNotSent && !res.headersSent) {
161
+ next();
162
+ }
163
+ };
164
+ }
165
+ toOcRequest(req) {
166
+ const memo = req[ocParamsSym];
167
+ const current = (req.params ?? {});
168
+ if (memo && memo.source === current) {
169
+ return req;
170
+ }
171
+ if (!memo) {
172
+ Object.assign(req, {
173
+ raw: req,
174
+ routeId: req.routeId ?? ''
175
+ });
176
+ }
177
+ const normalized = normaliseParams(current);
178
+ Object.assign(req, { params: normalized });
179
+ req[ocParamsSym] = {
180
+ source: normalized
181
+ };
182
+ return req;
183
+ }
184
+ toOcResponse(res) {
185
+ const cached = res[ocResponseSym];
186
+ if (cached) {
187
+ return cached;
188
+ }
189
+ const ocRes = Object.assign(res, {
190
+ raw: res,
191
+ stream
192
+ });
193
+ res[ocResponseSym] = ocRes;
194
+ return ocRes;
195
+ }
196
+ }
@@ -0,0 +1,99 @@
1
+ import type http from 'node:http';
2
+ import type { IncomingHttpHeaders } from 'node:http';
3
+ import type { Config } from '../../../types';
4
+ export interface CookieOptions {
5
+ domain?: string;
6
+ encode?: (value: string) => string;
7
+ expires?: Date;
8
+ httpOnly?: boolean;
9
+ maxAge?: number;
10
+ partitioned?: boolean;
11
+ path?: string;
12
+ priority?: 'low' | 'medium' | 'high';
13
+ sameSite?: boolean | 'lax' | 'strict' | 'none';
14
+ secure?: boolean;
15
+ signed?: boolean;
16
+ }
17
+ export type Method = 'get' | 'post' | 'put' | 'patch' | 'head' | 'delete';
18
+ export interface UploadedFile {
19
+ fieldname: string;
20
+ originalname: string;
21
+ encoding: string;
22
+ mimetype: string;
23
+ size: number;
24
+ destination: string;
25
+ filename: string;
26
+ path: string;
27
+ buffer?: Buffer;
28
+ stream?: NodeJS.ReadableStream;
29
+ truncated?: boolean;
30
+ }
31
+ export interface OcRequest {
32
+ method: string;
33
+ url: string;
34
+ path: string;
35
+ originalUrl: string;
36
+ protocol: string;
37
+ secure: boolean;
38
+ ip: string;
39
+ headers: IncomingHttpHeaders;
40
+ params: Record<string, string>;
41
+ query: Record<string, unknown>;
42
+ body: any;
43
+ cookies: Record<string, string>;
44
+ files?: UploadedFile[] | Record<string, UploadedFile[]>;
45
+ user?: string;
46
+ routeId: string;
47
+ get(header: string): string | undefined;
48
+ raw: http.IncomingMessage;
49
+ }
50
+ export interface OcResponse {
51
+ conf: Config;
52
+ errorCode?: string;
53
+ errorDetails?: string;
54
+ statusCode: number;
55
+ status(code: number): this;
56
+ json(body: unknown): void;
57
+ send(body: unknown): void;
58
+ set(field: string | Record<string, string>, value?: string): this;
59
+ header(name: string, value: string): this;
60
+ setHeader(name: string, value: string): this;
61
+ removeHeader(name: string): this;
62
+ type(mime: string): this;
63
+ cookie(name: string, value: string, opts?: CookieOptions): this;
64
+ redirect(url: string): void;
65
+ end(chunk?: unknown): void;
66
+ stream(readable: NodeJS.ReadableStream): void;
67
+ raw: http.ServerResponse;
68
+ }
69
+ export type OcHandler = (req: OcRequest, res: OcResponse) => void | Promise<void>;
70
+ export type ExpressMiddleware = (req: any, res: any, next: (err?: unknown) => void) => void;
71
+ export interface HttpServerAdapter {
72
+ name: string;
73
+ enableBodyParser(opts: {
74
+ limit?: number | string;
75
+ }): void;
76
+ enableCookies(): void;
77
+ enableFileUploads(opts: {
78
+ tempDir: string;
79
+ filename: (originalName: string) => string;
80
+ }): void;
81
+ enableRequestTiming(onDone: (req: OcRequest, res: OcResponse, ms: number) => void): void;
82
+ enableLogging(opts: {
83
+ skip: (req: OcRequest, res: OcResponse) => boolean;
84
+ }): void;
85
+ enableErrorHandler(): void;
86
+ use(handler: OcHandler): void;
87
+ route(method: Method, path: string, id: string, handlers: OcHandler[]): void;
88
+ fromConnect(handler: ExpressMiddleware): OcHandler;
89
+ listen(opts: {
90
+ port: number | string;
91
+ timeout: number;
92
+ keepAliveTimeout?: number;
93
+ }, cb: (err?: Error) => void): void;
94
+ onServerError(cb: (err: Error) => void): void;
95
+ close(cb: (err?: Error) => void): void;
96
+ isListening(): boolean;
97
+ native(): unknown;
98
+ httpServer(): http.Server;
99
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -41,6 +41,7 @@ const node_zlib_1 = __importDefault(require("node:zlib"));
41
41
  const oc_client_browser_1 = require("oc-client-browser");
42
42
  const settings_1 = __importDefault(require("../../resources/settings"));
43
43
  const auth = __importStar(require("./authentication"));
44
+ const express_adapter_1 = __importDefault(require("./http-server/express-adapter"));
44
45
  const DEFAULT_NODE_KEEPALIVE_MS = 5000;
45
46
  function optionsSanitiser(input) {
46
47
  const options = { ...input };
@@ -165,6 +166,18 @@ function optionsSanitiser(input) {
165
166
  options.timeout = options.timeout || 1000 * 60 * 2;
166
167
  options.keepAliveTimeout =
167
168
  options.keepAliveTimeout || DEFAULT_NODE_KEEPALIVE_MS;
169
+ if (!options.server) {
170
+ options.server = {
171
+ adapter: express_adapter_1.default,
172
+ options: { port: options.port }
173
+ };
174
+ }
175
+ if (!options.server.adapter) {
176
+ options.server.adapter = express_adapter_1.default;
177
+ }
178
+ if (typeof options.server.options === 'undefined') {
179
+ options.server.options = { port: options.port };
180
+ }
168
181
  if (options.s3) {
169
182
  options.storage = {
170
183
  adapter: require('oc-s3-storage-adapter'),
@@ -0,0 +1,4 @@
1
+ import type { HttpServerAdapter } from './http-server/types';
2
+ type HttpServerAdapterFactory<T = unknown> = (options?: T) => HttpServerAdapter;
3
+ export default function getHttpServerAdapter<T = unknown>(adapter: HttpServerAdapter | HttpServerAdapterFactory<T>, options?: T): HttpServerAdapter;
4
+ export {};
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = getHttpServerAdapter;
4
+ function isHttpServerAdapter(adapter) {
5
+ return (!!adapter &&
6
+ typeof adapter === 'object' &&
7
+ typeof adapter.native === 'function' &&
8
+ typeof adapter.listen === 'function' &&
9
+ typeof adapter.httpServer === 'function');
10
+ }
11
+ function getHttpServerAdapter(adapter, options) {
12
+ if (isHttpServerAdapter(adapter)) {
13
+ return adapter;
14
+ }
15
+ const instance = adapter(options);
16
+ if (!isHttpServerAdapter(instance)) {
17
+ throw new Error('Invalid HTTP server adapter');
18
+ }
19
+ return instance;
20
+ }