@contractkit/prettier-plugin 0.9.6 → 0.11.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.11.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.11.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.55 KB
15
+ ESM dist/index.js.map 49.22 KB
16
+ ESM ⚡️ Build success in 157ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 4458ms
19
- DTS dist/index.d.ts 157.00 B
18
+ DTS ⚡️ Build success in 3825ms
19
+ DTS dist/index.d.ts 630.00 B
@@ -1,17 +1,17 @@
1
1
 
2
- > @contractkit/prettier-plugin@0.9.6 test:ci /home/runner/work/ContractKit/ContractKit/apps/prettier-plugin
2
+ > @contractkit/prettier-plugin@0.11.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) 266ms
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  17:08:47
14
+  Duration  4.07s (transform 1.22s, setup 0ms, import 2.63s, tests 266ms, environment 0ms)
15
15
 
16
16
   % Coverage report from v8
17
17
  -------------------|---------|----------|---------|---------|-------------------
@@ -21,6 +21,6 @@ All files | 68.47 | 58.91 | 74.19 | 74.69 |
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.41 | 64.35 | 92.85 | 83.33 | ...67,275-286,318
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,82 @@
1
1
  # @contractkit/prettier-plugin-contractkit
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - dd8197b: **Breaking:** Replace the `requireMfa: boolean` field in `security: { ... }` blocks with `policy: <ident|none>`, and switch the generated Koa router middleware from `requireSecurity` to ServerKit's new `requirePolicy`.
8
+
9
+ The `security` declaration on operations, routes, and the file-level `options { security: { ... } }` block no longer accepts a `requireMfa:` line. The new field is `policy:` and takes a bare identifier (the named policy) or the keyword `none` to explicitly bypass policy enforcement. Existing `.ck` files that use `requireMfa:` will fail to parse.
10
+
11
+ ```ck
12
+ # Before
13
+ security: {
14
+ requireMfa: true
15
+ }
16
+
17
+ # After
18
+ security: {
19
+ policy: paymentsWrite
20
+ }
21
+
22
+ # Explicit bypass
23
+ security: {
24
+ policy: none
25
+ }
26
+ ```
27
+
28
+ **`@contractkit/core`** — `SecurityFields` interface drops `requireMfa` / `requireMfaDescription` and adds `policy?: string | false` / `policyDescription?: string`. The grammar's `SecurityRequireMfaLine` is replaced by `SecurityPolicyLine` (`policyKw ":" (noneKw | identifier)`). `security: none` (the route-level public sentinel) is unchanged.
29
+
30
+ **`@contractkit/plugin-typescript`** — Generated Koa routers now import `requirePolicy` from `@maroonedsoftware/koa` (previously `requireSecurity`) and emit `requirePolicy({ policy: 'name' })`, `requirePolicy({ policy: false })`, or bare `requirePolicy()`. Consumers must upgrade ServerKit alongside.
31
+
32
+ **`@contractkit/prettier-plugin`** — Formats `policy: <name>` and `policy: none` lines inside security blocks. Files containing `requireMfa:` will no longer round-trip and will surface as parse errors.
33
+
34
+ **`@contractkit/plugin-markdown`** — The "Security: authenticated" admonition now shows `policy: <name|none>` instead of `requireMfa: <bool>`.
35
+
36
+ **`@contractkit/openapi-to-ck`** — Non-empty OpenAPI `security` requirements continue to collapse to an empty `security: {}` (authenticated, default policy); the serializer now emits `policy:` lines when the field is set.
37
+
38
+ **`contractkit-vscode-extension`** — TextMate grammar highlights `policy:` inside the security block; LSP completion offers `policy` instead of `requireMfa`. Re-run `pnpm run vscode:install` to pick up the change.
39
+
40
+ ### Patch Changes
41
+
42
+ - Updated dependencies [dd8197b]
43
+ - @contractkit/core@0.18.0
44
+
45
+ ## 0.10.0
46
+
47
+ ### Minor Changes
48
+
49
+ - 79af33b: **Breaking:** Replace the `roles` field in `security: { ... }` blocks with `requireMfa: boolean`.
50
+
51
+ 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.
52
+
53
+ ```ck
54
+ # Before
55
+ security: {
56
+ roles: admin editor
57
+ }
58
+
59
+ # After
60
+ security: {
61
+ requireMfa: true
62
+ }
63
+ ```
64
+
65
+ **`@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.
66
+
67
+ **`@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.
68
+
69
+ **`@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.
70
+
71
+ **`@contractkit/plugin-markdown`** — The "Security: authenticated" admonition now shows `requireMfa: <bool>` instead of `roles: <list>`.
72
+
73
+ **`@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).
74
+
75
+ ### Patch Changes
76
+
77
+ - Updated dependencies [79af33b]
78
+ - @contractkit/core@0.17.0
79
+
3
80
  ## 0.9.6
