@speclynx/apidom-parser-adapter-json-schema-json-2020-12 4.0.3 → 4.0.4

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": "@speclynx/apidom-parser-adapter-json-schema-json-2020-12",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Parser adapter for parsing JSON documents into JSON Schema 2020-12 namespace.",
5
5
  "keywords": [
6
6
  "apidom",
@@ -54,15 +54,16 @@
54
54
  "license": "Apache-2.0",
55
55
  "dependencies": {
56
56
  "@babel/runtime-corejs3": "^7.28.4",
57
- "@speclynx/apidom-core": "4.0.3",
58
- "@speclynx/apidom-datamodel": "4.0.3",
59
- "@speclynx/apidom-ns-json-schema-2020-12": "4.0.3",
60
- "@speclynx/apidom-parser-adapter-json": "4.0.3",
57
+ "@speclynx/apidom-core": "4.0.4",
58
+ "@speclynx/apidom-datamodel": "4.0.4",
59
+ "@speclynx/apidom-ns-json-schema-2020-12": "4.0.4",
60
+ "@speclynx/apidom-parser-adapter-json": "4.0.4",
61
61
  "ramda": "~0.32.0",
62
62
  "ramda-adjunct": "^6.0.0"
63
63
  },
64
64
  "files": [
65
- "src/",
65
+ "src/**/*.mjs",
66
+ "src/**/*.cjs",
66
67
  "dist/",
67
68
  "types/apidom-parser-adapter-json-schema-json-2020-12.d.ts",
68
69
  "LICENSES",
@@ -70,5 +71,5 @@
70
71
  "README.md",
71
72
  "CHANGELOG.md"
72
73
  ],
73
- "gitHead": "6ccfa09c02232516215e7de3ead276641957e626"
74
+ "gitHead": "a06f6ef3d37ad5bf860cbbf4b442bfbe3a522cc2"
74
75
  }
package/src/adapter.ts DELETED
@@ -1,59 +0,0 @@
1
- import { propOr, omit } from 'ramda';
2
- import { isNotUndefined } from 'ramda-adjunct';
3
- import { ParseResultElement, Namespace } from '@speclynx/apidom-datamodel';
4
- import {
5
- parse as parseJSON,
6
- detect as detectJSON,
7
- type ParseDetectOptions,
8
- type ParseOptions as ParseOptionsJSON,
9
- } from '@speclynx/apidom-parser-adapter-json';
10
- import jsonSchemaNamespace, { refractJSONSchema } from '@speclynx/apidom-ns-json-schema-2020-12';
11
-
12
- export { default as mediaTypes } from './media-types.ts';
13
-
14
- /**
15
- * @public
16
- */
17
- export const detectionRegExp =
18
- /"\$schema"\s*:\s*"https:\/\/json-schema\.org\/draft\/(?<version_json>2020-12)\/schema"/;
19
-
20
- /**
21
- * @public
22
- */
23
- export const detect: typeof detectJSON = async (
24
- source: string,
25
- options: ParseDetectOptions = {},
26
- ): Promise<boolean> => detectionRegExp.test(source) && (await detectJSON(source, options));
27
-
28
- /**
29
- * @public
30
- */
31
- export interface ParseOptions extends ParseOptionsJSON {
32
- refractorOpts?: Record<string, unknown>;
33
- }
34
-
35
- /**
36
- * @public
37
- */
38
- export const parse: typeof parseJSON = async (
39
- source: string,
40
- options: ParseOptions = {},
41
- ): Promise<ParseResultElement> => {
42
- const refractorOpts: Record<string, unknown> = propOr({}, 'refractorOpts', options);
43
- const parserOpts = omit(['refractorOpts'], options);
44
- const parseResultElement = await parseJSON(source, parserOpts);
45
- const { result } = parseResultElement;
46
-
47
- if (isNotUndefined(result)) {
48
- const jsonSchemaElement = refractJSONSchema(result, { consume: true, ...refractorOpts });
49
- jsonSchemaElement.classes.push('result');
50
- parseResultElement.replaceResult(jsonSchemaElement);
51
- }
52
-
53
- return parseResultElement;
54
- };
55
-
56
- /**
57
- * @public
58
- */
59
- export const namespace = new Namespace().use(jsonSchemaNamespace);
@@ -1,11 +0,0 @@
1
- import { mediaTypes, JSONSchema202012MediaTypes } from '@speclynx/apidom-ns-json-schema-2020-12';
2
-
3
- /**
4
- * @public
5
- */
6
- const jsonMediaTypes = new JSONSchema202012MediaTypes(
7
- ...mediaTypes.filterByFormat('generic'),
8
- ...mediaTypes.filterByFormat('json'),
9
- );
10
-
11
- export default jsonMediaTypes;