@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.
Files changed (87) hide show
  1. package/arrow-arrow-annotations.mjs.map +1 -1
  2. package/arrow-arrow-atomic.mjs +13 -13
  3. package/arrow-arrow-atomic.mjs.map +1 -1
  4. package/arrow-arrow-core.mjs +588 -431
  5. package/arrow-arrow-core.mjs.map +1 -1
  6. package/arrow-arrow-exception-utils.mjs +30 -0
  7. package/arrow-arrow-exception-utils.mjs.map +1 -0
  8. package/clikt-clikt-mordant.mjs +318 -0
  9. package/clikt-clikt-mordant.mjs.map +1 -0
  10. package/clikt-clikt.mjs +3834 -3696
  11. package/clikt-clikt.mjs.map +1 -1
  12. package/colormath-root-colormath.mjs +619 -682
  13. package/colormath-root-colormath.mjs.map +1 -1
  14. package/kotlin-js-core.mjs +4 -0
  15. package/kotlin-js-core.mjs.map +1 -0
  16. package/kotlin-js.mjs +4 -0
  17. package/kotlin-js.mjs.map +1 -0
  18. package/kotlin-kotlin-stdlib.mjs +6284 -5825
  19. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  20. package/kotlin-openapi-bindings.mjs +8163 -8198
  21. package/kotlin-openapi-bindings.mjs.map +1 -1
  22. package/kotlin-plugins-js-plain-objects-runtime.mjs +4 -0
  23. package/kotlin-plugins-js-plain-objects-runtime.mjs.map +1 -0
  24. package/kotlin-rgxgen.mjs +2007 -2062
  25. package/kotlin-rgxgen.mjs.map +1 -1
  26. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
  27. package/kotlinx-atomicfu.mjs +4 -0
  28. package/kotlinx-atomicfu.mjs.map +1 -0
  29. package/kotlinx-coroutines-core.mjs +4 -0
  30. package/kotlinx-coroutines-core.mjs.map +1 -0
  31. package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
  32. package/kotlinx-io-kotlinx-io-core.mjs +803 -839
  33. package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
  34. package/kotlinx-serialization-kotlinx-serialization-core.mjs +2483 -2553
  35. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  36. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1861 -1928
  37. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  38. package/mordant-mordant-omnibus.mjs +4 -0
  39. package/mordant-mordant-omnibus.mjs.map +1 -0
  40. package/mordant-mordant.mjs +2525 -4426
  41. package/mordant-mordant.mjs.map +1 -1
  42. package/package.json +4 -7
  43. package/seskar-core.mjs +4 -0
  44. package/seskar-core.mjs.map +1 -0
  45. package/wirespec-bin.mjs +13 -1
  46. package/wirespec-fetch.d.ts +4 -1
  47. package/wirespec-fetch.mjs +34 -0
  48. package/wirespec-serialization.d.ts +13 -2
  49. package/wirespec-serialization.mjs +22 -1
  50. package/wirespec-src-compiler-core.mjs +2857 -3909
  51. package/wirespec-src-compiler-core.mjs.map +1 -1
  52. package/wirespec-src-compiler-emitters-java.mjs +1370 -413
  53. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  54. package/wirespec-src-compiler-emitters-kotlin.mjs +1015 -337
  55. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  56. package/wirespec-src-compiler-emitters-python.mjs +1465 -387
  57. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  58. package/wirespec-src-compiler-emitters-rust.mjs +2461 -0
  59. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -0
  60. package/wirespec-src-compiler-emitters-scala.mjs +1010 -0
  61. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -0
  62. package/wirespec-src-compiler-emitters-typescript.mjs +1533 -450
  63. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  64. package/wirespec-src-compiler-emitters-wirespec.mjs +122 -144
  65. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  66. package/wirespec-src-compiler-ir.mjs +17369 -0
  67. package/wirespec-src-compiler-ir.mjs.map +1 -0
  68. package/wirespec-src-compiler-lib.mjs +662 -728
  69. package/wirespec-src-compiler-lib.mjs.map +1 -1
  70. package/wirespec-src-converter-avro.mjs +630 -656
  71. package/wirespec-src-converter-avro.mjs.map +1 -1
  72. package/wirespec-src-converter-common.mjs.map +1 -1
  73. package/wirespec-src-converter-openapi.mjs +1705 -2024
  74. package/wirespec-src-converter-openapi.mjs.map +1 -1
  75. package/wirespec-src-plugin-arguments.mjs +418 -459
  76. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  77. package/wirespec-src-plugin-cli.mjs +367 -331
  78. package/wirespec-src-plugin-cli.mjs.map +1 -1
  79. package/{wirespec-src-plugin-npm.d.ts → wirespec-src-plugin-npm.d.mts} +247 -0
  80. package/wirespec-src-plugin-npm.mjs +166 -359
  81. package/wirespec-src-plugin-npm.mjs.map +1 -1
  82. package/wirespec-src-tools-generator.mjs +79 -106
  83. package/wirespec-src-tools-generator.mjs.map +1 -1
  84. package/arrow-arrow-continuations.mjs +0 -18
  85. package/arrow-arrow-continuations.mjs.map +0 -1
  86. package/markdown.mjs +0 -6756
  87. package/markdown.mjs.map +0 -1
package/package.json CHANGED
@@ -1,15 +1,12 @@
1
1
  {
2
2
  "name": "@flock/wirespec",
3
- "version": "0.17.20",
3
+ "version": "0.18.1-RC.2",
4
4
  "main": "wirespec-src-plugin-npm.mjs",
5
- "types": "wirespec-src-plugin-npm.d.ts",
5
+ "types": "wirespec-src-plugin-npm.d.mts",
6
6
  "devDependencies": {
7
- "typescript": "5.5.4",
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": [],
@@ -0,0 +1,4 @@
1
+ //region block: pre-declaration
2
+ //endregion
3
+
4
+ //# sourceMappingURL=seskar-core.mjs.map
@@ -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-cli.mjs";
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))
@@ -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>
@@ -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 Serialization = { serialize: <T>(typed: T) => string; deserialize: <T>(raw: string | undefined) => T }
1
+ export type Type = string
2
2
 
3
- export const wirespecSerialization: Serialization
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
+ };