@contractkit/prettier-plugin 0.9.6 → 0.10.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.
@@ -1,9 +1,9 @@
1
1
 
2
- > @contractkit/prettier-plugin@0.9.6 build:ci /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
2
+ > @contractkit/prettier-plugin@0.10.0 build:ci /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
3
3
  > eslint --max-warnings=0 && pnpm run build
4
4
 
5
5
 
6
- > @contractkit/prettier-plugin@0.9.6 build /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
6
+ > @contractkit/prettier-plugin@0.10.0 build /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
7
7
  > tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration
8
8
 
9
9
  CLI Building entry: src/index.ts
@@ -11,9 +11,9 @@
11
11
  CLI tsup v8.5.1
12
12
  CLI Target: esnext
13
13
  ESM Build start
14
- ESM dist/index.js 20.51 KB
15
- ESM dist/index.js.map 48.93 KB
16
- ESM ⚡️ Build success in 143ms
14
+ ESM dist/index.js 20.48 KB
15
+ ESM dist/index.js.map 49.09 KB
16
+ ESM ⚡️ Build success in 159ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 4458ms
18
+ DTS ⚡️ Build success in 3845ms
19
19
  DTS dist/index.d.ts 157.00 B
@@ -1,26 +1,26 @@
1
1
 
2
- > @contractkit/prettier-plugin@0.9.6 test:ci /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
2
+ > @contractkit/prettier-plugin@0.10.0 test:ci /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
3
3
  > vitest run --coverage
4
4
 
5
5
 
6
6
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
7
7
  Coverage enabled with v8
8
8
 
9
- ✓ tests/print-ck.test.ts (60 tests) 141ms
9
+ ✓ tests/print-ck.test.ts (60 tests) 176ms
10
10
 
11
11
   Test Files  1 passed (1)
12
12
   Tests  60 passed (60)
13
-  Start at  11:38:17
14
-  Duration  4.98s (transform 1.82s, setup 0ms, import 3.45s, tests 141ms, environment 10ms)
13
+  Start at  13:02:53
14
+  Duration  5.37s (transform 1.81s, setup 0ms, import 3.93s, tests 176ms, environment 3ms)
15
15
 
16
16
   % Coverage report from v8
17
17
  -------------------|---------|----------|---------|---------|-------------------
18
18
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
19
19
  -------------------|---------|----------|---------|---------|-------------------
20
- All files | 68.47 | 58.91 | 74.19 | 74.69 |
20
+ All files | 68.39 | 58.73 | 74.19 | 74.62 |
21
21
  indent.ts | 100 | 100 | 100 | 100 |
22
22
  print-ck.ts | 89.85 | 80 | 100 | 98.03 | 59
23
23
  print-contract.ts | 41.93 | 30.35 | 50 | 42.85 | 10,37-68
24
- ...t-operation.ts | 73.41 | 64.35 | 92.85 | 83.33 | ...61,269-280,312
24
+ ...t-operation.ts | 73.3 | 64.01 | 92.85 | 83.24 | ...66,274-285,317
25
25
  print-type.ts | 47.12 | 46.87 | 45.45 | 48.61 | ...10,139,142-145
26
26
  -------------------|---------|----------|---------|---------|-------------------
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @contractkit/prettier-plugin-contractkit
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor 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
+ ### Patch Changes
34
+
35
+ - Updated dependencies [79af33b]
36
+ - @contractkit/core@0.17.0
37
+
3
38
  ## 0.9.6
4
39
 
5
40
  ### Patch Changes
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1778153902774" clover="3.2.0">
3
- <project timestamp="1778153902774" name="All files">
4
- <metrics statements="332" coveredstatements="248" conditionals="443" coveredconditionals="261" methods="31" coveredmethods="23" elements="806" coveredelements="532" complexity="0" loc="332" ncloc="332" packages="1" files="5" classes="5"/>
2
+ <coverage generated="1778245379391" clover="3.2.0">
3
+ <project timestamp="1778245379391" name="All files">
4
+ <metrics statements="331" coveredstatements="247" conditionals="441" coveredconditionals="259" methods="31" coveredmethods="23" elements="803" coveredelements="529" complexity="0" loc="331" ncloc="331" packages="1" files="5" classes="5"/>
5
5
  <file name="indent.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/indent.ts">
6
6
  <metrics statements="1" coveredstatements="1" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
7
7
  <line num="1" count="1" type="stmt"/>
@@ -92,7 +92,7 @@
92
92
  <line num="68" count="0" type="stmt"/>
93
93
  </file>
94
94
  <file name="print-operation.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/print-operation.ts">
