@dxos/async 0.8.4-main.72ec0f3 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/dist/lib/browser/index.mjs +99 -84
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +99 -84
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/callback.d.ts.map +1 -1
- package/dist/types/src/chain.d.ts.map +1 -1
- package/dist/types/src/cleanup.d.ts +2 -2
- package/dist/types/src/cleanup.d.ts.map +1 -1
- package/dist/types/src/debounce.d.ts +15 -10
- package/dist/types/src/debounce.d.ts.map +1 -1
- package/dist/types/src/errors.d.ts.map +1 -1
- package/dist/types/src/event-emitter.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/mutex.d.ts.map +1 -1
- package/dist/types/src/observable-value.d.ts.map +1 -1
- package/dist/types/src/observable.d.ts.map +1 -1
- package/dist/types/src/persistent-lifecycle.d.ts +2 -2
- package/dist/types/src/persistent-lifecycle.d.ts.map +1 -1
- package/dist/types/src/stream-to-array.d.ts.map +1 -1
- package/dist/types/src/task-scheduling.d.ts +29 -1
- package/dist/types/src/task-scheduling.d.ts.map +1 -1
- package/dist/types/src/test-stream.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/timeout.d.ts +1 -1
- package/dist/types/src/timeout.d.ts.map +1 -1
- package/dist/types/src/timer.d.ts.map +1 -1
- package/dist/types/src/track-leaks.d.ts.map +1 -1
- package/dist/types/src/trigger.d.ts.map +1 -1
- package/dist/types/src/update-scheduler.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -11
- package/src/cleanup.ts +7 -4
- package/src/debounce.ts +19 -14
- package/src/event-emitter.test.ts +0 -1
- package/src/observable-value.ts +4 -2
- package/src/persistent-lifecycle.ts +10 -2
- package/src/task-scheduling.ts +95 -1
- package/src/timeout.ts +6 -9
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
|
@@ -22,7 +22,7 @@ var chain = (chain2) => async (elements) => {
|
|
|
22
22
|
import { ComplexMap } from "@dxos/util";
|
|
23
23
|
var combine = (...cleanupFns) => {
|
|
24
24
|
return () => {
|
|
25
|
-
cleanupFns.flat().forEach((cleanupFn) => cleanupFn());
|
|
25
|
+
cleanupFns.flat().filter((f) => typeof f === "function").forEach((cleanupFn) => cleanupFn());
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
var timeout = (cb, ms = 0) => {
|
|
@@ -39,8 +39,8 @@ var addEventListener = (target, type, listener, options) => {
|
|
|
39
39
|
};
|
|
40
40
|
var SubscriptionList = class {
|
|
41
41
|
_cleanups = [];
|
|
42
|
-
add(cb) {
|
|
43
|
-
this._cleanups.push(cb);
|
|
42
|
+
add(...cb) {
|
|
43
|
+
this._cleanups.push(...cb);
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
46
|
clear() {
|
|
@@ -166,6 +166,9 @@ var sleepWithContext = (ctx, ms) => {
|
|
|
166
166
|
};
|
|
167
167
|
var asyncReturn = () => sleep(0);
|
|
168
168
|
var asyncTimeout = async (promise, timeout2, err) => {
|
|
169
|
+
if (typeof promise === "function") {
|
|
170
|
+
throw new Error("First argument must be a promise.");
|
|
171
|
+
}
|
|
169
172
|
let timeoutId;
|
|
170
173
|
const throwable = err === void 0 || typeof err === "string" ? new TimeoutError(timeout2, err) : err;
|
|
171
174
|
const timeoutPromise = new Promise((resolve, reject) => {
|
|
@@ -174,9 +177,8 @@ var asyncTimeout = async (promise, timeout2, err) => {
|
|
|
174
177
|
}, timeout2);
|
|
175
178
|
unrefTimeout(timeoutId);
|
|
176
179
|
});
|
|
177
|
-
const conditionTimeout = typeof promise === "function" ? promiseFromCallback(promise) : promise;
|
|
178
180
|
return await Promise.race([
|
|
179
|
-
|
|
181
|
+
promise,
|
|
180
182
|
timeoutPromise
|
|
181
183
|
]).finally(() => {
|
|
182
184
|
clearTimeout(timeoutId);
|
|
@@ -213,7 +215,6 @@ var waitForEvent = (eventEmitter, eventName, test, timeout2, error) => {
|
|
|
213
215
|
|
|
214
216
|
// src/events.ts
|
|
215
217
|
import { Context } from "@dxos/context";
|
|
216
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/common/async/src/events.ts";
|
|
217
218
|
var DO_NOT_ERROR_ON_ASYNC_CALLBACK = true;
|
|
218
219
|
var Event = class _Event {
|
|
219
220
|
/**
|
|
@@ -268,10 +269,7 @@ var Event = class _Event {
|
|
|
268
269
|
_ctx,
|
|
269
270
|
_callback
|
|
270
271
|
] : [
|
|
271
|
-
new Context(
|
|
272
|
-
F: __dxlog_file,
|
|
273
|
-
L: 132
|
|
274
|
-
}),
|
|
272
|
+
new Context(),
|
|
275
273
|
_ctx
|
|
276
274
|
];
|
|
277
275
|
const weak = !!options?.weak;
|
|
@@ -301,10 +299,7 @@ var Event = class _Event {
|
|
|
301
299
|
_ctx,
|
|
302
300
|
_callback
|
|
303
301
|
] : [
|
|
304
|
-
new Context(
|
|
305
|
-
F: __dxlog_file,
|
|
306
|
-
L: 169
|
|
307
|
-
}),
|
|
302
|
+
new Context(),
|
|
308
303
|
_ctx
|
|
309
304
|
];
|
|
310
305
|
const listener = new EventListener(this, callback, ctx, true, false);
|
|
@@ -607,7 +602,7 @@ var MutexGuard = class {
|
|
|
607
602
|
this.release();
|
|
608
603
|
}
|
|
609
604
|
};
|
|
610
|
-
var classMutexSymbol = Symbol("class-mutex");
|
|
605
|
+
var classMutexSymbol = /* @__PURE__ */ Symbol("class-mutex");
|
|
611
606
|
var FORCE_DISABLE_WARNING = false;
|
|
612
607
|
var enableWarning = !FORCE_DISABLE_WARNING && globalThis.mochaExecutor;
|
|
613
608
|
var synchronized = (target, propertyName, descriptor) => {
|
|
@@ -638,7 +633,6 @@ import PushStream from "zen-push";
|
|
|
638
633
|
|
|
639
634
|
// src/trigger.ts
|
|
640
635
|
import { invariant } from "@dxos/invariant";
|
|
641
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/common/async/src/trigger.ts";
|
|
642
636
|
var trigger = (timeout2) => {
|
|
643
637
|
let callback;
|
|
644
638
|
const promise = new Promise((resolve, reject) => {
|
|
@@ -730,15 +724,7 @@ var Trigger = class {
|
|
|
730
724
|
}
|
|
731
725
|
};
|
|
732
726
|
var latch = ({ count = 1, timeout: timeout2 } = {}) => {
|
|
733
|
-
invariant(count >= 0
|
|
734
|
-
F: __dxlog_file2,
|
|
735
|
-
L: 139,
|
|
736
|
-
S: void 0,
|
|
737
|
-
A: [
|
|
738
|
-
"count >= 0",
|
|
739
|
-
""
|
|
740
|
-
]
|
|
741
|
-
});
|
|
727
|
+
invariant(count >= 0);
|
|
742
728
|
let t;
|
|
743
729
|
let doResolve;
|
|
744
730
|
let doReject;
|
|
@@ -935,16 +921,15 @@ import { warnAfterTimeout as warnAfterTimeout2 } from "@dxos/debug";
|
|
|
935
921
|
import { log as log2 } from "@dxos/log";
|
|
936
922
|
|
|
937
923
|
// src/task-scheduling.ts
|
|
938
|
-
import { ContextDisposedError as ContextDisposedError2 } from "@dxos/context";
|
|
924
|
+
import { Context as Context2, ContextDisposedError as ContextDisposedError2 } from "@dxos/context";
|
|
939
925
|
import { StackTrace as StackTrace2 } from "@dxos/debug";
|
|
940
926
|
|
|
941
927
|
// src/track-leaks.ts
|
|
942
928
|
import { StackTrace } from "@dxos/debug";
|
|
943
929
|
import { log } from "@dxos/log";
|
|
944
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/common/async/src/track-leaks.ts";
|
|
945
930
|
var enabled = typeof process !== "undefined" && !!process.env.DX_TRACK_LEAKS;
|
|
946
931
|
var openResources = /* @__PURE__ */ new Set();
|
|
947
|
-
var handleSymbol = Symbol("checkLeaksHandle");
|
|
932
|
+
var handleSymbol = /* @__PURE__ */ Symbol("checkLeaksHandle");
|
|
948
933
|
var trackResource = (resourceProvider) => {
|
|
949
934
|
if (!enabled) {
|
|
950
935
|
return () => {
|
|
@@ -991,31 +976,11 @@ var dumpLeaks = () => {
|
|
|
991
976
|
if (!enabled) {
|
|
992
977
|
return;
|
|
993
978
|
}
|
|
994
|
-
log.info(`Leaked resources ${openResources.size}
|
|
995
|
-
F: __dxlog_file3,
|
|
996
|
-
L: 82,
|
|
997
|
-
S: void 0,
|
|
998
|
-
C: (f, a) => f(...a)
|
|
999
|
-
});
|
|
979
|
+
log.info(`Leaked resources ${openResources.size}:`);
|
|
1000
980
|
for (const resource of openResources) {
|
|
1001
|
-
log.info(`- ${resource.name} at
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
S: void 0,
|
|
1005
|
-
C: (f, a) => f(...a)
|
|
1006
|
-
});
|
|
1007
|
-
log.info(resource.openStack.getStack(1), void 0, {
|
|
1008
|
-
F: __dxlog_file3,
|
|
1009
|
-
L: 85,
|
|
1010
|
-
S: void 0,
|
|
1011
|
-
C: (f, a) => f(...a)
|
|
1012
|
-
});
|
|
1013
|
-
log.info("\n", void 0, {
|
|
1014
|
-
F: __dxlog_file3,
|
|
1015
|
-
L: 86,
|
|
1016
|
-
S: void 0,
|
|
1017
|
-
C: (f, a) => f(...a)
|
|
1018
|
-
});
|
|
981
|
+
log.info(`- ${resource.name} at`);
|
|
982
|
+
log.info(resource.openStack.getStack(1));
|
|
983
|
+
log.info("\n");
|
|
1019
984
|
}
|
|
1020
985
|
};
|
|
1021
986
|
if (enabled) {
|
|
@@ -1072,6 +1037,79 @@ var DeferredTask = class {
|
|
|
1072
1037
|
await this._currentTask;
|
|
1073
1038
|
}
|
|
1074
1039
|
};
|
|
1040
|
+
var AsyncTask = class {
|
|
1041
|
+
#callback;
|
|
1042
|
+
#ctx = void 0;
|
|
1043
|
+
#scheduled = false;
|
|
1044
|
+
#currentTask = null;
|
|
1045
|
+
#nextTask = new Trigger();
|
|
1046
|
+
constructor(callback) {
|
|
1047
|
+
this.#callback = callback;
|
|
1048
|
+
}
|
|
1049
|
+
get scheduled() {
|
|
1050
|
+
return this.#scheduled;
|
|
1051
|
+
}
|
|
1052
|
+
/**
|
|
1053
|
+
* Context of the resource that owns the task.
|
|
1054
|
+
* When the context is disposed, the task is cancelled and cannot be scheduled again.
|
|
1055
|
+
*/
|
|
1056
|
+
open() {
|
|
1057
|
+
this.#ctx = new Context2();
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* Closes the task and waits for it to finish if it is running.
|
|
1061
|
+
*/
|
|
1062
|
+
async close() {
|
|
1063
|
+
await this.#ctx?.dispose();
|
|
1064
|
+
await this.join();
|
|
1065
|
+
this.#ctx = void 0;
|
|
1066
|
+
}
|
|
1067
|
+
[Symbol.asyncDispose]() {
|
|
1068
|
+
return this.close();
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Schedule the task to run asynchronously.
|
|
1072
|
+
*/
|
|
1073
|
+
// TODO(dmaretskyi): Add scheduleAt. Where the earlier time will override the later one.
|
|
1074
|
+
schedule() {
|
|
1075
|
+
if (!this.#ctx || this.#ctx.disposed) {
|
|
1076
|
+
throw new Error("AsyncTask not open");
|
|
1077
|
+
}
|
|
1078
|
+
if (this.#scheduled) {
|
|
1079
|
+
return;
|
|
1080
|
+
}
|
|
1081
|
+
scheduleTask(this.#ctx, async () => {
|
|
1082
|
+
await this.#currentTask;
|
|
1083
|
+
if (!this.#ctx || this.#ctx.disposed) {
|
|
1084
|
+
return;
|
|
1085
|
+
}
|
|
1086
|
+
this.#scheduled = false;
|
|
1087
|
+
const completionTrigger = this.#nextTask;
|
|
1088
|
+
this.#nextTask = new Trigger();
|
|
1089
|
+
this.#currentTask = runInContextAsync(this.#ctx, () => this.#callback()).then(() => {
|
|
1090
|
+
completionTrigger.wake();
|
|
1091
|
+
});
|
|
1092
|
+
});
|
|
1093
|
+
this.#scheduled = true;
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Schedule the task to run and wait for it to finish.
|
|
1097
|
+
*/
|
|
1098
|
+
async runBlocking() {
|
|
1099
|
+
if (this.#ctx?.disposed) {
|
|
1100
|
+
throw new ContextDisposedError2();
|
|
1101
|
+
}
|
|
1102
|
+
this.schedule();
|
|
1103
|
+
await this.#nextTask.wait();
|
|
1104
|
+
}
|
|
1105
|
+
/**
|
|
1106
|
+
* Waits for the current task to finish if it is running.
|
|
1107
|
+
* Does not schedule a new task.
|
|
1108
|
+
*/
|
|
1109
|
+
async join() {
|
|
1110
|
+
await this.#currentTask;
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1075
1113
|
var runInContext = (ctx, fn) => {
|
|
1076
1114
|
try {
|
|
1077
1115
|
fn();
|
|
@@ -1157,7 +1195,6 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
1157
1195
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1158
1196
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1159
1197
|
}
|
|
1160
|
-
var __dxlog_file4 = "/__w/dxos/dxos/packages/common/async/src/persistent-lifecycle.ts";
|
|
1161
1198
|
var INIT_RESTART_DELAY = 100;
|
|
1162
1199
|
var DEFAULT_MAX_RESTART_DELAY = 5e3;
|
|
1163
1200
|
var PersistentLifecycle = class extends Resource {
|
|
@@ -1183,25 +1220,21 @@ var PersistentLifecycle = class extends Resource {
|
|
|
1183
1220
|
try {
|
|
1184
1221
|
await this._restart();
|
|
1185
1222
|
} catch (err) {
|
|
1223
|
+
if (this._ctx?.disposed) {
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1186
1226
|
log2.warn("Restart failed", {
|
|
1187
1227
|
err
|
|
1188
|
-
}, {
|
|
1189
|
-
F: __dxlog_file4,
|
|
1190
|
-
L: 72,
|
|
1191
|
-
S: this,
|
|
1192
|
-
C: (f, a) => f(...a)
|
|
1193
1228
|
});
|
|
1194
1229
|
this._restartTask?.schedule();
|
|
1195
1230
|
}
|
|
1196
1231
|
});
|
|
1197
1232
|
this._currentState = await this._start().catch((err) => {
|
|
1233
|
+
if (this._ctx?.disposed) {
|
|
1234
|
+
return void 0;
|
|
1235
|
+
}
|
|
1198
1236
|
log2.warn("Start failed", {
|
|
1199
1237
|
err
|
|
1200
|
-
}, {
|
|
1201
|
-
F: __dxlog_file4,
|
|
1202
|
-
L: 78,
|
|
1203
|
-
S: this,
|
|
1204
|
-
C: (f, a) => f(...a)
|
|
1205
1238
|
});
|
|
1206
1239
|
this._restartTask?.schedule();
|
|
1207
1240
|
return void 0;
|
|
@@ -1215,11 +1248,6 @@ var PersistentLifecycle = class extends Resource {
|
|
|
1215
1248
|
async _restart() {
|
|
1216
1249
|
log2(`restarting in ${this._restartAfter}ms`, {
|
|
1217
1250
|
state: this._lifecycleState
|
|
1218
|
-
}, {
|
|
1219
|
-
F: __dxlog_file4,
|
|
1220
|
-
L: 91,
|
|
1221
|
-
S: this,
|
|
1222
|
-
C: (f, a) => f(...a)
|
|
1223
1251
|
});
|
|
1224
1252
|
await this._stopCurrentState();
|
|
1225
1253
|
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
@@ -1238,12 +1266,7 @@ var PersistentLifecycle = class extends Resource {
|
|
|
1238
1266
|
try {
|
|
1239
1267
|
await this._stop(this._currentState);
|
|
1240
1268
|
} catch (err) {
|
|
1241
|
-
log2.catch(err
|
|
1242
|
-
F: __dxlog_file4,
|
|
1243
|
-
L: 113,
|
|
1244
|
-
S: this,
|
|
1245
|
-
C: (f, a) => f(...a)
|
|
1246
|
-
});
|
|
1269
|
+
log2.catch(err);
|
|
1247
1270
|
}
|
|
1248
1271
|
this._currentState = void 0;
|
|
1249
1272
|
}
|
|
@@ -1267,7 +1290,6 @@ _ts_decorate([
|
|
|
1267
1290
|
|
|
1268
1291
|
// src/push-iterable.ts
|
|
1269
1292
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
1270
|
-
var __dxlog_file5 = "/__w/dxos/dxos/packages/common/async/src/push-iterable.ts";
|
|
1271
1293
|
var makePushIterable = () => {
|
|
1272
1294
|
const buf = [];
|
|
1273
1295
|
const trigger2 = new Trigger({
|
|
@@ -1281,15 +1303,7 @@ var makePushIterable = () => {
|
|
|
1281
1303
|
await trigger2.wait();
|
|
1282
1304
|
}
|
|
1283
1305
|
const item = buf.shift();
|
|
1284
|
-
invariant2(item
|
|
1285
|
-
F: __dxlog_file5,
|
|
1286
|
-
L: 42,
|
|
1287
|
-
S: this,
|
|
1288
|
-
A: [
|
|
1289
|
-
"item",
|
|
1290
|
-
""
|
|
1291
|
-
]
|
|
1292
|
-
});
|
|
1306
|
+
invariant2(item);
|
|
1293
1307
|
switch (item.kind) {
|
|
1294
1308
|
case "next":
|
|
1295
1309
|
return {
|
|
@@ -1594,6 +1608,7 @@ var UpdateScheduler = class {
|
|
|
1594
1608
|
}
|
|
1595
1609
|
};
|
|
1596
1610
|
export {
|
|
1611
|
+
AsyncTask,
|
|
1597
1612
|
CancellableObservableProvider,
|
|
1598
1613
|
DeferredTask,
|
|
1599
1614
|
Event,
|