@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.
- package/.turbo/turbo-build$colon$ci.log +7 -7
- package/.turbo/turbo-test$colon$ci.log +5 -5
- package/CHANGELOG.md +77 -0
- package/coverage/clover.xml +61 -61
- package/coverage/coverage-final.json +1 -1
- package/coverage/indent.ts.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/print-ck.ts.html +1 -1
- package/coverage/print-contract.ts.html +1 -1
- package/coverage/print-operation.ts.html +27 -9
- package/coverage/print-type.ts.html +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/print-operation.d.ts +8 -0
- package/dist/print-operation.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/print-operation.ts +12 -6
- package/tests/print-ck.test.ts +9 -9
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/prettier-plugin@0.
|
|
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.
|
|
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
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
[34mCLI[39m tsup v8.5.1
|
|
12
12
|
[34mCLI[39m Target: esnext
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[32mESM[39m [1mdist/index.js [22m[32m20.
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m20.55 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m49.22 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 157ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 3825ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m630.00 B[39m
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/prettier-plugin@0.
|
|
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
|
[1m[30m[46m RUN [49m[39m[22m [36mv4.1.5 [39m[90m/home/runner/work/ContractKit/ContractKit/apps/prettier-plugin[39m
|
|
7
7
|
[2mCoverage enabled with [22m[33mv8[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m tests/print-ck.test.ts [2m([22m[2m60 tests[22m[2m)[22m[32m
|
|
9
|
+
[32m✓[39m tests/print-ck.test.ts [2m([22m[2m60 tests[22m[2m)[22m[32m 266[2mms[22m[39m
|
|
10
10
|
|
|
11
11
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
12
|
[2m Tests [22m [1m[32m60 passed[39m[22m[90m (60)[39m
|
|
13
|
-
[2m Start at [22m
|
|
14
|
-
[2m Duration [22m 4.
|
|
13
|
+
[2m Start at [22m 17:08:47
|
|
14
|
+
[2m Duration [22m 4.07s[2m (transform 1.22s, setup 0ms, import 2.63s, tests 266ms, environment 0ms)[22m
|
|
15
15
|
|
|
16
16
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
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 | ...
|
|
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
|
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
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="
|
|
216
|
-
<line num="
|
|
217
|
-
<line num="
|
|
218
|
-
<line num="
|
|
219
|
-
<line num="
|
|
220
|
-
<line num="
|
|
221
|
-
<line num="
|
|
222
|
-
<line num="
|
|
223
|
-
<line num="
|
|
224
|
-
<line num="
|
|
225
|
-
<line num="
|
|
226
|
-
<line num="
|
|
227
|
-
<line num="
|
|
228
|
-
<line num="
|
|
229
|
-
<line num="
|
|
230
|
-
<line num="
|
|
231
|
-
<line num="
|
|
232
|
-
<line num="
|
|
233
|
-
<line num="
|
|
234
|
-
<line num="
|
|
235
|
-
<line num="
|
|
236
|
-
<line num="
|
|
237
|
-
<line num="
|
|
238
|
-
<line num="
|
|
239
|
-
<line num="
|
|
240
|
-
<line num="
|
|
241
|
-
<line num="
|
|
242
|
-
<line num="
|
|
243
|
-
<line num="
|
|
244
|
-
<line num="
|
|
245
|
-
<line num="
|
|
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="
|
|
253
|
-
<line num="
|
|
254
|
-
<line num="
|
|
255
|
-
<line num="
|
|
256
|
-
<line num="
|
|
257
|
-
<line num="
|
|
258
|
-
<line num="
|
|
259
|
-
<line num="294" count="
|
|
260
|
-
<line num="
|
|
261
|
-
<line num="
|
|
262
|
-
<line num="
|
|
263
|
-
<line num="299" count="8" type="
|
|
264
|
-
<line num="300" count="
|
|
265
|
-
<line num="301" count="
|
|
266
|
-
<line num="302" count="
|
|
267
|
-
<line num="303" count="
|
|
268
|
-
<line num="
|
|
269
|
-
<line num="
|
|
270
|
-
<line num="
|
|
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="
|
|
273
|
-
<line num="
|
|
274
|
-
<line num="
|
|
275
|
-
<line num="
|
|
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"/>
|