@dxos/cli-util 0.8.4-main.52d7546f51 → 0.8.4-main.60689f5b1c
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/node-esm/{chunk-6TKUDRM6.mjs → chunk-N5LOOWPE.mjs} +1 -1
- package/dist/lib/node-esm/index.mjs +104 -68
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +2 -2
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/testing/test-console.d.ts.map +1 -1
- package/dist/types/src/testing/test-layer.d.ts +1 -1
- package/dist/types/src/testing/test-layer.d.ts.map +1 -1
- package/dist/types/src/util/form-builder.d.ts +1 -1
- package/dist/types/src/util/form-builder.d.ts.map +1 -1
- package/dist/types/src/util/options.d.ts.map +1 -1
- package/dist/types/src/util/platform.d.ts.map +1 -1
- package/dist/types/src/util/printer.d.ts.map +1 -1
- package/dist/types/src/util/runtime.d.ts +1 -1
- package/dist/types/src/util/runtime.d.ts.map +1 -1
- package/dist/types/src/util/space-format.d.ts +13 -2
- package/dist/types/src/util/space-format.d.ts.map +1 -1
- package/dist/types/src/util/space.d.ts +7 -7
- package/dist/types/src/util/space.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +17 -15
- package/src/testing/test-console.ts +1 -2
- package/src/testing/test-layer.ts +0 -1
- package/src/util/form-builder.ts +1 -1
- package/src/util/platform.ts +1 -2
- package/src/util/printer.ts +1 -1
- package/src/util/runtime.ts +1 -1
- package/src/util/space-format.ts +86 -12
- package/src/util/space.ts +41 -27
- /package/dist/lib/node-esm/{chunk-6TKUDRM6.mjs.map → chunk-N5LOOWPE.mjs.map} +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2025 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.
|
|
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
CommandConfig,
|
|
4
4
|
__export
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-N5LOOWPE.mjs";
|
|
6
6
|
|
|
7
7
|
// src/util/form-builder.ts
|
|
8
8
|
var form_builder_exports = {};
|
|
@@ -16,8 +16,8 @@ __export(form_builder_exports, {
|
|
|
16
16
|
set: () => set,
|
|
17
17
|
when: () => when
|
|
18
18
|
});
|
|
19
|
-
import * as Doc from "@effect/printer/Doc";
|
|
20
19
|
import * as Ansi from "@effect/printer-ansi/Ansi";
|
|
20
|
+
import * as Doc from "@effect/printer/Doc";
|
|
21
21
|
import * as Option from "effect/Option";
|
|
22
22
|
import * as Pipeable from "effect/Pipeable";
|
|
23
23
|
var FormBuilderImpl = class {
|
|
@@ -44,16 +44,16 @@ var calculateDimensions = (entries, prefix) => {
|
|
|
44
44
|
var buildKeyLine = (prefix, key, targetWidth) => {
|
|
45
45
|
return Doc.annotate(Doc.fill(targetWidth)(Doc.text(prefix + key + ": ")), Ansi.blackBright);
|
|
46
46
|
};
|
|
47
|
-
var setImpl = (builder, key,
|
|
48
|
-
if (
|
|
47
|
+
var setImpl = (builder, key, value, color) => {
|
|
48
|
+
if (value !== void 0) {
|
|
49
49
|
let valueDoc;
|
|
50
|
-
if (typeof
|
|
51
|
-
valueDoc =
|
|
50
|
+
if (typeof value === "object" && value !== null) {
|
|
51
|
+
valueDoc = value;
|
|
52
52
|
} else {
|
|
53
|
-
valueDoc = Doc.text(String(
|
|
53
|
+
valueDoc = Doc.text(String(value));
|
|
54
54
|
}
|
|
55
55
|
if (color) {
|
|
56
|
-
const ansi = typeof color === "function" ? color(
|
|
56
|
+
const ansi = typeof color === "function" ? color(value) : color;
|
|
57
57
|
valueDoc = Doc.annotate(valueDoc, ansi);
|
|
58
58
|
}
|
|
59
59
|
builder.entries.push({
|
|
@@ -68,13 +68,13 @@ function set(builderOrKey, keyOrValue, valueOrColor, color) {
|
|
|
68
68
|
if (builderOrKey instanceof FormBuilderImpl) {
|
|
69
69
|
const builder = builderOrKey;
|
|
70
70
|
const key = keyOrValue;
|
|
71
|
-
const
|
|
72
|
-
return setImpl(builder, key,
|
|
71
|
+
const value = valueOrColor;
|
|
72
|
+
return setImpl(builder, key, value, color);
|
|
73
73
|
} else {
|
|
74
74
|
const key = builderOrKey;
|
|
75
|
-
const
|
|
75
|
+
const value = keyOrValue;
|
|
76
76
|
const color2 = valueOrColor;
|
|
77
|
-
return (builder) => setImpl(builder, key,
|
|
77
|
+
return (builder) => setImpl(builder, key, value, color2);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
var nestImpl = (parent, key, builder) => {
|
|
@@ -103,9 +103,9 @@ function nest(parentOrKey, keyOrBuilder, builder) {
|
|
|
103
103
|
return (parent) => nestImpl(parent, key, builder2);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
var optionImpl = (builder, key,
|
|
107
|
-
if (Option.isSome(
|
|
108
|
-
return setImpl(builder, key,
|
|
106
|
+
var optionImpl = (builder, key, value, color) => {
|
|
107
|
+
if (Option.isSome(value)) {
|
|
108
|
+
return setImpl(builder, key, value.value, color);
|
|
109
109
|
}
|
|
110
110
|
return builder;
|
|
111
111
|
};
|
|
@@ -113,30 +113,30 @@ function option(builderOrKey, keyOrValue, valueOrColor, color) {
|
|
|
113
113
|
if (builderOrKey instanceof FormBuilderImpl) {
|
|
114
114
|
const builder = builderOrKey;
|
|
115
115
|
const key = keyOrValue;
|
|
116
|
-
const
|
|
117
|
-
return optionImpl(builder, key,
|
|
116
|
+
const value = valueOrColor;
|
|
117
|
+
return optionImpl(builder, key, value, color);
|
|
118
118
|
} else {
|
|
119
119
|
const key = builderOrKey;
|
|
120
|
-
const
|
|
120
|
+
const value = keyOrValue;
|
|
121
121
|
const color2 = valueOrColor;
|
|
122
|
-
return (builder) => optionImpl(builder, key,
|
|
122
|
+
return (builder) => optionImpl(builder, key, value, color2);
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
var nestedOptionImpl = (builder, key,
|
|
126
|
-
if (Option.isSome(
|
|
127
|
-
return nestImpl(builder, key,
|
|
125
|
+
var nestedOptionImpl = (builder, key, value) => {
|
|
126
|
+
if (Option.isSome(value)) {
|
|
127
|
+
return nestImpl(builder, key, value.value);
|
|
128
128
|
}
|
|
129
129
|
return builder;
|
|
130
130
|
};
|
|
131
|
-
function nestedOption(builderOrKey, keyOrValue,
|
|
131
|
+
function nestedOption(builderOrKey, keyOrValue, value) {
|
|
132
132
|
if (builderOrKey instanceof FormBuilderImpl) {
|
|
133
133
|
const builder = builderOrKey;
|
|
134
134
|
const key = keyOrValue;
|
|
135
|
-
return nestedOptionImpl(builder, key,
|
|
135
|
+
return nestedOptionImpl(builder, key, value);
|
|
136
136
|
} else {
|
|
137
137
|
const key = builderOrKey;
|
|
138
|
-
const
|
|
139
|
-
return (builder) => nestedOptionImpl(builder, key,
|
|
138
|
+
const value2 = keyOrValue;
|
|
139
|
+
return (builder) => nestedOptionImpl(builder, key, value2);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
var whenImpl = (builder, condition, ...ops) => {
|
|
@@ -179,18 +179,18 @@ function each(builderOrItems, itemsOrFn, fn3) {
|
|
|
179
179
|
var build = (builder) => {
|
|
180
180
|
const { targetWidth } = calculateDimensions(builder.entries, builder.prefix);
|
|
181
181
|
const entryLines = [];
|
|
182
|
-
builder.entries.forEach(({ key, value
|
|
182
|
+
builder.entries.forEach(({ key, value, isNested }) => {
|
|
183
183
|
const keyLine = buildKeyLine(builder.prefix, key, targetWidth);
|
|
184
184
|
if (isNested) {
|
|
185
185
|
entryLines.push(Doc.hcat([
|
|
186
186
|
keyLine,
|
|
187
187
|
Doc.hardLine,
|
|
188
|
-
|
|
188
|
+
value
|
|
189
189
|
]));
|
|
190
190
|
} else {
|
|
191
191
|
entryLines.push(Doc.hcat([
|
|
192
192
|
keyLine,
|
|
193
|
-
|
|
193
|
+
value
|
|
194
194
|
]));
|
|
195
195
|
}
|
|
196
196
|
});
|
|
@@ -213,8 +213,8 @@ var Common = {
|
|
|
213
213
|
};
|
|
214
214
|
|
|
215
215
|
// src/util/platform.ts
|
|
216
|
-
import { spawn } from "node:child_process";
|
|
217
216
|
import * as Effect from "effect/Effect";
|
|
217
|
+
import { spawn } from "node:child_process";
|
|
218
218
|
var copyToClipboard = (text3) => Effect.tryPromise({
|
|
219
219
|
try: () => {
|
|
220
220
|
return new Promise((resolve, reject) => {
|
|
@@ -303,8 +303,8 @@ var openBrowser = (url) => Effect.tryPromise({
|
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
// src/util/printer.ts
|
|
306
|
-
import * as Doc2 from "@effect/printer/Doc";
|
|
307
306
|
import * as AnsiDoc from "@effect/printer-ansi/AnsiDoc";
|
|
307
|
+
import * as Doc2 from "@effect/printer/Doc";
|
|
308
308
|
var print = (doc) => AnsiDoc.render(doc, {
|
|
309
309
|
style: "pretty"
|
|
310
310
|
});
|
|
@@ -324,8 +324,8 @@ var withTypes = (...types) => Effect2.gen(function* () {
|
|
|
324
324
|
import * as Console from "effect/Console";
|
|
325
325
|
import * as Effect3 from "effect/Effect";
|
|
326
326
|
import * as Layer from "effect/Layer";
|
|
327
|
-
import * as Match from "effect/Match";
|
|
328
327
|
import * as Option2 from "effect/Option";
|
|
328
|
+
import { getPersonalSpace } from "@dxos/app-toolkit";
|
|
329
329
|
import { ClientService as ClientService2 } from "@dxos/client";
|
|
330
330
|
import { Database } from "@dxos/echo";
|
|
331
331
|
import { BaseError } from "@dxos/errors";
|
|
@@ -340,35 +340,43 @@ var getSpace = (spaceId) => Effect3.gen(function* () {
|
|
|
340
340
|
}).pipe(Effect3.catchTag("NoSuchElementException", () => Effect3.fail(new SpaceNotFoundError(spaceId))));
|
|
341
341
|
var spaceIdWithDefault = (spaceId) => Effect3.gen(function* () {
|
|
342
342
|
const client = yield* ClientService2;
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
return Option2.getOrElse(spaceId, () => {
|
|
344
|
+
const personal = getPersonalSpace(client);
|
|
345
|
+
if (!personal) {
|
|
346
|
+
throw new Error("No space ID provided and no personal space found.");
|
|
347
|
+
}
|
|
348
|
+
return personal.id;
|
|
349
|
+
});
|
|
345
350
|
});
|
|
346
|
-
var spaceLayer = (spaceId$,
|
|
351
|
+
var spaceLayer = (spaceId$, fallbackToPersonalSpace = false) => {
|
|
347
352
|
const getSpace2 = Effect3.fn(function* () {
|
|
348
353
|
const client = yield* ClientService2;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
354
|
+
const resolveSpace = () => {
|
|
355
|
+
if (!fallbackToPersonalSpace) {
|
|
356
|
+
return spaceId$.pipe(Option2.flatMap((id) => Option2.fromNullable(client.spaces.get(id))));
|
|
357
|
+
}
|
|
358
|
+
return spaceId$.pipe(Option2.flatMap((id) => Option2.fromNullable(client.spaces.get(id))), Option2.orElse(() => Option2.fromNullable(getPersonalSpace(client))), Option2.orElse(() => Option2.fromNullable(client.spaces.get()[0])));
|
|
359
|
+
};
|
|
360
|
+
const space = resolveSpace().pipe(Option2.getOrUndefined);
|
|
352
361
|
if (space) {
|
|
353
362
|
yield* Effect3.promise(() => space.waitUntilReady());
|
|
354
363
|
}
|
|
355
364
|
return space;
|
|
356
365
|
});
|
|
366
|
+
const NO_DB_STUB = {
|
|
367
|
+
get db() {
|
|
368
|
+
throw new Error("Space not found");
|
|
369
|
+
}
|
|
370
|
+
};
|
|
357
371
|
const db = Layer.scoped(Database.Service, Effect3.acquireRelease(Effect3.gen(function* () {
|
|
358
372
|
const space = yield* getSpace2();
|
|
359
373
|
if (!space) {
|
|
360
|
-
return
|
|
361
|
-
get db() {
|
|
362
|
-
throw new Error("Space not found");
|
|
363
|
-
}
|
|
364
|
-
};
|
|
374
|
+
return NO_DB_STUB;
|
|
365
375
|
}
|
|
366
376
|
return {
|
|
367
377
|
db: space.db
|
|
368
378
|
};
|
|
369
|
-
}), (
|
|
370
|
-
indexes: true
|
|
371
|
-
}))));
|
|
379
|
+
}), (holder) => holder === NO_DB_STUB ? Effect3.void : Effect3.promise(() => holder.db.flush())));
|
|
372
380
|
const queue = Layer.effect(QueueService, Effect3.gen(function* () {
|
|
373
381
|
const space = yield* getSpace2();
|
|
374
382
|
if (!space) {
|
|
@@ -402,12 +410,7 @@ var waitForSync = Effect3.fn(function* (space) {
|
|
|
402
410
|
yield* Effect3.promise(() => space.internal.syncToEdge({
|
|
403
411
|
onProgress: (state) => log2.info("syncing", {
|
|
404
412
|
state: state ?? "no connection to edge"
|
|
405
|
-
}, {
|
|
406
|
-
F: __dxlog_file,
|
|
407
|
-
L: 125,
|
|
408
|
-
S: this,
|
|
409
|
-
C: (f, a) => f(...a)
|
|
410
|
-
})
|
|
413
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 107, S: this })
|
|
411
414
|
}));
|
|
412
415
|
yield* Console.log("Sync complete");
|
|
413
416
|
});
|
|
@@ -429,28 +432,61 @@ var SpaceNotFoundError = class extends BaseError.extend("SpaceNotFoundError", "S
|
|
|
429
432
|
};
|
|
430
433
|
|
|
431
434
|
// src/util/space-format.ts
|
|
435
|
+
import * as Duration from "effect/Duration";
|
|
432
436
|
import * as Effect4 from "effect/Effect";
|
|
433
437
|
import { SpaceState } from "@dxos/client/echo";
|
|
434
|
-
var
|
|
438
|
+
var DEFAULT_OPTIONS = {
|
|
435
439
|
verbose: false,
|
|
436
|
-
truncateKeys: false
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
440
|
+
truncateKeys: false,
|
|
441
|
+
waitSeconds: 0
|
|
442
|
+
};
|
|
443
|
+
var READ_TIMEOUT_SECONDS = 2;
|
|
444
|
+
var tryWithFallback = (label, run, fallback) => Effect4.tryPromise(run).pipe(Effect4.timeoutFail({
|
|
445
|
+
duration: Duration.seconds(READ_TIMEOUT_SECONDS),
|
|
446
|
+
onTimeout: () => new Error(`${label} timed out`)
|
|
447
|
+
}), Effect4.catchAll(() => Effect4.succeed(fallback)));
|
|
448
|
+
var tryWithFallbackSync = (read, fallback) => {
|
|
449
|
+
try {
|
|
450
|
+
return read();
|
|
451
|
+
} catch {
|
|
452
|
+
return fallback;
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
var formatSpace = Effect4.fn(function* (space, options = {}) {
|
|
456
|
+
const { waitSeconds } = {
|
|
457
|
+
...DEFAULT_OPTIONS,
|
|
458
|
+
...options
|
|
459
|
+
};
|
|
460
|
+
if (waitSeconds > 0) {
|
|
461
|
+
yield* Effect4.tryPromise(() => space.waitUntilReady()).pipe(Effect4.timeoutFail({
|
|
462
|
+
duration: Duration.seconds(waitSeconds),
|
|
463
|
+
onTimeout: () => new Error("waitUntilReady timed out")
|
|
464
|
+
}), Effect4.catchAll(() => Effect4.void));
|
|
465
|
+
}
|
|
466
|
+
const state = tryWithFallbackSync(() => space.state.get(), SpaceState.SPACE_INITIALIZING);
|
|
467
|
+
const ready = state === SpaceState.SPACE_READY;
|
|
468
|
+
const metrics = tryWithFallbackSync(() => space.internal.data.metrics, void 0);
|
|
469
|
+
const startup = metrics?.open && metrics?.ready ? metrics.ready.getTime() - metrics.open.getTime() : void 0;
|
|
470
|
+
const pipeline = tryWithFallbackSync(() => space.internal.data.pipeline, void 0);
|
|
442
471
|
const epoch = pipeline?.currentEpoch?.subject.assertion.number;
|
|
443
|
-
const
|
|
472
|
+
const syncStateRaw = yield* tryWithFallback("getSyncState", () => space.internal.db.coreDatabase.getSyncState(), {
|
|
473
|
+
peers: {}
|
|
474
|
+
});
|
|
475
|
+
const syncState = aggregateSyncState(syncStateRaw);
|
|
476
|
+
const name = ready ? tryWithFallbackSync(() => space.properties.name, void 0) : "loading...";
|
|
477
|
+
const members = tryWithFallbackSync(() => space.members.get().length, 0);
|
|
478
|
+
const objects = tryWithFallbackSync(() => space.internal.db.coreDatabase.getAllObjectIds().length, 0);
|
|
479
|
+
const key = options.truncateKeys ? tryWithFallbackSync(() => space.key.truncate(), "") : tryWithFallbackSync(() => space.key.toHex(), "");
|
|
444
480
|
return {
|
|
445
481
|
id: space.id,
|
|
446
|
-
state: SpaceState[
|
|
447
|
-
name
|
|
448
|
-
members
|
|
449
|
-
objects
|
|
450
|
-
key
|
|
482
|
+
state: SpaceState[state],
|
|
483
|
+
name,
|
|
484
|
+
members,
|
|
485
|
+
objects,
|
|
486
|
+
key,
|
|
451
487
|
epoch,
|
|
452
488
|
startup,
|
|
453
|
-
automergeRoot:
|
|
489
|
+
automergeRoot: pipeline?.spaceRootUrl,
|
|
454
490
|
// appliedEpoch,
|
|
455
491
|
syncState: `${syncState.count} ${getSyncIndicator(syncState.up, syncState.down)} (${syncState.peers} peers)`
|
|
456
492
|
};
|
|
@@ -488,12 +524,12 @@ var printSpace = (spaceData) => make({
|
|
|
488
524
|
|
|
489
525
|
// src/util/timeout.ts
|
|
490
526
|
import * as Config from "effect/Config";
|
|
491
|
-
import * as
|
|
527
|
+
import * as Duration2 from "effect/Duration";
|
|
492
528
|
import * as Effect5 from "effect/Effect";
|
|
493
529
|
import * as Option3 from "effect/Option";
|
|
494
530
|
var withTimeout = Effect5.fnUntraced(function* (effect2) {
|
|
495
531
|
const timeout2 = yield* Config.integer("TIMEOUT").pipe(Config.option);
|
|
496
|
-
const duration = timeout2.pipe(Option3.map(
|
|
532
|
+
const duration = timeout2.pipe(Option3.map(Duration2.millis), Option3.getOrElse(() => Duration2.infinity));
|
|
497
533
|
return yield* effect2.pipe(Effect5.timeout(duration));
|
|
498
534
|
});
|
|
499
535
|
export {
|