@flock/wirespec 0.16.5 → 0.16.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.
Files changed (34) hide show
  1. package/clikt-clikt.mjs +1129 -1129
  2. package/colormath-root-colormath.mjs +400 -400
  3. package/kotlin-kotlin-stdlib.mjs +19 -19
  4. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  5. package/kotlin-rgxgen.mjs +1764 -1764
  6. package/kotlinx-io-kotlinx-io-core.mjs +2 -2
  7. package/markdown.mjs +1796 -1796
  8. package/mordant-mordant.mjs +1531 -1531
  9. package/package.json +5 -1
  10. package/wirespec-serialization.d.ts +3 -0
  11. package/wirespec-serialization.mjs +17 -0
  12. package/wirespec-src-compiler-core.mjs +2935 -2770
  13. package/wirespec-src-compiler-core.mjs.map +1 -1
  14. package/wirespec-src-compiler-emitters-java.mjs +176 -262
  15. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  16. package/wirespec-src-compiler-emitters-kotlin.mjs +179 -179
  17. package/wirespec-src-compiler-emitters-python.mjs +162 -162
  18. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  19. package/wirespec-src-compiler-emitters-typescript.mjs +772 -626
  20. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  21. package/wirespec-src-compiler-emitters-wirespec.mjs +57 -57
  22. package/wirespec-src-compiler-lib.mjs +312 -312
  23. package/wirespec-src-converter-avro.mjs +32 -32
  24. package/wirespec-src-converter-avro.mjs.map +1 -1
  25. package/wirespec-src-converter-openapi.mjs +197 -197
  26. package/wirespec-src-converter-openapi.mjs.map +1 -1
  27. package/wirespec-src-plugin-arguments.mjs +223 -249
  28. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  29. package/wirespec-src-plugin-cli.mjs +75 -75
  30. package/wirespec-src-plugin-npm.d.ts +1 -1
  31. package/wirespec-src-plugin-npm.mjs +12 -11
  32. package/wirespec-src-plugin-npm.mjs.map +1 -1
  33. package/wirespec-src-tools-generator.mjs +25 -25
  34. package/fetch.ts +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flock/wirespec",
3
- "version": "0.16.5",
3
+ "version": "0.16.7",
4
4
  "main": "wirespec-src-plugin-npm.mjs",
5
5
  "types": "wirespec-src-plugin-npm.d.ts",
6
6
  "devDependencies": {
@@ -25,6 +25,10 @@
25
25
  "./fetch": {
26
26
  "types": "./wirespec-fetch.d.ts",
27
27
  "default": "./wirespec-fetch.mjs"
28
+ },
29
+ "./serialization": {
30
+ "types": "./wirespec-serialization.d.ts",
31
+ "default": "./wirespec-serialization.mjs"
28
32
  }
29
33
  },
30
34
  "repository": {
@@ -0,0 +1,3 @@
1
+ export type Serialization = { serialize: <T>(typed: T) => string; deserialize: <T>(raw: string | undefined) => T }
2
+
3
+ export const wirespecSerialization: Serialization
@@ -0,0 +1,17 @@
1
+ export const wirespecSerialization = {
2
+ deserialize(raw) {
3
+ if (raw === undefined) {
4
+ return undefined;
5
+ }
6
+ if (raw.startsWith('{') && raw.endsWith('}')) return JSON.parse(raw);
7
+ if (raw.startsWith('[') && raw.endsWith(']')) return JSON.parse(raw);
8
+ return raw;
9
+ },
10
+ serialize(type) {
11
+ if (typeof type === 'string') {
12
+ return type;
13
+ }
14
+
15
+ return JSON.stringify(type);
16
+ },
17
+ };