@backstage/repo-tools 0.5.0 → 0.5.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @backstage/repo-tools
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f1dc48e: Updated the OpenAPI template to export the `TypedResponse` interface so that client code can leverage it
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-common@0.20.1
|
|
10
|
+
|
|
3
11
|
## 0.5.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/index.cjs.js
CHANGED
package/package.json
CHANGED
|
@@ -9,7 +9,12 @@ import * as parser from 'uri-template';
|
|
|
9
9
|
import { {{classname}} } from '{{filename}}.model{{importFileExtension}}';
|
|
10
10
|
{{/imports}}
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Wraps the Response type to convey a type on the json call.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export type TypedResponse<T> = Omit<Response, 'json'> & {
|
|
13
18
|
json: () => Promise<T>;
|
|
14
19
|
};
|
|
15
20
|
|
|
@@ -84,9 +89,9 @@ export class {{classname}}Client {
|
|
|
84
89
|
options?: RequestOptions
|
|
85
90
|
): Promise<TypedResponse<{{{returnType}}} {{^returnType}}void{{/returnType}}>> {
|
|
86
91
|
const baseUrl = await this.discoveryApi.getBaseUrl(pluginId);
|
|
87
|
-
|
|
92
|
+
|
|
88
93
|
const uriTemplate = `{{{path}}}{{#hasQueryParams}}{?{{#queryParams}}{{baseName}}{{#isArray}}{{#isExplode}}*{{/isExplode}}{{/isArray}}{{^-last}},{{/-last}}{{/queryParams}}}{{/hasQueryParams}}`;
|
|
89
|
-
|
|
94
|
+
|
|
90
95
|
const uri = parser.parse(uriTemplate).expand({
|
|
91
96
|
{{#pathParams}}
|
|
92
97
|
{{baseName}}: request.path.{{paramName}},
|