@devvit/multiplatform
Advanced tools
Comparing version 0.0.1-20240518-2c9eb775 to 0.0.1-20240520-742d6a9a
type Nullable<T> = T | null | undefined | ||
export declare namespace net.devvit { | ||
class SubscribeCallbackParams<Req, Rsp> { | ||
constructor(request: Req, response: Rsp); | ||
constructor(request: Req, response: Rsp, mode: net.devvit.Mode); | ||
get request(): Req; | ||
get response(): Rsp; | ||
copy(request?: Req, response?: Rsp): net.devvit.SubscribeCallbackParams<Req, Rsp>; | ||
get mode(): net.devvit.Mode; | ||
copy(request?: Req, response?: Rsp, mode?: net.devvit.Mode): net.devvit.SubscribeCallbackParams<Req, Rsp>; | ||
toString(): string; | ||
@@ -12,2 +13,21 @@ hashCode(): number; | ||
} | ||
abstract class Mode { | ||
private constructor(); | ||
static get SYNC(): net.devvit.Mode & { | ||
get name(): "SYNC"; | ||
get ordinal(): 0; | ||
}; | ||
static get ASYNC(): net.devvit.Mode & { | ||
get name(): "ASYNC"; | ||
get ordinal(): 1; | ||
}; | ||
static get SPEC(): net.devvit.Mode & { | ||
get name(): "SPEC"; | ||
get ordinal(): 2; | ||
}; | ||
static values(): Array<net.devvit.Mode>; | ||
static valueOf(value: string): net.devvit.Mode; | ||
get name(): "SYNC" | "ASYNC" | "SPEC"; | ||
get ordinal(): 0 | 1 | 2; | ||
} | ||
} | ||
@@ -17,6 +37,8 @@ export declare namespace net.devvit { | ||
constructor(); | ||
get logger(): net.devvit.Logger; | ||
set logger(value: net.devvit.Logger); | ||
get logger(): net.devvit.config.Logger; | ||
set logger(value: net.devvit.config.Logger); | ||
get errorHandler(): (p0: Error) => void; | ||
set errorHandler(value: (p0: Error) => void); | ||
get featureFlags(): net.devvit.config.FeatureFlags; | ||
set featureFlags(value: net.devvit.config.FeatureFlags); | ||
} | ||
@@ -64,4 +86,5 @@ } | ||
interface DispatcherOptions { | ||
logger: net.devvit.Logger; | ||
logger: net.devvit.config.Logger; | ||
errorHandler: (p0: Error) => void; | ||
featureFlags: net.devvit.config.FeatureFlags; | ||
} | ||
@@ -83,10 +106,2 @@ } | ||
export declare namespace net.devvit { | ||
interface Logger { | ||
info(messages: Array<any>): void; | ||
error(messages: Array<any>): void; | ||
warn(messages: Array<any>): void; | ||
debug(messages: Array<any>): void; | ||
} | ||
} | ||
export declare namespace net.devvit { | ||
interface Request<State, Event> { | ||
@@ -124,2 +139,15 @@ readonly events: Array<Event>; | ||
} | ||
export declare namespace net.devvit.config { | ||
interface FeatureFlags { | ||
readonly isSpeculativeExecutionEnabled: boolean; | ||
} | ||
} | ||
export declare namespace net.devvit.config { | ||
interface Logger { | ||
info(messages: Array<any>): void; | ||
error(messages: Array<any>): void; | ||
warn(messages: Array<any>): void; | ||
debug(messages: Array<any>): void; | ||
} | ||
} | ||
export declare namespace net.devvit.timer { | ||
@@ -126,0 +154,0 @@ interface TimerDelegate { |
@@ -18,10 +18,13 @@ (function (root, factory) { | ||
var emptyList = kotlin_kotlin.$_$.j; | ||
var protoOf = kotlin_kotlin.$_$.t; | ||
var protoOf = kotlin_kotlin.$_$.u; | ||
var classMeta = kotlin_kotlin.$_$.n; | ||
var setMetadataFor = kotlin_kotlin.$_$.u; | ||
var setMetadataFor = kotlin_kotlin.$_$.v; | ||
var VOID = kotlin_kotlin.$_$.b; | ||
var hashCode = kotlin_kotlin.$_$.r; | ||
var THROW_CCE = kotlin_kotlin.$_$.x; | ||
var THROW_CCE = kotlin_kotlin.$_$.z; | ||
var equals = kotlin_kotlin.$_$.p; | ||
var THROW_IAE = kotlin_kotlin.$_$.a1; | ||
var Unit_instance = kotlin_kotlin.$_$.g; | ||
var Enum = kotlin_kotlin.$_$.x; | ||
var defineProp = kotlin_kotlin.$_$.o; | ||
var first = kotlin_kotlin.$_$.k; | ||
@@ -34,11 +37,11 @@ var toList = kotlin_kotlin.$_$.m; | ||
var ArrayDeque_init_$Create$ = kotlin_kotlin.$_$.c; | ||
var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.y; | ||
var Pair = kotlin_kotlin.$_$.w; | ||
var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.b1; | ||
var Pair = kotlin_kotlin.$_$.y; | ||
var isArray = kotlin_kotlin.$_$.s; | ||
var addAll = kotlin_kotlin.$_$.h; | ||
var defineProp = kotlin_kotlin.$_$.o; | ||
var toString = kotlin_kotlin.$_$.v; | ||
var toString = kotlin_kotlin.$_$.w; | ||
var objectMeta = kotlin_kotlin.$_$.t; | ||
var getStringHashCode = kotlin_kotlin.$_$.q; | ||
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.d; | ||
var to = kotlin_kotlin.$_$.z; | ||
var to = kotlin_kotlin.$_$.c1; | ||
//endregion | ||
@@ -49,2 +52,3 @@ //region block: pre-declaration | ||
setMetadataFor(SubscribeCallbackParams, 'SubscribeCallbackParams', classMeta); | ||
setMetadataFor(Mode, 'Mode', classMeta, Enum); | ||
setMetadataFor(Callback, 'Callback', classMeta); | ||
@@ -55,2 +59,3 @@ setMetadataFor(DispatcherImpl$subscribe$1, VOID, classMeta); | ||
setMetadataFor(DispatcherSnapshot, 'DispatcherSnapshot', classMeta); | ||
setMetadataFor(Disabled, 'Disabled', objectMeta); | ||
setMetadataFor(NiceLogger, 'NiceLogger', classMeta); | ||
@@ -64,5 +69,5 @@ setMetadataFor(NoOpLogger, 'NoOpLogger', classMeta, VOID, VOID, NoOpLogger); | ||
function OneAtATimeAssembler(logger) { | ||
this.p5_1 = logger; | ||
this.w5_1 = logger; | ||
} | ||
protoOf(OneAtATimeAssembler).q5 = function (queue) { | ||
protoOf(OneAtATimeAssembler).x5 = function (queue, mode) { | ||
var tmp; | ||
@@ -72,4 +77,4 @@ if (queue.r()) { | ||
} else { | ||
var item = queue.b5(); | ||
this.p5_1.s5(['building batch of ', item]); | ||
var item = queue.i5(); | ||
this.w5_1.z5([mode, 'building batch of ', item]); | ||
tmp = listOf(item); | ||
@@ -81,31 +86,39 @@ } | ||
} | ||
protoOf(NoOpDeduper).t5 = function (events) { | ||
protoOf(NoOpDeduper).a6 = function (events) { | ||
return events; | ||
}; | ||
function SubscribeCallbackParams(request, response) { | ||
function SubscribeCallbackParams(request, response, mode) { | ||
this.request = request; | ||
this.response = response; | ||
this.mode = mode; | ||
} | ||
protoOf(SubscribeCallbackParams).u5 = function () { | ||
protoOf(SubscribeCallbackParams).b6 = function () { | ||
return this.request; | ||
}; | ||
protoOf(SubscribeCallbackParams).v5 = function () { | ||
protoOf(SubscribeCallbackParams).c6 = function () { | ||
return this.response; | ||
}; | ||
protoOf(SubscribeCallbackParams).w5 = function () { | ||
protoOf(SubscribeCallbackParams).d6 = function () { | ||
return this.mode; | ||
}; | ||
protoOf(SubscribeCallbackParams).e6 = function () { | ||
return this.request; | ||
}; | ||
protoOf(SubscribeCallbackParams).x5 = function () { | ||
protoOf(SubscribeCallbackParams).f6 = function () { | ||
return this.response; | ||
}; | ||
protoOf(SubscribeCallbackParams).y5 = function (request, response) { | ||
return new SubscribeCallbackParams(request, response); | ||
protoOf(SubscribeCallbackParams).g6 = function () { | ||
return this.mode; | ||
}; | ||
protoOf(SubscribeCallbackParams).copy = function (request, response, $super) { | ||
protoOf(SubscribeCallbackParams).h6 = function (request, response, mode) { | ||
return new SubscribeCallbackParams(request, response, mode); | ||
}; | ||
protoOf(SubscribeCallbackParams).copy = function (request, response, mode, $super) { | ||
request = request === VOID ? this.request : request; | ||
response = response === VOID ? this.response : response; | ||
return this.y5(request, response); | ||
mode = mode === VOID ? this.mode : mode; | ||
return this.h6(request, response, mode); | ||
}; | ||
protoOf(SubscribeCallbackParams).toString = function () { | ||
return 'SubscribeCallbackParams(request=' + this.request + ', response=' + this.response + ')'; | ||
return 'SubscribeCallbackParams(request=' + this.request + ', response=' + this.response + ', mode=' + this.mode + ')'; | ||
}; | ||
@@ -115,2 +128,3 @@ protoOf(SubscribeCallbackParams).hashCode = function () { | ||
result = imul(result, 31) + (this.response == null ? 0 : hashCode(this.response)) | 0; | ||
result = imul(result, 31) + this.mode.hashCode() | 0; | ||
return result; | ||
@@ -128,14 +142,60 @@ }; | ||
return false; | ||
if (!this.mode.equals(tmp0_other_with_cast.mode)) | ||
return false; | ||
return true; | ||
}; | ||
var Mode_SYNC_instance; | ||
var Mode_ASYNC_instance; | ||
var Mode_SPEC_instance; | ||
function values() { | ||
return [Mode_SYNC_getInstance(), Mode_ASYNC_getInstance(), Mode_SPEC_getInstance()]; | ||
} | ||
function valueOf(value) { | ||
switch (value) { | ||
case 'SYNC': | ||
return Mode_SYNC_getInstance(); | ||
case 'ASYNC': | ||
return Mode_ASYNC_getInstance(); | ||
case 'SPEC': | ||
return Mode_SPEC_getInstance(); | ||
default: | ||
Mode_initEntries(); | ||
THROW_IAE('No enum constant value.'); | ||
break; | ||
} | ||
} | ||
var Mode_entriesInitialized; | ||
function Mode_initEntries() { | ||
if (Mode_entriesInitialized) | ||
return Unit_instance; | ||
Mode_entriesInitialized = true; | ||
Mode_SYNC_instance = new Mode('SYNC', 0); | ||
Mode_ASYNC_instance = new Mode('ASYNC', 1); | ||
Mode_SPEC_instance = new Mode('SPEC', 2); | ||
} | ||
function Mode(name, ordinal) { | ||
Enum.call(this, name, ordinal); | ||
} | ||
function Mode_SYNC_getInstance() { | ||
Mode_initEntries(); | ||
return Mode_SYNC_instance; | ||
} | ||
function Mode_ASYNC_getInstance() { | ||
Mode_initEntries(); | ||
return Mode_ASYNC_instance; | ||
} | ||
function Mode_SPEC_getInstance() { | ||
Mode_initEntries(); | ||
return Mode_SPEC_instance; | ||
} | ||
function Callback(success, failure) { | ||
this.z5_1 = success; | ||
this.a6_1 = failure; | ||
this.k6_1 = success; | ||
this.l6_1 = failure; | ||
} | ||
protoOf(Callback).toString = function () { | ||
return 'Callback(success=' + this.z5_1 + ', failure=' + this.a6_1 + ')'; | ||
return 'Callback(success=' + this.k6_1 + ', failure=' + this.l6_1 + ')'; | ||
}; | ||
protoOf(Callback).hashCode = function () { | ||
var result = hashCode(this.z5_1); | ||
result = imul(result, 31) + hashCode(this.a6_1) | 0; | ||
var result = hashCode(this.k6_1); | ||
result = imul(result, 31) + hashCode(this.l6_1) | 0; | ||
return result; | ||
@@ -149,14 +209,41 @@ }; | ||
var tmp0_other_with_cast = other instanceof Callback ? other : THROW_CCE(); | ||
if (!equals(this.z5_1, tmp0_other_with_cast.z5_1)) | ||
if (!equals(this.k6_1, tmp0_other_with_cast.k6_1)) | ||
return false; | ||
if (!equals(this.a6_1, tmp0_other_with_cast.a6_1)) | ||
if (!equals(this.l6_1, tmp0_other_with_cast.l6_1)) | ||
return false; | ||
return true; | ||
}; | ||
function processBatch($this, batch) { | ||
function recalculateSpeculativeWork($this) { | ||
resetSpeculation($this); | ||
$this.h7_1 = true; | ||
$this.r6_1.z5(['recalculateSpeculativeWork']); | ||
var iterator = $this.v6_1.j(); | ||
var index = 0; | ||
$l$loop_1: while (iterator.k()) { | ||
var i = index; | ||
index = index + 1 | 0; | ||
var item = iterator.m(); | ||
if (i === 0) | ||
continue $l$loop_1; | ||
if ((item.retry === true ? true : item.async === true) ? true : item.remoteOnly === true) | ||
continue $l$loop_1; | ||
if ($this.x6_1.d5_1 > 10) | ||
break $l$loop_1; | ||
$this.x6_1.g(item); | ||
} | ||
} | ||
function cancelSpeculation($this) { | ||
$this.r6_1.z5(['cancelSpeculation']); | ||
$this.h7_1 = false; | ||
resetSpeculation($this); | ||
} | ||
function resetSpeculation($this) { | ||
$this.x6_1.l5(); | ||
$this.f7_1 = $this.o6_1.clone($this.state); | ||
$this.g7_1 = $this.g7_1 + 1 | 0; | ||
} | ||
function processBatch($this, batch, mode) { | ||
if (batch.r()) { | ||
return Unit_instance; | ||
} | ||
var isBatchSync = !(first(batch).async === true); | ||
var request = $this.c6_1.t6($this.state, batch); | ||
var tmp; | ||
@@ -167,57 +254,87 @@ var tmp0_elvis_lhs = first(batch).remoteOnly; | ||
} else { | ||
tmp = !$this.u6().isReady(); | ||
tmp = !$this.i7().isReady(); | ||
} | ||
var isRemote = tmp; | ||
var runtime = isRemote ? $this.v6() : $this.u6(); | ||
var tmp2 = $this.h6_1; | ||
$this.h6_1 = tmp2 + 1 | 0; | ||
if (mode.equals(Mode_SYNC_getInstance())) | ||
$this.y6_1 = true; | ||
var request = $this.n6_1.j7(mode.equals(Mode_SPEC_getInstance()) ? $this.f7_1 : $this.state, batch); | ||
var runtime = isRemote ? $this.k7() : $this.i7(); | ||
var tmp2 = $this.s6_1; | ||
$this.s6_1 = tmp2 + 1 | 0; | ||
var requestId = tmp2; | ||
var tmp_0 = DispatcherImpl$processBatch$lambda($this, isRemote, request, requestId, isBatchSync); | ||
var cbs = new Callback(tmp_0, DispatcherImpl$processBatch$lambda_0($this, requestId, batch)); | ||
var intendedGeneration = $this.g7_1; | ||
var tmp_0 = DispatcherImpl$processBatch$lambda($this, mode, isRemote, request, intendedGeneration, requestId); | ||
var cbs = new Callback(tmp_0, DispatcherImpl$processBatch$lambda_0($this, mode, isRemote, request, requestId, batch)); | ||
// Inline function 'kotlin.collections.set' call | ||
$this.n6_1.g1(requestId, cbs); | ||
runtime.handle($this.e6_1, request, cbs.z5_1, cbs.a6_1); | ||
$this.z6_1.g1(requestId, cbs); | ||
runtime.handle($this.p6_1, request, cbs.k6_1, cbs.l6_1); | ||
} | ||
function reset($this, isResettingTimers) { | ||
$this.state = $this.s6_1; | ||
$this.l6_1.e5(); | ||
$this.k6_1.e5(); | ||
$this.u6().reset(); | ||
$this.v6().reset(); | ||
$this.state = $this.o6_1.clone($this.e7_1); | ||
$this.w6_1.l5(); | ||
$this.v6_1.l5(); | ||
$this.i7().reset(); | ||
$this.k7().reset(); | ||
cancelSpeculation($this); | ||
if (isResettingTimers) { | ||
$this.w6().clear(); | ||
$this.l7().clear(); | ||
} | ||
} | ||
function DispatcherImpl$subscribe$1(this$0, $typedCallback) { | ||
this.x6_1 = this$0; | ||
this.y6_1 = $typedCallback; | ||
this.m7_1 = this$0; | ||
this.n7_1 = $typedCallback; | ||
} | ||
protoOf(DispatcherImpl$subscribe$1).unsubscribe = function () { | ||
this.x6_1.o6_1.h(this.y6_1); | ||
this.m7_1.a7_1.h(this.n7_1); | ||
}; | ||
function DispatcherImpl$processBatch$lambda(this$0, $isRemote, $request, $requestId, $isBatchSync) { | ||
function DispatcherImpl$processBatch$lambda(this$0, $mode, $isRemote, $request, $intendedGeneration, $requestId) { | ||
return function (rsp) { | ||
this$0.g6_1.s5([$isRemote ? 'remote' : 'local', 'runtime success', $request, rsp]); | ||
this$0.n6_1.h1($requestId); | ||
var tmp0_iterator = this$0.o6_1.j(); | ||
this$0.r6_1.z5([$mode, $isRemote ? 'remote' : 'local', 'runtime success', $request, rsp]); | ||
var tmp; | ||
if ($mode.equals(Mode_SPEC_getInstance()) ? !(this$0.g7_1 === $intendedGeneration) : false) { | ||
this$0.r6_1.z5(['throwing away stale speculative results']); | ||
return Unit_instance; | ||
} | ||
this$0.z6_1.h1($requestId); | ||
this$0.r6_1.z5([$mode, 'responding', new SubscribeCallbackParams($request, rsp, $mode)]); | ||
var tmp0_iterator = this$0.a7_1.j(); | ||
while (tmp0_iterator.k()) { | ||
var element = tmp0_iterator.m(); | ||
// Inline function 'net.devvit.DispatcherImpl.processBatch.<anonymous>.<anonymous>' call | ||
element(new SubscribeCallbackParams($request, rsp)); | ||
element(new SubscribeCallbackParams($request, rsp, $mode)); | ||
} | ||
var tmp; | ||
if ($isBatchSync) { | ||
this$0.state = this$0.d6_1.merge(this$0.state, rsp.state); | ||
this$0.m6_1 = false; | ||
this$0.z6(); | ||
tmp = Unit_instance; | ||
var tmp_0; | ||
if ($mode.equals(Mode_SYNC_getInstance())) { | ||
this$0.state = this$0.o6_1.merge(this$0.state, rsp.state); | ||
this$0.y6_1 = false; | ||
tmp_0 = Unit_instance; | ||
} else if ($mode.equals(Mode_SPEC_getInstance())) { | ||
this$0.f7_1 = this$0.o6_1.merge(this$0.f7_1, rsp.state); | ||
tmp_0 = Unit_instance; | ||
} | ||
this$0.a7(toList(rsp.replay)); | ||
this$0.o7(toList(rsp.replay), $mode); | ||
var tmp_1; | ||
if ($mode.equals(Mode_SYNC_getInstance())) { | ||
recalculateSpeculativeWork(this$0); | ||
tmp_1 = Unit_instance; | ||
} | ||
this$0.p7(); | ||
return Unit_instance; | ||
}; | ||
} | ||
function DispatcherImpl$processBatch$lambda_0(this$0, $requestId, $batch) { | ||
function DispatcherImpl$processBatch$lambda_0(this$0, $mode, $isRemote, $request, $requestId, $batch) { | ||
return function (err) { | ||
this$0.g6_1.b7(['failed with error', err]); | ||
this$0.n6_1.h1($requestId); | ||
this$0.r6_1.q7([$mode, $isRemote ? 'remote' : 'local', 'runtime error', err, $request]); | ||
this$0.z6_1.h1($requestId); | ||
var tmp; | ||
if ($mode.equals(Mode_SYNC_getInstance())) { | ||
this$0.y6_1 = false; | ||
tmp = Unit_instance; | ||
} | ||
var tmp_0; | ||
if ($mode.equals(Mode_SPEC_getInstance())) { | ||
cancelSpeculation(this$0); | ||
this$0.p7(); | ||
return Unit_instance; | ||
} | ||
// Inline function 'kotlin.collections.groupBy' call | ||
@@ -234,3 +351,3 @@ // Inline function 'kotlin.collections.groupByTo' call | ||
var value = destination.p1(key); | ||
var tmp; | ||
var tmp_1; | ||
if (value == null) { | ||
@@ -240,11 +357,11 @@ // Inline function 'kotlin.collections.groupByTo.<anonymous>' call | ||
destination.g1(key, answer); | ||
tmp = answer; | ||
tmp_1 = answer; | ||
} else { | ||
tmp = value; | ||
tmp_1 = value; | ||
} | ||
var list = tmp; | ||
var list = tmp_1; | ||
list.g(element); | ||
} | ||
var replayable = destination; | ||
var tmp_0; | ||
var tmp_2; | ||
// Inline function 'kotlin.collections.isNullOrEmpty' call | ||
@@ -258,6 +375,6 @@ var this_1 = replayable.p1(false); | ||
var events = copyToArray(this_2); | ||
this$0.g6_1.s5(arrayConcat([['unretryable', err], events])); | ||
tmp_0 = this$0.f6_1.errorHandler(err); | ||
this$0.r6_1.z5(arrayConcat([['unretryable', err], events])); | ||
tmp_2 = this$0.q6_1.errorHandler(err); | ||
} | ||
var tmp_1; | ||
var tmp_3; | ||
// Inline function 'kotlin.collections.isNullOrEmpty' call | ||
@@ -281,4 +398,8 @@ var this_3 = replayable.p1(true); | ||
var tmp2_elvis_lhs = replayable.p1(true); | ||
this$0.a7(tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs); | ||
tmp_1 = Unit_instance; | ||
this$0.o7(tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs, $mode); | ||
if ($mode.equals(Mode_SYNC_getInstance())) { | ||
recalculateSpeculativeWork(this$0); | ||
} | ||
this$0.p7(); | ||
tmp_3 = Unit_instance; | ||
} | ||
@@ -291,40 +412,47 @@ return Unit_instance; | ||
options = options === VOID ? new EmptyOptions() : options; | ||
this.b6_1 = state; | ||
this.c6_1 = requestBuilder; | ||
this.d6_1 = stateOperations; | ||
this.e6_1 = method; | ||
this.f6_1 = options; | ||
this.g6_1 = new NiceLogger(this.f6_1.logger); | ||
this.h6_1 = 0; | ||
this.i6_1 = new NoOpDeduper(); | ||
this.j6_1 = new OneAtATimeAssembler(this.g6_1); | ||
this.k6_1 = ArrayDeque_init_$Create$(); | ||
this.l6_1 = ArrayDeque_init_$Create$(); | ||
this.m6_1 = false; | ||
this.m6_1 = state; | ||
this.n6_1 = requestBuilder; | ||
this.o6_1 = stateOperations; | ||
this.p6_1 = method; | ||
this.q6_1 = options; | ||
this.r6_1 = new NiceLogger(this.q6_1.logger); | ||
this.s6_1 = 0; | ||
this.t6_1 = new NoOpDeduper(); | ||
this.u6_1 = new OneAtATimeAssembler(this.r6_1); | ||
this.v6_1 = ArrayDeque_init_$Create$(); | ||
this.w6_1 = ArrayDeque_init_$Create$(); | ||
this.x6_1 = ArrayDeque_init_$Create$(); | ||
this.y6_1 = false; | ||
var tmp = this; | ||
// Inline function 'kotlin.collections.mutableMapOf' call | ||
tmp.n6_1 = LinkedHashMap_init_$Create$(); | ||
tmp.z6_1 = LinkedHashMap_init_$Create$(); | ||
var tmp_0 = this; | ||
// Inline function 'kotlin.collections.mutableListOf' call | ||
tmp_0.o6_1 = ArrayList_init_$Create$(); | ||
this.s6_1 = this.state; | ||
this.g6_1.s5(['constructed Dispatcher v2']); | ||
tmp_0.a7_1 = ArrayList_init_$Create$(); | ||
this.e7_1 = this.o6_1.clone(this.state); | ||
this.f7_1 = this.o6_1.clone(this.e7_1); | ||
this.g7_1 = 0; | ||
this.h7_1 = true; | ||
this.r6_1.z5(['constructed Dispatcher v2']); | ||
} | ||
protoOf(DispatcherImpl).c7 = function (_set____db54di) { | ||
this.b6_1 = _set____db54di; | ||
protoOf(DispatcherImpl).r7 = function (_set____db54di) { | ||
this.m6_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).d7 = function () { | ||
return this.b6_1; | ||
protoOf(DispatcherImpl).s7 = function () { | ||
return this.m6_1; | ||
}; | ||
protoOf(DispatcherImpl).e7 = function () { | ||
return this.k6_1; | ||
protoOf(DispatcherImpl).t7 = function () { | ||
return this.v6_1; | ||
}; | ||
protoOf(DispatcherImpl).f7 = function () { | ||
return this.l6_1; | ||
protoOf(DispatcherImpl).u7 = function () { | ||
return this.w6_1; | ||
}; | ||
protoOf(DispatcherImpl).g7 = function (_set____db54di) { | ||
this.p6_1 = _set____db54di; | ||
protoOf(DispatcherImpl).v7 = function () { | ||
return this.x6_1; | ||
}; | ||
protoOf(DispatcherImpl).u6 = function () { | ||
var tmp = this.p6_1; | ||
protoOf(DispatcherImpl).w7 = function (_set____db54di) { | ||
this.b7_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).i7 = function () { | ||
var tmp = this.b7_1; | ||
if (!(tmp == null)) | ||
@@ -336,7 +464,7 @@ return tmp; | ||
}; | ||
protoOf(DispatcherImpl).h7 = function (_set____db54di) { | ||
this.q6_1 = _set____db54di; | ||
protoOf(DispatcherImpl).x7 = function (_set____db54di) { | ||
this.c7_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).v6 = function () { | ||
var tmp = this.q6_1; | ||
protoOf(DispatcherImpl).k7 = function () { | ||
var tmp = this.c7_1; | ||
if (!(tmp == null)) | ||
@@ -348,7 +476,7 @@ return tmp; | ||
}; | ||
protoOf(DispatcherImpl).i7 = function (_set____db54di) { | ||
this.r6_1 = _set____db54di; | ||
protoOf(DispatcherImpl).y7 = function (_set____db54di) { | ||
this.d7_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).w6 = function () { | ||
var tmp = this.r6_1; | ||
protoOf(DispatcherImpl).l7 = function () { | ||
var tmp = this.d7_1; | ||
if (!(tmp == null)) | ||
@@ -360,40 +488,61 @@ return tmp; | ||
}; | ||
protoOf(DispatcherImpl).j7 = function () { | ||
return this.s6_1; | ||
protoOf(DispatcherImpl).z7 = function () { | ||
return this.e7_1; | ||
}; | ||
protoOf(DispatcherImpl).a8 = function (_set____db54di) { | ||
this.f7_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).b8 = function () { | ||
return this.f7_1; | ||
}; | ||
protoOf(DispatcherImpl).c8 = function (_set____db54di) { | ||
this.g7_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).d8 = function () { | ||
return this.g7_1; | ||
}; | ||
protoOf(DispatcherImpl).e8 = function (_set____db54di) { | ||
this.h7_1 = _set____db54di; | ||
}; | ||
protoOf(DispatcherImpl).f8 = function () { | ||
return this.h7_1 ? this.q6_1.featureFlags.isSpeculativeExecutionEnabled : false; | ||
}; | ||
protoOf(DispatcherImpl).init = function (local, remote, timers) { | ||
this.g6_1.s5(['Initializing Dispatcher', local, remote]); | ||
this.p6_1 = local; | ||
this.q6_1 = remote; | ||
this.r6_1 = timers; | ||
this.z6(); | ||
this.r6_1.z5(['Initializing Dispatcher', local, remote]); | ||
this.b7_1 = local; | ||
this.c7_1 = remote; | ||
this.d7_1 = timers; | ||
this.p7(); | ||
}; | ||
protoOf(DispatcherImpl).subscribe = function (callback) { | ||
var typedCallback = typeof callback === 'function' ? callback : THROW_CCE(); | ||
this.o6_1.g(typedCallback); | ||
this.a7_1.g(typedCallback); | ||
return new DispatcherImpl$subscribe$1(this, typedCallback); | ||
}; | ||
protoOf(DispatcherImpl).z6 = function () { | ||
this.g6_1.s5(['ticking', this.l6_1.w4_1, this.k6_1.w4_1]); | ||
if ((!this.u6().isReady() ? !this.v6().isReady() : false) ? !(this.k6_1.r() ? this.l6_1.r() : false) : false) { | ||
this.g6_1.b7(['ticking with events and no runtime, deferring...']); | ||
protoOf(DispatcherImpl).p7 = function () { | ||
this.r6_1.z5(['ticking', this.y6_1, this.w6_1.d5_1, this.v6_1.d5_1, this.x6_1.d5_1]); | ||
if ((!this.i7().isReady() ? !this.k7().isReady() : false) ? !(this.v6_1.r() ? this.w6_1.r() : false) : false) { | ||
this.r6_1.q7(['ticking with events and no runtime, deferring...']); | ||
return Unit_instance; | ||
} | ||
if (!this.m6_1) { | ||
var batch = this.j6_1.q5(this.k6_1); | ||
processBatch(this, batch); | ||
if (!this.y6_1) { | ||
var batch = this.u6_1.x5(this.v6_1, Mode_SYNC_getInstance()); | ||
processBatch(this, batch, Mode_SYNC_getInstance()); | ||
} else if (this.f8()) { | ||
var batch_0 = this.u6_1.x5(this.x6_1, Mode_SPEC_getInstance()); | ||
processBatch(this, batch_0, Mode_SPEC_getInstance()); | ||
} | ||
if (!this.l6_1.r()) { | ||
while (!this.l6_1.r()) { | ||
var batch_0 = this.j6_1.q5(this.l6_1); | ||
processBatch(this, batch_0); | ||
if (!this.w6_1.r()) { | ||
while (!this.w6_1.r()) { | ||
var batch_1 = this.u6_1.x5(this.w6_1, Mode_ASYNC_getInstance()); | ||
processBatch(this, batch_1, Mode_ASYNC_getInstance()); | ||
} | ||
this.z6(); | ||
this.p7(); | ||
} | ||
}; | ||
protoOf(DispatcherImpl).a7 = function (events) { | ||
if (events.r()) { | ||
protoOf(DispatcherImpl).o7 = function (events, fromMode) { | ||
if (events.r() ? true : fromMode.equals(Mode_SPEC_getInstance())) { | ||
return Unit_instance; | ||
} | ||
this.g6_1.s5(['replaying events', events]); | ||
this.r6_1.z5(['replaying events', events]); | ||
// Inline function 'kotlin.collections.groupBy' call | ||
@@ -423,14 +572,13 @@ // Inline function 'kotlin.collections.groupByTo' call | ||
var tmp0_elvis_lhs = grouped.p1(new Pair(true, true)); | ||
this.l6_1.d5(0, tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs); | ||
this.w6_1.k5(0, tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs); | ||
var tmp1_elvis_lhs = grouped.p1(new Pair(true, false)); | ||
this.l6_1.n(tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs); | ||
this.w6_1.n(tmp1_elvis_lhs == null ? emptyList() : tmp1_elvis_lhs); | ||
var tmp2_elvis_lhs = grouped.p1(new Pair(false, true)); | ||
this.k6_1.d5(0, tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs); | ||
this.v6_1.k5(0, tmp2_elvis_lhs == null ? emptyList() : tmp2_elvis_lhs); | ||
var tmp3_elvis_lhs = grouped.p1(new Pair(false, false)); | ||
this.k6_1.n(tmp3_elvis_lhs == null ? emptyList() : tmp3_elvis_lhs); | ||
this.z6(); | ||
this.v6_1.n(tmp3_elvis_lhs == null ? emptyList() : tmp3_elvis_lhs); | ||
}; | ||
protoOf(DispatcherImpl).submit = function (events) { | ||
this.g6_1.s5(['submitted', events]); | ||
var deduped = this.i6_1.t5(toList(events)); | ||
this.r6_1.z5(arrayConcat([['submitted'], events])); | ||
var deduped = this.t6_1.a6(toList(events)); | ||
// Inline function 'kotlin.collections.forEach' call | ||
@@ -442,8 +590,11 @@ var tmp0_iterator = deduped.j(); | ||
if (element.async === true) { | ||
this.l6_1.g(element); | ||
this.w6_1.g(element); | ||
} else { | ||
this.k6_1.g(element); | ||
this.v6_1.g(element); | ||
if (this.y6_1 ? this.f8() : false) { | ||
this.x6_1.g(element); | ||
} | ||
} | ||
} | ||
this.z6(); | ||
this.p7(); | ||
}; | ||
@@ -454,14 +605,14 @@ protoOf(DispatcherImpl).reset = function () { | ||
protoOf(DispatcherImpl).snapshot = function () { | ||
var tmp = this.d6_1.clone(this.state); | ||
var tmp = this.o6_1.clone(this.state); | ||
// Inline function 'kotlin.collections.toTypedArray' call | ||
var this_0 = this.k6_1; | ||
var this_0 = this.v6_1; | ||
var tmp_0 = copyToArray(this_0); | ||
// Inline function 'kotlin.collections.toTypedArray' call | ||
var this_1 = this.l6_1; | ||
var this_1 = this.w6_1; | ||
var tmp$ret$1 = copyToArray(this_1); | ||
return new DispatcherSnapshot(tmp, tmp_0, tmp$ret$1, this.u6().snapshot(), this.v6().snapshot(), this.w6().list()); | ||
return new DispatcherSnapshot(tmp, tmp_0, tmp$ret$1, this.i7().snapshot(), this.k7().snapshot(), this.l7().list()); | ||
}; | ||
protoOf(DispatcherImpl).pause = function () { | ||
var snap = this.snapshot(); | ||
this.w6().pauseAll(); | ||
this.l7().pauseAll(); | ||
reset(this, false); | ||
@@ -471,12 +622,13 @@ return snap; | ||
protoOf(DispatcherImpl).resume = function (snap) { | ||
this.state = snap.state; | ||
this.l6_1.e5(); | ||
this.state = this.o6_1.clone(snap.state); | ||
this.w6_1.l5(); | ||
var tmp = snap.asyncQueue; | ||
addAll(this.l6_1, isArray(tmp) ? tmp : THROW_CCE()); | ||
this.k6_1.e5(); | ||
addAll(this.w6_1, isArray(tmp) ? tmp : THROW_CCE()); | ||
this.v6_1.l5(); | ||
var tmp_0 = snap.syncQueue; | ||
addAll(this.k6_1, isArray(tmp_0) ? tmp_0 : THROW_CCE()); | ||
this.u6().resume(snap.localSnapshot); | ||
this.v6().resume(snap.remoteSnapshot); | ||
this.w6().resumeAll(snap.timerSnapshot); | ||
addAll(this.v6_1, isArray(tmp_0) ? tmp_0 : THROW_CCE()); | ||
cancelSpeculation(this); | ||
this.i7().resume(snap.localSnapshot); | ||
this.k7().resume(snap.remoteSnapshot); | ||
this.l7().resumeAll(snap.timerSnapshot); | ||
}; | ||
@@ -487,18 +639,25 @@ function EmptyOptions$errorHandler$lambda(it) { | ||
function EmptyOptions() { | ||
this.k7_1 = new NoOpLogger(); | ||
this.g8_1 = new NoOpLogger(); | ||
var tmp = this; | ||
tmp.l7_1 = EmptyOptions$errorHandler$lambda; | ||
tmp.h8_1 = EmptyOptions$errorHandler$lambda; | ||
this.i8_1 = Disabled_instance; | ||
} | ||
protoOf(EmptyOptions).m7 = function (_set____db54di) { | ||
this.k7_1 = _set____db54di; | ||
protoOf(EmptyOptions).j8 = function (_set____db54di) { | ||
this.g8_1 = _set____db54di; | ||
}; | ||
protoOf(EmptyOptions).n7 = function () { | ||
return this.k7_1; | ||
protoOf(EmptyOptions).k8 = function () { | ||
return this.g8_1; | ||
}; | ||
protoOf(EmptyOptions).o7 = function (_set____db54di) { | ||
this.l7_1 = _set____db54di; | ||
protoOf(EmptyOptions).l8 = function (_set____db54di) { | ||
this.h8_1 = _set____db54di; | ||
}; | ||
protoOf(EmptyOptions).p7 = function () { | ||
return this.l7_1; | ||
protoOf(EmptyOptions).m8 = function () { | ||
return this.h8_1; | ||
}; | ||
protoOf(EmptyOptions).n8 = function (_set____db54di) { | ||
this.i8_1 = _set____db54di; | ||
}; | ||
protoOf(EmptyOptions).o8 = function () { | ||
return this.i8_1; | ||
}; | ||
function DispatcherSnapshot(state, syncQueue, asyncQueue, localSnapshot, remoteSnapshot, timerSnapshot) { | ||
@@ -512,39 +671,39 @@ this.state = state; | ||
} | ||
protoOf(DispatcherSnapshot).d7 = function () { | ||
protoOf(DispatcherSnapshot).s7 = function () { | ||
return this.state; | ||
}; | ||
protoOf(DispatcherSnapshot).e7 = function () { | ||
protoOf(DispatcherSnapshot).t7 = function () { | ||
return this.syncQueue; | ||
}; | ||
protoOf(DispatcherSnapshot).f7 = function () { | ||
protoOf(DispatcherSnapshot).u7 = function () { | ||
return this.asyncQueue; | ||
}; | ||
protoOf(DispatcherSnapshot).q7 = function () { | ||
protoOf(DispatcherSnapshot).p8 = function () { | ||
return this.localSnapshot; | ||
}; | ||
protoOf(DispatcherSnapshot).r7 = function () { | ||
protoOf(DispatcherSnapshot).q8 = function () { | ||
return this.remoteSnapshot; | ||
}; | ||
protoOf(DispatcherSnapshot).s7 = function () { | ||
protoOf(DispatcherSnapshot).r8 = function () { | ||
return this.timerSnapshot; | ||
}; | ||
protoOf(DispatcherSnapshot).w5 = function () { | ||
protoOf(DispatcherSnapshot).e6 = function () { | ||
return this.state; | ||
}; | ||
protoOf(DispatcherSnapshot).x5 = function () { | ||
protoOf(DispatcherSnapshot).f6 = function () { | ||
return this.syncQueue; | ||
}; | ||
protoOf(DispatcherSnapshot).t7 = function () { | ||
protoOf(DispatcherSnapshot).g6 = function () { | ||
return this.asyncQueue; | ||
}; | ||
protoOf(DispatcherSnapshot).u7 = function () { | ||
protoOf(DispatcherSnapshot).s8 = function () { | ||
return this.localSnapshot; | ||
}; | ||
protoOf(DispatcherSnapshot).v7 = function () { | ||
protoOf(DispatcherSnapshot).t8 = function () { | ||
return this.remoteSnapshot; | ||
}; | ||
protoOf(DispatcherSnapshot).w7 = function () { | ||
protoOf(DispatcherSnapshot).u8 = function () { | ||
return this.timerSnapshot; | ||
}; | ||
protoOf(DispatcherSnapshot).x7 = function (state, syncQueue, asyncQueue, localSnapshot, remoteSnapshot, timerSnapshot) { | ||
protoOf(DispatcherSnapshot).v8 = function (state, syncQueue, asyncQueue, localSnapshot, remoteSnapshot, timerSnapshot) { | ||
return new DispatcherSnapshot(state, syncQueue, asyncQueue, localSnapshot, remoteSnapshot, timerSnapshot); | ||
@@ -559,3 +718,3 @@ }; | ||
timerSnapshot = timerSnapshot === VOID ? this.timerSnapshot : timerSnapshot; | ||
return this.x7(state, syncQueue, asyncQueue, localSnapshot, remoteSnapshot, timerSnapshot); | ||
return this.v8(state, syncQueue, asyncQueue, localSnapshot, remoteSnapshot, timerSnapshot); | ||
}; | ||
@@ -594,10 +753,20 @@ protoOf(DispatcherSnapshot).toString = function () { | ||
}; | ||
function Disabled() { | ||
this.w8_1 = false; | ||
} | ||
protoOf(Disabled).x8 = function () { | ||
return this.w8_1; | ||
}; | ||
var Disabled_instance; | ||
function Disabled_getInstance() { | ||
return Disabled_instance; | ||
} | ||
function NiceLogger(logger) { | ||
this.r5_1 = logger; | ||
this.y5_1 = logger; | ||
} | ||
protoOf(NiceLogger).b7 = function (messages) { | ||
this.r5_1.warn(messages); | ||
protoOf(NiceLogger).q7 = function (messages) { | ||
this.y5_1.warn(messages); | ||
}; | ||
protoOf(NiceLogger).s5 = function (messages) { | ||
this.r5_1.debug(messages); | ||
protoOf(NiceLogger).z5 = function (messages) { | ||
this.y5_1.debug(messages); | ||
}; | ||
@@ -618,15 +787,15 @@ function NoOpLogger() { | ||
} | ||
protoOf(TimerDefinition).y7 = function () { | ||
protoOf(TimerDefinition).y8 = function () { | ||
return this.id; | ||
}; | ||
protoOf(TimerDefinition).z7 = function () { | ||
protoOf(TimerDefinition).z8 = function () { | ||
return this.duration; | ||
}; | ||
protoOf(TimerDefinition).w5 = function () { | ||
protoOf(TimerDefinition).e6 = function () { | ||
return this.id; | ||
}; | ||
protoOf(TimerDefinition).x5 = function () { | ||
protoOf(TimerDefinition).f6 = function () { | ||
return this.duration; | ||
}; | ||
protoOf(TimerDefinition).a8 = function (id, duration) { | ||
protoOf(TimerDefinition).a9 = function (id, duration) { | ||
return new TimerDefinition(id, duration); | ||
@@ -637,3 +806,3 @@ }; | ||
duration = duration === VOID ? this.duration : duration; | ||
return this.a8(id, duration); | ||
return this.a9(id, duration); | ||
}; | ||
@@ -664,15 +833,15 @@ protoOf(TimerDefinition).toString = function () { | ||
DispatcherImpl.call(this, state, new JsRequestBuilderAdapter(requestBuilder), new JsonStateOperations(), method, options); | ||
this.t8_1 = method; | ||
this.u8_1 = options; | ||
this.x9_1 = method; | ||
this.y9_1 = options; | ||
} | ||
function JsRequestBuilderAdapter(jsRequestBuilder) { | ||
this.v8_1 = jsRequestBuilder; | ||
this.z9_1 = jsRequestBuilder; | ||
} | ||
protoOf(JsRequestBuilderAdapter).w8 = function (state, events) { | ||
protoOf(JsRequestBuilderAdapter).aa = function (state, events) { | ||
// Inline function 'kotlin.collections.toTypedArray' call | ||
var tmp$ret$0 = copyToArray(events); | ||
return this.v8_1.build(state, tmp$ret$0); | ||
return this.z9_1.build(state, tmp$ret$0); | ||
}; | ||
protoOf(JsRequestBuilderAdapter).t6 = function (state, events) { | ||
return this.w8((!(state == null) ? !(state == null) : false) ? state : THROW_CCE(), events); | ||
protoOf(JsRequestBuilderAdapter).j7 = function (state, events) { | ||
return this.aa((!(state == null) ? !(state == null) : false) ? state : THROW_CCE(), events); | ||
}; | ||
@@ -710,3 +879,3 @@ function entriesOf(jsObject) { | ||
// Inline function 'net.devvit.JsonStateOperations.merge.<anonymous>' call | ||
result[element.n5_1] = element.o5_1; | ||
result[element.u5_1] = element.v5_1; | ||
} | ||
@@ -718,3 +887,3 @@ // Inline function 'kotlin.collections.forEach' call | ||
// Inline function 'net.devvit.JsonStateOperations.merge.<anonymous>' call | ||
result[element_0.n5_1] = element_0.o5_1; | ||
result[element_0.u5_1] = element_0.v5_1; | ||
} | ||
@@ -724,23 +893,36 @@ return result; | ||
//region block: post-declaration | ||
defineProp(protoOf(Mode), 'name', protoOf(Mode).e4); | ||
defineProp(protoOf(Mode), 'ordinal', protoOf(Mode).f4); | ||
defineProp(protoOf(DispatcherImpl), 'state', function () { | ||
return this.d7(); | ||
return this.s7(); | ||
}, function (value) { | ||
this.c7(value); | ||
this.r7(value); | ||
}); | ||
defineProp(protoOf(EmptyOptions), 'logger', function () { | ||
return this.n7(); | ||
return this.k8(); | ||
}, function (value) { | ||
this.m7(value); | ||
this.j8(value); | ||
}); | ||
defineProp(protoOf(EmptyOptions), 'errorHandler', function () { | ||
return this.p7(); | ||
return this.m8(); | ||
}, function (value) { | ||
this.o7(value); | ||
this.l8(value); | ||
}); | ||
defineProp(protoOf(EmptyOptions), 'featureFlags', function () { | ||
return this.o8(); | ||
}, function (value) { | ||
this.n8(value); | ||
}); | ||
defineProp(protoOf(Disabled), 'isSpeculativeExecutionEnabled', function () { | ||
return this.x8(); | ||
}); | ||
defineProp(protoOf(JsDispatcherImpl), 'state', function () { | ||
return this.d7(); | ||
return this.s7(); | ||
}, function (value) { | ||
this.c7(value); | ||
this.r7(value); | ||
}); | ||
//endregion | ||
//region block: init | ||
Disabled_instance = new Disabled(); | ||
//endregion | ||
//region block: exports | ||
@@ -751,2 +933,8 @@ function $jsExportAll$(_) { | ||
$net$devvit.SubscribeCallbackParams = SubscribeCallbackParams; | ||
$net$devvit.Mode = Mode; | ||
$net$devvit.Mode.values = values; | ||
$net$devvit.Mode.valueOf = valueOf; | ||
defineProp($net$devvit.Mode, 'SYNC', Mode_SYNC_getInstance); | ||
defineProp($net$devvit.Mode, 'ASYNC', Mode_ASYNC_getInstance); | ||
defineProp($net$devvit.Mode, 'SPEC', Mode_SPEC_getInstance); | ||
var $net = _.net || (_.net = {}); | ||
@@ -782,4 +970,8 @@ var $net$devvit = $net.devvit || ($net.devvit = {}); | ||
var $net$devvit = $net.devvit || ($net.devvit = {}); | ||
var $net$devvit$config = $net$devvit.config || ($net$devvit.config = {}); | ||
var $net = _.net || (_.net = {}); | ||
var $net$devvit = $net.devvit || ($net.devvit = {}); | ||
var $net$devvit$config = $net$devvit.config || ($net$devvit.config = {}); | ||
var $net = _.net || (_.net = {}); | ||
var $net$devvit = $net.devvit || ($net.devvit = {}); | ||
var $net$devvit$timer = $net$devvit.timer || ($net$devvit.timer = {}); | ||
@@ -786,0 +978,0 @@ var $net = _.net || (_.net = {}); |
{ | ||
"name": "@devvit/multiplatform", | ||
"version": "0.0.1-20240518-2c9eb775", | ||
"version": "0.0.1-20240520-742d6a9a", | ||
"main": "kotlin/ui-shared-shared.js", | ||
@@ -5,0 +5,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
271815
4956