@flock/wirespec 0.9.23 → 0.9.25
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.js +1 -1
- package/arrow-arrow-atomic.js +17 -18
- package/arrow-arrow-atomic.js.map +1 -1
- package/arrow-arrow-continuations.js +4 -4
- package/arrow-arrow-core.js +96 -99
- package/arrow-arrow-core.js.map +1 -1
- package/clikt-clikt.js +2045 -2060
- package/clikt-clikt.js.map +1 -1
- package/colormath-root-colormath.js +552 -444
- package/colormath-root-colormath.js.map +1 -1
- package/kotlin-kotlin-stdlib.js +7798 -7841
- package/kotlin-kotlin-stdlib.js.map +1 -1
- package/{kotlin-kotlin-test-kotlin-test-js-ir.js → kotlin-kotlin-test.js} +3 -3
- package/kotlin-openapi-bindings.js +5331 -5326
- package/kotlin-openapi-bindings.js.map +1 -1
- package/kotlin-rgxgen.js +2051 -2052
- package/kotlin-rgxgen.js.map +1 -1
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +1 -1
- package/kotlinx-serialization-kotlinx-serialization-core-js-ir.js +2151 -2187
- package/kotlinx-serialization-kotlinx-serialization-core-js-ir.js.map +1 -1
- package/kotlinx-serialization-kotlinx-serialization-json-js-ir.js +1571 -1731
- package/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.map +1 -1
- package/markdown.js +2308 -2317
- package/markdown.js.map +1 -1
- package/mordant-mordant.js +2405 -2492
- package/mordant-mordant.js.map +1 -1
- package/package.json +2 -2
- package/resources-library.js +1 -1
- package/wirespec-src-compiler-core.js +2578 -2457
- package/wirespec-src-compiler-core.js.map +1 -1
- package/wirespec-src-compiler-lib.js +733 -605
- package/wirespec-src-compiler-lib.js.map +1 -1
- package/wirespec-src-converter-openapi.js +1494 -1477
- package/wirespec-src-converter-openapi.js.map +1 -1
- package/wirespec-src-plugin-arguments.js +127 -124
- package/wirespec-src-plugin-arguments.js.map +1 -1
- package/wirespec-src-plugin-cli.js +236 -231
- package/wirespec-src-plugin-cli.js.map +1 -1
- package/wirespec-src-plugin-npm.d.ts +28 -9
- package/wirespec-src-plugin-npm.js +71 -71
- package/wirespec-src-plugin-npm.js.map +1 -1
- package/wirespec-src-tools-generator.js +176 -181
- package/wirespec-src-tools-generator.js.map +1 -1
- /package/{kotlin-kotlin-test-kotlin-test-js-ir.js.map → kotlin-kotlin-test.js.map} +0 -0
|
@@ -18,75 +18,133 @@
|
|
|
18
18
|
}
|
|
19
19
|
root['wirespec-src-tools-generator'] = factory(typeof this['wirespec-src-tools-generator'] === 'undefined' ? {} : this['wirespec-src-tools-generator'], this['kotlin-kotlin-stdlib'], this['wirespec-src-compiler-core'], this['kotlinx-serialization-kotlinx-serialization-json-js-ir'], this['kotlin-rgxgen']);
|
|
20
20
|
}
|
|
21
|
-
}(
|
|
21
|
+
}(globalThis, function (_, kotlin_kotlin, kotlin_community_flock_wirespec_compiler_core, kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json, kotlin_community_flock_kotlinx_rgxgen_kotlin_rgxgen) {
|
|
22
22
|
'use strict';
|
|
23
23
|
//region block: imports
|
|
24
|
-
var
|
|
24
|
+
var Default_getInstance = kotlin_kotlin.$_$.x3;
|
|
25
|
+
var VOID = kotlin_kotlin.$_$.g;
|
|
26
|
+
var removeSuffix = kotlin_kotlin.$_$.ad;
|
|
27
|
+
var endsWith = kotlin_kotlin.$_$.hc;
|
|
28
|
+
var Custom = kotlin_community_flock_wirespec_compiler_core.$_$.s;
|
|
29
|
+
var numberRangeToNumber = kotlin_kotlin.$_$.oa;
|
|
30
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.h5;
|
|
31
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.k;
|
|
25
32
|
var Unit_instance = kotlin_kotlin.$_$.i4;
|
|
33
|
+
var JsonArray = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.e;
|
|
34
|
+
var noWhenBranchMatchedException = kotlin_kotlin.$_$.vf;
|
|
35
|
+
var NotImplementedError = kotlin_kotlin.$_$.ve;
|
|
36
|
+
var Channel = kotlin_community_flock_wirespec_compiler_core.$_$.g;
|
|
37
|
+
var Endpoint = kotlin_community_flock_wirespec_compiler_core.$_$.p;
|
|
38
|
+
var Union = kotlin_community_flock_wirespec_compiler_core.$_$.b1;
|
|
39
|
+
var Enum = kotlin_community_flock_wirespec_compiler_core.$_$.q;
|
|
40
|
+
var Refined = kotlin_community_flock_wirespec_compiler_core.$_$.y;
|
|
41
|
+
var Type = kotlin_community_flock_wirespec_compiler_core.$_$.a1;
|
|
42
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.l;
|
|
26
43
|
var Definition = kotlin_community_flock_wirespec_compiler_core.$_$.i;
|
|
27
|
-
var isInterface = kotlin_kotlin.$_$.
|
|
28
|
-
var toString = kotlin_kotlin.$_$.
|
|
44
|
+
var isInterface = kotlin_kotlin.$_$.ia;
|
|
45
|
+
var toString = kotlin_kotlin.$_$.xa;
|
|
29
46
|
var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.n1;
|
|
30
|
-
var numberRangeToNumber = kotlin_kotlin.$_$.ka;
|
|
31
|
-
var collectionSizeOrDefault = kotlin_kotlin.$_$.h5;
|
|
32
|
-
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.k;
|
|
33
|
-
var JsonArray = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.e;
|
|
34
|
-
var noWhenBranchMatchedException = kotlin_kotlin.$_$.tf;
|
|
35
|
-
var NotImplementedError = kotlin_kotlin.$_$.te;
|
|
36
|
-
var Any = kotlin_community_flock_wirespec_compiler_core.$_$.r;
|
|
37
|
-
var JsonNull_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.c;
|
|
38
|
-
var Unit = kotlin_community_flock_wirespec_compiler_core.$_$.u;
|
|
39
|
-
var Custom = kotlin_community_flock_wirespec_compiler_core.$_$.s;
|
|
40
|
-
var Companion_instance = kotlin_community_flock_kotlinx_rgxgen_kotlin_rgxgen.$_$.a;
|
|
41
|
-
var JsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.h;
|
|
42
|
-
var JsonPrimitive_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.i;
|
|
43
|
-
var JsonPrimitive_1 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.j;
|
|
44
|
-
var Primitive = kotlin_community_flock_wirespec_compiler_core.$_$.t;
|
|
45
47
|
var emptyMap = kotlin_kotlin.$_$.a6;
|
|
46
48
|
var charSequenceLength = kotlin_kotlin.$_$.j9;
|
|
47
49
|
var charSequenceGet = kotlin_kotlin.$_$.i9;
|
|
48
50
|
var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.z1;
|
|
49
|
-
var Random = kotlin_kotlin.$_$.
|
|
50
|
-
var to = kotlin_kotlin.$_$.
|
|
51
|
+
var Random = kotlin_kotlin.$_$.ab;
|
|
52
|
+
var to = kotlin_kotlin.$_$.yf;
|
|
51
53
|
var plus = kotlin_kotlin.$_$.o7;
|
|
52
54
|
var JsonObject = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.g;
|
|
55
|
+
var JsonPrimitive = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.h;
|
|
53
56
|
var toList = kotlin_kotlin.$_$.i8;
|
|
54
|
-
var
|
|
55
|
-
var
|
|
56
|
-
var
|
|
57
|
-
var
|
|
58
|
-
var
|
|
59
|
-
var
|
|
60
|
-
var
|
|
61
|
-
var protoOf = kotlin_kotlin.$_$.qa;
|
|
62
|
-
var Default_getInstance = kotlin_kotlin.$_$.x3;
|
|
63
|
-
var VOID = kotlin_kotlin.$_$.g;
|
|
64
|
-
var objectMeta = kotlin_kotlin.$_$.pa;
|
|
65
|
-
var setMetadataFor = kotlin_kotlin.$_$.ra;
|
|
57
|
+
var Any = kotlin_community_flock_wirespec_compiler_core.$_$.r;
|
|
58
|
+
var JsonNull_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.c;
|
|
59
|
+
var Unit = kotlin_community_flock_wirespec_compiler_core.$_$.u;
|
|
60
|
+
var Companion_instance = kotlin_community_flock_kotlinx_rgxgen_kotlin_rgxgen.$_$.a;
|
|
61
|
+
var JsonPrimitive_0 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.i;
|
|
62
|
+
var JsonPrimitive_1 = kotlin_org_jetbrains_kotlinx_kotlinx_serialization_json.$_$.j;
|
|
63
|
+
var Primitive = kotlin_community_flock_wirespec_compiler_core.$_$.t;
|
|
66
64
|
//endregion
|
|
67
65
|
//region block: pre-declaration
|
|
68
|
-
setMetadataFor(Generator, 'Generator', objectMeta);
|
|
69
66
|
//endregion
|
|
70
|
-
function
|
|
67
|
+
function generate(_this__u8e3s4, type, random) {
|
|
68
|
+
random = random === VOID ? Default_getInstance() : random;
|
|
69
|
+
// Inline function 'kotlin.let' call
|
|
70
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
71
|
+
// Inline function 'community.flock.wirespec.generator.generate.<anonymous>' call
|
|
72
|
+
var it = new Custom(removeSuffix(type, '[]'), endsWith(type, '[]'), false);
|
|
73
|
+
return generate_0(_this__u8e3s4, it, random);
|
|
74
|
+
}
|
|
75
|
+
function generate_0(_this__u8e3s4, type, random) {
|
|
76
|
+
random = random === VOID ? Default_getInstance() : random;
|
|
77
|
+
// Inline function 'kotlin.let' call
|
|
78
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
79
|
+
// Inline function 'community.flock.wirespec.generator.generate.<anonymous>' call
|
|
80
|
+
var it = resolveReference(_this__u8e3s4, type);
|
|
81
|
+
return type.o21() ? generateIterator(_this__u8e3s4, it, random) : generateObject(_this__u8e3s4, it, random);
|
|
82
|
+
}
|
|
83
|
+
function generateIterator(_this__u8e3s4, def, random) {
|
|
84
|
+
// Inline function 'kotlin.let' call
|
|
85
|
+
// Inline function 'kotlin.collections.map' call
|
|
86
|
+
var this_0 = numberRangeToNumber(0, random.jf(10));
|
|
87
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
88
|
+
var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
|
|
89
|
+
var tmp0_iterator = this_0.g();
|
|
90
|
+
while (tmp0_iterator.h()) {
|
|
91
|
+
var item = tmp0_iterator.i();
|
|
92
|
+
// Inline function 'community.flock.wirespec.generator.generateIterator.<anonymous>' call
|
|
93
|
+
var tmp$ret$0 = generateObject(_this__u8e3s4, def, random);
|
|
94
|
+
destination.e(tmp$ret$0);
|
|
95
|
+
}
|
|
96
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
97
|
+
return new JsonArray(destination);
|
|
98
|
+
}
|
|
99
|
+
function generateObject(_this__u8e3s4, def, random) {
|
|
100
|
+
var tmp;
|
|
101
|
+
if (def instanceof Type) {
|
|
102
|
+
tmp = generateType(_this__u8e3s4, def, random);
|
|
103
|
+
} else {
|
|
104
|
+
if (def instanceof Refined) {
|
|
105
|
+
tmp = generateRefined(def, random);
|
|
106
|
+
} else {
|
|
107
|
+
if (def instanceof Enum) {
|
|
108
|
+
tmp = generateEnum(def, random);
|
|
109
|
+
} else {
|
|
110
|
+
if (def instanceof Union) {
|
|
111
|
+
tmp = generateUnion(_this__u8e3s4, def, random);
|
|
112
|
+
} else {
|
|
113
|
+
if (def instanceof Endpoint) {
|
|
114
|
+
throw new NotImplementedError('Endpoint cannot be generated');
|
|
115
|
+
} else {
|
|
116
|
+
if (def instanceof Channel) {
|
|
117
|
+
throw new NotImplementedError('Channel cannot be generated');
|
|
118
|
+
} else {
|
|
119
|
+
noWhenBranchMatchedException();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return tmp;
|
|
127
|
+
}
|
|
128
|
+
function resolveReference(_this__u8e3s4, type) {
|
|
71
129
|
// Inline function 'kotlin.collections.find' call
|
|
72
130
|
// Inline function 'kotlin.collections.filterIsInstance' call
|
|
73
131
|
// Inline function 'kotlin.collections.filterIsInstanceTo' call
|
|
74
|
-
var destination = ArrayList_init_$Create$();
|
|
75
|
-
var tmp0_iterator = _this__u8e3s4.
|
|
76
|
-
while (tmp0_iterator.
|
|
77
|
-
var element = tmp0_iterator.
|
|
132
|
+
var destination = ArrayList_init_$Create$_0();
|
|
133
|
+
var tmp0_iterator = _this__u8e3s4.g();
|
|
134
|
+
while (tmp0_iterator.h()) {
|
|
135
|
+
var element = tmp0_iterator.i();
|
|
78
136
|
if (!(element == null) ? isInterface(element, Definition) : false) {
|
|
79
|
-
destination.
|
|
137
|
+
destination.e(element);
|
|
80
138
|
}
|
|
81
139
|
}
|
|
82
140
|
var tmp$ret$3;
|
|
83
141
|
$l$block: {
|
|
84
142
|
// Inline function 'kotlin.collections.firstOrNull' call
|
|
85
|
-
var tmp0_iterator_0 = destination.
|
|
86
|
-
while (tmp0_iterator_0.
|
|
87
|
-
var element_0 = tmp0_iterator_0.
|
|
88
|
-
// Inline function 'community.flock.wirespec.generator.
|
|
89
|
-
if (element_0.
|
|
143
|
+
var tmp0_iterator_0 = destination.g();
|
|
144
|
+
while (tmp0_iterator_0.h()) {
|
|
145
|
+
var element_0 = tmp0_iterator_0.i();
|
|
146
|
+
// Inline function 'community.flock.wirespec.generator.resolveReference.<anonymous>' call
|
|
147
|
+
if (element_0.h2b().t28_1 === type.b1()) {
|
|
90
148
|
tmp$ret$3 = element_0;
|
|
91
149
|
break $l$block;
|
|
92
150
|
}
|
|
@@ -96,38 +154,84 @@
|
|
|
96
154
|
var tmp0_elvis_lhs = tmp$ret$3;
|
|
97
155
|
var tmp;
|
|
98
156
|
if (tmp0_elvis_lhs == null) {
|
|
99
|
-
var message = 'Definition not found in AST: ' + type;
|
|
157
|
+
var message = 'Definition not found in AST: ' + toString(type);
|
|
100
158
|
throw IllegalStateException_init_$Create$(toString(message));
|
|
101
159
|
} else {
|
|
102
160
|
tmp = tmp0_elvis_lhs;
|
|
103
161
|
}
|
|
104
162
|
return tmp;
|
|
105
163
|
}
|
|
106
|
-
function
|
|
164
|
+
function generateType(_this__u8e3s4, def, random) {
|
|
107
165
|
// Inline function 'kotlin.let' call
|
|
108
|
-
// Inline function 'kotlin.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
166
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
167
|
+
// Inline function 'community.flock.wirespec.generator.generateType.<anonymous>' call
|
|
168
|
+
var typeSeed = random.be();
|
|
169
|
+
// Inline function 'kotlin.let' call
|
|
170
|
+
// Inline function 'kotlin.collections.fold' call
|
|
171
|
+
var this_0 = def.o22_1.o28_1;
|
|
172
|
+
var accumulator = emptyMap();
|
|
173
|
+
var tmp0_iterator = this_0.g();
|
|
174
|
+
while (tmp0_iterator.h()) {
|
|
175
|
+
var element = tmp0_iterator.i();
|
|
176
|
+
// Inline function 'community.flock.wirespec.generator.generateType.<anonymous>.<anonymous>' call
|
|
177
|
+
var acc = accumulator;
|
|
178
|
+
// Inline function 'kotlin.let' call
|
|
179
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
180
|
+
// Inline function 'community.flock.wirespec.generator.generateType.<anonymous>.<anonymous>.<anonymous>' call
|
|
181
|
+
var value = element.p28_1.t28_1;
|
|
182
|
+
// Inline function 'kotlin.text.sumOf' call
|
|
183
|
+
var sum = 0;
|
|
184
|
+
var inductionVariable = 0;
|
|
185
|
+
while (inductionVariable < charSequenceLength(value)) {
|
|
186
|
+
var element_0 = charSequenceGet(value, inductionVariable);
|
|
187
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
188
|
+
var tmp = sum;
|
|
189
|
+
// Inline function 'community.flock.wirespec.generator.generateType.<anonymous>.<anonymous>.<anonymous>.<anonymous>' call
|
|
190
|
+
// Inline function 'kotlin.code' call
|
|
191
|
+
sum = tmp + Char__toInt_impl_vasixd(element_0) | 0;
|
|
192
|
+
}
|
|
193
|
+
var fieldSeed = typeSeed + sum | 0;
|
|
194
|
+
var fieldRandom = Random(fieldSeed);
|
|
195
|
+
accumulator = plus(acc, to(value, generateReference(_this__u8e3s4, element.q28_1, fieldRandom)));
|
|
118
196
|
}
|
|
197
|
+
var this_1 = accumulator;
|
|
119
198
|
// Inline function 'kotlin.contracts.contract' call
|
|
120
|
-
return new
|
|
199
|
+
return new JsonObject(this_1);
|
|
200
|
+
}
|
|
201
|
+
function generateRefined(def, random) {
|
|
202
|
+
// Inline function 'kotlin.let' call
|
|
203
|
+
var this_0 = randomRegex(def.r22_1.c29_1, random);
|
|
204
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
205
|
+
return JsonPrimitive(this_0);
|
|
206
|
+
}
|
|
207
|
+
function generateEnum(def, random) {
|
|
208
|
+
// Inline function 'kotlin.let' call
|
|
209
|
+
// Inline function 'kotlin.let' call
|
|
210
|
+
var this_0 = random.jf(def.u22_1.j());
|
|
211
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
212
|
+
var this_1 = toList(def.u22_1).o(this_0);
|
|
213
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
214
|
+
return JsonPrimitive(this_1);
|
|
215
|
+
}
|
|
216
|
+
function generateUnion(_this__u8e3s4, def, random) {
|
|
217
|
+
// Inline function 'kotlin.let' call
|
|
218
|
+
// Inline function 'kotlin.let' call
|
|
219
|
+
var this_0 = random.jf(def.k22_1.j());
|
|
220
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
221
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
222
|
+
// Inline function 'community.flock.wirespec.generator.generateUnion.<anonymous>' call
|
|
223
|
+
var it = toList(def.k22_1).o(this_0);
|
|
224
|
+
return generate_0(_this__u8e3s4, it, random);
|
|
121
225
|
}
|
|
122
|
-
function generateReference(_this__u8e3s4,
|
|
226
|
+
function generateReference(_this__u8e3s4, ref, random) {
|
|
123
227
|
var tmp;
|
|
124
228
|
if (ref instanceof Primitive) {
|
|
125
229
|
var tmp_0;
|
|
126
|
-
switch (ref.
|
|
230
|
+
switch (ref.u28_1.o2_1) {
|
|
127
231
|
case 0:
|
|
128
232
|
// Inline function 'kotlin.let' call
|
|
129
233
|
|
|
130
|
-
var this_0 = Companion_instance.
|
|
234
|
+
var this_0 = Companion_instance.r47('\\w{1,50}').a48(random);
|
|
131
235
|
// Inline function 'kotlin.contracts.contract' call
|
|
132
236
|
|
|
133
237
|
tmp_0 = JsonPrimitive(this_0);
|
|
@@ -135,7 +239,7 @@
|
|
|
135
239
|
case 1:
|
|
136
240
|
// Inline function 'kotlin.let' call
|
|
137
241
|
|
|
138
|
-
var this_1 = random.
|
|
242
|
+
var this_1 = random.be();
|
|
139
243
|
// Inline function 'kotlin.contracts.contract' call
|
|
140
244
|
|
|
141
245
|
tmp_0 = JsonPrimitive_0(this_1);
|
|
@@ -143,7 +247,7 @@
|
|
|
143
247
|
case 2:
|
|
144
248
|
// Inline function 'kotlin.let' call
|
|
145
249
|
|
|
146
|
-
var this_2 = random.
|
|
250
|
+
var this_2 = random.mf();
|
|
147
251
|
// Inline function 'kotlin.contracts.contract' call
|
|
148
252
|
|
|
149
253
|
tmp_0 = JsonPrimitive_0(this_2);
|
|
@@ -151,7 +255,7 @@
|
|
|
151
255
|
case 3:
|
|
152
256
|
// Inline function 'kotlin.let' call
|
|
153
257
|
|
|
154
|
-
var this_3 = random.
|
|
258
|
+
var this_3 = random.lf();
|
|
155
259
|
// Inline function 'kotlin.contracts.contract' call
|
|
156
260
|
|
|
157
261
|
tmp_0 = JsonPrimitive_1(this_3);
|
|
@@ -163,14 +267,11 @@
|
|
|
163
267
|
tmp = tmp_0;
|
|
164
268
|
} else {
|
|
165
269
|
if (ref instanceof Custom) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
tmp_1 = generateObject(_this__u8e3s4, $this, def, random);
|
|
172
|
-
}
|
|
173
|
-
tmp = tmp_1;
|
|
270
|
+
// Inline function 'kotlin.let' call
|
|
271
|
+
// Inline function 'kotlin.contracts.contract' call
|
|
272
|
+
// Inline function 'community.flock.wirespec.generator.generateReference.<anonymous>' call
|
|
273
|
+
var it = resolveReference(_this__u8e3s4, ref);
|
|
274
|
+
tmp = ref.z28_1 ? generateIterator(_this__u8e3s4, it, random) : generateObject(_this__u8e3s4, it, random);
|
|
174
275
|
} else {
|
|
175
276
|
if (ref instanceof Unit) {
|
|
176
277
|
tmp = JsonNull_getInstance();
|
|
@@ -185,123 +286,17 @@
|
|
|
185
286
|
}
|
|
186
287
|
return tmp;
|
|
187
288
|
}
|
|
188
|
-
function
|
|
189
|
-
var typeSeed = random.xd();
|
|
190
|
-
// Inline function 'kotlin.let' call
|
|
191
|
-
// Inline function 'kotlin.collections.fold' call
|
|
192
|
-
var this_0 = def.j27_1.l27_1;
|
|
193
|
-
var accumulator = emptyMap();
|
|
194
|
-
var tmp0_iterator = this_0.v();
|
|
195
|
-
while (tmp0_iterator.w()) {
|
|
196
|
-
var element = tmp0_iterator.y();
|
|
197
|
-
// Inline function 'community.flock.wirespec.generator.Generator.generateType.<anonymous>' call
|
|
198
|
-
var acc = accumulator;
|
|
199
|
-
// Inline function 'kotlin.let' call
|
|
200
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
201
|
-
// Inline function 'community.flock.wirespec.generator.Generator.generateType.<anonymous>.<anonymous>' call
|
|
202
|
-
var value = element.m27_1.q27_1;
|
|
203
|
-
// Inline function 'kotlin.text.sumOf' call
|
|
204
|
-
var sum = 0;
|
|
205
|
-
var inductionVariable = 0;
|
|
206
|
-
while (inductionVariable < charSequenceLength(value)) {
|
|
207
|
-
var element_0 = charSequenceGet(value, inductionVariable);
|
|
208
|
-
inductionVariable = inductionVariable + 1 | 0;
|
|
209
|
-
var tmp = sum;
|
|
210
|
-
// Inline function 'community.flock.wirespec.generator.Generator.generateType.<anonymous>.<anonymous>.<anonymous>' call
|
|
211
|
-
// Inline function 'kotlin.code' call
|
|
212
|
-
sum = tmp + Char__toInt_impl_vasixd(element_0) | 0;
|
|
213
|
-
}
|
|
214
|
-
var fieldSeed = typeSeed + sum | 0;
|
|
215
|
-
var fieldRandom = Random(fieldSeed);
|
|
216
|
-
accumulator = plus(acc, to(value, generateReference(_this__u8e3s4, Generator_instance, element.n27_1, fieldRandom)));
|
|
217
|
-
}
|
|
218
|
-
var this_1 = accumulator;
|
|
219
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
220
|
-
return new JsonObject(this_1);
|
|
221
|
-
}
|
|
222
|
-
function randomRegex($this, regex, random) {
|
|
289
|
+
function randomRegex(regex, random) {
|
|
223
290
|
var tmp = Companion_instance;
|
|
224
291
|
// Inline function 'kotlin.text.substring' call
|
|
225
292
|
var endIndex = regex.length - 2 | 0;
|
|
226
293
|
// Inline function 'kotlin.js.asDynamic' call
|
|
227
294
|
var tmp$ret$1 = regex.substring(1, endIndex);
|
|
228
|
-
|
|
229
|
-
return rgxgen.b47(random);
|
|
230
|
-
}
|
|
231
|
-
function generateRefined($this, def, random) {
|
|
232
|
-
var regex = def.x27_1.z27_1;
|
|
233
|
-
// Inline function 'kotlin.let' call
|
|
234
|
-
var this_0 = randomRegex($this, regex, random);
|
|
235
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
236
|
-
return JsonPrimitive(this_0);
|
|
237
|
-
}
|
|
238
|
-
function generateEnum($this, def, random) {
|
|
239
|
-
var index = random.ff(def.g27_1.p());
|
|
240
|
-
// Inline function 'kotlin.let' call
|
|
241
|
-
var this_0 = toList(def.g27_1).g1(index);
|
|
242
|
-
// Inline function 'kotlin.contracts.contract' call
|
|
243
|
-
return JsonPrimitive(this_0);
|
|
244
|
-
}
|
|
245
|
-
function generateUnion(_this__u8e3s4, $this, def, random) {
|
|
246
|
-
var index = random.ff(def.b29_1.p());
|
|
247
|
-
var type = toList(def.b29_1).g1(index);
|
|
248
|
-
return $this.u5i(_this__u8e3s4, type, random);
|
|
249
|
-
}
|
|
250
|
-
function generateObject(_this__u8e3s4, $this, def, random) {
|
|
251
|
-
var tmp;
|
|
252
|
-
if (def instanceof Type) {
|
|
253
|
-
tmp = generateType(_this__u8e3s4, $this, def, random);
|
|
254
|
-
} else {
|
|
255
|
-
if (def instanceof Refined) {
|
|
256
|
-
tmp = generateRefined($this, def, random);
|
|
257
|
-
} else {
|
|
258
|
-
if (def instanceof Enum) {
|
|
259
|
-
tmp = generateEnum($this, def, random);
|
|
260
|
-
} else {
|
|
261
|
-
if (def instanceof Union) {
|
|
262
|
-
tmp = generateUnion(_this__u8e3s4, $this, def, random);
|
|
263
|
-
} else {
|
|
264
|
-
if (def instanceof Endpoint) {
|
|
265
|
-
throw new NotImplementedError('Endpoint cannot be generated');
|
|
266
|
-
} else {
|
|
267
|
-
noWhenBranchMatchedException();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
return tmp;
|
|
274
|
-
}
|
|
275
|
-
function Generator() {
|
|
276
|
-
}
|
|
277
|
-
protoOf(Generator).v5i = function (_this__u8e3s4, type, random) {
|
|
278
|
-
var ref = new Custom(removeSuffix(type, '[]'), endsWith(type, '[]'), false);
|
|
279
|
-
return this.u5i(_this__u8e3s4, ref, random);
|
|
280
|
-
};
|
|
281
|
-
protoOf(Generator).w5i = function (_this__u8e3s4, type, random, $super) {
|
|
282
|
-
random = random === VOID ? Default_getInstance() : random;
|
|
283
|
-
return $super === VOID ? this.v5i(_this__u8e3s4, type, random) : $super.v5i.call(this, _this__u8e3s4, type, random);
|
|
284
|
-
};
|
|
285
|
-
protoOf(Generator).u5i = function (_this__u8e3s4, type, random) {
|
|
286
|
-
var def = resolveReference(_this__u8e3s4, this, type);
|
|
287
|
-
var tmp;
|
|
288
|
-
if (type.g21()) {
|
|
289
|
-
tmp = generateIterator(_this__u8e3s4, this, def, random);
|
|
290
|
-
} else {
|
|
291
|
-
tmp = generateObject(_this__u8e3s4, this, def, random);
|
|
292
|
-
}
|
|
293
|
-
return tmp;
|
|
294
|
-
};
|
|
295
|
-
var Generator_instance;
|
|
296
|
-
function Generator_getInstance() {
|
|
297
|
-
return Generator_instance;
|
|
295
|
+
return tmp.r47(tmp$ret$1).a48(random);
|
|
298
296
|
}
|
|
299
|
-
//region block: init
|
|
300
|
-
Generator_instance = new Generator();
|
|
301
|
-
//endregion
|
|
302
297
|
//region block: exports
|
|
303
298
|
_.$_$ = _.$_$ || {};
|
|
304
|
-
_.$_$.a =
|
|
299
|
+
_.$_$.a = generate;
|
|
305
300
|
//endregion
|
|
306
301
|
return _;
|
|
307
302
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/tools/generator/src/commonMain/kotlin/community/flock/wirespec/generator/Generator.kt","../../../../../src/plugin/npm/build/compileSync/js/main/productionLibrary/kotlin/
|
|
1
|
+
{"version":3,"sources":["../../../../../src/tools/generator/src/commonMain/kotlin/community/flock/wirespec/generator/Generator.kt","../../../../../src/plugin/npm/build/compileSync/js/main/productionLibrary/kotlin/src/kotlin/util/Standard.kt","../../../../../src/plugin/npm/build/compileSync/js/main/productionLibrary/kotlin/common/src/generated/_Collections.kt","../../../../../src/plugin/npm/build/compileSync/js/main/productionLibrary/kotlin/common/src/generated/_Strings.kt","../../../../../src/plugin/npm/build/compileSync/js/main/productionLibrary/kotlin/src/kotlin/CharCode.kt","../../../../../src/plugin/npm/build/compileSync/js/main/productionLibrary/kotlin/js/src/kotlin/text/stringJs.kt"],"sourcesContent":[null,null,null,null,null,null],"names":["generate","<this>","type","random","generateIterator","def","item","generateObject","resolveReference","element","generateType","accumulator","sum","fieldSeed","fieldRandom","generateRefined","generateEnum","generateUnion","generateReference","ref","randomRegex","regex"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAoBAA,CAAIC,a,EAAaC,I,EAAcC,MAA/BH,EAA+E;A;;;;aCc5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