@flock/wirespec 0.17.20 → 0.18.1-RC.2
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/arrow-arrow-annotations.mjs.map +1 -1
- package/arrow-arrow-atomic.mjs +13 -13
- package/arrow-arrow-atomic.mjs.map +1 -1
- package/arrow-arrow-core.mjs +588 -431
- package/arrow-arrow-core.mjs.map +1 -1
- package/arrow-arrow-exception-utils.mjs +30 -0
- package/arrow-arrow-exception-utils.mjs.map +1 -0
- package/clikt-clikt-mordant.mjs +318 -0
- package/clikt-clikt-mordant.mjs.map +1 -0
- package/clikt-clikt.mjs +3834 -3696
- package/clikt-clikt.mjs.map +1 -1
- package/colormath-root-colormath.mjs +619 -682
- package/colormath-root-colormath.mjs.map +1 -1
- package/kotlin-js-core.mjs +4 -0
- package/kotlin-js-core.mjs.map +1 -0
- package/kotlin-js.mjs +4 -0
- package/kotlin-js.mjs.map +1 -0
- package/kotlin-kotlin-stdlib.mjs +6284 -5825
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlin-openapi-bindings.mjs +8163 -8198
- package/kotlin-openapi-bindings.mjs.map +1 -1
- package/kotlin-plugins-js-plain-objects-runtime.mjs +4 -0
- package/kotlin-plugins-js-plain-objects-runtime.mjs.map +1 -0
- package/kotlin-rgxgen.mjs +2007 -2062
- package/kotlin-rgxgen.mjs.map +1 -1
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
- package/kotlinx-atomicfu.mjs +4 -0
- package/kotlinx-atomicfu.mjs.map +1 -0
- package/kotlinx-coroutines-core.mjs +4 -0
- package/kotlinx-coroutines-core.mjs.map +1 -0
- package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
- package/kotlinx-io-kotlinx-io-core.mjs +803 -839
- package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-core.mjs +2483 -2553
- package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-json.mjs +1861 -1928
- package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
- package/mordant-mordant-omnibus.mjs +4 -0
- package/mordant-mordant-omnibus.mjs.map +1 -0
- package/mordant-mordant.mjs +2525 -4426
- package/mordant-mordant.mjs.map +1 -1
- package/package.json +4 -7
- package/seskar-core.mjs +4 -0
- package/seskar-core.mjs.map +1 -0
- package/wirespec-bin.mjs +13 -1
- package/wirespec-fetch.d.ts +4 -1
- package/wirespec-fetch.mjs +34 -0
- package/wirespec-serialization.d.ts +13 -2
- package/wirespec-serialization.mjs +22 -1
- package/wirespec-src-compiler-core.mjs +2857 -3909
- package/wirespec-src-compiler-core.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-java.mjs +1370 -413
- package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-kotlin.mjs +1015 -337
- package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-python.mjs +1465 -387
- package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-rust.mjs +2461 -0
- package/wirespec-src-compiler-emitters-rust.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-scala.mjs +1010 -0
- package/wirespec-src-compiler-emitters-scala.mjs.map +1 -0
- package/wirespec-src-compiler-emitters-typescript.mjs +1533 -450
- package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
- package/wirespec-src-compiler-emitters-wirespec.mjs +122 -144
- package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
- package/wirespec-src-compiler-ir.mjs +17369 -0
- package/wirespec-src-compiler-ir.mjs.map +1 -0
- package/wirespec-src-compiler-lib.mjs +662 -728
- package/wirespec-src-compiler-lib.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +630 -656
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-common.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +1705 -2024
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +418 -459
- package/wirespec-src-plugin-arguments.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +367 -331
- package/wirespec-src-plugin-cli.mjs.map +1 -1
- package/{wirespec-src-plugin-npm.d.ts → wirespec-src-plugin-npm.d.mts} +247 -0
- package/wirespec-src-plugin-npm.mjs +166 -359
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +79 -106
- package/wirespec-src-tools-generator.mjs.map +1 -1
- package/arrow-arrow-continuations.mjs +0 -18
- package/arrow-arrow-continuations.mjs.map +0 -1
- package/markdown.mjs +0 -6756
- package/markdown.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flock/wirespec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.1-RC.2",
|
|
4
4
|
"main": "wirespec-src-plugin-npm.mjs",
|
|
5
|
-
"types": "wirespec-src-plugin-npm.d.
|
|
5
|
+
"types": "wirespec-src-plugin-npm.d.mts",
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"typescript": "5.
|
|
8
|
-
"source-map-support": "0.5.21"
|
|
9
|
-
},
|
|
10
|
-
"dependencies": {
|
|
11
|
-
"format-util": "^1.0.5"
|
|
7
|
+
"typescript": "5.9.3"
|
|
12
8
|
},
|
|
9
|
+
"dependencies": {},
|
|
13
10
|
"peerDependencies": {},
|
|
14
11
|
"optionalDependencies": {},
|
|
15
12
|
"bundledDependencies": [],
|
package/seskar-core.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"ignoreList":[],"x_google_ignoreList":[],"names":[],"mappings":";;"}
|
package/wirespec-bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {cli} from "./wirespec-src-plugin-
|
|
2
|
+
import {cli} from "./wirespec-src-plugin-npm.mjs";
|
|
3
3
|
|
|
4
4
|
// https://github.com/Kotlin/kotlinx-io/issues/345
|
|
5
5
|
import os from "node:os";
|
|
@@ -15,4 +15,16 @@ global.require = function require(input) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// Workaround: Clikt's ES modules have a circular dependency (clikt-core imports
|
|
19
|
+
// selfAndAncestors from clikt-mordant, while clikt-mordant imports CoreCliktCommand
|
|
20
|
+
// from clikt-core). This causes CliktCommand's prototype to chain to a stale
|
|
21
|
+
// CoreCliktCommand prototype instead of the properly initialized one.
|
|
22
|
+
import * as cliktCore from "./clikt-clikt.mjs";
|
|
23
|
+
import * as cliktMordant from "./clikt-clikt-mordant.mjs";
|
|
24
|
+
const CoreCC = Object.values(cliktCore).find(v => typeof v === 'function' && v.name === 'CoreCliktCommand');
|
|
25
|
+
const CC = Object.values(cliktMordant).find(v => typeof v === 'function' && v.name === 'CliktCommand');
|
|
26
|
+
if (CoreCC && CC && Object.getPrototypeOf(CC.prototype) !== CoreCC.prototype) {
|
|
27
|
+
Object.setPrototypeOf(CC.prototype, CoreCC.prototype);
|
|
28
|
+
}
|
|
29
|
+
|
|
18
30
|
cli(process.argv.slice(2))
|
package/wirespec-fetch.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE"
|
|
2
2
|
export type RawRequest = { method: Method, path: string[], queries: Record<string, string>, headers: Record<string, string>, body?: string }
|
|
3
|
+
export type RawRequestIr = { method: string, path: string[], queries: Record<string, string[]>, headers: Record<string, string[]>, body: Uint8Array | undefined }
|
|
3
4
|
export type RawResponse = { status: number, headers: Record<string, string>, body?: string }
|
|
5
|
+
export type RawResponseIr = { statusCode:number, headers: Record<string, string[]>, body: Uint8Array | undefined }
|
|
4
6
|
export type HandleFetch = ( path:string, init?:RequestInit) => Promise<Response>
|
|
5
7
|
|
|
6
|
-
export declare function wirespecFetch (rawRequest:RawRequest, handle?: HandleFetch): Promise<RawResponse>
|
|
8
|
+
export declare function wirespecFetch (rawRequest:(RawRequest), handle?: HandleFetch): Promise<RawResponse>
|
|
9
|
+
export declare function wirespecFetchIr (rawRequest:(RawRequestIr), handle?: HandleFetch): Promise<RawResponseIr>
|
package/wirespec-fetch.mjs
CHANGED
|
@@ -31,3 +31,37 @@ export async function wirespecFetch(req, handler) {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export async function wirespecFetchIr(req, handler) {
|
|
36
|
+
const contentHeader = req.body ? { 'Content-Type': 'application/json' } : {};
|
|
37
|
+
const body = req.body !== undefined ? req.body : undefined;
|
|
38
|
+
const query = Object.entries(req.queries)
|
|
39
|
+
.filter(([_, value]) => value !== undefined)
|
|
40
|
+
.flatMap(([key, value]) => {
|
|
41
|
+
if (value && typeof value === 'string' && value.startsWith('[') && value.endsWith(']')) {
|
|
42
|
+
const parsedValue = JSON.parse(value);
|
|
43
|
+
if (Array.isArray(parsedValue)) {
|
|
44
|
+
return parsedValue.map((item) => `${key}=${item}`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return `${key}=${value}`;
|
|
48
|
+
})
|
|
49
|
+
.join('&');
|
|
50
|
+
const path = req.path
|
|
51
|
+
.map(segment => encodeURIComponent(segment))
|
|
52
|
+
.join('/')
|
|
53
|
+
const url = `/${path}${query ? `?${query}` : ''}`;
|
|
54
|
+
const init = {method: req.method, body, headers: {...req.headers, ...contentHeader}}
|
|
55
|
+
const res = handler ? await handler(url, init) : await fetch(url, init)
|
|
56
|
+
const contentType = res.headers.get('Content-Type');
|
|
57
|
+
const contentLength = res.headers.get('Content-Length');
|
|
58
|
+
return {
|
|
59
|
+
statusCode: res.status,
|
|
60
|
+
headers: {
|
|
61
|
+
...[...res.headers.entries()].reduce((acc, [key, value]) => ({...acc, [key]: [value]}), {}),
|
|
62
|
+
'Content-Type': [contentType],
|
|
63
|
+
},
|
|
64
|
+
body: contentLength !== '0' && contentType ? await res.text() : undefined,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Type = string
|
|
2
2
|
|
|
3
|
-
export
|
|
3
|
+
export interface Serialization {
|
|
4
|
+
serialize<T>(typed: T): string;
|
|
5
|
+
deserialize<T>(raw: string | undefined): T;
|
|
6
|
+
serializeBody<T>(t: T, type: Type): Uint8Array;
|
|
7
|
+
deserializeBody<T>(raw: Uint8Array, type: Type): T;
|
|
8
|
+
serializePath<T>(t: T, type: Type): string;
|
|
9
|
+
deserializePath<T>(raw: string, type: Type): T;
|
|
10
|
+
serializeParam<T>(value: T, type: Type): string[];
|
|
11
|
+
deserializeParam<T>(values: string[], type: Type): T;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export declare const wirespecSerialization: Serialization
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
const encoder = new TextEncoder();
|
|
2
|
+
const decoder = new TextDecoder();
|
|
3
|
+
|
|
1
4
|
export const wirespecSerialization = {
|
|
2
5
|
deserialize(raw) {
|
|
3
6
|
if (raw === undefined) {
|
|
@@ -14,4 +17,22 @@ export const wirespecSerialization = {
|
|
|
14
17
|
|
|
15
18
|
return JSON.stringify(type);
|
|
16
19
|
},
|
|
17
|
-
|
|
20
|
+
serializeBody(t, _type) {
|
|
21
|
+
return encoder.encode(JSON.stringify(t));
|
|
22
|
+
},
|
|
23
|
+
deserializeBody(raw, _type) {
|
|
24
|
+
return JSON.parse(decoder.decode(raw));
|
|
25
|
+
},
|
|
26
|
+
serializePath(t, _type) {
|
|
27
|
+
return String(t);
|
|
28
|
+
},
|
|
29
|
+
deserializePath(raw, _type) {
|
|
30
|
+
return raw;
|
|
31
|
+
},
|
|
32
|
+
serializeParam(value, _type) {
|
|
33
|
+
return Array.isArray(value) ? value.map(String) : [String(value)];
|
|
34
|
+
},
|
|
35
|
+
deserializeParam(values, _type) {
|
|
36
|
+
return values[0];
|
|
37
|
+
},
|
|
38
|
+
};
|