scjson 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -29,4 +29,26 @@ scjson xml path/to/machine.scjson
29
29
  scjson validate path/to/dir -r
30
30
  ```
31
31
 
32
+ ### Other Resources
33
+ github: [https://github.com/SoftOboros/scjson]
34
+ ```bash
35
+ git clone https://github.com/SoftOboros/scjson.git
36
+
37
+ git clone git@github.com:SoftOboros/scjson.git
38
+
39
+ gh repo clone SoftOboros/scjson
40
+ ```
41
+
42
+ pypi: [https://www.npmjs.com/package/scjson]
43
+ ```bash
44
+ npm install scjson
45
+ ```
46
+
47
+ dockerhub: [https://hub.docker.com/r/iraa/scjson]
48
+ (Full development environment for all supported languages)
49
+ ```bash
50
+ docker pull iraa/scjson:latest
51
+ ```
52
+
53
+
32
54
  All source code in this directory is released under the BSD\u00A01-Clause license. See `LICENSE` and `LEGAL.md` for details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scjson",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "A JSON-based serialization of SCXML (State Chart XML) for modern tooling, interoperability, and education.",
5
5
  "keywords": [
6
6
  "scjson",
@@ -27,21 +27,29 @@
27
27
  "engines": {
28
28
  "node": ">=18"
29
29
  },
30
+ "main": "index.js",
31
+ "type": "commonjs",
32
+ "exports": {
33
+ ".": "./index.js",
34
+ "./browser": "./browser.mjs"
35
+ },
36
+ "typesVersions": {
37
+ "*": {
38
+ "browser": [
39
+ "/types/scjson-browser.d.ts"
40
+ ]
41
+ }
42
+ },
30
43
  "files": [
31
44
  "bin/",
32
45
  "index.js",
33
46
  "browser.mjs",
47
+ "types/scjson-browser.d.ts",
34
48
  "tests/",
35
49
  "README.md",
36
50
  "LEGAL.md",
37
51
  "LICENSE"
38
- ],
39
- "main": "index.js",
40
- "type": "commonjs",
41
- "exports": {
42
- ".": "./index.js",
43
- "./browser": "./browser.mjs"
44
- },
52
+ ],
45
53
  "module": "./browser.mjs",
46
54
  "browser": "./browser.mjs",
47
55
  "publishConfig": {
@@ -58,6 +66,7 @@
58
66
  "fast-xml-parser": "^5.2.5"
59
67
  },
60
68
  "devDependencies": {
61
- "jest": "^30.0.4"
69
+ "jest": "^30.0.4",
70
+ "typescript": "^5.8.3"
62
71
  }
63
72
  }
@@ -0,0 +1,25 @@
1
+ declare module 'scjson/browser' {
2
+ /**
3
+ * Recursively removes nulls, empty arrays/objects, and empty strings from a value.
4
+ * @param value Any input value (array, object, scalar).
5
+ * @returns Sanitized value or `undefined`.
6
+ */
7
+ export function removeEmpty(value: any): any;
8
+
9
+ /**
10
+ * Converts SCXML (as XML string) to SCJSON (as JSON string).
11
+ * @param xmlStr SCXML input as string.
12
+ * @param omitEmpty Optional: if true, removes empty/null fields (default: true).
13
+ * @returns Validated SCJSON as pretty-printed JSON string.
14
+ * @throws Error if validation fails.
15
+ */
16
+ export function xmlToJson(xmlStr: string, omitEmpty?: boolean): string;
17
+
18
+ /**
19
+ * Converts SCJSON (as JSON string) to SCXML (as XML string).
20
+ * @param jsonStr SCJSON input as string.
21
+ * @returns Valid SCXML string.
22
+ * @throws Error if validation fails.
23
+ */
24
+ export function jsonToXml(jsonStr: string): string;
25
+ }