@contractkit/openapi-to-ck 0.7.6 → 0.7.8

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,9 +1,9 @@
1
1
 
2
- > @contractkit/openapi-to-ck@0.7.6 build:ci /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
2
+ > @contractkit/openapi-to-ck@0.7.8 build:ci /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
3
3
  > eslint --max-warnings=0 && pnpm run build
4
4
 
5
5
 
6
- > @contractkit/openapi-to-ck@0.7.6 build /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
6
+ > @contractkit/openapi-to-ck@0.7.8 build /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
7
7
  > tsup src/index.ts src/plugin.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
8
8
 
9
9
  CLI Building entry: src/index.ts, src/plugin.ts
@@ -13,12 +13,12 @@
13
13
  ESM Build start
14
14
  ESM dist/index.js 498.00 B
15
15
  ESM dist/plugin.js 2.51 KB
16
- ESM dist/chunk-YP7FWA4H.js 50.65 KB
16
+ ESM dist/chunk-T2G2WRZ2.js 50.36 KB
17
17
  ESM dist/index.js.map 71.00 B
18
18
  ESM dist/plugin.js.map 4.95 KB
19
- ESM dist/chunk-YP7FWA4H.js.map 117.23 KB
20
- ESM ⚡️ Build success in 264ms
19
+ ESM dist/chunk-T2G2WRZ2.js.map 116.56 KB
20
+ ESM ⚡️ Build success in 191ms
21
21
  DTS Build start
22
- DTS ⚡️ Build success in 5952ms
22
+ DTS ⚡️ Build success in 6387ms
23
23
  DTS dist/index.d.ts 8.29 KB
24
24
  DTS dist/plugin.d.ts 128.00 B
@@ -1,34 +1,34 @@
1
1
 
2
- > @contractkit/openapi-to-ck@0.7.6 test:ci /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
2
+ > @contractkit/openapi-to-ck@0.7.8 test:ci /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
3
3
  > vitest run --coverage
4
4
 
5
5
 
6
6
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck
7
7
  Coverage enabled with v8
8
8
 
9
- ✓ tests/ast-to-ck.test.ts (35 tests) 89ms
10
- ✓ tests/schema-to-ast.test.ts (36 tests) 113ms
11
- ✓ tests/tag-splitter.test.ts (5 tests) 74ms
12
- ✓ tests/normalize.test.ts (6 tests) 54ms
13
- ✓ tests/convert.test.ts (16 tests) 277ms
14
- ✓ tests/circular-refs.test.ts (8 tests) 43ms
9
+ ✓ tests/ast-to-ck.test.ts (35 tests) 79ms
10
+ ✓ tests/schema-to-ast.test.ts (36 tests) 44ms
11
+ ✓ tests/normalize.test.ts (6 tests) 91ms
12
+ ✓ tests/tag-splitter.test.ts (5 tests) 94ms
13
+ ✓ tests/circular-refs.test.ts (8 tests) 24ms
14
+ ✓ tests/convert.test.ts (16 tests) 142ms
15
15
 
16
16
   Test Files  6 passed (6)
17
17
   Tests  106 passed (106)
18
-  Start at  11:16:35
19
-  Duration  5.56s (transform 2.68s, setup 0ms, import 6.97s, tests 650ms, environment 15ms)
18
+  Start at  13:02:53
19
+  Duration  4.97s (transform 2.41s, setup 0ms, import 5.49s, tests 474ms, environment 1ms)
20
20
 
21
21
   % Coverage report from v8
22
22
  -------------------|---------|----------|---------|---------|-------------------------------------------------------------
23
23
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
24
24
  -------------------|---------|----------|---------|---------|-------------------------------------------------------------
25
- All files | 80.49 | 70.11 | 94.69 | 82.95 |
26
- src | 80.24 | 70.39 | 93.47 | 82.57 |
27
- ast-to-ck.ts | 90.65 | 82.01 | 100 | 91.91 | 82-91,168,263,295-296,311,344-345,355,415
25
+ All files | 81.01 | 70.41 | 94.69 | 83.55 |
26
+ src | 80.79 | 70.7 | 93.47 | 83.18 |
27
+ ast-to-ck.ts | 90.65 | 82.7 | 100 | 91.91 | 82-91,168,263,295-296,311,344-345,355,415
28
28
  circular-refs.ts | 100 | 90 | 100 | 100 | 20-23
