@contractkit/plugin-bruno 1.1.0 → 1.3.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 +15 -14
- package/CHANGELOG.md +23 -0
- package/README.md +7 -5
- package/coverage/clover.xml +339 -278
- package/coverage/coverage-final.json +3 -2
- package/coverage/index.html +21 -21
- package/coverage/src/codegen-bruno.ts.html +170 -113
- package/coverage/src/index.html +34 -19
- package/coverage/src/index.ts.html +631 -0
- package/coverage/tests/helpers.ts.html +9 -9
- package/coverage/tests/index.html +1 -1
- package/dist/codegen-bruno.d.ts.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +63 -15
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/codegen-bruno.ts +31 -12
- package/src/index.ts +30 -1
- package/tests/codegen-bruno.test.ts +92 -17
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/plugin-bruno@1.
|
|
2
|
+
> @contractkit/plugin-bruno@1.3.0 build:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
|
|
3
3
|
> eslint --max-warnings=0 && pnpm run build
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @contractkit/plugin-bruno@1.
|
|
6
|
+
> @contractkit/plugin-bruno@1.3.0 build /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
|
|
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[
|
|
15
|
-
[32mESM[39m [1mdist/index.js.map [22m[
|
|
16
|
-
[32mESM[39m ⚡️ Build success in
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m23.43 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m56.92 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 174ms
|
|
17
17
|
[34mDTS[39m Build start
|
|
18
|
-
[32mDTS[39m ⚡️ Build success in
|
|
19
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.
|
|
18
|
+
[32mDTS[39m ⚡️ Build success in 3925ms
|
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.95 KB[39m
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
|
|
2
|
-
> @contractkit/plugin-bruno@1.
|
|
2
|
+
> @contractkit/plugin-bruno@1.3.0 test:ci /home/runner/work/ContractKit/ContractKit/packages/plugin-bruno
|
|
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/packages/plugin-bruno[39m
|
|
7
7
|
[2mCoverage enabled with [22m[33mv8[39m
|
|
8
8
|
|
|
9
|
-
[32m✓[39m tests/codegen-bruno.test.ts [2m([22m[
|
|
9
|
+
[32m✓[39m tests/codegen-bruno.test.ts [2m([22m[2m108 tests[22m[2m)[22m[32m 207[2mms[22m[39m
|
|
10
10
|
|
|
11
11
|
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
12
|
-
[2m Tests [22m [1m[
|
|
13
|
-
[2m Start at [22m
|
|
14
|
-
[2m Duration [22m 5.
|
|
12
|
+
[2m Tests [22m [1m[32m108 passed[39m[22m[90m (108)[39m
|
|
13
|
+
[2m Start at [22m 12:37:07
|
|
14
|
+
[2m Duration [22m 5.13s[2m (transform 1.70s, setup 0ms, import 3.83s, tests 207ms, environment 0ms)[22m
|
|
15
15
|
|
|
16
16
|
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
17
|
-
|
|
18
|
-
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
19
|
-
|
|
20
|
-
All files |
|
|
21
|
-
src |
|
|
22
|
-
codegen-bruno.ts | 87.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
-------------------|---------|----------|---------|---------|----------------------------------------------------------------------------------------------------
|
|
18
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
19
|
+
-------------------|---------|----------|---------|---------|----------------------------------------------------------------------------------------------------
|
|
20
|
+
All files | 78.68 | 72.17 | 82.92 | 79.46 |
|
|
21
|
+
src | 79.11 | 71.65 | 85.96 | 79.52 |
|
|
22
|
+
codegen-bruno.ts | 87.31 | 76.72 | 92.15 | 88.58 | 98,337-338,422,430,483-486,493-500,520,526,530-532,548,558,582,592-594,600-602,607,611-619,628,632
|
|
23
|
+
index.ts | 26.92 | 35.89 | 33.33 | 25 | 73-178
|
|
24
|
+
tests | 75 | 77.41 | 76 | 78.94 |
|
|
25
|
+
helpers.ts | 75 | 77.41 | 76 | 78.94 | 43-47,55-59,71,113,133,145
|
|
26
|
+
-------------------|---------|----------|---------|---------|----------------------------------------------------------------------------------------------------
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @contractkit/contractkit-plugin-bruno
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- a9e9ec0: Replace per-operation `pluginFiles` with structured `pluginExtensions`. The `plugins:` block on an operation now accepts JSON-like values (string, number, boolean, null, object, array) so each plugin owns its own schema for its entry. `file://` URLs in any string position are resolved relative to the `.ck` source file before plugins run, and `http://` / `https://` URLs are fetched via GET. `op.pluginExtensions` carries the resolved tree; the raw form lives at `op.plugins`. The Bruno plugin now expects `{ template: "file://..." }` (was a bare path string) and ships a `validateBrunoExtension` hook that fails compilation on unknown fields or non-string `template`.
|
|
8
|
+
|
|
9
|
+
Plugins can now implement `validateExtension(value)` on the `ContractKitPlugin` interface to surface compilation-time errors/warnings on their entry.
|
|
10
|
+
|
|
11
|
+
All CLI caching is unified under `<rootDir>/.contractkit/cache/` via a new `CacheService` class: `build.json` for file/plugin hashes and `http/<sha256(url)>` for fetched HTTP response bodies. The `cache: string` config field is reinterpreted as a custom cache **directory** (was a custom build-cache filename); previous file paths under `.contractkit-cache` and `.contractkit-http-cache/` are abandoned. Add `.contractkit/` to `.gitignore`.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [a9e9ec0]
|
|
16
|
+
- @contractkit/core@0.14.0
|
|
17
|
+
|
|
18
|
+
## 1.2.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- e54256e: Sort the Bruno collection alphabetically during codegen.
|
|
23
|
+
|
|
24
|
+
Top-level folders now order by area name (with subarea as a tiebreaker), and requests within a folder order by request name. The emitted `seq:` numbers — which drive Bruno's UI ordering — line up with that alphabetical sort, regardless of the order the source `.ck` files declare operations.
|
|
25
|
+
|
|
3
26
|
## 1.1.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -66,18 +66,18 @@ The output directory is fully replaced on each run — stale request files from
|
|
|
66
66
|
|
|
67
67
|
## Per-operation overrides
|
|
68
68
|
|
|
69
|
-
Add a `plugins` block to any operation in a `.ck` file to deep-merge a YAML
|
|
69
|
+
Add a `plugins` block to any operation in a `.ck` file to deep-merge a YAML fragment into the generated request. The Bruno plugin reads `plugins.bruno.template`; the value is either an inline YAML string or a `file://`/`http(s)://` URL that the CLI resolves to the file/response body before the plugin runs:
|
|
70
70
|
|
|
71
71
|
```
|
|
72
72
|
post: {
|
|
73
73
|
plugins: {
|
|
74
|
-
bruno: "overrides/auth-token.yml"
|
|
74
|
+
bruno: { template: "file://overrides/auth-token.yml" }
|
|
75
75
|
}
|
|
76
76
|
response: { 200: AuthResponse }
|
|
77
77
|
}
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
The file path is relative to the `.ck` source file.
|
|
80
|
+
The `file://` path is relative to the `.ck` source file. The resolved content is deep-merged into the generated request YAML — objects recurse, arrays replace entirely:
|
|
81
81
|
|
|
82
82
|
```yaml
|
|
83
83
|
# overrides/auth-token.yml
|
|
@@ -87,7 +87,9 @@ runtime:
|
|
|
87
87
|
bru.setVar("token", bru.getEnvVar("adminToken"));
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
`validateBrunoExtension` (run during compilation) enforces the shape: the value must be an object whose only allowed key is `template: string`. Anything else fails the build with a precise error.
|
|
91
|
+
|
|
92
|
+
Authoring tip: combine per-operation `template` URLs with `{{var}}` substitution to factor out a shared override directory:
|
|
91
93
|
|
|
92
94
|
```
|
|
93
95
|
options {
|
|
@@ -96,7 +98,7 @@ options {
|
|
|
96
98
|
|
|
97
99
|
operation /payments/{id}: {
|
|
98
100
|
get: {
|
|
99
|
-
plugins: { bruno: "{{bruno}}/payments/get-payment.yml" }
|
|
101
|
+
plugins: { bruno: { template: "file://{{bruno}}/payments/get-payment.yml" } }
|
|
100
102
|
response: { 200: { application/json: Payment } }
|
|
101
103
|
}
|
|
102
104
|
}
|