@contractkit/plugin-bruno 0.9.1

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.
@@ -0,0 +1,116 @@
1
+
2
+ <!doctype html>
3
+ <html lang="en">
4
+
5
+ <head>
6
+ <title>Code coverage report for tests</title>
7
+ <meta charset="utf-8" />
8
+ <link rel="stylesheet" href="../prettify.css" />
9
+ <link rel="stylesheet" href="../base.css" />
10
+ <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <style type='text/css'>
13
+ .coverage-summary .sorter {
14
+ background-image: url(../sort-arrow-sprite.png);
15
+ }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <div class='wrapper'>
21
+ <div class='pad1'>
22
+ <h1><a href="../index.html">All files</a> tests</h1>
23
+ <div class='clearfix'>
24
+
25
+ <div class='fl pad1y space-right2'>
26
+ <span class="strong">68.18% </span>
27
+ <span class="quiet">Statements</span>
28
+ <span class='fraction'>30/44</span>
29
+ </div>
30
+
31
+
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">67.74% </span>
34
+ <span class="quiet">Branches</span>
35
+ <span class='fraction'>21/31</span>
36
+ </div>
37
+
38
+
39
+ <div class='fl pad1y space-right2'>
40
+ <span class="strong">72% </span>
41
+ <span class="quiet">Functions</span>
42
+ <span class='fraction'>18/25</span>
43
+ </div>
44
+
45
+
46
+ <div class='fl pad1y space-right2'>
47
+ <span class="strong">71.05% </span>
48
+ <span class="quiet">Lines</span>
49
+ <span class='fraction'>27/38</span>
50
+ </div>
51
+
52
+
53
+ </div>
54
+ <p class="quiet">
55
+ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
+ </p>
57
+ <template id="filterTemplate">
58
+ <div class="quiet">
59
+ Filter:
60
+ <input type="search" id="fileSearch">
61
+ </div>
62
+ </template>
63
+ </div>
64
+ <div class='status-line medium'></div>
65
+ <div class="pad1">
66
+ <table class="coverage-summary">
67
+ <thead>
68
+ <tr>
69
+ <th data-col="file" data-fmt="html" data-html="true" class="file">File</th>
70
+ <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th>
71
+ <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th>
72
+ <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th>
73
+ <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th>
74
+ <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th>
75
+ <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th>
76
+ <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th>
77
+ <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th>
78
+ <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th>
79
+ </tr>
80
+ </thead>
81
+ <tbody><tr>
82
+ <td class="file medium" data-value="helpers.ts"><a href="helpers.ts.html">helpers.ts</a></td>
83
+ <td data-value="68.18" class="pic medium">
84
+ <div class="chart"><div class="cover-fill" style="width: 68%"></div><div class="cover-empty" style="width: 32%"></div></div>
85
+ </td>
86
+ <td data-value="68.18" class="pct medium">68.18%</td>
87
+ <td data-value="44" class="abs medium">30/44</td>
88
+ <td data-value="67.74" class="pct medium">67.74%</td>
89
+ <td data-value="31" class="abs medium">21/31</td>
90
+ <td data-value="72" class="pct medium">72%</td>
91
+ <td data-value="25" class="abs medium">18/25</td>
92
+ <td data-value="71.05" class="pct medium">71.05%</td>
93
+ <td data-value="38" class="abs medium">27/38</td>
94
+ </tr>
95
+
96
+ </tbody>
97
+ </table>
98
+ </div>
99
+ <div class='push'></div><!-- for sticky footer -->
100
+ </div><!-- /wrapper -->
101
+ <div class='footer quiet pad2 space-top1 center small'>
102
+ Code coverage generated by
103
+ <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
104
+ at 2026-04-29T12:51:10.099Z
105
+ </div>
106
+ <script src="../prettify.js"></script>
107
+ <script>
108
+ window.onload = function () {
109
+ prettyPrint();
110
+ };
111
+ </script>
112
+ <script src="../sorter.js"></script>
113
+ <script src="../block-navigation.js"></script>
114
+ </body>
115
+ </html>
116
+
@@ -0,0 +1,50 @@
1
+ import type { OpRootNode, ContractRootNode } from '@contractkit/core';
2
+ export interface OpenCollectionFile {
3
+ relativePath: string;
4
+ content: string;
5
+ }
6
+ /** Manifest filename — tracks which files this plugin previously generated so subsequent runs can clean up only those, leaving any user-added files alone. */
7
+ export declare const MANIFEST_FILENAME = ".contractkit-bruno-manifest.json";
8
+ /** Subset of a security scheme sufficient for Bruno auth generation (non-HMAC). */
9
+ export interface BrunoSecurityScheme {
10
+ type: string;
11
+ scheme?: string;
12
+ name?: string;
13
+ in?: string;
14
+ }
15
+ export interface BrunoAuthOptions {
16
+ /** Name of the default scheme (from config.security.default) */
17
+ defaultScheme?: string;
18
+ /** Scheme definitions keyed by name (non-HMAC only) */
19
+ schemes?: Record<string, BrunoSecurityScheme>;
20
+ }
21
+ export interface OpenCollectionOptions {
22
+ collectionName: string;
23
+ contractRoots?: ContractRootNode[];
24
+ auth?: BrunoAuthOptions;
25
+ /**
26
+ * When true, emit Bruno faker template strings (e.g. `{{$randomUUID}}`,
27
+ * `{{$randomEmail}}`) for compatible scalar types so each send produces
28
+ * fresh data. When false (default), use deterministic placeholders.
29
+ */
30
+ randomExamples?: boolean;
31
+ /**
32
+ * Whether to generate request files for operations marked `internal`. Defaults to
33
+ * `true` — Bruno collections are typically used by the team that owns the API and
34
+ * benefit from full coverage. Set to `false` to omit internal ops.
35
+ */
36
+ includeInternal?: boolean;
37
+ }
38
+ /**
39
+ * Generates an OpenCollection (https://spec.opencollection.com/) API collection
40
+ * from a set of operation roots. Produces opencollection.yml, an environment
41
+ * file, and one .yml request file per operation.
42
+ */
43
+ export declare function generateOpenCollection(roots: OpRootNode[], options: OpenCollectionOptions): OpenCollectionFile[];
44
+ /** Parse a previously-written manifest. Returns the list of relative paths to clean up. Returns [] if missing or unreadable so a stale/garbled manifest never blocks regeneration. */
45
+ export declare function parseManifest(content: string): string[];
46
+ /** Convert "Create an Offer" → create-an-offer (for .yml file names) */
47
+ export declare function slugifyName(name: string): string;
48
+ /** Convert /users/{id}/posts → users-id-posts (for .yml file names) */
49
+ export declare function sanitizePath(path: string): string;
50
+ //# sourceMappingURL=codegen-bruno.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codegen-bruno.d.ts","sourceRoot":"","sources":["../src/codegen-bruno.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,UAAU,EAMV,gBAAgB,EAGnB,MAAM,mBAAmB,CAAC;AAI3B,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,8JAA8J;AAC9J,eAAO,MAAM,iBAAiB,qCAAqC,CAAC;AAEpE,mFAAmF;AACnF,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC7B,gEAAgE;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;CACjD;AAED,MAAM,WAAW,qBAAqB;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,qBAAqB,GAAG,kBAAkB,EAAE,CAmDhH;AAED,sLAAsL;AACtL,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAUvD;AAybD,wEAAwE;AACxE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMhD;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASjD"}
@@ -0,0 +1,32 @@
1
+ import type { BrunoSecurityScheme } from './codegen-bruno.js';
2
+ import type { ContractKitPlugin } from '@contractkit/core';
3
+ export interface BrunoPluginConfig {
4
+ baseDir?: string;
5
+ output?: string;
6
+ collectionName?: string;
7
+ /**
8
+ * When true (default), example values use Bruno's faker templates
9
+ * (`{{$randomUUID}}`, `{{$randomEmail}}`, etc.) so each send produces
10
+ * fresh data. Set to false for deterministic placeholders.
11
+ */
12
+ randomExamples?: boolean;
13
+ /**
14
+ * Whether to generate request files for operations marked `internal`. Defaults to
15
+ * `true` — Bruno collections are typically used by the team that owns the API and
16
+ * benefit from full coverage. Set to `false` to omit internal ops.
17
+ */
18
+ includeInternal?: boolean;
19
+ }
20
+ export interface BrunoPluginOptions extends BrunoPluginConfig {
21
+ auth?: {
22
+ defaultScheme: string;
23
+ schemes?: Record<string, BrunoSecurityScheme>;
24
+ };
25
+ }
26
+ declare const plugin: ContractKitPlugin;
27
+ export default plugin;
28
+ export declare function createBrunoPlugin(config: BrunoPluginConfig, rootDir: string, auth?: {
29
+ defaultScheme: string;
30
+ schemes?: Record<string, BrunoSecurityScheme>;
31
+ }): ContractKitPlugin;
32
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,WAAW,iBAAiB;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IACzD,IAAI,CAAC,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;KAAE,CAAC;CACnF;AAID,QAAA,MAAM,MAAM,EAAE,iBAsBb,CAAC;AAEF,eAAe,MAAM,CAAC;AAItB,wBAAgB,iBAAiB,CAC7B,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAA;CAAE,GAChF,iBAAiB,CAsBnB"}