@flock/wirespec 0.16.4 → 0.16.5
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/fetch.ts +0 -0
- package/kotlin-kotlin-stdlib.mjs +26 -26
- package/kotlin-kotlin-stdlib.mjs.map +1 -1
- package/kotlinx-io-kotlinx-io-core.mjs +2 -2
- package/package.json +1 -1
- package/wirespec-fetch.mjs +3 -2
- package/wirespec-src-compiler-core.mjs +1052 -4723
- 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 +812 -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 +67 -67
- package/wirespec-src-compiler-lib.mjs.map +1 -1
- package/wirespec-src-converter-avro.mjs +34 -34
- package/wirespec-src-converter-avro.mjs.map +1 -1
- package/wirespec-src-converter-openapi.mjs +201 -201
- package/wirespec-src-converter-openapi.mjs.map +1 -1
- package/wirespec-src-plugin-arguments.mjs +60 -22
- package/wirespec-src-plugin-arguments.mjs.map +1 -1
- package/wirespec-src-plugin-cli.mjs +25 -59
- package/wirespec-src-plugin-cli.mjs.map +1 -1
- package/wirespec-src-plugin-npm.d.ts +6 -2
- package/wirespec-src-plugin-npm.mjs +40 -22
- package/wirespec-src-plugin-npm.mjs.map +1 -1
- package/wirespec-src-tools-generator.mjs +23 -23
|
@@ -0,0 +1,844 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArrayList_init_$Create$2rimpp4x9tjd3 as ArrayList_init_$Create$,
|
|
3
|
+
Unit_instanceat14thlj150z as Unit_instance,
|
|
4
|
+
collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
|
|
5
|
+
ArrayList_init_$Create$3m1kyiqequwm5 as ArrayList_init_$Create$_0,
|
|
6
|
+
VOID7hggqo3abtya as VOID,
|
|
7
|
+
joinToString1cxrrlmo0chqs as joinToString,
|
|
8
|
+
charSequenceGet1vxk1y5n17t1z as charSequenceGet,
|
|
9
|
+
Char19o2r8palgjof as Char,
|
|
10
|
+
distinct10qe1scfdvu5k as distinct,
|
|
11
|
+
trimMarginhyd3fsmh8iev as trimMargin,
|
|
12
|
+
listOfNotNull2woi2boe01ub4 as listOfNotNull,
|
|
13
|
+
isBlank1dvkhjjvox3p0 as isBlank,
|
|
14
|
+
charSequenceLength3278n89t01tmv as charSequenceLength,
|
|
15
|
+
split2bvyvnrlcifjv as split,
|
|
16
|
+
checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
|
|
17
|
+
asSequence3lsvgkvyzox0q as asSequence,
|
|
18
|
+
filter184huxd00uyfg as filter,
|
|
19
|
+
joinToStringooja5rkatz3u as joinToString_0,
|
|
20
|
+
firstOrNulltrxqttxfxqju as firstOrNull,
|
|
21
|
+
isDigit3mimrri4wkzop as isDigit,
|
|
22
|
+
setOf45ia9pnfhe90 as setOf,
|
|
23
|
+
protoOf180f3jzyo7rfj as protoOf,
|
|
24
|
+
initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
|
|
25
|
+
THROW_CCE2g6jy02ryeudk as THROW_CCE,
|
|
26
|
+
isCharSequence1ju9jr1w86plq as isCharSequence,
|
|
27
|
+
trimStart5ewg8zf6cs5u as trimStart,
|
|
28
|
+
toString1pkumu07cwy4m as toString,
|
|
29
|
+
toString14fd7g605f91p as toString_0,
|
|
30
|
+
noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
|
|
31
|
+
isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
|
|
32
|
+
_Char___init__impl__6a9atx367vrx0avsvbg as _Char___init__impl__6a9atx,
|
|
33
|
+
listOfvhqybd2zx248 as listOf,
|
|
34
|
+
dropLastlqc2oyv04br0 as dropLast,
|
|
35
|
+
equals2au1ep9vhcato as equals,
|
|
36
|
+
first58ocm7j58k3q as first,
|
|
37
|
+
initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
|
|
38
|
+
initMetadataForObject1cxne3s9w65el as initMetadataForObject,
|
|
39
|
+
} from './kotlin-kotlin-stdlib.mjs';
|
|
40
|
+
import {
|
|
41
|
+
Spacer_instancel9yep7i0q3er as Spacer_instance,
|
|
42
|
+
orNull2zq556ke3x99j as orNull,
|
|
43
|
+
removeQuestionMark174e2l0zlwrek as removeQuestionMark,
|
|
44
|
+
Companion_instanceb7vsmblp2jf7 as Companion_instance,
|
|
45
|
+
concatGenerics2esceo9p1a45k as concatGenerics,
|
|
46
|
+
Param33sus5zaarsk0 as Param,
|
|
47
|
+
Literal32wmkquj6qapn as Literal,
|
|
48
|
+
Emitterpslsvv25okcl as Emitter,
|
|
49
|
+
Companion_instance2ag0h5twtdral as Companion_instance_0,
|
|
50
|
+
Companion_instance26a9xkw31611z as Companion_instance_1,
|
|
51
|
+
FileExtension_Kotlin_getInstanceme7il40s0mth as FileExtension_Kotlin_getInstance,
|
|
52
|
+
Emitted12h24rpo4uifw as Emitted,
|
|
53
|
+
plus2csvv9vgnno78 as plus,
|
|
54
|
+
Bytes2moci2lqqzua3 as Bytes,
|
|
55
|
+
Boolean1v54w5v4qjba1 as Boolean_0,
|
|
56
|
+
Number3i05nlui0wcz8 as Number_0,
|
|
57
|
+
Integeryrcje1s9u7kr as Integer,
|
|
58
|
+
String23kqvhe3sk098 as String_0,
|
|
59
|
+
Primitivexjb7c0cm123a as Primitive,
|
|
60
|
+
Custom37hvrfgd6b0uj as Custom,
|
|
61
|
+
Any268baxyo9do19 as Any,
|
|
62
|
+
Unit3rie819ih39bz as Unit,
|
|
63
|
+
Iterablerto606wd057m as Iterable,
|
|
64
|
+
Dict3l6tdihpke4rr as Dict,
|
|
65
|
+
FieldIdentifier2fnn30qixmpf as FieldIdentifier,
|
|
66
|
+
DefinitionIdentifier21mzme854zakh as DefinitionIdentifier,
|
|
67
|
+
Bytes_instance1at7binw0nl40 as Bytes_instance,
|
|
68
|
+
Boolean_instance3qnzv8pgzox40 as Boolean_instance,
|
|
69
|
+
RegExp1kvu7kxwy7td5 as RegExp_0,
|
|
70
|
+
Bound1dotva4vah4jp as Bound,
|
|
71
|
+
addBackticks1di5q03fw4yhx as addBackticks,
|
|
72
|
+
} from './wirespec-src-compiler-core.mjs';
|
|
73
|
+
//region block: imports
|
|
74
|
+
//endregion
|
|
75
|
+
//region block: pre-declaration
|
|
76
|
+
initMetadataForCompanion(Companion);
|
|
77
|
+
initMetadataForClass(KotlinEmitter, 'KotlinEmitter', KotlinEmitter, Emitter);
|
|
78
|
+
initMetadataForObject(KotlinShared, 'KotlinShared');
|
|
79
|
+
//endregion
|
|
80
|
+
function emitImports(_this__u8e3s4, $this) {
|
|
81
|
+
// Inline function 'kotlin.collections.map' call
|
|
82
|
+
// Inline function 'kotlin.collections.filter' call
|
|
83
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
84
|
+
var this_0 = $this.t26(_this__u8e3s4);
|
|
85
|
+
var destination = ArrayList_init_$Create$();
|
|
86
|
+
var tmp0_iterator = this_0.g();
|
|
87
|
+
while (tmp0_iterator.h()) {
|
|
88
|
+
var element = tmp0_iterator.i();
|
|
89
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitImports.<anonymous>' call
|
|
90
|
+
if (!(_this__u8e3s4.x24().b1() === element.x28_1)) {
|
|
91
|
+
destination.e(element);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
95
|
+
var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination, 10));
|
|
96
|
+
var tmp0_iterator_0 = destination.g();
|
|
97
|
+
while (tmp0_iterator_0.h()) {
|
|
98
|
+
var item = tmp0_iterator_0.i();
|
|
99
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitImports.<anonymous>' call
|
|
100
|
+
var tmp$ret$3 = 'import ' + $this.h2a_1.z26_1 + '.model.' + item.x28_1 + ';';
|
|
101
|
+
destination_0.e(tmp$ret$3);
|
|
102
|
+
}
|
|
103
|
+
var tmp = destination_0;
|
|
104
|
+
return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitImports$lambda);
|
|
105
|
+
}
|
|
106
|
+
function emitStatusInterfaces(_this__u8e3s4, $this) {
|
|
107
|
+
// Inline function 'kotlin.collections.map' call
|
|
108
|
+
var this_0 = _this__u8e3s4.y25_1;
|
|
109
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
110
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
111
|
+
var tmp0_iterator = this_0.g();
|
|
112
|
+
while (tmp0_iterator.h()) {
|
|
113
|
+
var item = tmp0_iterator.i();
|
|
114
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitStatusInterfaces.<anonymous>' call
|
|
115
|
+
var tmp$ret$0 = new Char(charSequenceGet(item.o26_1, 0));
|
|
116
|
+
destination.e(tmp$ret$0);
|
|
117
|
+
}
|
|
118
|
+
var tmp = distinct(destination);
|
|
119
|
+
return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitStatusInterfaces$lambda);
|
|
120
|
+
}
|
|
121
|
+
function emitResponseInterfaces(_this__u8e3s4, $this) {
|
|
122
|
+
// Inline function 'kotlin.collections.map' call
|
|
123
|
+
var this_0 = _this__u8e3s4.y25_1;
|
|
124
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
125
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
126
|
+
var tmp0_iterator = this_0.g();
|
|
127
|
+
while (tmp0_iterator.h()) {
|
|
128
|
+
var item = tmp0_iterator.i();
|
|
129
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitResponseInterfaces.<anonymous>' call
|
|
130
|
+
var tmp$ret$0 = emit(item.q26_1, $this);
|
|
131
|
+
destination.e(tmp$ret$0);
|
|
132
|
+
}
|
|
133
|
+
var tmp = distinct(destination);
|
|
134
|
+
return joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitResponseInterfaces$lambda);
|
|
135
|
+
}
|
|
136
|
+
function emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block) {
|
|
137
|
+
var tmp;
|
|
138
|
+
if (_this__u8e3s4.l()) {
|
|
139
|
+
tmp = Spacer_instance.p23(spaces) + 'data object ' + name + ' : ' + extends_0;
|
|
140
|
+
} else {
|
|
141
|
+
var tmp_0 = Spacer_instance.p23(spaces);
|
|
142
|
+
tmp = trimMargin('\n |' + tmp_0 + 'data class ' + name + '(\n |' + joinToString(_this__u8e3s4, ',\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitObject$lambda(spaces, block)) + ',\n |' + Spacer_instance.p23(spaces) + ') : ' + extends_0 + '\n ');
|
|
143
|
+
}
|
|
144
|
+
return tmp;
|
|
145
|
+
}
|
|
146
|
+
function emitObject$default(_this__u8e3s4, $this, name, extends_0, spaces, block, $super) {
|
|
147
|
+
spaces = spaces === VOID ? 1 : spaces;
|
|
148
|
+
return emitObject(_this__u8e3s4, $this, name, extends_0, spaces, block);
|
|
149
|
+
}
|
|
150
|
+
function emitConstructor(_this__u8e3s4, $this, endpoint) {
|
|
151
|
+
// Inline function 'kotlin.let' call
|
|
152
|
+
var tmp = $this.j26(endpoint);
|
|
153
|
+
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitConstructor$lambda($this)));
|
|
154
|
+
var tmp_1 = orNull(joinToString(endpoint.v25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitConstructor$lambda_0($this)));
|
|
155
|
+
var tmp_2 = orNull(joinToString(endpoint.w25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitConstructor$lambda_1($this)));
|
|
156
|
+
var tmp0_safe_receiver = _this__u8e3s4.m26_1;
|
|
157
|
+
var tmp_3;
|
|
158
|
+
if (tmp0_safe_receiver == null) {
|
|
159
|
+
tmp_3 = null;
|
|
160
|
+
} else {
|
|
161
|
+
// Inline function 'kotlin.let' call
|
|
162
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
163
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitConstructor.<anonymous>' call
|
|
164
|
+
tmp_3 = Spacer_instance.p23(2) + 'override val body: ' + emit(tmp0_safe_receiver, $this) + ',';
|
|
165
|
+
}
|
|
166
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
167
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitConstructor.<anonymous>' call
|
|
168
|
+
var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
|
|
169
|
+
return isBlank(it) ? 'object Request : Wirespec.Request<' + emit(_this__u8e3s4.m26_1, $this) + '> {' : 'class Request(\n' + it + '\n' + Spacer_instance.toString() + ') : Wirespec.Request<' + emit(_this__u8e3s4.m26_1, $this) + '> {';
|
|
170
|
+
}
|
|
171
|
+
function emitDeserializedParams(_this__u8e3s4, $this, endpoint) {
|
|
172
|
+
// Inline function 'kotlin.let' call
|
|
173
|
+
var tmp = $this.k26(endpoint);
|
|
174
|
+
var tmp_0 = orNull(joinToString(tmp, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserializedParams$lambda($this)));
|
|
175
|
+
var tmp_1 = orNull(joinToString(endpoint.v25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserializedParams$lambda_0($this)));
|
|
176
|
+
var tmp_2 = orNull(joinToString(endpoint.w25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserializedParams$lambda_1($this)));
|
|
177
|
+
var tmp0_safe_receiver = _this__u8e3s4.m26_1;
|
|
178
|
+
var tmp_3;
|
|
179
|
+
if (tmp0_safe_receiver == null) {
|
|
180
|
+
tmp_3 = null;
|
|
181
|
+
} else {
|
|
182
|
+
// Inline function 'kotlin.let' call
|
|
183
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
184
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitDeserializedParams.<anonymous>' call
|
|
185
|
+
tmp_3 = Spacer_instance.p23(3) + 'body = serialization.deserialize(requireNotNull(request.body) { "body is null" }, typeOf<' + emit(tmp0_safe_receiver, $this) + '>()),';
|
|
186
|
+
}
|
|
187
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
188
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emitDeserializedParams.<anonymous>' call
|
|
189
|
+
var it = joinToString(listOfNotNull([tmp_0, tmp_1, tmp_2, tmp_3]), ',\n');
|
|
190
|
+
return isBlank(it) ? '' : '(\n' + it + '\n' + Spacer_instance.p23(2) + ')';
|
|
191
|
+
}
|
|
192
|
+
function emitSerialized(_this__u8e3s4, $this) {
|
|
193
|
+
var tmp = Spacer_instance.p23(3);
|
|
194
|
+
var tmp_0 = Spacer_instance.p23(4);
|
|
195
|
+
var tmp_1 = Spacer_instance.p23(4);
|
|
196
|
+
var tmp_2;
|
|
197
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
198
|
+
if (!_this__u8e3s4.p26_1.l()) {
|
|
199
|
+
tmp_2 = joinToString(_this__u8e3s4.p26_1, ' + ', VOID, VOID, VOID, VOID, KotlinEmitter$emitSerialized$lambda($this));
|
|
200
|
+
} else {
|
|
201
|
+
tmp_2 = 'emptyMap()';
|
|
202
|
+
}
|
|
203
|
+
return trimMargin('\n |' + tmp + 'is Response' + _this__u8e3s4.o26_1 + ' -> Wirespec.RawResponse(\n |' + tmp_0 + 'statusCode = response.status,\n |' + tmp_1 + 'headers = ' + tmp_2 + ',\n |' + Spacer_instance.p23(4) + 'body = ' + (!(_this__u8e3s4.q26_1 == null) ? 'serialization.serialize(response.body, typeOf<' + emit(_this__u8e3s4.q26_1, $this) + '>())' : 'null') + ',\n |' + Spacer_instance.p23(3) + ')\n ');
|
|
204
|
+
}
|
|
205
|
+
function emitDeserialized(_this__u8e3s4, $this) {
|
|
206
|
+
var tmp = Spacer_instance.p23(3) + _this__u8e3s4.o26_1 + ' -> Response' + _this__u8e3s4.o26_1 + '(';
|
|
207
|
+
var tmp_0;
|
|
208
|
+
if (!(_this__u8e3s4.q26_1 == null)) {
|
|
209
|
+
tmp_0 = Spacer_instance.p23(4) + 'body = serialization.deserialize(requireNotNull(response.body) { "body is null" }, typeOf<' + emit(_this__u8e3s4.q26_1, $this) + '>()),';
|
|
210
|
+
} else {
|
|
211
|
+
tmp_0 = Spacer_instance.p23(4) + 'body = Unit,';
|
|
212
|
+
}
|
|
213
|
+
var tmp_1 = tmp_0;
|
|
214
|
+
return joinToString(listOfNotNull([tmp, tmp_1, orNull(joinToString(_this__u8e3s4.p26_1, ',\n', VOID, VOID, VOID, VOID, KotlinEmitter$emitDeserialized$lambda($this))), Spacer_instance.p23(3) + ')']), '\n');
|
|
215
|
+
}
|
|
216
|
+
function emitSerializedParams(_this__u8e3s4, $this, type, fields) {
|
|
217
|
+
return 'mapOf("' + _this__u8e3s4.i24_1.b1() + '" to (' + type + '.' + fields + '.' + $this.d25(_this__u8e3s4.i24_1) + '?.let{ serialization.serializeParam(it, typeOf<' + $this.n2a(_this__u8e3s4.j24_1) + '>()) } ?: emptyList()))';
|
|
218
|
+
}
|
|
219
|
+
function emitDeserialized_0(_this__u8e3s4, $this) {
|
|
220
|
+
return Spacer_instance.p23(3) + $this.d25(_this__u8e3s4.rd_1.e24_1) + ' = serialization.deserialize(request.path[' + _this__u8e3s4.qd_1 + '], typeOf<' + $this.n2a(_this__u8e3s4.rd_1.f24_1) + '>())';
|
|
221
|
+
}
|
|
222
|
+
function emitDeserializedParams_0(_this__u8e3s4, $this, type, fields, spaces) {
|
|
223
|
+
return _this__u8e3s4.j24_1.hm() ? Spacer_instance.p23(spaces) + $this.d25(_this__u8e3s4.i24_1) + ' = ' + type + '.' + fields + '["' + _this__u8e3s4.i24_1.b1() + '"]?.let{ serialization.deserializeParam(it, typeOf<' + $this.n2a(_this__u8e3s4.j24_1) + '>()) }' : Spacer_instance.p23(spaces) + $this.d25(_this__u8e3s4.i24_1) + ' = serialization.deserializeParam(requireNotNull(' + type + '.' + fields + '["' + _this__u8e3s4.i24_1.b1() + '"]) { "' + $this.d25(_this__u8e3s4.i24_1) + ' is null" }, typeOf<' + $this.n2a(_this__u8e3s4.j24_1) + '>())';
|
|
224
|
+
}
|
|
225
|
+
function emitDeserializedParams$default(_this__u8e3s4, $this, type, fields, spaces, $super) {
|
|
226
|
+
spaces = spaces === VOID ? 3 : spaces;
|
|
227
|
+
return emitDeserializedParams_0(_this__u8e3s4, $this, type, fields, spaces);
|
|
228
|
+
}
|
|
229
|
+
function emitIdentifier(_this__u8e3s4, $this) {
|
|
230
|
+
return 'request.path.' + $this.d25(_this__u8e3s4.e24_1) + '.let{serialization.serialize(it, typeOf<' + $this.n2a(_this__u8e3s4.f24_1) + '>())}';
|
|
231
|
+
}
|
|
232
|
+
function emit(_this__u8e3s4, $this) {
|
|
233
|
+
var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.h24_1;
|
|
234
|
+
var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : $this.n2a(tmp1_safe_receiver);
|
|
235
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : removeQuestionMark(tmp2_safe_receiver);
|
|
236
|
+
return tmp3_elvis_lhs == null ? 'Unit' : tmp3_elvis_lhs;
|
|
237
|
+
}
|
|
238
|
+
function emit_0(_this__u8e3s4, $this) {
|
|
239
|
+
return $this.d25(_this__u8e3s4.e24_1) + ': ' + $this.n2a(_this__u8e3s4.f24_1);
|
|
240
|
+
}
|
|
241
|
+
function brace(_this__u8e3s4, $this) {
|
|
242
|
+
return wrap(_this__u8e3s4, $this, '(', ')');
|
|
243
|
+
}
|
|
244
|
+
function wrap(_this__u8e3s4, $this, prefix, postfix) {
|
|
245
|
+
var tmp;
|
|
246
|
+
// Inline function 'kotlin.text.isEmpty' call
|
|
247
|
+
if (charSequenceLength(_this__u8e3s4) === 0) {
|
|
248
|
+
tmp = '';
|
|
249
|
+
} else {
|
|
250
|
+
tmp = prefix + _this__u8e3s4 + postfix;
|
|
251
|
+
}
|
|
252
|
+
return tmp;
|
|
253
|
+
}
|
|
254
|
+
function sanitizeSymbol(_this__u8e3s4, $this) {
|
|
255
|
+
// Inline function 'kotlin.collections.mapIndexed' call
|
|
256
|
+
var this_0 = split(_this__u8e3s4, ['.', ' ']);
|
|
257
|
+
// Inline function 'kotlin.collections.mapIndexedTo' call
|
|
258
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
259
|
+
var index = 0;
|
|
260
|
+
var tmp0_iterator = this_0.g();
|
|
261
|
+
while (tmp0_iterator.h()) {
|
|
262
|
+
var item = tmp0_iterator.i();
|
|
263
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.sanitizeSymbol.<anonymous>' call
|
|
264
|
+
var tmp1 = index;
|
|
265
|
+
index = tmp1 + 1 | 0;
|
|
266
|
+
var tmp$ret$0 = checkIndexOverflow(tmp1) > 0 ? Companion_instance.k24(item) : item;
|
|
267
|
+
destination.e(tmp$ret$0);
|
|
268
|
+
}
|
|
269
|
+
var tmp = asSequence(joinToString(destination, ''));
|
|
270
|
+
return sanitizeFirstIsDigit(joinToString_0(filter(tmp, KotlinEmitter$sanitizeSymbol$lambda), ''), $this);
|
|
271
|
+
}
|
|
272
|
+
function sanitizeFirstIsDigit(_this__u8e3s4, $this) {
|
|
273
|
+
var tmp;
|
|
274
|
+
var tmp0_safe_receiver = firstOrNull(_this__u8e3s4);
|
|
275
|
+
var tmp_0;
|
|
276
|
+
var tmp_1 = tmp0_safe_receiver;
|
|
277
|
+
if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
|
|
278
|
+
tmp_0 = null;
|
|
279
|
+
} else {
|
|
280
|
+
tmp_0 = isDigit(tmp0_safe_receiver);
|
|
281
|
+
}
|
|
282
|
+
if (tmp_0 === true) {
|
|
283
|
+
tmp = '_' + _this__u8e3s4;
|
|
284
|
+
} else {
|
|
285
|
+
tmp = _this__u8e3s4;
|
|
286
|
+
}
|
|
287
|
+
return tmp;
|
|
288
|
+
}
|
|
289
|
+
function Companion() {
|
|
290
|
+
Companion_instance_2 = this;
|
|
291
|
+
this.o2a_1 = setOf(['as', 'break', 'class', 'continue', 'do', 'else', 'false', 'for', 'fun', 'if', 'in', 'interface', 'internal', 'is', 'null', 'object', 'open', 'package', 'return', 'super', 'this', 'throw', 'true', 'try', 'typealias', 'typeof', 'val', 'var', 'when', 'while', 'private', 'public']);
|
|
292
|
+
this.p2a_1 = 'emptyMap()';
|
|
293
|
+
}
|
|
294
|
+
var Companion_instance_2;
|
|
295
|
+
function Companion_getInstance() {
|
|
296
|
+
if (Companion_instance_2 == null)
|
|
297
|
+
new Companion();
|
|
298
|
+
return Companion_instance_2;
|
|
299
|
+
}
|
|
300
|
+
function KotlinEmitter$emit$lambda(this$0) {
|
|
301
|
+
return function (it) {
|
|
302
|
+
return this$0.n2a(it);
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
function KotlinEmitter$emit$lambda_0(this$0) {
|
|
306
|
+
return function (it) {
|
|
307
|
+
return Spacer_instance.toString() + 'val ' + this$0.q2a(it) + ',';
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
function KotlinEmitter$emit$lambda_1(this$0) {
|
|
311
|
+
return function (it) {
|
|
312
|
+
return this$0.s2a(this$0.r2a(it)) + '("' + it + '")';
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
function KotlinEmitter$emitImports$lambda(it) {
|
|
316
|
+
// Inline function 'kotlin.text.trimStart' call
|
|
317
|
+
return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
|
|
318
|
+
}
|
|
319
|
+
function KotlinEmitter$emit$lambda_2(it) {
|
|
320
|
+
// Inline function 'kotlin.text.trimStart' call
|
|
321
|
+
return toString(trimStart(isCharSequence(it) ? it : THROW_CCE()));
|
|
322
|
+
}
|
|
323
|
+
function KotlinEmitter$emit$lambda_3(this$0) {
|
|
324
|
+
return function (it) {
|
|
325
|
+
return emit_0(it, this$0);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function KotlinEmitter$emit$lambda_4(this$0) {
|
|
329
|
+
return function (it) {
|
|
330
|
+
return this$0.q2a(it);
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
function KotlinEmitter$emit$lambda_5(this$0) {
|
|
334
|
+
return function (it) {
|
|
335
|
+
return this$0.q2a(it);
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
function KotlinEmitter$emit$lambda_6(this$0) {
|
|
339
|
+
return function (it) {
|
|
340
|
+
return this$0.t2a(it);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function KotlinEmitter$emit$lambda_7(this$0) {
|
|
344
|
+
return function (it) {
|
|
345
|
+
return emitSerialized(it, this$0);
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
function KotlinEmitter$emit$lambda_8(this$0) {
|
|
349
|
+
return function (it) {
|
|
350
|
+
return emitDeserialized(it, this$0);
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function KotlinEmitter$emit$lambda_9(this$0) {
|
|
354
|
+
return function (it) {
|
|
355
|
+
return this$0.h26(it);
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function KotlinEmitter$emitStatusInterfaces$lambda(it) {
|
|
359
|
+
return Spacer_instance.toString() + 'sealed interface Response' + toString_0(it.x_1) + 'XX<T: Any> : Response<T>';
|
|
360
|
+
}
|
|
361
|
+
function KotlinEmitter$emitResponseInterfaces$lambda(it) {
|
|
362
|
+
return Spacer_instance.toString() + 'sealed interface Response' + concatGenerics(it) + ' : Response<' + it + '>';
|
|
363
|
+
}
|
|
364
|
+
function KotlinEmitter$emitObject$lambda($spaces, $block) {
|
|
365
|
+
return function (it) {
|
|
366
|
+
return Spacer_instance.p23($spaces + 1 | 0) + 'val ' + $block(it);
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function KotlinEmitter$emit$lambda_10(this$0) {
|
|
370
|
+
return function (it) {
|
|
371
|
+
return this$0.d25(it.e24_1);
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function KotlinEmitter$emit$lambda_11(this$0) {
|
|
375
|
+
return function (it) {
|
|
376
|
+
return this$0.d25(it.i24_1);
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function KotlinEmitter$emit$lambda_12(this$0) {
|
|
380
|
+
return function (it) {
|
|
381
|
+
return this$0.d25(it.i24_1);
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function KotlinEmitter$emit$lambda_13(this$0) {
|
|
385
|
+
return function (it) {
|
|
386
|
+
var tmp;
|
|
387
|
+
if (it instanceof Literal) {
|
|
388
|
+
tmp = '"' + it.i26_1 + '"';
|
|
389
|
+
} else {
|
|
390
|
+
if (it instanceof Param) {
|
|
391
|
+
tmp = emitIdentifier(it, this$0);
|
|
392
|
+
} else {
|
|
393
|
+
noWhenBranchMatchedException();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
return tmp;
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function KotlinEmitter$emit$lambda_14(this$0) {
|
|
400
|
+
return function (it) {
|
|
401
|
+
return '(' + emitSerializedParams(it, this$0, 'request', 'queries') + ')';
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
function KotlinEmitter$emit$lambda_15(this$0) {
|
|
405
|
+
return function (it) {
|
|
406
|
+
return '(' + emitSerializedParams(it, this$0, 'request', 'headers') + ')';
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function KotlinEmitter$emit$lambda_16(this$0) {
|
|
410
|
+
return function (it) {
|
|
411
|
+
return 'val ' + this$0.q2a(it);
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
function KotlinEmitter$emit$lambda_17(this$0) {
|
|
415
|
+
return function (it) {
|
|
416
|
+
return this$0.d25(it.i24_1);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
function KotlinEmitter$emit$lambda_18(this$0) {
|
|
420
|
+
return function (it) {
|
|
421
|
+
return this$0.q2a(it);
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
function KotlinEmitter$emitConstructor$lambda(this$0) {
|
|
425
|
+
return function (it) {
|
|
426
|
+
return Spacer_instance.p23(2) + emit_0(it, this$0);
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
function KotlinEmitter$emitConstructor$lambda_0(this$0) {
|
|
430
|
+
return function (it) {
|
|
431
|
+
return Spacer_instance.p23(2) + this$0.q2a(it);
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
function KotlinEmitter$emitConstructor$lambda_1(this$0) {
|
|
435
|
+
return function (it) {
|
|
436
|
+
return Spacer_instance.p23(2) + this$0.q2a(it);
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function KotlinEmitter$emitDeserializedParams$lambda(this$0) {
|
|
440
|
+
return function (it) {
|
|
441
|
+
return emitDeserialized_0(it, this$0);
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
function KotlinEmitter$emitDeserializedParams$lambda_0(this$0) {
|
|
445
|
+
return function (it) {
|
|
446
|
+
return emitDeserializedParams$default(it, this$0, 'request', 'queries');
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
function KotlinEmitter$emitDeserializedParams$lambda_1(this$0) {
|
|
450
|
+
return function (it) {
|
|
451
|
+
return emitDeserializedParams$default(it, this$0, 'request', 'headers');
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
function KotlinEmitter$emitSerialized$lambda(this$0) {
|
|
455
|
+
return function (it) {
|
|
456
|
+
return '(' + emitSerializedParams(it, this$0, 'response', 'headers') + ')';
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
function KotlinEmitter$emitDeserialized$lambda(this$0) {
|
|
460
|
+
return function (it) {
|
|
461
|
+
return emitDeserializedParams_0(it, this$0, 'response', 'headers', 4);
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
function KotlinEmitter$sanitizeSymbol$lambda(it) {
|
|
465
|
+
return isLetterOrDigit(it.x_1) || listOf(new Char(_Char___init__impl__6a9atx(95))).o1(it);
|
|
466
|
+
}
|
|
467
|
+
function KotlinEmitter(packageName, emitShared) {
|
|
468
|
+
Companion_getInstance();
|
|
469
|
+
packageName = packageName === VOID ? Companion_instance_0.y26('community.flock.wirespec.generated') : packageName;
|
|
470
|
+
emitShared = emitShared === VOID ? Companion_instance_1.r23() : emitShared;
|
|
471
|
+
Emitter.call(this);
|
|
472
|
+
this.h2a_1 = packageName;
|
|
473
|
+
this.i2a_1 = emitShared;
|
|
474
|
+
this.j2a_1 = '\nimport community.flock.wirespec.kotlin.Wirespec\nimport kotlin.reflect.typeOf\n';
|
|
475
|
+
this.k2a_1 = FileExtension_Kotlin_getInstance();
|
|
476
|
+
this.l2a_1 = KotlinShared_getInstance();
|
|
477
|
+
this.m2a_1 = '//';
|
|
478
|
+
}
|
|
479
|
+
protoOf(KotlinEmitter).q24 = function () {
|
|
480
|
+
return this.k2a_1;
|
|
481
|
+
};
|
|
482
|
+
protoOf(KotlinEmitter).u2a = function () {
|
|
483
|
+
return this.l2a_1;
|
|
484
|
+
};
|
|
485
|
+
protoOf(KotlinEmitter).w26 = function () {
|
|
486
|
+
return this.m2a_1;
|
|
487
|
+
};
|
|
488
|
+
protoOf(KotlinEmitter).s24 = function (module_0, logger) {
|
|
489
|
+
// Inline function 'kotlin.let' call
|
|
490
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
491
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
492
|
+
var it = protoOf(Emitter).s24.call(this, module_0, logger);
|
|
493
|
+
return this.i2a_1.s23_1 ? it.pk(new Emitted(Companion_instance_0.y26('community.flock.wirespec.kotlin').b27() + 'Wirespec', this.u2a().w2a_1)) : it;
|
|
494
|
+
};
|
|
495
|
+
protoOf(KotlinEmitter).w24 = function (definition, module_0, logger) {
|
|
496
|
+
// Inline function 'kotlin.let' call
|
|
497
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
498
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
499
|
+
var it = protoOf(Emitter).w24.call(this, definition, module_0, logger);
|
|
500
|
+
var subPackageName = plus(this.h2a_1, definition);
|
|
501
|
+
var tmp = subPackageName.b27() + sanitizeSymbol(it.t23_1, this);
|
|
502
|
+
// Inline function 'kotlin.text.trimStart' call
|
|
503
|
+
var this_0 = trimMargin('\n |package ' + subPackageName.toString() + '\n |' + (Companion_instance.m24(module_0) ? this.j2a_1 : '') + '\n |' + it.u23_1 + '\n ');
|
|
504
|
+
var tmp$ret$0 = toString(trimStart(isCharSequence(this_0) ? this_0 : THROW_CCE()));
|
|
505
|
+
return new Emitted(tmp, tmp$ret$0);
|
|
506
|
+
};
|
|
507
|
+
protoOf(KotlinEmitter).e26 = function (type, module_0) {
|
|
508
|
+
var tmp;
|
|
509
|
+
if (type.c26_1.u26_1.l()) {
|
|
510
|
+
tmp = 'data object ' + this.d25(type.b26_1);
|
|
511
|
+
} else {
|
|
512
|
+
var tmp_0 = this.d25(type.b26_1);
|
|
513
|
+
var tmp_1 = this.x2a(type.c26_1);
|
|
514
|
+
// Inline function 'kotlin.run' call
|
|
515
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
516
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
517
|
+
var $this$run = type.d26_1;
|
|
518
|
+
var tmp_2;
|
|
519
|
+
if ($this$run.l()) {
|
|
520
|
+
tmp_2 = '';
|
|
521
|
+
} else {
|
|
522
|
+
tmp_2 = ' : ' + joinToString($this$run, ', ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda(this));
|
|
523
|
+
}
|
|
524
|
+
var tmp$ret$1 = tmp_2;
|
|
525
|
+
tmp = trimMargin('\n |data class ' + tmp_0 + '(\n |' + tmp_1 + '\n |)' + tmp$ret$1 + '\n |\n ');
|
|
526
|
+
}
|
|
527
|
+
return tmp;
|
|
528
|
+
};
|
|
529
|
+
protoOf(KotlinEmitter).x2a = function (_this__u8e3s4) {
|
|
530
|
+
return dropLast(joinToString(_this__u8e3s4.u26_1, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_0(this)), 1);
|
|
531
|
+
};
|
|
532
|
+
protoOf(KotlinEmitter).q2a = function (_this__u8e3s4) {
|
|
533
|
+
return this.d25(_this__u8e3s4.i24_1) + ': ' + this.n2a(_this__u8e3s4.j24_1);
|
|
534
|
+
};
|
|
535
|
+
protoOf(KotlinEmitter).n2a = function (_this__u8e3s4) {
|
|
536
|
+
// Inline function 'kotlin.let' call
|
|
537
|
+
var tmp;
|
|
538
|
+
if (_this__u8e3s4 instanceof Dict) {
|
|
539
|
+
tmp = 'Map<String, ' + this.n2a(_this__u8e3s4.b24_1) + '>';
|
|
540
|
+
} else {
|
|
541
|
+
if (_this__u8e3s4 instanceof Iterable) {
|
|
542
|
+
tmp = 'List<' + this.n2a(_this__u8e3s4.y23_1) + '>';
|
|
543
|
+
} else {
|
|
544
|
+
if (_this__u8e3s4 instanceof Unit) {
|
|
545
|
+
tmp = 'Unit';
|
|
546
|
+
} else {
|
|
547
|
+
if (_this__u8e3s4 instanceof Any) {
|
|
548
|
+
tmp = 'Any';
|
|
549
|
+
} else {
|
|
550
|
+
if (_this__u8e3s4 instanceof Custom) {
|
|
551
|
+
tmp = _this__u8e3s4.x28_1;
|
|
552
|
+
} else {
|
|
553
|
+
if (_this__u8e3s4 instanceof Primitive) {
|
|
554
|
+
var t = _this__u8e3s4.b29_1;
|
|
555
|
+
var tmp_0;
|
|
556
|
+
if (t instanceof String_0) {
|
|
557
|
+
tmp_0 = 'String';
|
|
558
|
+
} else {
|
|
559
|
+
if (t instanceof Integer) {
|
|
560
|
+
var tmp_1;
|
|
561
|
+
switch (t.g28_1.r2_1) {
|
|
562
|
+
case 0:
|
|
563
|
+
tmp_1 = 'Int';
|
|
564
|
+
break;
|
|
565
|
+
case 1:
|
|
566
|
+
tmp_1 = 'Long';
|
|
567
|
+
break;
|
|
568
|
+
default:
|
|
569
|
+
noWhenBranchMatchedException();
|
|
570
|
+
break;
|
|
571
|
+
}
|
|
572
|
+
tmp_0 = tmp_1;
|
|
573
|
+
} else {
|
|
574
|
+
if (t instanceof Number_0) {
|
|
575
|
+
var tmp_2;
|
|
576
|
+
switch (t.j28_1.r2_1) {
|
|
577
|
+
case 0:
|
|
578
|
+
tmp_2 = 'Float';
|
|
579
|
+
break;
|
|
580
|
+
case 1:
|
|
581
|
+
tmp_2 = 'Double';
|
|
582
|
+
break;
|
|
583
|
+
default:
|
|
584
|
+
noWhenBranchMatchedException();
|
|
585
|
+
break;
|
|
586
|
+
}
|
|
587
|
+
tmp_0 = tmp_2;
|
|
588
|
+
} else {
|
|
589
|
+
if (t instanceof Boolean_0) {
|
|
590
|
+
tmp_0 = 'Boolean';
|
|
591
|
+
} else {
|
|
592
|
+
if (t instanceof Bytes) {
|
|
593
|
+
tmp_0 = 'ByteArray';
|
|
594
|
+
} else {
|
|
595
|
+
noWhenBranchMatchedException();
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
tmp = tmp_0;
|
|
602
|
+
} else {
|
|
603
|
+
noWhenBranchMatchedException();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
611
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
612
|
+
var it = tmp;
|
|
613
|
+
return _this__u8e3s4.hm() ? it + '?' : it;
|
|
614
|
+
};
|
|
615
|
+
protoOf(KotlinEmitter).d25 = function (identifier) {
|
|
616
|
+
var tmp;
|
|
617
|
+
if (identifier instanceof DefinitionIdentifier) {
|
|
618
|
+
tmp = sanitizeSymbol(identifier.b1(), this);
|
|
619
|
+
} else {
|
|
620
|
+
if (identifier instanceof FieldIdentifier) {
|
|
621
|
+
tmp = this.s2a(sanitizeSymbol(identifier.b1(), this));
|
|
622
|
+
} else {
|
|
623
|
+
noWhenBranchMatchedException();
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return tmp;
|
|
627
|
+
};
|
|
628
|
+
protoOf(KotlinEmitter).m25 = function (refined) {
|
|
629
|
+
return trimMargin('\n |data class ' + sanitizeSymbol(refined.k25_1.b1(), this) + '(override val value: String): Wirespec.Refined {\n |' + Spacer_instance.toString() + 'override fun toString() = value\n |}\n |\n |fun ' + refined.k25_1.b1() + '.validate() = ' + this.y2a(refined) + '\n |\n ');
|
|
630
|
+
};
|
|
631
|
+
protoOf(KotlinEmitter).y2a = function (_this__u8e3s4) {
|
|
632
|
+
var defaultReturn = 'true';
|
|
633
|
+
var type = _this__u8e3s4.l25_1.b29_1;
|
|
634
|
+
var tmp;
|
|
635
|
+
if (type instanceof Integer) {
|
|
636
|
+
var tmp0_safe_receiver = type.h28_1;
|
|
637
|
+
var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : this.z2a(tmp0_safe_receiver);
|
|
638
|
+
tmp = tmp1_elvis_lhs == null ? defaultReturn : tmp1_elvis_lhs;
|
|
639
|
+
} else {
|
|
640
|
+
if (type instanceof Number_0) {
|
|
641
|
+
var tmp2_safe_receiver = type.k28_1;
|
|
642
|
+
var tmp3_elvis_lhs = tmp2_safe_receiver == null ? null : this.z2a(tmp2_safe_receiver);
|
|
643
|
+
tmp = tmp3_elvis_lhs == null ? defaultReturn : tmp3_elvis_lhs;
|
|
644
|
+
} else {
|
|
645
|
+
if (type instanceof String_0) {
|
|
646
|
+
var tmp4_safe_receiver = type.e28_1;
|
|
647
|
+
var tmp_0;
|
|
648
|
+
var tmp_1 = tmp4_safe_receiver;
|
|
649
|
+
if ((tmp_1 == null ? null : new RegExp_0(tmp_1)) == null) {
|
|
650
|
+
tmp_0 = null;
|
|
651
|
+
} else {
|
|
652
|
+
tmp_0 = this.z2a(new RegExp_0(tmp4_safe_receiver));
|
|
653
|
+
}
|
|
654
|
+
var tmp5_elvis_lhs = tmp_0;
|
|
655
|
+
tmp = tmp5_elvis_lhs == null ? defaultReturn : tmp5_elvis_lhs;
|
|
656
|
+
} else {
|
|
657
|
+
if (equals(type, Boolean_instance)) {
|
|
658
|
+
tmp = defaultReturn;
|
|
659
|
+
} else {
|
|
660
|
+
if (equals(type, Bytes_instance)) {
|
|
661
|
+
tmp = defaultReturn;
|
|
662
|
+
} else {
|
|
663
|
+
noWhenBranchMatchedException();
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
return tmp;
|
|
670
|
+
};
|
|
671
|
+
protoOf(KotlinEmitter).z2a = function (_this__u8e3s4) {
|
|
672
|
+
var tmp;
|
|
673
|
+
if (_this__u8e3s4 instanceof RegExp_0) {
|
|
674
|
+
tmp = 'Regex("""' + this.v26(_this__u8e3s4.b28_1) + '""").matches(value)';
|
|
675
|
+
} else {
|
|
676
|
+
if (_this__u8e3s4 instanceof Bound) {
|
|
677
|
+
tmp = Spacer_instance.toString() + _this__u8e3s4.c28_1 + ' < record.value < ' + _this__u8e3s4.d28_1 + ';';
|
|
678
|
+
} else {
|
|
679
|
+
noWhenBranchMatchedException();
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
return tmp;
|
|
683
|
+
};
|
|
684
|
+
protoOf(KotlinEmitter).q25 = function (enum_0, module_0) {
|
|
685
|
+
var tmp = sanitizeSymbol(enum_0.o25_1.b1(), this);
|
|
686
|
+
return trimMargin('\n |enum class ' + tmp + ' (override val label: String): Wirespec.Enum {\n |' + this.g26(joinToString(enum_0.p25_1, ',\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_1(this))) + ';\n |' + Spacer_instance.toString() + 'override fun toString(): String {\n |' + Spacer_instance.p23(2) + 'return label\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
687
|
+
};
|
|
688
|
+
protoOf(KotlinEmitter).i25 = function (union) {
|
|
689
|
+
return trimMargin('\n |sealed interface ' + this.d25(union.g25_1) + '\n |\n ');
|
|
690
|
+
};
|
|
691
|
+
protoOf(KotlinEmitter).e25 = function (channel) {
|
|
692
|
+
return trimMargin('\n |' + emitImports(channel, this) + '\n |\n |interface ' + this.d25(channel.b25_1) + 'Channel {\n | operator fun invoke(message: ' + this.n2a(channel.c25_1) + ')\n |}\n |\n ');
|
|
693
|
+
};
|
|
694
|
+
protoOf(KotlinEmitter).z25 = function (endpoint) {
|
|
695
|
+
// Inline function 'kotlin.collections.map' call
|
|
696
|
+
var this_0 = this.t26(endpoint);
|
|
697
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
698
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
699
|
+
var tmp0_iterator = this_0.g();
|
|
700
|
+
while (tmp0_iterator.h()) {
|
|
701
|
+
var item = tmp0_iterator.i();
|
|
702
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
703
|
+
var tmp$ret$0 = 'import ' + this.h2a_1.z26_1 + '.model.' + item.x28_1;
|
|
704
|
+
destination.e(tmp$ret$0);
|
|
705
|
+
}
|
|
706
|
+
var tmp = destination;
|
|
707
|
+
var tmp_0 = joinToString(tmp, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_2);
|
|
708
|
+
var tmp_1 = this.d25(endpoint.s25_1);
|
|
709
|
+
var tmp_2 = this.j26(endpoint);
|
|
710
|
+
var tmp_3 = emitObject$default(tmp_2, this, 'Path', 'Wirespec.Path', VOID, KotlinEmitter$emit$lambda_3(this));
|
|
711
|
+
var tmp_4 = emitObject$default(endpoint.v25_1, this, 'Queries', 'Wirespec.Queries', VOID, KotlinEmitter$emit$lambda_4(this));
|
|
712
|
+
var tmp_5 = emitObject$default(endpoint.w25_1, this, 'Headers', 'Wirespec.Request.Headers', VOID, KotlinEmitter$emit$lambda_5(this));
|
|
713
|
+
var tmp_6 = this.a2b(first(endpoint.x25_1), endpoint);
|
|
714
|
+
var tmp_7 = Spacer_instance.toString();
|
|
715
|
+
var tmp_8 = emitStatusInterfaces(endpoint, this);
|
|
716
|
+
var tmp_9 = emitResponseInterfaces(endpoint, this);
|
|
717
|
+
var tmp_10 = this.s26(endpoint.y25_1);
|
|
718
|
+
var tmp_11 = joinToString(tmp_10, '\n\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_6(this));
|
|
719
|
+
var tmp_12 = Spacer_instance.toString();
|
|
720
|
+
var tmp_13 = Spacer_instance.p23(2);
|
|
721
|
+
var tmp_14 = this.s26(endpoint.y25_1);
|
|
722
|
+
var tmp_15 = joinToString(tmp_14, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_7(this));
|
|
723
|
+
var tmp_16 = Spacer_instance.p23(2);
|
|
724
|
+
var tmp_17 = Spacer_instance.toString();
|
|
725
|
+
var tmp_18 = Spacer_instance.p23(2);
|
|
726
|
+
// Inline function 'kotlin.collections.filter' call
|
|
727
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
728
|
+
var this_1 = this.s26(endpoint.y25_1);
|
|
729
|
+
var destination_0 = ArrayList_init_$Create$();
|
|
730
|
+
var tmp0_iterator_0 = this_1.g();
|
|
731
|
+
while (tmp0_iterator_0.h()) {
|
|
732
|
+
var element = tmp0_iterator_0.i();
|
|
733
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
734
|
+
if (Companion_instance.p24(element.o26_1)) {
|
|
735
|
+
destination_0.e(element);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
var tmp_19 = destination_0;
|
|
739
|
+
var tmp_20 = joinToString(tmp_19, '\n', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_8(this));
|
|
740
|
+
var tmp_21 = Spacer_instance.p23(3);
|
|
741
|
+
var tmp_22 = Spacer_instance.p23(2);
|
|
742
|
+
var tmp_23 = Spacer_instance.toString();
|
|
743
|
+
var tmp_24 = Spacer_instance.p23(2);
|
|
744
|
+
var tmp_25 = this.b2b(endpoint);
|
|
745
|
+
var tmp_26 = Spacer_instance.p23(2);
|
|
746
|
+
var tmp_27 = Spacer_instance.p23(3);
|
|
747
|
+
return trimMargin('\n |' + tmp_0 + '\n |\n |object ' + tmp_1 + ' : Wirespec.Endpoint {\n |' + tmp_3 + '\n |\n |' + tmp_4 + '\n |\n |' + tmp_5 + '\n |\n |' + tmp_6 + '\n |\n |' + tmp_7 + 'sealed interface Response<T: Any> : Wirespec.Response<T>\n |\n |' + tmp_8 + '\n |\n |' + tmp_9 + '\n |\n |' + tmp_11 + '\n |\n |' + tmp_12 + 'fun toResponse(serialization: Wirespec.Serializer<String>, response: Response<*>): Wirespec.RawResponse =\n |' + tmp_13 + 'when(response) {\n |' + tmp_15 + '\n |' + tmp_16 + '}\n |\n |' + tmp_17 + 'fun fromResponse(serialization: Wirespec.Deserializer<String>, response: Wirespec.RawResponse): Response<*> =\n |' + tmp_18 + 'when (response.statusCode) {\n |' + tmp_20 + '\n |' + tmp_21 + 'else -> error("Cannot match response with status: ${response.statusCode}")\n |' + tmp_22 + '}\n |\n |' + tmp_23 + 'interface Handler: Wirespec.Handler {\n |' + tmp_24 + tmp_25 + '\n |' + tmp_26 + 'companion object: Wirespec.Server<Request, Response<*>>, Wirespec.Client<Request, Response<*>> {\n |' + tmp_27 + 'override val pathTemplate = "/' + joinToString(endpoint.u25_1, '/', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_9(this)) + '"\n |' + Spacer_instance.p23(3) + 'override val method = "' + endpoint.t25_1.toString() + '"\n |' + Spacer_instance.p23(3) + 'override fun server(serialization: Wirespec.Serialization<String>) = object : Wirespec.ServerEdge<Request, Response<*>> {\n |' + Spacer_instance.p23(4) + 'override fun from(request: Wirespec.RawRequest) = fromRequest(serialization, request)\n |' + Spacer_instance.p23(4) + 'override fun to(response: Response<*>) = toResponse(serialization, response)\n |' + Spacer_instance.p23(3) + '}\n |' + Spacer_instance.p23(3) + 'override fun client(serialization: Wirespec.Serialization<String>) = object : Wirespec.ClientEdge<Request, Response<*>> {\n |' + Spacer_instance.p23(4) + 'override fun to(request: Request) = toRequest(serialization, request)\n |' + Spacer_instance.p23(4) + 'override fun from(response: Wirespec.RawResponse) = fromResponse(serialization, response)\n |' + Spacer_instance.p23(3) + '}\n |' + Spacer_instance.p23(2) + '}\n |' + Spacer_instance.toString() + '}\n |}\n |\n ');
|
|
748
|
+
};
|
|
749
|
+
protoOf(KotlinEmitter).b2b = function (endpoint) {
|
|
750
|
+
return 'suspend fun ' + Companion_instance.l24(this.d25(endpoint.s25_1)) + '(request: Request): Response<*>';
|
|
751
|
+
};
|
|
752
|
+
protoOf(KotlinEmitter).a2b = function (_this__u8e3s4, endpoint) {
|
|
753
|
+
var tmp = Spacer_instance.toString();
|
|
754
|
+
var tmp_0 = emitConstructor(_this__u8e3s4, this, endpoint);
|
|
755
|
+
var tmp_1 = Spacer_instance.p23(2);
|
|
756
|
+
var tmp_2 = this.j26(endpoint);
|
|
757
|
+
var tmp_3 = brace(joinToString(tmp_2, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_10(this)), this);
|
|
758
|
+
var tmp_4 = Spacer_instance.p23(2);
|
|
759
|
+
var tmp_5 = Spacer_instance.p23(2);
|
|
760
|
+
var tmp_6 = brace(joinToString(endpoint.v25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_11(this)), this);
|
|
761
|
+
var tmp_7 = Spacer_instance.p23(2);
|
|
762
|
+
var tmp_8 = brace(joinToString(endpoint.w25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_12(this)), this);
|
|
763
|
+
var tmp_9 = _this__u8e3s4.m26_1 == null ? '\n' + Spacer_instance.p23(2) + 'override val body = Unit' : '';
|
|
764
|
+
var tmp_10 = Spacer_instance.toString();
|
|
765
|
+
var tmp_11 = Spacer_instance.toString();
|
|
766
|
+
var tmp_12 = Spacer_instance.p23(2);
|
|
767
|
+
var tmp_13 = Spacer_instance.p23(3);
|
|
768
|
+
var tmp_14 = joinToString(endpoint.u25_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_13(this));
|
|
769
|
+
var tmp_15 = Spacer_instance.p23(3);
|
|
770
|
+
var tmp_16 = Spacer_instance.p23(3);
|
|
771
|
+
var tmp_17;
|
|
772
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
773
|
+
if (!endpoint.v25_1.l()) {
|
|
774
|
+
tmp_17 = joinToString(endpoint.v25_1, ' + ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_14(this));
|
|
775
|
+
} else {
|
|
776
|
+
tmp_17 = 'emptyMap()';
|
|
777
|
+
}
|
|
778
|
+
var tmp_18 = tmp_17;
|
|
779
|
+
var tmp_19 = Spacer_instance.p23(3);
|
|
780
|
+
var tmp_20;
|
|
781
|
+
// Inline function 'kotlin.collections.isNotEmpty' call
|
|
782
|
+
if (!endpoint.w25_1.l()) {
|
|
783
|
+
tmp_20 = joinToString(endpoint.w25_1, ' + ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_15(this));
|
|
784
|
+
} else {
|
|
785
|
+
tmp_20 = 'emptyMap()';
|
|
786
|
+
}
|
|
787
|
+
return trimMargin('\n |' + tmp + tmp_0 + '\n |' + tmp_1 + 'override val path = Path' + tmp_3 + '\n |' + tmp_4 + 'override val method = Wirespec.Method.' + endpoint.t25_1.q2_1 + '\n |' + tmp_5 + 'override val queries = Queries' + tmp_6 + '\n |' + tmp_7 + 'override val headers = Headers' + tmp_8 + tmp_9 + '\n |' + tmp_10 + '}\n |\n |' + tmp_11 + 'fun toRequest(serialization: Wirespec.Serializer<String>, request: Request): Wirespec.RawRequest =\n |' + tmp_12 + 'Wirespec.RawRequest(\n |' + tmp_13 + 'path = listOf(' + tmp_14 + '),\n |' + tmp_15 + 'method = request.method.name,\n |' + tmp_16 + 'queries = ' + tmp_18 + ',\n |' + tmp_19 + 'headers = ' + tmp_20 + ',\n |' + Spacer_instance.p23(3) + 'body = serialization.serialize(request.body, typeOf<' + emit(_this__u8e3s4.m26_1, this) + '>()),\n |' + Spacer_instance.p23(2) + ')\n |\n |' + Spacer_instance.toString() + 'fun fromRequest(serialization: Wirespec.Deserializer<String>, request: Wirespec.RawRequest): Request =\n |' + Spacer_instance.p23(2) + 'Request' + emitDeserializedParams(_this__u8e3s4, this, endpoint) + '\n ');
|
|
788
|
+
};
|
|
789
|
+
protoOf(KotlinEmitter).t2a = function (_this__u8e3s4) {
|
|
790
|
+
var tmp = Spacer_instance.toString();
|
|
791
|
+
var tmp_0 = emit(_this__u8e3s4.q26_1, this);
|
|
792
|
+
// Inline function 'kotlin.let' call
|
|
793
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
794
|
+
// Inline function 'community.flock.wirespec.emitters.kotlin.KotlinEmitter.emit.<anonymous>' call
|
|
795
|
+
var it = joinToString(_this__u8e3s4.p26_1, ', ', VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_16(this));
|
|
796
|
+
var tmp_1 = isBlank(it) ? '' : ', ' + it;
|
|
797
|
+
var tmp_2 = toString_0(charSequenceGet(_this__u8e3s4.o26_1, 0));
|
|
798
|
+
var tmp_3 = emit(_this__u8e3s4.q26_1, this);
|
|
799
|
+
var tmp_4 = concatGenerics(emit(_this__u8e3s4.q26_1, this));
|
|
800
|
+
var tmp_5 = Spacer_instance.p23(2);
|
|
801
|
+
var tmp_6 = this.r26(_this__u8e3s4.o26_1);
|
|
802
|
+
var tmp_7 = Spacer_instance.p23(2);
|
|
803
|
+
var tmp_8 = brace(joinToString(_this__u8e3s4.p26_1, VOID, VOID, VOID, VOID, VOID, KotlinEmitter$emit$lambda_17(this)), this);
|
|
804
|
+
return trimMargin('\n |' + tmp + 'data class Response' + _this__u8e3s4.o26_1 + '(override val body: ' + tmp_0 + tmp_1 + ') : Response' + tmp_2 + 'XX<' + tmp_3 + '>, Response' + tmp_4 + ' {\n |' + tmp_5 + 'override val status = ' + tmp_6 + '\n |' + tmp_7 + 'override val headers = ResponseHeaders' + tmp_8 + '\n |' + emitObject(_this__u8e3s4.p26_1, this, 'ResponseHeaders', 'Wirespec.Response.Headers', 2, KotlinEmitter$emit$lambda_18(this)) + '\n |' + Spacer_instance.toString() + '}\n ');
|
|
805
|
+
};
|
|
806
|
+
protoOf(KotlinEmitter).r2a = function (_this__u8e3s4) {
|
|
807
|
+
return sanitizeFirstIsDigit(joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_'), this);
|
|
808
|
+
};
|
|
809
|
+
protoOf(KotlinEmitter).s2a = function (_this__u8e3s4) {
|
|
810
|
+
return Companion_getInstance().o2a_1.o1(_this__u8e3s4) ? addBackticks(_this__u8e3s4) : _this__u8e3s4;
|
|
811
|
+
};
|
|
812
|
+
function KotlinShared() {
|
|
813
|
+
KotlinShared_instance = this;
|
|
814
|
+
this.v2a_1 = 'community.flock.wirespec.kotlin';
|
|
815
|
+
this.w2a_1 = trimMargin('\n |package ' + this.v2a_1 + '\n |\n |import kotlin.reflect.KType\n |\n |object Wirespec {\n |' + Spacer_instance.toString() + 'interface Enum { val label: String }\n |' + Spacer_instance.toString() + 'interface Endpoint\n |' + Spacer_instance.toString() + 'interface Refined { val value: String }\n |' + Spacer_instance.toString() + 'interface Path\n |' + Spacer_instance.toString() + 'interface Queries\n |' + Spacer_instance.toString() + 'interface Headers\n |' + Spacer_instance.toString() + 'interface Handler\n |' + Spacer_instance.toString() + 'interface ServerEdge<Req: Request<*>, Res: Response<*>> { \n |' + Spacer_instance.toString() + 'fun from(request: RawRequest): Req \n |' + Spacer_instance.toString() + 'fun to(response: Res): RawResponse\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface ClientEdge<Req: Request<*>, Res: Response<*>> { \n |' + Spacer_instance.p23(2) + 'fun to(request: Req): RawRequest\n |' + Spacer_instance.p23(2) + 'fun from(response: RawResponse): Res\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Client<Req : Request<*>, Res : Response<*>> {\n |' + Spacer_instance.p23(2) + 'val pathTemplate: String\n |' + Spacer_instance.p23(2) + 'val method: String\n |' + Spacer_instance.p23(2) + 'fun client(serialization: Serialization<String>): ClientEdge<Req, Res>\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'interface Server<Req : Request<*>, Res : Response<*>> {\n |' + Spacer_instance.p23(2) + 'val pathTemplate: String\n |' + Spacer_instance.p23(2) + 'val method: String\n |' + Spacer_instance.p23(2) + 'fun server(serialization: Serialization<String>): ServerEdge<Req, Res>\n |' + Spacer_instance.toString() + '}\n |' + Spacer_instance.toString() + 'enum class Method { GET, PUT, POST, DELETE, OPTIONS, HEAD, PATCH, TRACE }\n |' + Spacer_instance.toString() + 'interface Request<T : Any> { val path: Path; val method: Method; val queries: Queries; val headers: Headers; val body: T; interface Headers : Wirespec.Headers }\n |' + Spacer_instance.toString() + 'interface Response<T : Any> { val status: Int; val headers: Headers; val body: T; interface Headers : Wirespec.Headers }\n |' + Spacer_instance.toString() + 'interface Serialization<RAW : Any> : Serializer<RAW>, Deserializer<RAW>, ParamSerialization\n |' + Spacer_instance.toString() + 'interface ParamSerialization: ParamSerializer, ParamDeserializer\n |' + Spacer_instance.toString() + 'interface ParamSerializer { fun <T> serializeParam(value: T, kType: KType): List<String> }\n |' + Spacer_instance.toString() + 'interface Serializer<RAW : Any> : ParamSerializer { fun <T> serialize(t: T, kType: KType): RAW }\n |' + Spacer_instance.toString() + 'interface Deserializer<RAW: Any>: ParamDeserializer { fun <T> deserialize(raw: RAW, kType: KType): T }\n |' + Spacer_instance.toString() + 'interface ParamDeserializer { fun <T> deserializeParam(values: List<String>, kType: KType): T }\n |' + Spacer_instance.toString() + 'data class RawRequest(val method: String, val path: List<String>, val queries: Map<String, List<String>>, val headers: Map<String, List<String>>, val body: String?) \n |' + Spacer_instance.toString() + 'data class RawResponse(val statusCode: Int, val headers: Map<String, List<String>>, val body: String?)\n |}\n ');
|
|
816
|
+
}
|
|
817
|
+
protoOf(KotlinShared).toString = function () {
|
|
818
|
+
return 'KotlinShared';
|
|
819
|
+
};
|
|
820
|
+
protoOf(KotlinShared).hashCode = function () {
|
|
821
|
+
return -563306154;
|
|
822
|
+
};
|
|
823
|
+
protoOf(KotlinShared).equals = function (other) {
|
|
824
|
+
if (this === other)
|
|
825
|
+
return true;
|
|
826
|
+
if (!(other instanceof KotlinShared))
|
|
827
|
+
return false;
|
|
828
|
+
other instanceof KotlinShared || THROW_CCE();
|
|
829
|
+
return true;
|
|
830
|
+
};
|
|
831
|
+
var KotlinShared_instance;
|
|
832
|
+
function KotlinShared_getInstance() {
|
|
833
|
+
if (KotlinShared_instance == null)
|
|
834
|
+
new KotlinShared();
|
|
835
|
+
return KotlinShared_instance;
|
|
836
|
+
}
|
|
837
|
+
//region block: exports
|
|
838
|
+
export {
|
|
839
|
+
KotlinEmitter as KotlinEmitterddb8247fx90i,
|
|
840
|
+
KotlinShared_getInstance as KotlinShared_getInstanceiccawfpqjyjd,
|
|
841
|
+
};
|
|
842
|
+
//endregion
|
|
843
|
+
|
|
844
|
+
//# sourceMappingURL=wirespec-src-compiler-emitters-kotlin.mjs.map
|