oc 0.50.65 → 0.50.66

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.
@@ -1,17 +1,17 @@
1
1
 
2
2
  
3
- > oc@0.50.65 prebuild
3
+ > oc@0.50.66 prebuild
4
4
  > node -e "require('node:fs').rmSync('dist', { recursive: true, force: true })"
5
5
 
6
6
  ⠙
7
- > oc@0.50.65 build
7
+ > oc@0.50.66 build
8
8
  > npm run lint && tsc && tsc --project tsconfig.types.json && node tasks/build.js
9
9
 
10
10
  ⠙
11
- > oc@0.50.65 lint
11
+ > oc@0.50.66 lint
12
12
  > npx @biomejs/biome check preview src test tasks
13
13
 
14
- ⠙⠹⠸Checked 148 files in 76ms. No fixes applied.
14
+ ⠙⠹Checked 148 files in 55ms. No fixes applied.
15
15
  ⠙⠙Building client
16
16
  compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/src/components/oc-client/
17
17
  Client has been built and packaged 👍
@@ -18,11 +18,11 @@ compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/tes
18
18
  compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/welcome-with-optional-parameters
19
19
  Test components packaged 👍
20
20
 
21
- [?25l [..........................................................................................................] [.........................................................................................................] [▬........................................................................................................] [▬▬.......................................................................................................] [▬▬▬......................................................................................................] [▬▬▬▬.....................................................................................................] [▬▬▬▬▬....................................................................................................] [▬▬▬▬▬▬...................................................................................................] [▬▬▬▬▬▬▬..................................................................................................] [▬▬▬▬▬▬▬▬.................................................................................................] [▬▬▬▬▬▬▬▬▬................................................................................................] [▬▬▬▬▬▬▬▬▬▬...............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬..............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬.............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬............................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................................................................]compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world
22
-  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................](node:79872) [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.)
21
+ [?25l [...................................................] [..................................................] [▬.................................................] [▬▬................................................] [▬▬▬...............................................] [▬▬▬▬..............................................] [▬▬▬▬▬.............................................] [▬▬▬▬▬▬............................................] [▬▬▬▬▬▬▬...........................................] [▬▬▬▬▬▬▬▬..........................................]compiling component /Users/Ricardo.Agullo/Work/opencomponents/oc/packages/oc/test/fixtures/components/hello-world
22
+  [▬▬▬▬▬▬▬▬▬.........................................] [▬▬▬▬▬▬▬▬▬▬........................................] [▬▬▬▬▬▬▬▬▬▬▬.......................................] [▬▬▬▬▬▬▬▬▬▬▬▬......................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬.....................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................](node:86129) [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.)
23
23
  (Use `node --trace-deprecation ...` to show where the warning was created)
24
-  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬................] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬][?25h
24
+  [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬............] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬........] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.......] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬......] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.....] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬....] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬...] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬..] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬.] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬] [▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬][?25h
25
25
 
26
-   1158 passing (13s)
26
+   1175 passing (14s)
27
27
 
28
28
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## Change Log
2
2
 
3
+ ## 0.50.66
4
+
5
+ ### Patch Changes
6
+
7
+ - 737a1c4: Add an `onComponentRequest` registry option. It runs for every component request once the version has been resolved, receives the request context and the component's package.json (including `allVersions` and `latestVersion`), and can reject the request by returning `{ status, code, error }`.
8
+
3
9
  ## 0.50.65
4
10
 
5
11
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oc-client",
3
3
  "description": "The OpenComponents client-side javascript client",
4
- "version": "0.50.65",
4
+ "version": "0.50.66",
5
5
  "repository": "https://github.com/opencomponents/oc/tree/master/components/oc-client",
6
6
  "author": "Matteo Figus <matteofigus@gmail.com>",
7
7
  "oc": {
@@ -23,14 +23,14 @@
23
23
  ],
24
24
  "dataProvider": {
25
25
  "type": "node.js",
26
- "hashKey": "7f071ae91230e1a9a6023433067990cb0f72fac3",
26
+ "hashKey": "fed5de8d00863aa9b01df903797d6561af433390",
27
27
  "src": "server.js",
28
28
  "size": 644
29
29
  }
30
30
  },
31
- "version": "0.50.65",
31
+ "version": "0.50.66",
32
32
  "packaged": true,
33
- "date": 1793638875796
33
+ "date": 1794233290926
34
34
  },