4
81
 
5
82
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1778153902774" clover="3.2.0">
3
- <project timestamp="1778153902774" name="All files">
2
+ <coverage generated="1778692131156" clover="3.2.0">
3
+ <project timestamp="1778692131156" name="All files">
4
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"/>
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"/>
@@ -212,67 +212,67 @@
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"/>
229
- <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"/>
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="cond" truecount="2" falsecount="0"/>
222
+ <line num="240" count="5" type="stmt"/>
223
+ <line num="241" count="5" type="stmt"/>
224
+ <line num="242" count="5" type="stmt"/>
225
+ <line num="248" count="9" type="cond" truecount="1" falsecount="1"/>
226
+ <line num="249" count="9" type="cond" truecount="1" falsecount="1"/>
227
+ <line num="250" count="0" type="stmt"/>
228
+ <line num="252" count="9" type="cond" truecount="1" falsecount="1"/>
229
+ <line num="253" count="9" type="cond" truecount="1" falsecount="1"/>
230
+ <line num="254" count="9" type="stmt"/>
231
+ <line num="255" count="9" type="cond" truecount="2" falsecount="2"/>
232
+ <line num="256" count="11" type="cond" truecount="2" falsecount="0"/>
233
+ <line num="257" count="11" type="stmt"/>
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="cond" truecount="2" falsecount="0"/>
237
+ <line num="261" count="11" type="stmt"/>
238
+ <line num="263" count="9" type="stmt"/>
239
+ <line num="264" count="9" type="stmt"/>
240
+ <line num="267" count="0" type="stmt"/>
241
+ <line num="274" count="10" type="cond" truecount="1" falsecount="1"/>
242
+ <line num="275" count="0" type="stmt"/>
243
+ <line num="276" count="0" type="stmt"/>
244
+ <line num="277" count="0" type="cond" truecount="0" falsecount="4"/>
245
+ <line num="278" count="0" type="cond" truecount="0" falsecount="2"/>
251
246
  <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"/>
261
- <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"/>
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="cond" truecount="0" falsecount="2"/>
250
+ <line num="283" count="0" type="stmt"/>
251
+ <line num="285" count="0" type="stmt"/>
252
+ <line num="286" count="0" type="stmt"/>
253
+ <line num="288" count="10" type="stmt"/>
254
+ <line num="294" count="7" type="stmt"/>
255
+ <line num="296" count="7" type="cond" truecount="2" falsecount="2"/>
256
+ <line num="297" count="8" type="cond" truecount="2" falsecount="0"/>
257
+ <line num="298" count="8" type="cond" truecount="2" falsecount="0"/>
258
+ <line num="299" count="8" type="stmt"/>
259
+ <line num="300" count="8" type="cond" truecount="4" falsecount="1"/>
260
+ <line num="301" count="8" type="stmt"/>
261
+ <line num="302" count="8" type="cond" truecount="2" falsecount="0"/>
262
+ <line num="303" count="6" type="stmt"/>
263
+ <line num="305" count="8" type="cond" truecount="2" falsecount="0"/>
264
+ <line num="306" count="1" type="stmt"/>
265
+ <line num="307" count="7" type="cond" truecount="2" falsecount="0"/>
271
266
  <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"/>
267
+ <line num="309" count="2" type="cond" truecount="2" falsecount="2"/>
268
+ <line num="310" count="3" type="cond" truecount="2" falsecount="0"/>
269
+ <line num="311" count="3" type="cond" truecount="2" falsecount="0"/>
270
+ <line num="312" count="3" type="stmt"/>
271
+ <line num="314" count="2" type="stmt"/>
272
+ <line num="316" count="8" type="stmt"/>
273
+ <line num="318" count="0" type="stmt"/>
274
+ <line num="322" count="7" type="stmt"/>
275
+ <line num="323" count="7" type="stmt"/>
276
276
  </file>
277
277
  <file name="print-type.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/print-type.ts">
278
278
  <metrics statements="72" coveredstatements="35" conditionals="96" coveredconditionals="45" methods="11" coveredmethods="5"/>