@asyncapi/converter 1.0.0 → 1.2.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 +11 -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,11 @@ 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,
|
|
32
|
+
'2.6.0': from__2_5_0__to__2_6_0,
|
|
31
33
|
};
|
|
32
34
|
const conversionVersions = Object.keys(conversions);
|
|
33
|
-
function convert(asyncapi, version, options = {}) {
|
|
35
|
+
function convert(asyncapi, version = '2.6.0', options = {}) {
|
|
34
36
|
const { format, document } = (0, utils_1.serializeInput)(asyncapi);
|
|
35
37
|
const asyncapiVersion = document.asyncapi;
|
|
36
38
|
let fromVersion = conversionVersions.indexOf(asyncapiVersion);
|
|
@@ -190,3 +192,11 @@ function from__2_3_0__to__2_4_0(asyncapi, _) {
|
|
|
190
192
|
asyncapi.asyncapi = '2.4.0';
|
|
191
193
|
return asyncapi;
|
|
192
194
|
}
|
|
195
|
+
function from__2_4_0__to__2_5_0(asyncapi, _) {
|
|
196
|
+
asyncapi.asyncapi = '2.5.0';
|
|
197
|
+
return asyncapi;
|
|
198
|
+
}
|
|
199
|
+
function from__2_5_0__to__2_6_0(asyncapi, _) {
|
|
200
|
+
asyncapi.asyncapi = '2.6.0';
|
|
201
|
+
return asyncapi;
|
|
202
|
+
}
|
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' | '2.6.0';
|
|
5
5
|
export interface ConvertOptions {
|
|
6
6
|
}
|