95
- <metrics statements="180" coveredstatements="150" conditionals="216" coveredconditionals="139" methods="14" coveredmethods="13"/>
95
+ <metrics statements="179" coveredstatements="149" conditionals="214" coveredconditionals="137" methods="14" coveredmethods="13"/>
96
96
  <line num="16" count="1" type="stmt"/>
97
97
  <line num="17" count="1" type="stmt"/>
98
98
  <line num="18" count="1" type="stmt"/>
@@ -212,67 +212,66 @@
212
212
  <line num="212" count="4" type="stmt"/>
213
213
  <line num="215" count="0" type="stmt"/>
214
214
  <line num="222" count="2" type="cond" truecount="2" falsecount="0"/>
215
- <line num="227" count="5" type="cond" truecount="8" falsecount="0"/>
216
- <line num="228" count="5" type="cond" truecount="2" falsecount="0"/>
217
- <line num="229" count="3" type="stmt"/>
218
- <line num="230" count="3" type="cond" truecount="2" falsecount="0"/>
219
- <line num="231" count="5" type="cond" truecount="1" falsecount="1"/>
220
- <line num="232" count="3" type="stmt"/>
221
- <line num="233" count="3" type="cond" truecount="1" falsecount="1"/>
222
- <line num="234" count="5" type="stmt"/>
223
- <line num="235" count="5" type="stmt"/>
224
- <line num="236" count="5" type="stmt"/>
225
- <line num="242" count="9" type="cond" truecount="1" falsecount="1"/>
226
- <line num="243" count="9" type="cond" truecount="1" falsecount="1"/>
227
- <line num="244" count="0" type="stmt"/>
228
- <line num="246" count="9" type="cond" truecount="1" falsecount="1"/>
215
+ <line num="233" count="5" type="cond" truecount="8" falsecount="0"/>
216
+ <line num="234" count="5" type="cond" truecount="2" falsecount="0"/>
217
+ <line num="235" count="3" type="stmt"/>
218
+ <line num="236" count="3" type="cond" truecount="1" falsecount="1"/>
219
+ <line num="237" count="3" type="stmt"/>
220
+ <line num="238" count="3" type="cond" truecount="1" falsecount="1"/>
221
+ <line num="239" count="5" type="stmt"/>
222
+ <line num="240" count="5" type="stmt"/>
223
+ <line num="241" count="5" type="stmt"/>
229
224
  <line num="247" count="9" type="cond" truecount="1" falsecount="1"/>
230
- <line num="248" count="9" type="stmt"/>
231
- <line num="249" count="9" type="cond" truecount="2" falsecount="2"/>
232
- <line num="250" count="11" type="cond" truecount="2" falsecount="0"/>
233
- <line num="251" count="11" type="stmt"/>
234
- <line num="252" count="11" type="cond" truecount="2" falsecount="0"/>
235
- <line num="253" count="11" type="cond" truecount="2" falsecount="0"/>
236
- <line num="254" count="11" type="cond" truecount="2" falsecount="0"/>
237
- <line num="255" count="11" type="stmt"/>
238
- <line num="257" count="9" type="stmt"/>
239
- <line num="258" count="9" type="stmt"/>
240
- <line num="261" count="0" type="stmt"/>
241
- <line num="268" count="10" type="cond" truecount="1" falsecount="1"/>
242
- <line num="269" count="0" type="stmt"/>
243
- <line num="270" count="0" type="stmt"/>
244
- <line num="271" count="0" type="cond" truecount="0" falsecount="4"/>
245
- <line num="272" count="0" type="cond" truecount="0" falsecount="2"/>
246
- <line num="273" count="0" type="stmt"/>
247
- <line num="274" count="0" type="cond" truecount="0" falsecount="2"/>
248
- <line num="275" count="0" type="cond" truecount="0" falsecount="2"/>
249
- <line num="276" count="0" type="cond" truecount="0" falsecount="2"/>
250
- <line num="277" count="0" type="stmt"/>
251
- <line num="279" count="0" type="stmt"/>
252
- <line num="280" count="0" type="stmt"/>
253
- <line num="282" count="10" type="stmt"/>
254
- <line num="288" count="7" type="stmt"/>
255
- <line num="290" count="7" type="cond" truecount="2" falsecount="2"/>
256
- <line num="291" count="8" type="cond" truecount="2" falsecount="0"/>
257
- <line num="292" count="8" type="cond" truecount="2" falsecount="0"/>
258
- <line num="293" count="8" type="stmt"/>
259
- <line num="294" count="8" type="cond" truecount="4" falsecount="1"/>
260
- <line num="295" count="8" type="stmt"/>
225
+ <line num="248" count="9" type="cond" truecount="1" falsecount="1"/>
226
+ <line num="249" count="0" type="stmt"/>
227
+ <line num="251" count="9" type="cond" truecount="1" falsecount="1"/>
228
+ <line num="252" count="9" type="cond" truecount="1" falsecount="1"/>
229
+ <line num="253" count="9" type="stmt"/>
230
+ <line num="254" count="9" type="cond" truecount="2" falsecount="2"/>
231
+ <line num="255" count="11" type="cond" truecount="2" falsecount="0"/>
232
+ <line num="256" count="11" type="stmt"/>
233
+ <line num="257" count="11" type="cond" truecount="2" falsecount="0"/>
234
+ <line num="258" count="11" type="cond" truecount="2" falsecount="0"/>
235
+ <line num="259" count="11" type="cond" truecount="2" falsecount="0"/>
236
+ <line num="260" count="11" type="stmt"/>
237
+ <line num="262" count="9" type="stmt"/>
238
+ <line num="263" count="9" type="stmt"/>
239
+ <line num="266" count="0" type="stmt"/>
240
+ <line num="273" count="10" type="cond" truecount="1" falsecount="1"/>
241
+ <line num="274" count="0" type="stmt"/>
242
+ <line num="275" count="0" type="stmt"/>
243
+ <line num="276" count="0" type="cond" truecount="0" falsecount="4"/>
244
+ <line num="277" count="0" type="cond" truecount="0" falsecount="2"/>
245
+ <line num="278" count="0" type="stmt"/>
246
+ <line num="279" count="0" type="cond" truecount="0" falsecount="2"/>
247
+ <line num="280" count="0" type="cond" truecount="0" falsecount="2"/>
248
+ <line num="281" count="0" type="cond" truecount="0" falsecount="2"/>
249
+ <line num="282" count="0" type="stmt"/>
250
+ <line num="284" count="0" type="stmt"/>
251
+ <line num="285" count="0" type="stmt"/>
252
+ <line num="287" count="10" type="stmt"/>
253
+ <line num="293" count="7" type="stmt"/>
254
+ <line num="295" count="7" type="cond" truecount="2" falsecount="2"/>
261
255
  <line num="296" count="8" type="cond" truecount="2" falsecount="0"/>
