@swagger-api/apidom-parser-adapter-asyncapi-json-2 1.0.0-beta.0 → 1.0.0-beta.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swagger-api/apidom-parser-adapter-asyncapi-json-2",
3
- "version": "1.0.0-beta.0",
3
+ "version": "1.0.0-beta.10",
4
4
  "description": "Parser adapter for parsing JSON documents into AsyncAPI 2.x.y namespace.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -11,11 +11,11 @@
11
11
  "unpkg": "./dist/apidom-parser-apdater-asyncapi-json-2.browser.min.js",
12
12
  "main": "./src/adapter.cjs",
13
13
  "exports": {
14
- "types": "./types/dist.d.ts",
14
+ "types": "./types/apidom-parser-adapter-asyncapi-json-2.d.ts",
15
15
  "import": "./src/adapter.mjs",
16
16
  "require": "./src/adapter.cjs"
17
17
  },
18
- "types": "./types/dist.d.ts",
18
+ "types": "./types/apidom-parser-adapter-asyncapi-json-2.d.ts",
19
19
  "scripts": {
20
20
  "build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
21
21
  "build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
@@ -25,7 +25,7 @@
25
25
  "lint:fix": "eslint ./ --fix",
26
26
  "clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' 'test/**/*.mjs' ./dist ./types",
27
27
  "typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
28
- "typescript:declaration": "tsc -p tsconfig.declaration.json && rollup -c config/rollup/types.dist.js",
28
+ "typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json",
29
29
  "test": "npm run build:es && cross-env BABEL_ENV=es babel test --out-dir test --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test mocha",
30
30
  "perf": "cross-env BABEL_ENV=es babel ./test/perf/index.ts --out-file ./test/perf/index.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs",
31
31
  "perf:lexical-analysis": "cross-env BABEL_ENV=es babel ./test/perf/lexical-analysis.ts --out-file ./test/perf/lexical-analysis.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/lexical-analysis.mjs",
@@ -43,9 +43,9 @@
43
43
  "license": "Apache-2.0",
44
44
  "dependencies": {
45
45
  "@babel/runtime-corejs3": "^7.20.7",
46
- "@swagger-api/apidom-core": "^1.0.0-beta.0",
47
- "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-beta.0",
48
- "@swagger-api/apidom-parser-adapter-json": "^1.0.0-beta.0",
46
+ "@swagger-api/apidom-core": "^1.0.0-beta.10",
47
+ "@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-beta.10",
48
+ "@swagger-api/apidom-parser-adapter-json": "^1.0.0-beta.10",
49
49
  "@types/ramda": "~0.30.0",
50
50
  "ramda": "~0.30.0",
51
51
  "ramda-adjunct": "^5.0.0"
@@ -54,11 +54,11 @@
54
54
  "src/**/*.mjs",
55
55
  "src/**/*.cjs",
56
56
  "dist/",
57
- "types/dist.d.ts",
57
+ "types/apidom-parser-adapter-asyncapi-json-2.d.ts",
58
58
  "LICENSES",
59
59
  "NOTICE",
60
60
  "README.md",
61
61
  "CHANGELOG.md"
62
62
  ],
63
- "gitHead": "ed1426743ba9d9d581146e617ec1762df670320c"
63
+ "gitHead": "ee2045e4a14214810fecb7ddaa75b1ae35daf8e4"
64
64
  }
