@contractkit/prettier-plugin 0.10.0 → 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.10.0 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.10.0 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.48 KB
15
- ESM dist/index.js.map 49.09 KB
16
- ESM ⚡️ Build success in 159ms
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 3845ms
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,26 +1,26 @@
1
1
 
2
- > @contractkit/prettier-plugin@0.10.0 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) 176ms
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  13:02:53
14
-  Duration  5.37s (transform 1.81s, setup 0ms, import 3.93s, tests 176ms, environment 3ms)
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
  -------------------|---------|----------|---------|---------|-------------------
18
18
  File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
19
19
  -------------------|---------|----------|---------|---------|-------------------
20
- All files | 68.39 | 58.73 | 74.19 | 74.62 |
20
+ 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.3 | 64.01 | 92.85 | 83.24 | ...66,274-285,317
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,47 @@
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
+
3
45
  ## 0.10.0
4
46
 
5
47
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
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"/>
2
+ <coverage generated="1778692131156" clover="3.2.0">
3
+ <project timestamp="1778692131156" 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"/>
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="179" coveredstatements="149" conditionals="214" coveredconditionals="137" methods="14" coveredmethods="13"/>
95
+ <metrics statements="180" coveredstatements="150" conditionals="216" coveredconditionals="139" 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"/>
@@ -218,60 +218,61 @@
218
218
  <line num="236" count="3" type="cond" truecount="1" falsecount="1"/>
219
219
  <line num="237" count="3" type="stmt"/>
220
220
  <line num="238" count="3" type="cond" truecount="1" falsecount="1"/>
221
- <line num="239" count="5" type="stmt"/>
221
+ <line num="239" count="5" type="cond" truecount="2" falsecount="0"/>
222
222
  <line num="240" count="5" type="stmt"/>
223
223
  <line num="241" count="5" type="stmt"/>
224
- <line num="247" count="9" type="cond" truecount="1" falsecount="1"/>
224
+ <line num="242" count="5" type="stmt"/>
225
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"/>
226
+ <line num="249" count="9" type="cond" truecount="1" falsecount="1"/>
227
+ <line num="250" count="0" type="stmt"/>
228
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"/>
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
234
  <line num="258" count="11" type="cond" truecount="2" falsecount="0"/>
235
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"/>
236
+ <line num="260" count="11" type="cond" truecount="2" falsecount="0"/>
237
+ <line num="261" count="11" type="stmt"/>
238
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"/>
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
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"/>
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"/>
246
+ <line num="279" count="0" type="stmt"/>
247
247
  <line num="280" count="0" type="cond" truecount="0" falsecount="2"/>
248
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"/>
249
+ <line num="282" count="0" type="cond" truecount="0" falsecount="2"/>
250
+ <line num="283" count="0" type="stmt"/>
251
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"/>
255
- <line num="296" count="8" type="cond" truecount="2" falsecount="0"/>
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
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"/>
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"/>
266
+ <line num="308" count="2" type="stmt"/>
267
+ <line num="309" count="2" type="cond" truecount="2" falsecount="2"/>
268
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"/>
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
274
  <line num="322" count="7" type="stmt"/>
275
+ <line num="323" count="7" type="stmt"/>
275
276
  </file>
276
277
  <file name="print-type.ts" path="/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin/src/print-type.ts">
277
278
  <metrics statements="72" coveredstatements="35" conditionals="96" coveredconditionals="45" methods="11" coveredmethods="5"/>