35
35
  "devDependencies": {
36
36
  "oc-template-es6-compiler": "^8.0.0"
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(t,s)=>{const{staticPath:e,templates:a}=t;return s(null,{staticPath:e,templates:a})},r=(t,s)=>{o(t,(e,a,i={})=>{if(e)return s(e);if(a==null)return s(null,{__oc_emptyResponse:!0});const n=t.action?a:Object.assign({},a,{_staticPath:t.staticPath,_baseUrl:t.baseUrl,_componentName:"oc-client",_componentVersion:"0.50.65"}),c=t.staticPath.indexOf("http")===0?t.staticPath:"https:"+t.staticPath;return s(null,Object.assign({},{component:{key:"c4abb6bf4dc6657fb718a45b64bd6b2cb92e874a",src:c+"template.js",props:n,esm:!1,development:void 0}}))})};exports.data=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(t,s)=>{const{staticPath:e,templates:a}=t;return s(null,{staticPath:e,templates:a})},r=(t,s)=>{o(t,(e,a,i={})=>{if(e)return s(e);if(a==null)return s(null,{__oc_emptyResponse:!0});const n=t.action?a:Object.assign({},a,{_staticPath:t.staticPath,_baseUrl:t.baseUrl,_componentName:"oc-client",_componentVersion:"0.50.66"}),c=t.staticPath.indexOf("http")===0?t.staticPath:"https:"+t.staticPath;return s(null,Object.assign({},{component:{key:"c4abb6bf4dc6657fb718a45b64bd6b2cb92e874a",src:c+"template.js",props:n,esm:!1,development:void 0}}))})};exports.data=r;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oc-client",
3
3
  "description": "The OpenComponents client-side javascript client",
4
- "version": "0.50.65",
4
+ "version": "0.50.66",
5
5
  "repository": "https://github.com/opencomponents/oc/tree/master/components/oc-client",
6
6
  "author": "Matteo Figus <matteofigus@gmail.com>",
7
7
  "oc": {
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export { default as cli } from './cli/programmatic-api';
3
3
  export type { RegistryType } from './registry';
4
4
  export { default as Registry, RegistryOptions } from './registry';
5
5
  export type { CookieOptions, ExpressMiddleware, HttpServerAdapter, HttpServerAdapterFactory, HttpServerListenOptions, Method, NativeApp, OcHandler, OcRequest, OcResponse, PromiseHttpServerAdapter, UploadedFile } from './registry/domain/http-server/types';
6
- export type { CorsConfig, CorsOptions, Plugin, PluginContext, RegistryErrorEvent } from './types';
6
+ export type { ComponentRequestContext, ComponentRequestHook, ComponentRequestRejection, CorsConfig, CorsOptions, Plugin, PluginContext, RegistryErrorEvent } from './types';
@@ -2,6 +2,7 @@ import type { Component, ComponentsDetails, Config, TemplateInfo } from '../../t
2
2
  export default function repository(conf: Config): {
3
3
  getCompiledView(componentName: string, componentVersion: string): Promise<string>;
4
4
  getComponent(componentName: string, componentVersion?: string): Promise<Component>;
5
+ getLatestVersion(component: Component): string;
5
6
  getComponentInfo(componentName: string, componentVersion: string): Promise<Component>;
6
7
  getComponentPath(componentName: string, componentVersion: string): string;
7
8
  getComponents(): Promise<string[]>;
@@ -86,6 +86,7 @@ function repository(conf) {
86
86
  const componentInfoLoads = new Map();
87
87
  const localVersions = new Map();
88
88
  const localVersionLoads = new Map();
89
+ const componentSourceVersions = new WeakMap();
89
90
  let exportLegacyFilesLoop;
90
91
  let closed = false;
91
92
  const getFilePath = (component, version, filePath) => `${options.componentsDir}/${component}/${version}/${filePath}`;
@@ -281,7 +282,12 @@ function repository(conf) {
281
282
  });
282
283
  }
283
284
  }
284
- return { ...component, allVersions: [...allVersions] };
285
+ const result = { ...component, allVersions: [...allVersions] };
286
+ componentSourceVersions.set(result, allVersions);
287
+ return result;
288
+ },
289
+ getLatestVersion(component) {
290
+ return (versionHandler.getLatestVersion(componentSourceVersions.get(component) ?? component.allVersions) ?? component.version);
285
291
  },
286
292
  getComponentInfo(componentName, componentVersion) {
287
293
  if (conf.local) {
@@ -148,5 +148,10 @@ function registryConfiguration(conf) {
148
148
  .CONFIGURATION_HEADERS_TO_SKIP_MUST_BE_STRING_ARRAY);
149
149
  }
150
150
  }
