@flock/wirespec 0.10.16 → 0.10.18
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/package.json
CHANGED
|
@@ -2199,7 +2199,7 @@
|
|
|
2199
2199
|
return joinToString_0(filter(tmp, TypeScriptEmitter$sanitizeSymbol$lambda), '');
|
|
2200
2200
|
}
|
|
2201
2201
|
function emitClient(_this__u8e3s4, $this) {
|
|
2202
|
-
return trimMargin('\n |export const client: Wirespec.Client<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.z23(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.z23(1)) + '\n |})\n ');
|
|
2202
|
+
return trimMargin('\n |export const client: Wirespec.Client<Request, Response, Handler> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitClientTo(_this__u8e3s4, $this), Spacer_instance.z23(1)) + ',\n |' + prependIndent(emitClientFrom(_this__u8e3s4, $this), Spacer_instance.z23(1)) + '\n |})\n ');
|
|
2203
2203
|
}
|
|
2204
2204
|
function emitPathArray(_this__u8e3s4, $this) {
|
|
2205
2205
|
return joinToString(_this__u8e3s4.p23_1, ', ', '[', ']', VOID, VOID, TypeScriptEmitter$emitPathArray$lambda($this));
|
|
@@ -2224,7 +2224,7 @@
|
|
|
2224
2224
|
return trimMargin('\n |case ' + _this__u8e3s4.v23_1 + ':\n |' + Spacer_instance.z23(1) + 'return {\n |' + Spacer_instance.z23(2) + 'status: ' + _this__u8e3s4.v23_1 + ',\n |' + Spacer_instance.z23(2) + 'headers: {},\n |' + Spacer_instance.z23(2) + 'body: serialization.deserialize<' + emitReference_0(_this__u8e3s4, $this) + '>(response.body)\n |' + Spacer_instance.z23(1) + '};\n ');
|
|
2225
2225
|
}
|
|
2226
2226
|
function emitServer(_this__u8e3s4, $this) {
|
|
2227
|
-
return trimMargin('\n |export const server:Wirespec.Server<Request, Response> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.z23(1)) + ',\n |' + prependIndent(emitServerTo($this), Spacer_instance.z23(1)) + '\n |})\n ');
|
|
2227
|
+
return trimMargin('\n |export const server:Wirespec.Server<Request, Response, Handler> = (serialization: Wirespec.Serialization) => ({\n |' + prependIndent(emitServerFrom(_this__u8e3s4, $this), Spacer_instance.z23(1)) + ',\n |' + prependIndent(emitServerTo($this), Spacer_instance.z23(1)) + '\n |})\n ');
|
|
2228
2228
|
}
|
|
2229
2229
|
function emitServerFrom(_this__u8e3s4, $this) {
|
|
2230
2230
|
var tmp = Spacer_instance.z23(1);
|
|
@@ -2293,6 +2293,11 @@
|
|
|
2293
2293
|
};
|
|
2294
2294
|
}
|
|
2295
2295
|
function TypeScriptEmitter$emit$lambda_7(this$0) {
|
|
2296
|
+
return function (it) {
|
|
2297
|
+
return this$0.u24(it);
|
|
2298
|
+
};
|
|
2299
|
+
}
|
|
2300
|
+
function TypeScriptEmitter$emit$lambda_8(this$0) {
|
|
2296
2301
|
return function (it) {
|
|
2297
2302
|
return this$0.o24(it);
|
|
2298
2303
|
};
|
|
@@ -2521,11 +2526,23 @@
|
|
|
2521
2526
|
var tmp_8 = toSet(endpoint.u23_1);
|
|
2522
2527
|
var tmp_9 = joinToString(tmp_8, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_5(this));
|
|
2523
2528
|
var tmp_10 = emitFunction(first_0(endpoint.t23_1), this, endpoint);
|
|
2524
|
-
|
|
2529
|
+
var tmp_11 = joinToString(endpoint.u23_1, '\n', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_6(this, endpoint));
|
|
2530
|
+
var tmp_12 = Spacer_instance.toString();
|
|
2531
|
+
var tmp_13 = Spacer_instance.z23(2);
|
|
2532
|
+
var tmp_14 = emitHandleFunction(this, endpoint);
|
|
2533
|
+
var tmp_15 = Spacer_instance.toString();
|
|
2534
|
+
var tmp_16 = prependIndent(emitClient(endpoint, this), Spacer_instance.z23(1));
|
|
2535
|
+
var tmp_17 = prependIndent(emitServer(endpoint, this), Spacer_instance.z23(1));
|
|
2536
|
+
var tmp_18 = Spacer_instance.toString();
|
|
2537
|
+
var tmp_19 = Spacer_instance.z23(2);
|
|
2538
|
+
var tmp_20 = Companion_getInstance_3().p24(sanitizeSymbol_1(endpoint.n23_1, this));
|
|
2539
|
+
var tmp_21 = Spacer_instance.z23(2);
|
|
2540
|
+
var tmp_22 = Spacer_instance.z23(2);
|
|
2541
|
+
return trimMargin('\n |export namespace ' + tmp + ' {\n |' + tmp_1 + '\n |' + tmp_2 + '\n |' + tmp_3 + '\n |' + tmp_4 + '\n |' + tmp_6 + '\n |' + tmp_7 + 'export type Response = ' + tmp_9 + '\n |' + tmp_10 + '\n |' + tmp_11 + '\n |' + tmp_12 + 'export type Handler = {\n |' + tmp_13 + tmp_14 + '\n |' + tmp_15 + '}\n |' + tmp_16 + '\n |' + tmp_17 + '\n |' + tmp_18 + 'export const api: Wirespec.Api<Request, Response, Handler> = {\n |' + tmp_19 + 'name: "' + tmp_20 + '",\n |' + tmp_21 + 'method: "' + endpoint.o23_1.p2_1 + '",\n |' + tmp_22 + 'path: "' + joinToString(endpoint.p23_1, '/', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_7(this)) + '",\n |' + Spacer_instance.z23(2) + 'server,\n |' + Spacer_instance.z23(2) + 'client\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
2525
2542
|
};
|
|
2526
2543
|
protoOf(TypeScriptEmitter).u25 = function (union) {
|
|
2527
2544
|
var tmp = sanitizeSymbol_1(union.t22_1, this);
|
|
2528
|
-
return 'export type ' + tmp + ' = ' + joinToString(union.u22_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$
|
|
2545
|
+
return 'export type ' + tmp + ' = ' + joinToString(union.u22_1, ' | ', VOID, VOID, VOID, VOID, TypeScriptEmitter$emit$lambda_8(this)) + '\n';
|
|
2529
2546
|
};
|
|
2530
2547
|
protoOf(TypeScriptEmitter).l24 = function (identifier) {
|
|
2531
2548
|
return identifier.b1();
|
|
@@ -3254,7 +3271,7 @@
|
|
|
3254
3271
|
function TypeScriptShared() {
|
|
3255
3272
|
TypeScriptShared_instance = this;
|
|
3256
3273
|
this.v26_1 = 'community.flock.wirespec';
|
|
3257
|
-
this.w26_1 = trimMargin('\n |export namespace Wirespec {\n |' + Spacer_instance.toString() + 'export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE"\n |' + Spacer_instance.toString() + 'export type RawRequest = { method: Method, path: string[], queries: Record<string, string>, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type RawResponse = { status: number, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type Content<T> = { type:string, body:T }\n |' + Spacer_instance.toString() + 'export type Request<T> = { path: Record<string, unknown>, method: Method, query?: Record<string, unknown>, headers?: Record<string, unknown>, content?:Content<T> }\n |' + Spacer_instance.toString() + 'export type Response<T> = { status:number, headers?: Record<string, unknown[]>, content?:Content<T> }\n |' + Spacer_instance.toString() + 'export type Serialization = { serialize: <T>(type: T) => string; deserialize: <T>(raw: string | undefined) => T }\n |' + Spacer_instance.toString() + 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown
|
|
3274
|
+
this.w26_1 = trimMargin('\n |export namespace Wirespec {\n |' + Spacer_instance.toString() + 'export type Method = "GET" | "PUT" | "POST" | "DELETE" | "OPTIONS" | "HEAD" | "PATCH" | "TRACE"\n |' + Spacer_instance.toString() + 'export type RawRequest = { method: Method, path: string[], queries: Record<string, string>, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type RawResponse = { status: number, headers: Record<string, string>, body?: string }\n |' + Spacer_instance.toString() + 'export type Content<T> = { type:string, body:T }\n |' + Spacer_instance.toString() + 'export type Request<T> = { path: Record<string, unknown>, method: Method, query?: Record<string, unknown>, headers?: Record<string, unknown>, content?:Content<T> }\n |' + Spacer_instance.toString() + 'export type Response<T> = { status:number, headers?: Record<string, unknown[]>, content?:Content<T> }\n |' + Spacer_instance.toString() + 'export type Serialization = { serialize: <T>(type: T) => string; deserialize: <T>(raw: string | undefined) => T }\n |' + Spacer_instance.toString() + 'export type Client<REQ extends Request<unknown>, RES extends Response<unknown>, HAN> = (serialization: Serialization) => { to: (request: REQ) => RawRequest; from: (response: RawResponse) => RES }\n |' + Spacer_instance.toString() + 'export type Server<REQ extends Request<unknown>, RES extends Response<unknown>, HAN> = (serialization: Serialization) => { from: (request: RawRequest) => REQ; to: (response: RES) => RawResponse }\n |' + Spacer_instance.toString() + 'export type Api<REQ extends Request<unknown>, RES extends Response<unknown>, HAN> = { name: string; method: Method, path: string, client: Client<REQ, RES, HAN>; server: Server<REQ, RES, HAN> }\n |}\n ');
|
|
3258
3275
|
}
|
|
3259
3276
|
protoOf(TypeScriptShared).toString = function () {
|
|
3260
3277
|
return 'TypeScriptShared';
|