29
29
  convert.ts | 77.19 | 87.5 | 80 | 77.77 | 83-98,112-117
30
30
  normalize.ts | 62.96 | 56.6 | 80 | 63.33 | 79,121-163,237-255,270-271,280-309,346,350,358
31
- paths-to-ast.ts | 81.2 | 64.48 | 100 | 85.12 | 100,125,130,140-141,149,192,206,247,277,283,320-332
31
+ paths-to-ast.ts | 85.03 | 65.71 | 100 | 89.56 | 100,125,130,140-141,149,192,206,247,277,283,320
32
32
  schema-to-ast.ts | 84.69 | 75 | 95.65 | 87.65 | 128-129,151,159,173,196-197,205-206,311-314,353-360,396-404
33
33
  tag-splitter.ts | 70 | 57.14 | 81.81 | 76.47 | 63-71,137-138,141-146,162-163,171-178
34
34
  warnings.ts | 100 | 100 | 100 | 100 |
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @contractkit/openapi-to-ck
2
2
 
3
+ ## 0.7.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 79af33b: **Breaking:** Replace the `roles` field in `security: { ... }` blocks with `requireMfa: boolean`.
8
+
9
+ The `security` declaration on operations, routes, and the file-level `options { security: { ... } }` block no longer accepts a `roles:` line. The new field is `requireMfa: true | false`. Existing `.ck` files that use `roles:` will fail to parse.
10
+
11
+ ```ck
12
+ # Before
13
+ security: {
14
+ roles: admin editor
15
+ }
16
+
17
+ # After
18
+ security: {
19
+ requireMfa: true
20
+ }
21
+ ```
22
+
23
+ **`@contractkit/core`** — `SecurityFields` interface drops `roles` / `rolesDescription` and adds `requireMfa` / `requireMfaDescription`. The grammar's `SecurityRolesLine` is replaced by `SecurityRequireMfaLine` (`requireMfaKw ":" booleanLit`). `security: none` continues to work.
24
+
25
+ **`@contractkit/plugin-typescript`** — Generated Koa routers now emit `requireSecurity({ requireMfa: <bool> })` when `requireMfa` is set, and bare `requireSecurity()` for unannotated routes (previously `requireSecurity({ roles: [...] })` / `requireSecurity({ })`). The generated code matches the updated serverkit `SecurityOptions = { requireMfa: boolean }` signature; consumers must upgrade serverkit alongside.
26
+
27
+ **`@contractkit/prettier-plugin`** — Formats `requireMfa: true|false` lines inside security blocks. Files containing `roles:` will no longer round-trip and will surface as parse errors.
28
+
29
+ **`@contractkit/plugin-markdown`** — The "Security: authenticated" admonition now shows `requireMfa: <bool>` instead of `roles: <list>`.
30
+
31
+ **`@contractkit/openapi-to-ck`** — `convertSecurity` no longer extracts OpenAPI scopes into a `roles` list (those don't map onto MFA semantics). Any non-empty OpenAPI `security` requirement now collapses to `security: {}` (authenticated, no MFA flag).
32
+
33
+ - Updated dependencies [79af33b]
34
+ - @contractkit/core@0.17.0
35
+
36
+ ## 0.7.7
37
+
38
+ ### Patch Changes
39
+
40
+ - Updated dependencies [4ac6d4d]
41
+ - @contractkit/core@0.16.0
42
+
3
43
  ## 0.7.6
4
44
 
5
45
  ### Patch Changes
@@ -1,11 +1,11 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1778152601471" clover="3.2.0">
3
- <project timestamp="1778152601471" name="All files">
4
- <metrics statements="839" coveredstatements="696" conditionals="753" coveredconditionals="528" methods="113" coveredmethods="107" elements="1705" coveredelements="1331" complexity="0" loc="839" ncloc="839" packages="2" files="9" classes="9"/>
2
+ <coverage generated="1778245378830" clover="3.2.0">
3
+ <project timestamp="1778245378831" name="All files">
4
+ <metrics statements="833" coveredstatements="696" conditionals="747" coveredconditionals="526" methods="113" coveredmethods="107" elements="1693" coveredelements="1329" complexity="0" loc="833" ncloc="833" packages="2" files="9" classes="9"/>
5
5
  <package name="src">
6
- <metrics statements="809" coveredstatements="668" conditionals="733" coveredconditionals="516" methods="92" coveredmethods="86"/>
6
+ <metrics statements="803" coveredstatements="668" conditionals="727" coveredconditionals="514" methods="92" coveredmethods="86"/>
7
7
  <file name="ast-to-ck.ts" path="/home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck/src/ast-to-ck.ts">
8
- <metrics statements="198" coveredstatements="182" conditionals="189" coveredconditionals="155" methods="18" coveredmethods="18"/>
8
+ <metrics statements="198" coveredstatements="182" conditionals="185" coveredconditionals="153" methods="18" coveredmethods="18"/>
9
9
  <line num="17" count="2" type="stmt"/>
10
10
  <line num="27" count="47" type="cond" truecount="1" falsecount="0"/>
11
11
  <line num="28" count="47" type="stmt"/>
@@ -37,7 +37,7 @@
37
37
  <line num="83" count="0" type="cond" truecount="0" falsecount="2"/>
38
38
  <line num="84" count="0" type="stmt"/>
39
39
  <line num="86" count="0" type="stmt"/>
40
- <line num="87" count="0" type="cond" truecount="0" falsecount="4"/>
40
+ <line num="87" count="0" type="cond" truecount="0" falsecount="2"/>
41
41
  <line num="88" count="0" type="stmt"/>
42
42
  <line num="91" count="0" type="stmt"/>
43
43
  <line num="94" count="11" type="stmt"/>
@@ -198,7 +198,7 @@
198
198
  <line num="404" count="11" type="stmt"/>
199
199
  <line num="405" count="11" type="stmt"/>
200
200
  <line num="408" count="1" type="stmt"/>
201
- <line num="409" count="1" type="cond" truecount="3" falsecount="1"/>
201
+ <line num="409" count="1" type="cond" truecount="1" falsecount="1"/>
202
202
  <line num="410" count="1" type="cond" truecount="3" falsecount="1"/>
203
203
  <line num="411" count="1" type="stmt"/>
204
204
  <line num="412" count="1" type="stmt"/>
@@ -452,7 +452,7 @@
452
452
  <line num="358" count="0" type="stmt"/>
453
453
  </file>
454
454
  <file name="paths-to-ast.ts" path="/home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck/src/paths-to-ast.ts">
455
- <metrics statements="121" coveredstatements="103" conditionals="107" coveredconditionals="69" methods="16" coveredmethods="16"/>
455
+ <metrics statements="115" coveredstatements="103" conditionals="105" coveredconditionals="69" methods="16" coveredmethods="16"/>
456
456
  <line num="25" count="1" type="stmt"/>
457
457
  <line num="26" count="1" type="stmt"/>
458
458
  <line num="46" count="16" type="stmt"/>
@@ -564,16 +564,10 @@
564
564
  <line num="314" count="10" type="cond" truecount="1" falsecount="1"/>
565
565
  <line num="315" count="10" type="stmt"/>
566
566
  <line num="320" count="0" type="stmt"/>
567
- <line num="321" count="0" type="stmt"/>
568
- <line num="322" count="0" type="stmt"/>
569
- <line num="323" count="0" type="stmt"/>
570
- <line num="327" count="0" type="cond" truecount="0" falsecount="2"/>
571
- <line num="328" count="0" type="stmt"/>
572
- <line num="332" count="0" type="stmt"/>
573
- <line num="338" count="88" type="stmt"/>
574
- <line num="350" count="53" type="stmt"/>
575
- <line num="354" count="53" type="stmt"/>
576
- <line num="359" count="88" type="stmt"/>
567
+ <line num="326" count="88" type="stmt"/>
568
+ <line num="338" count="53" type="stmt"/>
569
+ <line num="342" count="53" type="stmt"/>
570
+ <line num="347" count="88" type="stmt"/>
577
571
  </file>
578
572
  <file name="schema-to-ast.ts" path="/home/runner/work/ContractKit/ContractKit/packages/openapi-to-ck/src/schema-to-ast.ts">
579
573
  <metrics statements="162" coveredstatements="142" conditionals="164" coveredconditionals="123" methods="23" coveredmethods="22"/>