@asyncapi/converter 1.0.0 → 1.1.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/lib/convert.d.ts +2 -2
- package/lib/convert.js +6 -1
- package/lib/interfaces.d.ts +1 -1
- package/package.json +1 -1
package/lib/convert.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AsyncAPIDocument, ConvertVersion, ConvertOptions } from './interfaces';
|
|
2
|
-
export declare function convert(asyncapi: string, version
|
|
3
|
-
export declare function convert(asyncapi: AsyncAPIDocument, version
|
|
2
|
+
export declare function convert(asyncapi: string, version?: ConvertVersion, options?: ConvertOptions): string;
|
|
3
|
+
export declare function convert(asyncapi: AsyncAPIDocument, version?: ConvertVersion, options?: ConvertOptions): AsyncAPIDocument;
|
package/lib/convert.js
CHANGED
|
@@ -28,9 +28,10 @@ const conversions = {
|
|
|
28
28
|
'2.2.0': from__2_1_0__to__2_2_0,
|
|
29
29
|
'2.3.0': from__2_2_0__to__2_3_0,
|
|
30
30
|
'2.4.0': from__2_3_0__to__2_4_0,
|
|
31
|
+
'2.5.0': from__2_4_0__to__2_5_0,
|
|
31
32
|
};
|
|
32
33
|
const conversionVersions = Object.keys(conversions);
|
|
33
|
-
function convert(asyncapi, version, options = {}) {
|
|
34
|
+
function convert(asyncapi, version = '2.5.0', options = {}) {
|
|
34
35
|
const { format, document } = (0, utils_1.serializeInput)(asyncapi);
|
|
35
36
|
const asyncapiVersion = document.asyncapi;
|
|
36
37
|
let fromVersion = conversionVersions.indexOf(asyncapiVersion);
|
|
@@ -190,3 +191,7 @@ function from__2_3_0__to__2_4_0(asyncapi, _) {
|
|
|
190
191
|
asyncapi.asyncapi = '2.4.0';
|
|
191
192
|
return asyncapi;
|
|
192
193
|
}
|
|
194
|
+
function from__2_4_0__to__2_5_0(asyncapi, _) {
|
|
195
|
+
asyncapi.asyncapi = '2.5.0';
|
|
196
|
+
return asyncapi;
|
|
197
|
+
}
|
package/lib/interfaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type AsyncAPIDocument = {
|
|
2
2
|
asyncapi: string;
|
|
3
3
|
} & Record<string, any>;
|
|
4
|
-
export declare type ConvertVersion = '1.1.0' | '1.2.0' | '2.0.0-rc1' | '2.0.0-rc2' | '2.0.0' | '2.1.0' | '2.2.0' | '2.3.0' | '2.4.0';
|
|
4
|
+
export declare type ConvertVersion = '1.1.0' | '1.2.0' | '2.0.0-rc1' | '2.0.0-rc2' | '2.0.0' | '2.1.0' | '2.2.0' | '2.3.0' | '2.4.0' | '2.5.0';
|
|
5
5
|
export interface ConvertOptions {
|
|
6
6
|
}
|