package/src/adapter.cjs CHANGED
@@ -11,8 +11,19 @@ var _apidomParserAdapterJson = require("@swagger-api/apidom-parser-adapter-json"
11
11
  var _apidomNsAsyncapi = _interopRequireWildcard(require("@swagger-api/apidom-ns-asyncapi-2"));
12
12
  var _mediaTypes = _interopRequireDefault(require("./media-types.cjs"));
13
13
  exports.mediaTypes = _mediaTypes.default;
14
+ /**
15
+ * @public
16
+ */
14
17
  const detectionRegExp = exports.detectionRegExp = /"asyncapi"\s*:\s*"(?<version_json>2\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))"/;
18
+
19
+ /**
20
+ * @public
21
+ */
15
22
  const detect = async source => detectionRegExp.test(source) && (await (0, _apidomParserAdapterJson.detect)(source));
23
+
24
+ /**
25
+ * @public
26
+ */
16
27
  exports.detect = detect;
17
28
  const parse = async (source, options = {}) => {
18
29
  const refractorOpts = (0, _ramda.propOr)({}, 'refractorOpts', options);
@@ -28,5 +39,9 @@ const parse = async (source, options = {}) => {
28
39
  }
29
40
  return parseResultElement;
30
41
  };
42
+
43
+ /**
44
+ * @public
45
+ */
31
46
  exports.parse = parse;
32
47
  const namespace = exports.namespace = (0, _apidomCore.createNamespace)(_apidomNsAsyncapi.default);
package/src/adapter.mjs CHANGED
@@ -4,8 +4,19 @@ import { createNamespace } from '@swagger-api/apidom-core';
4
4
  import { parse as parseJSON, detect as detectJSON } from '@swagger-api/apidom-parser-adapter-json';
5
5
  import asyncApiNamespace, { AsyncApi2Element } from '@swagger-api/apidom-ns-asyncapi-2';
6
6
  export { default as mediaTypes } from "./media-types.mjs";
7
+ /**
8
+ * @public
9
+ */
7
10
  export const detectionRegExp = /"asyncapi"\s*:\s*"(?<version_json>2\.(?:[1-9]\d*|0)\.(?:[1-9]\d*|0))"/;
11
+
12
+ /**
13
+ * @public
14
+ */
8
15
  export const detect = async source => detectionRegExp.test(source) && (await detectJSON(source));
16
+
17
+ /**
18
+ * @public
19
+ */
9
20
  export const parse = async (source, options = {}) => {
10
21
  const refractorOpts = propOr({}, 'refractorOpts', options);
11
22
  const parserOpts = omit(['refractorOpts'], options);
@@ -20,4 +31,8 @@ export const parse = async (source, options = {}) => {
20
31
  }
21
32
  return parseResultElement;
22
33
  };
34
+
35
+ /**
36
+ * @public
37
+ */
23
38
  export const namespace = createNamespace(asyncApiNamespace);
@@ -3,5 +3,8 @@
3
3
  exports.__esModule = true;
4
4
  exports.default = void 0;
5
5
  var _apidomNsAsyncapi = require("@swagger-api/apidom-ns-asyncapi-2");
6
+ /**
7
+ * @public
8
+ */
6
9
  const jsonMediaTypes = new _apidomNsAsyncapi.AsyncAPIMediaTypes(..._apidomNsAsyncapi.mediaTypes.filterByFormat('generic'), ..._apidomNsAsyncapi.mediaTypes.filterByFormat('json'));
7
10
  var _default = exports.default = jsonMediaTypes;
@@ -1,3 +1,7 @@
1
1
  import { mediaTypes, AsyncAPIMediaTypes } from '@swagger-api/apidom-ns-asyncapi-2';
2
+
3
+ /**
4
+ * @public
5
+ */
2
6
  const jsonMediaTypes = new AsyncAPIMediaTypes(...mediaTypes.filterByFormat('generic'), ...mediaTypes.filterByFormat('json'));
3
7
  export default jsonMediaTypes;
@@ -0,0 +1,30 @@
1
+ import { AsyncAPIMediaTypes } from '@swagger-api/apidom-ns-asyncapi-2';
2
+ import { Namespace } from '@swagger-api/apidom-core';
3
+ import { ParseResultElement } from '@swagger-api/apidom-core';
4
+
5
+ /**
6
+ * @public
7
+ */
8
+ export declare const detect: (source: string) => Promise<boolean>;
9
+
10
+ /**
11
+ * @public
12
+ */
13
+ export declare const detectionRegExp: RegExp;
14
+
15
+ /**
16
+ * @public
17
+ */
18
+ export declare const mediaTypes: AsyncAPIMediaTypes;
19
+
20
+ /**
21
+ * @public
22
+ */
23
+ export declare const namespace: Namespace;
24
+
25
+ /**
26
+ * @public
27
+ */
28
+ export declare const parse: (source: string, options?: Record<string, unknown>) => Promise<ParseResultElement>;
29
+
30
+ export { }
package/types/dist.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import * as _swagger_api_apidom_core from '@swagger-api/apidom-core';
2
- import { ParseResultElement } from '@swagger-api/apidom-core';
3
- import { AsyncAPIMediaTypes } from '@swagger-api/apidom-ns-asyncapi-2';
4
-
5
- declare const jsonMediaTypes: AsyncAPIMediaTypes;
6
-
7
- declare const detectionRegExp: RegExp;
8
- declare const detect: (source: string) => Promise<boolean>;
9
- declare const parse: (source: string, options?: Record<string, unknown>) => Promise<ParseResultElement>;
10
- declare const namespace: _swagger_api_apidom_core.Namespace;
11
-
12
- export { detect, detectionRegExp, jsonMediaTypes as mediaTypes, namespace, parse };