151
+ if (conf.onComponentRequest !== undefined &&
152
+ typeof conf.onComponentRequest !== 'function') {
153
+ return returnError(resources_1.default.errors.registry
154
+ .CONFIGURATION_ON_COMPONENT_REQUEST_MUST_BE_FUNCTION);
155
+ }
151
156
  return { isValid: true };
152
157
  }
@@ -1,2 +1,3 @@
1
+ export declare function getLatestVersion(availableVersions: readonly string[]): string | undefined;
1
2
  export declare function getAvailableVersion(requestedVersion: string | undefined, availableVersions: string[]): string | undefined;
2
3
  export declare function validateNewVersion(requestedVersion: string, availableVersions: string[]): boolean;
@@ -3,14 +3,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getLatestVersion = getLatestVersion;
6
7
  exports.getAvailableVersion = getAvailableVersion;
7
8
  exports.validateNewVersion = validateNewVersion;
8
9
  const semver_1 = __importDefault(require("semver"));
10
+ const latestVersions = new WeakMap();
11
+ function getLatestVersion(availableVersions) {
12
+ if (latestVersions.has(availableVersions)) {
13
+ return latestVersions.get(availableVersions);
14
+ }
15
+ const latest = semver_1.default.maxSatisfying(availableVersions, '') ||
16
+ [...availableVersions].sort(semver_1.default.rcompare)[0] ||
17
+ undefined;
18
+ latestVersions.set(availableVersions, latest);
19
+ return latest;
20
+ }
9
21
  function getAvailableVersion(requestedVersion, availableVersions) {
10
22
  if (!requestedVersion) {
11
- return (semver_1.default.maxSatisfying(availableVersions, '') ||
12
- [...availableVersions].sort(semver_1.default.rcompare)[0] ||
13
- undefined);
23
+ return getLatestVersion(availableVersions);
14
24
  }
15
25
  if (availableVersions.includes(requestedVersion)) {
16
26
  return requestedVersion;
@@ -47,6 +47,7 @@ const resources_1 = __importDefault(require("../../../resources"));
47
47
  const settings_1 = __importDefault(require("../../../resources/settings"));
48
48
  const accept_language_1 = require("../../../utils/accept-language");
49
49
  const bounded_cache_1 = __importDefault(require("../../../utils/bounded-cache"));
50
+ const error_to_string_1 = __importDefault(require("../../../utils/error-to-string"));
50
51
  const is_template_legacy_1 = __importDefault(require("../../../utils/is-template-legacy"));
51
52
  const universalify_1 = require("../../../utils/universalify");
52
53
  const events_handler_1 = __importDefault(require("../../domain/events-handler"));
@@ -58,6 +59,12 @@ const validators_1 = require("../../domain/validators");
58
59
  const component_parameter_processor_1 = require("./component-parameter-processor");
59
60
  const format_error_stack_1 = require("./format-error-stack");
60
61
  const getComponentFallback = __importStar(require("./get-component-fallback"));
62
+ class ComponentRequestRejected {
63
+ result;
64
+ constructor(result) {
65
+ this.result = result;
66
+ }
67
+ }
61
68
  exports.stream = Symbol('stream');
62
69
  const MAX_ARTIFACT_CACHE_ENTRIES = 1000;
63
70
  const noop = () => { };
@@ -207,6 +214,62 @@ function getComponent(conf, repository) {
207
214
  // keep the original error stack when local diagnostics fail
208
215
  }
209
216
  };
217
+ const resolveComponent = (name, version, options, cb) => {
218
+ getComponentCb(name, version, (err, component) => {
219
+ const hook = options.conf.onComponentRequest;
220
+ if (err || !hook) {
221
+ return cb(err, component);
222
+ }
223
+ const decide = (rejection) => rejection
224
+ ? cb(new ComponentRequestRejected({
225
+ status: rejection.status ?? 403,
226
+ response: {
227
+ code: rejection.code ?? 'COMPONENT_REQUEST_REJECTED',
228
+ error: rejection.error ??
229
+ resources_1.default.errors.registry.COMPONENT_REQUEST_REJECTED
230
+ }
231
+ }), component)
232
+ : cb(null, component);
233
+ const fail = (hookErr) => {
234
+ const message = (0, error_to_string_1.default)(hookErr);
235
+ events_handler_1.default.fire('error', {
236
+ code: 'COMPONENT_REQUEST_HOOK_FAILED',
237
+ message
238
+ });
239
+ cb(new ComponentRequestRejected({
240
+ status: 500,
241
+ response: {
242
+ code: 'COMPONENT_REQUEST_HOOK_FAILED',
243
+ error: resources_1.default.errors.registry.COMPONENT_REQUEST_HOOK_FAILED(message)
244
+ }
245
+ }), component);
246
+ };
247
+ let decision;
248
+ try {
249
+ decision = hook({
250
+ name,
251
+ requestedVersion: version,
252
+ version: component.version,
253
+ get latestVersion() {
254
+ return repository.getLatestVersion(component);
255
+ },
256
+ component,
257
+ headers: options.headers,
258
+ parameters: options.parameters,
259
+ action: options.action
260
+ });
261
+ }
262
+ catch (hookErr) {
263
+ return fail(hookErr);
264
+ }
265
+ if (decision instanceof Promise) {
266
+ decision.then(decide, fail);
267
+ }
268
+ else {
269
+ decide(decision);
270
+ }
271
+ });
272
+ };
210
273
  const renderer = (options, cb) => {
211
274
  const retrievalStart = process.hrtime.bigint();
212
275
  let retrievedHref;
@@ -260,7 +323,10 @@ function getComponent(conf, repository) {
260
323
  version: options.version || '',
261
324
  parameters: options.parameters
262
325
  };
263
- getComponentCb(requestedComponent.name, requestedComponent.version, (err, component) => {
326
+ resolveComponent(requestedComponent.name, requestedComponent.version, options, (err, component) => {
327
+ if (err instanceof ComponentRequestRejected) {
328
+ return callback(err.result);
329
+ }
264
330
  // check route exist for component and version
265
331
  if (err) {
266
332
  if (conf.fallbackRegistryUrl) {
@@ -408,7 +474,7 @@ function getComponent(conf, repository) {
408
474
  status,
409
475
  response: {
410
476
  code: 'GENERIC_ERROR',
411
- error: resources_1.default.errors.registry.COMPONENT_EXECUTION_ERROR(err.message || ''),
477
+ error: resources_1.default.errors.registry.COMPONENT_EXECUTION_ERROR(err.message || (typeof err === 'string' ? err : '')),
412
478
  details: {
413
479
  message: err.message,
414
480
  stack: err.stack,
@@ -26,6 +26,8 @@ declare const _default: {
26
26
  COMPONENT_VERSION_NOT_VALID_CODE: string;
27
27
  COMPONENT_SET_HEADER_PARAMETERS_NOT_VALID: string;
28
28
  COMPONENT_SET_COOKIE_PARAMETERS_NOT_VALID: string;
29
+ COMPONENT_REQUEST_HOOK_FAILED: (message: string) => string;
30
+ COMPONENT_REQUEST_REJECTED: string;
29
31
  CONFIGURATION_DEPENDENCIES_MUST_BE_ARRAY: string;
30
32
  CONFIGURATION_CORS_MUST_BE_OBJECT: string;
31
33
  CONFIGURATION_CORS_ORIGIN_MUST_BE_STRING: string;
@@ -48,6 +50,7 @@ declare const _default: {
48
50
  CONFIGURATION_ROUTES_ROUTE_CONTAINS_PREFIX: (prefix: string) => string;
49
51
  CONFIGURATION_STORAGE_NOT_VALID: (storage: string) => string;
50
52
  CONFIGURATION_HEADERS_TO_SKIP_MUST_BE_STRING_ARRAY: string;
53
+ CONFIGURATION_ON_COMPONENT_REQUEST_MUST_BE_FUNCTION: string;
51
54
  DATA_OBJECT_IS_UNDEFINED: string;
52
55
  DEPENDENCY_NOT_FOUND: (dependencies: string) => string;
53
56
  DEPENDENCY_NOT_FOUND_CODE: string;
@@ -75,6 +75,8 @@ exports.default = {
75
75
  COMPONENT_VERSION_NOT_VALID_CODE: 'version_not_valid',
76
76
  COMPONENT_SET_HEADER_PARAMETERS_NOT_VALID: 'context.setHeader parameters must be strings',
77
77
  COMPONENT_SET_COOKIE_PARAMETERS_NOT_VALID: 'context.setCookie parameters are not valid',
78
+ COMPONENT_REQUEST_HOOK_FAILED: (message) => `onComponentRequest hook failed: ${message}`,
79
+ COMPONENT_REQUEST_REJECTED: 'Component request rejected by the registry',
78
80
  CONFIGURATION_DEPENDENCIES_MUST_BE_ARRAY: 'Registry configuration is not valid: dependencies must be an array',
79
81
  CONFIGURATION_CORS_MUST_BE_OBJECT: 'Registry configuration is not valid: cors must be an object',
80
82
  CONFIGURATION_CORS_ORIGIN_MUST_BE_STRING: 'Registry configuration is not valid: cors.origin must be a non-empty string',
@@ -97,6 +99,7 @@ exports.default = {
97
99
  CONFIGURATION_ROUTES_ROUTE_CONTAINS_PREFIX: (prefix) => `Registry configuration is not valid: route url can't contain "${prefix}"`,
98
100
  CONFIGURATION_STORAGE_NOT_VALID: (storage) => `Registry configuration is not valid: ${storage} configuration is not valid`,
99
101
  CONFIGURATION_HEADERS_TO_SKIP_MUST_BE_STRING_ARRAY: 'Registry configuration is not valid: customHeadersToSkipOnWeakVersion must be an array of strings',
102
+ CONFIGURATION_ON_COMPONENT_REQUEST_MUST_BE_FUNCTION: 'Registry configuration is not valid: onComponentRequest must be a function',
100
103
  DATA_OBJECT_IS_UNDEFINED: 'data object is undefined',
101
104
  DEPENDENCY_NOT_FOUND: (dependencies) => `Component is trying to use unavailable dependencies: ${dependencies}`,
102
105
  DEPENDENCY_NOT_FOUND_CODE: 'DEPENDENCY_MISSING_FROM_REGISTRY',
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { IncomingHttpHeaders } from 'node:http';
1
2
  import type { NextFunction, Request, Response } from 'express';
2
3
  import type { MetadataStore as MetadataStoreType } from 'oc-metadata-adapters-utils';
3
4
  import type { StorageAdapter } from 'oc-storage-adapters-utils';
@@ -154,6 +155,30 @@ export interface Component extends PackageJson {
154
155
  oc: OcConfiguration;
155
156
  version: string;
156
157
  }
158
+ export interface ComponentRequestContext {
159
+ /** Name of the requested component. */
160
+ name: string;
161
+ /** Version requested by the consumer (exact, semver range or empty for latest). */
162
+ requestedVersion: string;
163
+ /** Version the registry resolved the request to and is about to serve. */
164
+ version: string;
165
+ /** Latest published version of the component, as resolved for an unversioned request. */
166
+ latestVersion: string;
167
+ /** package.json of the resolved component, including `allVersions`. */
168
+ component: Readonly<Component>;
169
+ headers: IncomingHttpHeaders;
170
+ parameters: Record<string, string>;
171
+ /** Name of the action being invoked, if any. */
172
+ action?: string;
173
+ }
174
+ export interface ComponentRequestRejection {
175
+ /** @default 403 */
176
+ status?: number;
177
+ /** @default "COMPONENT_REQUEST_REJECTED" */
178
+ code?: string;
179
+ error?: string;
180
+ }
181
+ export type ComponentRequestHook = (context: ComponentRequestContext) => ComponentRequestRejection | undefined | Promise<ComponentRequestRejection | undefined>;
157
182
  export interface ParsedComponent extends Omit<Component, 'author'> {
158
183
  author: Author;
159
184
  }
@@ -434,6 +459,21 @@ export interface Config<T = any, TServerAdapter extends HttpServerAdapterFactory
434
459
  isValid: boolean;
435
460
  error?: string;
436
461
  } | boolean;
462
+ /**
463
+ * Hook executed for every component request once the requested version has
464
+ * been resolved, before the component is rendered or its info returned.
465
+ * Return (or resolve to) a {@link ComponentRequestRejection} to reject the
466
+ * request, or nothing to let it through. Throwing or rejecting responds with
467
+ * a 500 error.
468
+ *
469
+ * @example
470
+ * onComponentRequest: ({ version, latestVersion }) => {
471
+ * if (semver.major(version) < semver.major(latestVersion)) {
472
+ * return { status: 410, code: 'VERSION_TOO_OLD', error: `Use ${latestVersion}` };
473
+ * }
474
+ * }
475
+ */
476
+ onComponentRequest?: ComponentRequestHook;
437
477
  /**
438
478
  * Seconds between each refresh of the internal component list cache.
439
479
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc",
3
- "version": "0.50.65",
3
+ "version": "0.50.66",
4
4
  "description": "A framework for developing and distributing html components",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",