262
- <line num="297" count="6" type="stmt"/>
263
- <line num="299" count="8" type="cond" truecount="2" falsecount="0"/>
264
- <line num="300" count="1" type="stmt"/>
265
- <line num="301" count="7" type="cond" truecount="2" falsecount="0"/>
266
- <line num="302" count="2" type="stmt"/>
267
- <line num="303" count="2" type="cond" truecount="2" falsecount="2"/>
268
- <line num="304" count="3" type="cond" truecount="2" falsecount="0"/>
269
- <line num="305" count="3" type="cond" truecount="2" falsecount="0"/>
270
- <line num="306" count="3" type="stmt"/>
271
- <line num="308" count="2" type="stmt"/>
272
- <line num="310" count="8" type="stmt"/>
273
- <line num="312" count="0" type="stmt"/>
274
- <line num="316" count="7" type="stmt"/>
275
- <line num="317" count="7" type="stmt"/>
256
+ <line num="297" count="8" type="cond" truecount="2" falsecount="0"/>
257
+ <line num="298" count="8" type="stmt"/>
258
+ <line num="299" count="8" type="cond" truecount="4" falsecount="1"/>
259
+ <line num="300" count="8" type="stmt"/>
260
+ <line num="301" count="8" type="cond" truecount="2" falsecount="0"/>
261
+ <line num="302" count="6" type="stmt"/>
262
+ <line num="304" count="8" type="cond" truecount="2" falsecount="0"/>
263
+ <line num="305" count="1" type="stmt"/>
264
+ <line num="306" count="7" type="cond" truecount="2" falsecount="0"/>
265
+ <line num="307" count="2" type="stmt"/>
266
+ <line num="308" count="2" type="cond" truecount="2" falsecount="2"/>
267
+ <line num="309" count="3" type="cond" truecount="2" falsecount="0"/>
268
+ <line num="310" count="3" type="cond" truecount="2" falsecount="0"/>
269
+ <line num="311" count="3" type="stmt"/>
270
+ <line num="313" count="2" type="stmt"/>
271
+ <line num="315" count="8" type="stmt"/>
272
+ <line num="317" count="0" type="stmt"/>
273
+ <line num="321" count="7" type="stmt"/>
274
+ <line num="322" count="7" type="stmt"/>
276
275
  </file>
277
276
  <file name="print-type.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/print-type.ts">
278
277
  <metrics statements="72" coveredstatements="35" conditionals="96" coveredconditionals="45" methods="11" coveredmethods="5"/>