@khanacademy/perseus-core 18.0.0 → 18.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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Result } from "./result";
|
|
2
2
|
import type { PerseusItem, PerseusArticle } from "../data-schema";
|
|
3
|
+
import type { UserInputMap } from "../validation.types";
|
|
3
4
|
/**
|
|
4
5
|
* Helper to parse PerseusItem JSON
|
|
5
6
|
* Why not just use JSON.parse? We want:
|
|
@@ -44,3 +45,14 @@ export declare function parseAndMigratePerseusItem(data: unknown): Result<Perseu
|
|
|
44
45
|
* @throws SyntaxError if the argument is not well-formed JSON.
|
|
45
46
|
*/
|
|
46
47
|
export declare function parseAndMigratePerseusArticle(data: unknown): Result<PerseusArticle, ParseFailureDetail>;
|
|
48
|
+
/**
|
|
49
|
+
* Parses a UserInputMap from a plain object or JSON string, migrates old
|
|
50
|
+
* formats to the latest schema, and runtime-typechecks the result.
|
|
51
|
+
*
|
|
52
|
+
* @returns a {@link Result} of the parsed UserInputMap. If the result is a
|
|
53
|
+
* failure, it will contain an error message describing where in the tree
|
|
54
|
+
* parsing failed.
|
|
55
|
+
* @throws SyntaxError if the argument is a string that is not well-formed
|
|
56
|
+
* JSON.
|
|
57
|
+
*/
|
|
58
|
+
export declare function parseAndMigrateUserInputMap(data: unknown): Result<UserInputMap, ParseFailureDetail>;
|