@contractkit/plugin-typescript 0.23.1 → 0.25.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/plugin-typescript@0.23.1 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
2
+ > @contractkit/plugin-typescript@0.25.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
3
3
  > eslint --max-warnings=0 && pnpm run build
4
4
 
5
5
 
6
- > @contractkit/plugin-typescript@0.23.1 build /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
6
+ > @contractkit/plugin-typescript@0.25.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
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 149.66 KB
15
- ESM dist/index.js.map 326.35 KB
16
- ESM ⚡️ Build success in 367ms
14
+ ESM dist/index.js 149.94 KB
15
+ ESM dist/index.js.map 327.66 KB
16
+ ESM ⚡️ Build success in 449ms
17
17
  DTS Build start
18
- DTS ⚡️ Build success in 6065ms
18
+ DTS ⚡️ Build success in 5889ms
19
19
  DTS dist/index.d.ts 1.82 KB
@@ -1,31 +1,31 @@
1
1
 
2
- > @contractkit/plugin-typescript@0.23.1 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
2
+ > @contractkit/plugin-typescript@0.25.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
3
3
  > vitest run --coverage
4
4
 
5
5
 
6
6
   RUN  v4.1.5 /home/runner/work/ContractKit/ContractKit/packages/plugin-typescript
7
7
  Coverage enabled with v8
8
8
 
9
- ✓ tests/codegen-contract.test.ts (125 tests) 78ms
10
- ✓ tests/codegen-sdk.test.ts (132 tests) 128ms
11
- ✓ tests/codegen-operation.test.ts (88 tests) 109ms
12
- ✓ tests/codegen-plain-types.test.ts (61 tests) 62ms
13
- ✓ tests/codegen-server.test.ts (19 tests) 88ms
14
- ✓ tests/pipeline.test.ts (25 tests) 277ms
9
+ ✓ tests/codegen-operation.test.ts (88 tests) 149ms
10
+ ✓ tests/codegen-contract.test.ts (127 tests) 132ms
11
+ ✓ tests/codegen-sdk.test.ts (132 tests) 175ms
12
+ ✓ tests/codegen-plain-types.test.ts (61 tests) 34ms
13
+ ✓ tests/pipeline.test.ts (25 tests) 199ms
14
+ ✓ tests/codegen-server.test.ts (19 tests) 67ms
15
15
 
16
16
   Test Files  6 passed (6)
17
-  Tests  450 passed (450)
18
-  Start at  14:28:27
19
-  Duration  6.25s (transform 3.59s, setup 0ms, import 11.84s, tests 741ms, environment 3ms)
17
+  Tests  452 passed (452)
18
+  Start at  17:08:46
19
+  Duration  6.33s (transform 4.31s, setup 0ms, import 12.82s, tests 757ms, environment 9ms)
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 | 79.97 | 75.13 | 83.5 | 82.58 |
26
- src | 79.75 | 74.81 | 83.06 | 82.34 |
27
- ...n-contract.ts | 87.85 | 82.2 | 90.08 | 88.98 | ...1070,1075-1076
28
- ...-operation.ts | 78.13 | 74.26 | 77.77 | 79.69 | ...69-680,685-686
25
+ All files | 80.01 | 75.28 | 83.5 | 82.62 |
26
+ src | 79.79 | 74.96 | 83.06 | 82.38 |
27
+ ...n-contract.ts | 87.92 | 82.7 | 90.08 | 89.06 | ...1085,1090-1091
28
+ ...-operation.ts | 78.18 | 74.26 | 77.77 | 79.75 | ...75-686,691-692
29
29
  ...lain-types.ts | 89.08 | 78.37 | 96.66 | 92.3 | ...31,243,249,301
30
30
  codegen-sdk.ts | 88.09 | 82.56 | 87.32 | 91.32 | ...1108-1109,1112
31
31
  index.ts | 60.23 | 47.91 | 63.04 | 65.37 | ...08-811,827-846
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # @contractkit/contractkit-plugin-typescript
2
2
 
3
+ ## 0.25.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.24.0
46
+
47
+ ### Minor Changes
48
+
49
+ - 27521cc: Preserve the optional-field modality through `format(input=...)` / `format(output=...)` transforms. Optional fields are now emitted with a conditional spread (`...(data.x !== undefined ? { k: data.x } : {})` for output, `... != null` for input) so the inferred `z.input` / `z.output` type widens the property to `k?: T` instead of required-nullable `k: T | undefined`. Consumer code that constructs values with `...(x ? { k: x } : {})` is now assignable to the schema's inferred type. Runtime wire output is unchanged.
50
+
3
51
  ## 0.23.1
4
52
 
5
53
  ### Patch Changes