@flock/wirespec 0.16.4 → 0.16.6
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/clikt-clikt.mjs +1148 -1148
- package/colormath-root-colormath.mjs +418 -418
- package/kotlin-kotlin-stdlib.mjs +29 -29
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-rgxgen.mjs +1766 -1766
- package/kotlinx-io-kotlinx-io-core.mjs +373 -373
- package/markdown.mjs +1829 -1829
- package/mordant-mordant.mjs +1582 -1582
- package/package.json +5 -1
- package/wirespec-fetch.mjs +3 -2
- package/wirespec-serialization.d.ts +3 -0
- package/wirespec-serialization.mjs +17 -0
- package/wirespec-src-compiler-core.mjs +2938 -6444
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +1003 -0
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-kotlin.mjs +844 -0
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-python.mjs +1004 -0
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-typescript.mjs +958 -0
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-wirespec.mjs +390 -0
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -0
- package/wirespec-src-compiler-lib.mjs +314 -314
- package/wirespec-src-compiler-lib.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +292 -292
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +354 -354
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +331 -319
- package/wirespec-src-plugin-arguments.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +87 -121
- package/wirespec-src-plugin-cli.mjs.map +1 -1
- package/wirespec-src-plugin-npm.d.ts +6 -2
- package/wirespec-src-plugin-npm.mjs +46 -28
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +25 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flock/wirespec",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.6",
|
|
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": {
|
package/wirespec-fetch.mjs
CHANGED
|
@@ -13,9 +13,10 @@ export async function wirespecFetch(req, handler) {
|
|
|
13
13
|
return `${key}=${value}`;
|
|
14
14
|
})
|
|
15
15
|
.join('&');
|
|
16
|
-
const
|
|
16
|
+
const path = req.path
|
|
17
17
|
.map(segment => encodeURIComponent(segment))
|
|
18
|
-
.join('/')
|
|
18
|
+
.join('/')
|
|
19
|
+
const url = `/${path}${query ? `?${query}` : ''}`;
|
|
19
20
|
const init = {method: req.method, body, headers: {...req.headers, ...contentHeader}}
|
|
20
21
|
const res = handler ? await handler(url, init) : await fetch(url, init)
|
|
21
22
|
const contentType = res.headers.get('Content-Type');
|
|
@@ -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
|
+
};
|