@dxos/cli-util 0.0.0 → 0.8.4-main.52d7546f51
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/dist/lib/node-esm/chunk-6TKUDRM6.mjs +27 -0
- package/dist/lib/node-esm/chunk-6TKUDRM6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +518 -0
- package/dist/lib/node-esm/index.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -0
- package/dist/lib/node-esm/testing/index.mjs +82 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/types/src/index.d.ts +3 -0
- package/dist/types/src/index.d.ts.map +1 -0
- package/dist/types/src/services/command-config.d.ts +16 -0
- package/dist/types/src/services/command-config.d.ts.map +1 -0
- package/dist/types/src/services/index.d.ts +2 -0
- package/dist/types/src/services/index.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +3 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/test-console.d.ts +37 -0
- package/dist/types/src/testing/test-console.d.ts.map +1 -0
- package/dist/types/src/testing/test-layer.d.ts +6 -0
- package/dist/types/src/testing/test-layer.d.ts.map +1 -0
- package/dist/types/src/util/form-builder.d.ts +56 -0
- package/dist/types/src/util/form-builder.d.ts.map +1 -0
- package/dist/types/src/util/form-builder.test.d.ts +2 -0
- package/dist/types/src/util/form-builder.test.d.ts.map +1 -0
- package/dist/types/src/util/index.d.ts +9 -0
- package/dist/types/src/util/index.d.ts.map +1 -0
- package/dist/types/src/util/options.d.ts +7 -0
- package/dist/types/src/util/options.d.ts.map +1 -0
- package/dist/types/src/util/platform.d.ts +12 -0
- package/dist/types/src/util/platform.d.ts.map +1 -0
- package/dist/types/src/util/printer.d.ts +10 -0
- package/dist/types/src/util/printer.d.ts.map +1 -0
- package/dist/types/src/util/runtime.d.ts +6 -0
- package/dist/types/src/util/runtime.d.ts.map +1 -0
- package/dist/types/src/util/space-format.d.ts +31 -0
- package/dist/types/src/util/space-format.d.ts.map +1 -0
- package/dist/types/src/util/space.d.ts +45 -0
- package/dist/types/src/util/space.d.ts.map +1 -0
- package/dist/types/src/util/timeout.d.ts +5 -0
- package/dist/types/src/util/timeout.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +17 -13
- package/src/util/runtime.ts +2 -4
- package/src/util/space.ts +2 -2
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/services/command-config.ts
|
|
9
|
+
import * as Context from "effect/Context";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Layer from "effect/Layer";
|
|
12
|
+
var CommandConfig = class _CommandConfig extends Context.Tag("CommandConfig")() {
|
|
13
|
+
static isJson = _CommandConfig.pipe(Effect.map((config) => config.json));
|
|
14
|
+
static isVerbose = _CommandConfig.pipe(Effect.map((config) => config.verbose));
|
|
15
|
+
static layerTest = Layer.succeed(_CommandConfig, {
|
|
16
|
+
json: true,
|
|
17
|
+
verbose: false,
|
|
18
|
+
profile: "default",
|
|
19
|
+
logLevel: "info"
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
__export,
|
|
25
|
+
CommandConfig
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=chunk-6TKUDRM6.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/services/command-config.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\n\nexport class CommandConfig extends Context.Tag('CommandConfig')<\n CommandConfig,\n {\n json: boolean;\n verbose: boolean;\n profile: string;\n logLevel: string;\n }\n>() {\n static isJson: Effect.Effect<boolean, never, CommandConfig> = CommandConfig.pipe(Effect.map((config) => config.json));\n static isVerbose: Effect.Effect<boolean, never, CommandConfig> = CommandConfig.pipe(\n Effect.map((config) => config.verbose),\n );\n\n static layerTest = Layer.succeed(CommandConfig, {\n json: true,\n verbose: false,\n profile: 'default',\n logLevel: 'info',\n });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,WAAW;AAEhB,IAAMC,gBAAN,MAAMA,uBAA8BC,YAAI,eAAA,EAAA,EAAA;EAS7C,OAAOC,SAAuDF,eAAcG,KAAYC,WAAI,CAACC,WAAWA,OAAOC,IAAI,CAAA;EACnH,OAAOC,YAA0DP,eAAcG,KACtEC,WAAI,CAACC,WAAWA,OAAOG,OAAO,CAAA;EAGvC,OAAOC,YAAkBC,cAAQV,gBAAe;IAC9CM,MAAM;IACNE,SAAS;IACTG,SAAS;IACTC,UAAU;EACZ,CAAA;AACF;",
|
|
6
|
+
"names": ["Context", "Effect", "Layer", "CommandConfig", "Tag", "isJson", "pipe", "map", "config", "json", "isVerbose", "verbose", "layerTest", "succeed", "profile", "logLevel"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,518 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
CommandConfig,
|
|
4
|
+
__export
|
|
5
|
+
} from "./chunk-6TKUDRM6.mjs";
|
|
6
|
+
|
|
7
|
+
// src/util/form-builder.ts
|
|
8
|
+
var form_builder_exports = {};
|
|
9
|
+
__export(form_builder_exports, {
|
|
10
|
+
build: () => build,
|
|
11
|
+
each: () => each,
|
|
12
|
+
make: () => make,
|
|
13
|
+
nest: () => nest,
|
|
14
|
+
nestedOption: () => nestedOption,
|
|
15
|
+
option: () => option,
|
|
16
|
+
set: () => set,
|
|
17
|
+
when: () => when
|
|
18
|
+
});
|
|
19
|
+
import * as Doc from "@effect/printer/Doc";
|
|
20
|
+
import * as Ansi from "@effect/printer-ansi/Ansi";
|
|
21
|
+
import * as Option from "effect/Option";
|
|
22
|
+
import * as Pipeable from "effect/Pipeable";
|
|
23
|
+
var FormBuilderImpl = class {
|
|
24
|
+
entries = [];
|
|
25
|
+
title;
|
|
26
|
+
prefix;
|
|
27
|
+
constructor(options = {}) {
|
|
28
|
+
this.title = options.title;
|
|
29
|
+
this.prefix = options.prefix ?? "- ";
|
|
30
|
+
}
|
|
31
|
+
pipe() {
|
|
32
|
+
return Pipeable.pipeArguments(this, arguments);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var make = (props) => new FormBuilderImpl(props);
|
|
36
|
+
var calculateDimensions = (entries, prefix) => {
|
|
37
|
+
const maxKeyLen = Math.max(0, ...entries.map((entry) => entry.key.length));
|
|
38
|
+
const targetWidth = prefix.length + maxKeyLen + 2;
|
|
39
|
+
return {
|
|
40
|
+
maxKeyLen,
|
|
41
|
+
targetWidth
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
var buildKeyLine = (prefix, key, targetWidth) => {
|
|
45
|
+
return Doc.annotate(Doc.fill(targetWidth)(Doc.text(prefix + key + ": ")), Ansi.blackBright);
|
|
46
|
+
};
|
|
47
|
+
var setImpl = (builder, key, value2, color) => {
|
|
48
|
+
if (value2 !== void 0) {
|
|
49
|
+
let valueDoc;
|
|
50
|
+
if (typeof value2 === "object" && value2 !== null) {
|
|
51
|
+
valueDoc = value2;
|
|
52
|
+
} else {
|
|
53
|
+
valueDoc = Doc.text(String(value2));
|
|
54
|
+
}
|
|
55
|
+
if (color) {
|
|
56
|
+
const ansi = typeof color === "function" ? color(value2) : color;
|
|
57
|
+
valueDoc = Doc.annotate(valueDoc, ansi);
|
|
58
|
+
}
|
|
59
|
+
builder.entries.push({
|
|
60
|
+
key,
|
|
61
|
+
value: valueDoc,
|
|
62
|
+
isNested: false
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return builder;
|
|
66
|
+
};
|
|
67
|
+
function set(builderOrKey, keyOrValue, valueOrColor, color) {
|
|
68
|
+
if (builderOrKey instanceof FormBuilderImpl) {
|
|
69
|
+
const builder = builderOrKey;
|
|
70
|
+
const key = keyOrValue;
|
|
71
|
+
const value2 = valueOrColor;
|
|
72
|
+
return setImpl(builder, key, value2, color);
|
|
73
|
+
} else {
|
|
74
|
+
const key = builderOrKey;
|
|
75
|
+
const value2 = keyOrValue;
|
|
76
|
+
const color2 = valueOrColor;
|
|
77
|
+
return (builder) => setImpl(builder, key, value2, color2);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
var nestImpl = (parent, key, builder) => {
|
|
81
|
+
const nestedBuilder = {
|
|
82
|
+
...builder,
|
|
83
|
+
title: void 0,
|
|
84
|
+
entries: builder.entries
|
|
85
|
+
};
|
|
86
|
+
let valueDoc = build(nestedBuilder);
|
|
87
|
+
valueDoc = Doc.indent(valueDoc, 2);
|
|
88
|
+
parent.entries.push({
|
|
89
|
+
key,
|
|
90
|
+
value: valueDoc,
|
|
91
|
+
isNested: true
|
|
92
|
+
});
|
|
93
|
+
return parent;
|
|
94
|
+
};
|
|
95
|
+
function nest(parentOrKey, keyOrBuilder, builder) {
|
|
96
|
+
if (parentOrKey instanceof FormBuilderImpl) {
|
|
97
|
+
const parent = parentOrKey;
|
|
98
|
+
const key = keyOrBuilder;
|
|
99
|
+
return nestImpl(parent, key, builder);
|
|
100
|
+
} else {
|
|
101
|
+
const key = parentOrKey;
|
|
102
|
+
const builder2 = keyOrBuilder;
|
|
103
|
+
return (parent) => nestImpl(parent, key, builder2);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
var optionImpl = (builder, key, value2, color) => {
|
|
107
|
+
if (Option.isSome(value2)) {
|
|
108
|
+
return setImpl(builder, key, value2.value, color);
|
|
109
|
+
}
|
|
110
|
+
return builder;
|
|
111
|
+
};
|
|
112
|
+
function option(builderOrKey, keyOrValue, valueOrColor, color) {
|
|
113
|
+
if (builderOrKey instanceof FormBuilderImpl) {
|
|
114
|
+
const builder = builderOrKey;
|
|
115
|
+
const key = keyOrValue;
|
|
116
|
+
const value2 = valueOrColor;
|
|
117
|
+
return optionImpl(builder, key, value2, color);
|
|
118
|
+
} else {
|
|
119
|
+
const key = builderOrKey;
|
|
120
|
+
const value2 = keyOrValue;
|
|
121
|
+
const color2 = valueOrColor;
|
|
122
|
+
return (builder) => optionImpl(builder, key, value2, color2);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
var nestedOptionImpl = (builder, key, value2) => {
|
|
126
|
+
if (Option.isSome(value2)) {
|
|
127
|
+
return nestImpl(builder, key, value2.value);
|
|
128
|
+
}
|
|
129
|
+
return builder;
|
|
130
|
+
};
|
|
131
|
+
function nestedOption(builderOrKey, keyOrValue, value2) {
|
|
132
|
+
if (builderOrKey instanceof FormBuilderImpl) {
|
|
133
|
+
const builder = builderOrKey;
|
|
134
|
+
const key = keyOrValue;
|
|
135
|
+
return nestedOptionImpl(builder, key, value2);
|
|
136
|
+
} else {
|
|
137
|
+
const key = builderOrKey;
|
|
138
|
+
const value3 = keyOrValue;
|
|
139
|
+
return (builder) => nestedOptionImpl(builder, key, value3);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
var whenImpl = (builder, condition, ...ops) => {
|
|
143
|
+
if (condition) {
|
|
144
|
+
for (const op of ops) {
|
|
145
|
+
op(builder);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return builder;
|
|
149
|
+
};
|
|
150
|
+
function when(builderOrCondition, conditionOrOp, ...ops) {
|
|
151
|
+
if (builderOrCondition instanceof FormBuilderImpl) {
|
|
152
|
+
const builder = builderOrCondition;
|
|
153
|
+
const condition = conditionOrOp;
|
|
154
|
+
return whenImpl(builder, condition, ...ops);
|
|
155
|
+
} else {
|
|
156
|
+
const condition = builderOrCondition;
|
|
157
|
+
const allOps = [
|
|
158
|
+
conditionOrOp,
|
|
159
|
+
...ops
|
|
160
|
+
].filter((op) => typeof op === "function");
|
|
161
|
+
return (builder) => whenImpl(builder, condition, ...allOps);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
var eachImpl = (builder, items, fn3) => {
|
|
165
|
+
items.forEach((item) => fn3(item)(builder));
|
|
166
|
+
return builder;
|
|
167
|
+
};
|
|
168
|
+
function each(builderOrItems, itemsOrFn, fn3) {
|
|
169
|
+
if (builderOrItems instanceof FormBuilderImpl) {
|
|
170
|
+
const builder = builderOrItems;
|
|
171
|
+
const items = itemsOrFn;
|
|
172
|
+
return eachImpl(builder, items, fn3);
|
|
173
|
+
} else {
|
|
174
|
+
const items = builderOrItems;
|
|
175
|
+
const fn4 = itemsOrFn;
|
|
176
|
+
return (builder) => eachImpl(builder, items, fn4);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
var build = (builder) => {
|
|
180
|
+
const { targetWidth } = calculateDimensions(builder.entries, builder.prefix);
|
|
181
|
+
const entryLines = [];
|
|
182
|
+
builder.entries.forEach(({ key, value: value2, isNested }) => {
|
|
183
|
+
const keyLine = buildKeyLine(builder.prefix, key, targetWidth);
|
|
184
|
+
if (isNested) {
|
|
185
|
+
entryLines.push(Doc.hcat([
|
|
186
|
+
keyLine,
|
|
187
|
+
Doc.hardLine,
|
|
188
|
+
value2
|
|
189
|
+
]));
|
|
190
|
+
} else {
|
|
191
|
+
entryLines.push(Doc.hcat([
|
|
192
|
+
keyLine,
|
|
193
|
+
value2
|
|
194
|
+
]));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const entriesDoc = Doc.vsep(entryLines);
|
|
198
|
+
if (builder.title) {
|
|
199
|
+
const titleDoc = Doc.hcat([
|
|
200
|
+
Doc.annotate(Doc.text(builder.title), Ansi.combine(Ansi.bold, Ansi.cyan))
|
|
201
|
+
]);
|
|
202
|
+
return Doc.cat(titleDoc, Doc.cat(Doc.line, entriesDoc));
|
|
203
|
+
}
|
|
204
|
+
return entriesDoc;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
// src/util/options.ts
|
|
208
|
+
import * as Options from "@effect/cli/Options";
|
|
209
|
+
import { Key } from "@dxos/echo";
|
|
210
|
+
var Common = {
|
|
211
|
+
functionId: Options.text("function-id").pipe(Options.withDescription("EDGE Function ID.")),
|
|
212
|
+
spaceId: Options.text("space-id").pipe(Options.withSchema(Key.SpaceId), Options.withDescription("Space ID."))
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// src/util/platform.ts
|
|
216
|
+
import { spawn } from "node:child_process";
|
|
217
|
+
import * as Effect from "effect/Effect";
|
|
218
|
+
var copyToClipboard = (text3) => Effect.tryPromise({
|
|
219
|
+
try: () => {
|
|
220
|
+
return new Promise((resolve, reject) => {
|
|
221
|
+
const platform = process.platform;
|
|
222
|
+
let command;
|
|
223
|
+
let args;
|
|
224
|
+
if (platform === "darwin") {
|
|
225
|
+
command = "pbcopy";
|
|
226
|
+
args = [];
|
|
227
|
+
} else if (platform === "win32") {
|
|
228
|
+
command = "clip";
|
|
229
|
+
args = [];
|
|
230
|
+
} else {
|
|
231
|
+
command = "xclip";
|
|
232
|
+
args = [
|
|
233
|
+
"-selection",
|
|
234
|
+
"clipboard"
|
|
235
|
+
];
|
|
236
|
+
}
|
|
237
|
+
const proc = spawn(command, args);
|
|
238
|
+
proc.stdin?.write(text3);
|
|
239
|
+
proc.stdin?.end();
|
|
240
|
+
proc.on("close", (code) => {
|
|
241
|
+
if (code === 0) {
|
|
242
|
+
resolve();
|
|
243
|
+
} else {
|
|
244
|
+
if (platform === "linux") {
|
|
245
|
+
const proc2 = spawn("xsel", [
|
|
246
|
+
"--clipboard",
|
|
247
|
+
"--input"
|
|
248
|
+
]);
|
|
249
|
+
proc2.stdin?.write(text3);
|
|
250
|
+
proc2.stdin?.end();
|
|
251
|
+
proc2.on("close", (code2) => {
|
|
252
|
+
if (code2 === 0) {
|
|
253
|
+
resolve();
|
|
254
|
+
} else {
|
|
255
|
+
reject(new Error("Failed to copy to clipboard"));
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
proc2.on("error", reject);
|
|
259
|
+
} else {
|
|
260
|
+
reject(new Error("Failed to copy to clipboard"));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
proc.on("error", reject);
|
|
265
|
+
});
|
|
266
|
+
},
|
|
267
|
+
catch: (error) => new Error(`Failed to copy to clipboard: ${error}`)
|
|
268
|
+
});
|
|
269
|
+
var openBrowser = (url) => Effect.tryPromise({
|
|
270
|
+
try: () => {
|
|
271
|
+
return new Promise((resolve, reject) => {
|
|
272
|
+
const platform = process.platform;
|
|
273
|
+
let command;
|
|
274
|
+
let args;
|
|
275
|
+
if (platform === "darwin") {
|
|
276
|
+
command = "open";
|
|
277
|
+
args = [
|
|
278
|
+
url
|
|
279
|
+
];
|
|
280
|
+
} else if (platform === "win32") {
|
|
281
|
+
command = "start";
|
|
282
|
+
args = [
|
|
283
|
+
url
|
|
284
|
+
];
|
|
285
|
+
} else {
|
|
286
|
+
command = "xdg-open";
|
|
287
|
+
args = [
|
|
288
|
+
url
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
const proc = spawn(command, args);
|
|
292
|
+
proc.on("close", (code) => {
|
|
293
|
+
if (code === 0) {
|
|
294
|
+
resolve();
|
|
295
|
+
} else {
|
|
296
|
+
reject(new Error("Failed to open browser"));
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
proc.on("error", reject);
|
|
300
|
+
});
|
|
301
|
+
},
|
|
302
|
+
catch: (error) => new Error(`Failed to open browser: ${error}`)
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// src/util/printer.ts
|
|
306
|
+
import * as Doc2 from "@effect/printer/Doc";
|
|
307
|
+
import * as AnsiDoc from "@effect/printer-ansi/AnsiDoc";
|
|
308
|
+
var print = (doc) => AnsiDoc.render(doc, {
|
|
309
|
+
style: "pretty"
|
|
310
|
+
});
|
|
311
|
+
var printList = (items) => AnsiDoc.render(Doc2.vsep(items.map((item) => Doc2.cat(item, Doc2.hardLine))), {
|
|
312
|
+
style: "pretty"
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// src/util/runtime.ts
|
|
316
|
+
import * as Effect2 from "effect/Effect";
|
|
317
|
+
import { ClientService } from "@dxos/client";
|
|
318
|
+
var withTypes = (...types) => Effect2.gen(function* () {
|
|
319
|
+
const client = yield* ClientService;
|
|
320
|
+
yield* Effect2.promise(() => client.addTypes(types));
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
// src/util/space.ts
|
|
324
|
+
import * as Console from "effect/Console";
|
|
325
|
+
import * as Effect3 from "effect/Effect";
|
|
326
|
+
import * as Layer from "effect/Layer";
|
|
327
|
+
import * as Match from "effect/Match";
|
|
328
|
+
import * as Option2 from "effect/Option";
|
|
329
|
+
import { ClientService as ClientService2 } from "@dxos/client";
|
|
330
|
+
import { Database } from "@dxos/echo";
|
|
331
|
+
import { BaseError } from "@dxos/errors";
|
|
332
|
+
import { QueueService } from "@dxos/functions";
|
|
333
|
+
import { log as log2 } from "@dxos/log";
|
|
334
|
+
import { EdgeReplicationSetting } from "@dxos/protocols/proto/dxos/echo/metadata";
|
|
335
|
+
import { isBun } from "@dxos/util";
|
|
336
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/devtools/cli-util/src/util/space.ts";
|
|
337
|
+
var getSpace = (spaceId) => Effect3.gen(function* () {
|
|
338
|
+
const client = yield* ClientService2;
|
|
339
|
+
return yield* Option2.fromNullable(client.spaces.get(spaceId));
|
|
340
|
+
}).pipe(Effect3.catchTag("NoSuchElementException", () => Effect3.fail(new SpaceNotFoundError(spaceId))));
|
|
341
|
+
var spaceIdWithDefault = (spaceId) => Effect3.gen(function* () {
|
|
342
|
+
const client = yield* ClientService2;
|
|
343
|
+
yield* Effect3.promise(() => client.spaces.waitUntilReady());
|
|
344
|
+
return Option2.getOrElse(spaceId, () => client.spaces.default.id);
|
|
345
|
+
});
|
|
346
|
+
var spaceLayer = (spaceId$, fallbackToDefaultSpace = false) => {
|
|
347
|
+
const getSpace2 = Effect3.fn(function* () {
|
|
348
|
+
const client = yield* ClientService2;
|
|
349
|
+
yield* Effect3.promise(() => client.spaces.waitUntilReady());
|
|
350
|
+
const spaceId = Match.value(fallbackToDefaultSpace).pipe(Match.when(true, () => spaceId$.pipe(Option2.getOrElse(() => client.spaces.default.id), Option2.some)), Match.when(false, () => spaceId$), Match.exhaustive);
|
|
351
|
+
const space = spaceId.pipe(Option2.flatMap((id) => Option2.fromNullable(client.spaces.get(id))), Option2.getOrUndefined);
|
|
352
|
+
if (space) {
|
|
353
|
+
yield* Effect3.promise(() => space.waitUntilReady());
|
|
354
|
+
}
|
|
355
|
+
return space;
|
|
356
|
+
});
|
|
357
|
+
const db = Layer.scoped(Database.Service, Effect3.acquireRelease(Effect3.gen(function* () {
|
|
358
|
+
const space = yield* getSpace2();
|
|
359
|
+
if (!space) {
|
|
360
|
+
return {
|
|
361
|
+
get db() {
|
|
362
|
+
throw new Error("Space not found");
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
return {
|
|
367
|
+
db: space.db
|
|
368
|
+
};
|
|
369
|
+
}), ({ db: db2 }) => Effect3.promise(() => db2.flush({
|
|
370
|
+
indexes: true
|
|
371
|
+
}))));
|
|
372
|
+
const queue = Layer.effect(QueueService, Effect3.gen(function* () {
|
|
373
|
+
const space = yield* getSpace2();
|
|
374
|
+
if (!space) {
|
|
375
|
+
return {
|
|
376
|
+
queues: {
|
|
377
|
+
get: (_dxn) => {
|
|
378
|
+
throw new Error("Queues not available");
|
|
379
|
+
},
|
|
380
|
+
create: () => {
|
|
381
|
+
throw new Error("Queues not available");
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
queue: void 0
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
return {
|
|
388
|
+
queues: space.queues,
|
|
389
|
+
queue: void 0
|
|
390
|
+
};
|
|
391
|
+
}));
|
|
392
|
+
return Layer.merge(db, queue);
|
|
393
|
+
};
|
|
394
|
+
var waitForSync = Effect3.fn(function* (space) {
|
|
395
|
+
if (!isBun()) {
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
if (space.internal.data.edgeReplication !== EdgeReplicationSetting.ENABLED) {
|
|
399
|
+
yield* Console.log("Edge replication is disabled, enabling...");
|
|
400
|
+
yield* Effect3.promise(() => space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED));
|
|
401
|
+
}
|
|
402
|
+
yield* Effect3.promise(() => space.internal.syncToEdge({
|
|
403
|
+
onProgress: (state) => log2.info("syncing", {
|
|
404
|
+
state: state ?? "no connection to edge"
|
|
405
|
+
}, {
|
|
406
|
+
F: __dxlog_file,
|
|
407
|
+
L: 125,
|
|
408
|
+
S: this,
|
|
409
|
+
C: (f, a) => f(...a)
|
|
410
|
+
})
|
|
411
|
+
}));
|
|
412
|
+
yield* Console.log("Sync complete");
|
|
413
|
+
});
|
|
414
|
+
var flushAndSync = Effect3.fn(function* (opts) {
|
|
415
|
+
yield* Database.flush(opts);
|
|
416
|
+
const spaceId = yield* Database.spaceId;
|
|
417
|
+
const space = yield* getSpace(spaceId);
|
|
418
|
+
yield* waitForSync(space);
|
|
419
|
+
});
|
|
420
|
+
var SpaceNotFoundError = class extends BaseError.extend("SpaceNotFoundError", "Space not found") {
|
|
421
|
+
constructor(spaceId, options) {
|
|
422
|
+
super({
|
|
423
|
+
context: {
|
|
424
|
+
spaceId
|
|
425
|
+
},
|
|
426
|
+
...options
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
// src/util/space-format.ts
|
|
432
|
+
import * as Effect4 from "effect/Effect";
|
|
433
|
+
import { SpaceState } from "@dxos/client/echo";
|
|
434
|
+
var formatSpace = Effect4.fn(function* (space, options = {
|
|
435
|
+
verbose: false,
|
|
436
|
+
truncateKeys: false
|
|
437
|
+
}) {
|
|
438
|
+
yield* Effect4.tryPromise(() => space.waitUntilReady());
|
|
439
|
+
const { open, ready } = space.internal.data.metrics ?? {};
|
|
440
|
+
const startup = open && ready && ready.getTime() - open.getTime();
|
|
441
|
+
const pipeline = space.internal.data.pipeline;
|
|
442
|
+
const epoch = pipeline?.currentEpoch?.subject.assertion.number;
|
|
443
|
+
const syncState = aggregateSyncState(yield* Effect4.tryPromise(() => space.internal.db.coreDatabase.getSyncState()));
|
|
444
|
+
return {
|
|
445
|
+
id: space.id,
|
|
446
|
+
state: SpaceState[space.state.get()],
|
|
447
|
+
name: space.state.get() === SpaceState.SPACE_READY ? space.properties.name : "loading...",
|
|
448
|
+
members: space.members.get().length,
|
|
449
|
+
objects: space.internal.db.coreDatabase.getAllObjectIds().length,
|
|
450
|
+
key: options.truncateKeys ? space.key.truncate() : space.key.toHex(),
|
|
451
|
+
epoch,
|
|
452
|
+
startup,
|
|
453
|
+
automergeRoot: space.internal.data.pipeline?.spaceRootUrl,
|
|
454
|
+
// appliedEpoch,
|
|
455
|
+
syncState: `${syncState.count} ${getSyncIndicator(syncState.up, syncState.down)} (${syncState.peers} peers)`
|
|
456
|
+
};
|
|
457
|
+
});
|
|
458
|
+
var aggregateSyncState = (syncState) => {
|
|
459
|
+
const peers = Object.keys(syncState.peers ?? {}).length;
|
|
460
|
+
const missingOnLocal = Math.max(...Object.values(syncState.peers ?? {}).map((peer) => peer.missingOnLocal), 0);
|
|
461
|
+
const missingOnRemote = Math.max(...Object.values(syncState.peers ?? {}).map((peer) => peer.missingOnRemote), 0);
|
|
462
|
+
const differentDocuments = Math.max(...Object.values(syncState.peers ?? {}).map((peer) => peer.differentDocuments), 0);
|
|
463
|
+
return {
|
|
464
|
+
count: missingOnLocal + missingOnRemote + differentDocuments,
|
|
465
|
+
peers,
|
|
466
|
+
up: missingOnRemote > 0 || differentDocuments > 0,
|
|
467
|
+
down: missingOnLocal > 0 || differentDocuments > 0
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
var getSyncIndicator = (up, down) => {
|
|
471
|
+
if (up) {
|
|
472
|
+
if (down) {
|
|
473
|
+
return "\u21C5";
|
|
474
|
+
} else {
|
|
475
|
+
return "\u2191";
|
|
476
|
+
}
|
|
477
|
+
} else {
|
|
478
|
+
if (down) {
|
|
479
|
+
return "\u2193";
|
|
480
|
+
} else {
|
|
481
|
+
return "\u2713";
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
var printSpace = (spaceData) => make({
|
|
486
|
+
title: spaceData.name ?? spaceData.id
|
|
487
|
+
}).pipe(set("id", spaceData.id), set("state", spaceData.state), set("key", spaceData.key), set("members", spaceData.members), set("objects", spaceData.objects), set("epoch", spaceData.epoch ?? "<none>"), set("startup", spaceData.startup ? `${spaceData.startup}ms` : "<none>"), set("syncState", spaceData.syncState), set("automergeRoot", spaceData.automergeRoot ?? "<none>"), build);
|
|
488
|
+
|
|
489
|
+
// src/util/timeout.ts
|
|
490
|
+
import * as Config from "effect/Config";
|
|
491
|
+
import * as Duration from "effect/Duration";
|
|
492
|
+
import * as Effect5 from "effect/Effect";
|
|
493
|
+
import * as Option3 from "effect/Option";
|
|
494
|
+
var withTimeout = Effect5.fnUntraced(function* (effect2) {
|
|
495
|
+
const timeout2 = yield* Config.integer("TIMEOUT").pipe(Config.option);
|
|
496
|
+
const duration = timeout2.pipe(Option3.map(Duration.millis), Option3.getOrElse(() => Duration.infinity));
|
|
497
|
+
return yield* effect2.pipe(Effect5.timeout(duration));
|
|
498
|
+
});
|
|
499
|
+
export {
|
|
500
|
+
CommandConfig,
|
|
501
|
+
Common,
|
|
502
|
+
form_builder_exports as FormBuilder,
|
|
503
|
+
SpaceNotFoundError,
|
|
504
|
+
copyToClipboard,
|
|
505
|
+
flushAndSync,
|
|
506
|
+
formatSpace,
|
|
507
|
+
getSpace,
|
|
508
|
+
openBrowser,
|
|
509
|
+
print,
|
|
510
|
+
printList,
|
|
511
|
+
printSpace,
|
|
512
|
+
spaceIdWithDefault,
|
|
513
|
+
spaceLayer,
|
|
514
|
+
waitForSync,
|
|
515
|
+
withTimeout,
|
|
516
|
+
withTypes
|
|
517
|
+
};
|
|
518
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/util/form-builder.ts", "../../../src/util/options.ts", "../../../src/util/platform.ts", "../../../src/util/printer.ts", "../../../src/util/runtime.ts", "../../../src/util/space.ts", "../../../src/util/space-format.ts", "../../../src/util/timeout.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Doc from '@effect/printer/Doc';\nimport * as Ansi from '@effect/printer-ansi/Ansi';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nexport type FormBuilderOptions = {\n title?: string;\n prefix?: string;\n};\n\nexport interface FormBuilder extends Pipeable.Pipeable {\n readonly entries: ReadonlyArray<{ key: string; value: Doc.Doc<any>; isNested?: boolean }>;\n readonly title?: string;\n readonly prefix: string;\n}\n\nclass FormBuilderImpl implements FormBuilder {\n readonly entries: Array<{ key: string; value: Doc.Doc<any>; isNested?: boolean }> = [];\n readonly title?: string;\n readonly prefix: string;\n\n constructor(options: FormBuilderOptions = {}) {\n this.title = options.title;\n this.prefix = options.prefix ?? '- ';\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new FormBuilder instance.\n */\nexport const make = (props?: FormBuilderOptions): FormBuilder => new FormBuilderImpl(props);\n\n// Helper to calculate dimensions for formatting\nconst calculateDimensions = (entries: ReadonlyArray<{ key: string }>, prefix: string) => {\n const maxKeyLen = Math.max(0, ...entries.map((entry) => entry.key.length));\n const targetWidth = prefix.length + maxKeyLen + 2;\n return { maxKeyLen, targetWidth };\n};\n\n// Helper to build a formatted key line\nconst buildKeyLine = (prefix: string, key: string, targetWidth: number) => {\n // Use fill to pad the key to targetWidth.\n // Note: We don't add indentation here; indentation is handled by the parent container or nestImpl.\n return Doc.annotate(Doc.fill(targetWidth)(Doc.text(prefix + key + ': ')), Ansi.blackBright);\n};\n\n// Implementation helper\nconst setImpl = <T>(\n builder: FormBuilder,\n key: string,\n value: T,\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): FormBuilder => {\n if (value !== undefined) {\n let valueDoc: Doc.Doc<any>;\n if (typeof value === 'object' && value !== null) {\n // Assume it's a Doc.Doc\n valueDoc = value as unknown as Doc.Doc<any>;\n } else {\n valueDoc = Doc.text(String(value));\n }\n\n if (color) {\n const ansi = typeof color === 'function' ? color(value as T) : color;\n valueDoc = Doc.annotate(valueDoc, ansi);\n }\n\n (builder as FormBuilderImpl).entries.push({\n key,\n value: valueDoc,\n isNested: false,\n });\n }\n return builder;\n};\n\n/**\n * Adds a key-value pair to the form.\n */\nexport function set<T>(\n builder: FormBuilder,\n key: string,\n value: T,\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): FormBuilder;\nexport function set<T>(\n key: string,\n value: T,\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): (builder: FormBuilder) => FormBuilder;\nexport function set<T>(\n builderOrKey: FormBuilder | string,\n keyOrValue?: string | T,\n valueOrColor?: T | Ansi.Ansi | ((value: T) => Ansi.Ansi),\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): FormBuilder | ((builder: FormBuilder) => FormBuilder) {\n if (builderOrKey instanceof FormBuilderImpl) {\n // Direct: set(builder, key, value, color?)\n const builder = builderOrKey;\n const key = keyOrValue as string;\n const value = valueOrColor as T;\n return setImpl(builder, key, value, color);\n } else {\n // Curried: set(key, value, color?)\n const key = builderOrKey as string;\n const value = keyOrValue as T;\n const color = valueOrColor as Ansi.Ansi | ((value: T) => Ansi.Ansi) | undefined;\n return (builder: FormBuilder) => setImpl(builder, key, value, color);\n }\n}\n\n// Implementation helper\nconst nestImpl = (parent: FormBuilder, key: string, builder: FormBuilder): FormBuilder => {\n // Build nested entries without title, directly under the parent field name\n\n // Create a temporary builder without title to ignore it.\n const nestedBuilder: FormBuilder = {\n ...builder,\n title: undefined,\n entries: builder.entries,\n };\n\n // Build content.\n let valueDoc = build(nestedBuilder);\n\n // Indent the content by 2 spaces.\n // This ensures that when this doc is embedded in the parent, it is visually nested.\n valueDoc = Doc.indent(valueDoc, 2);\n\n (parent.entries as Array<{ key: string; value: Doc.Doc<any>; isNested?: boolean }>).push({\n key,\n value: valueDoc,\n isNested: true,\n });\n return parent;\n};\n\n/**\n * Nests another form builder under a key.\n */\nexport function nest(parent: FormBuilder, key: string, builder: FormBuilder): FormBuilder;\nexport function nest(key: string, builder: FormBuilder): (parent: FormBuilder) => FormBuilder;\nexport function nest(\n parentOrKey: FormBuilder | string,\n keyOrBuilder?: string | FormBuilder,\n builder?: FormBuilder,\n): FormBuilder | ((parent: FormBuilder) => FormBuilder) {\n if (parentOrKey instanceof FormBuilderImpl) {\n // Direct: nest(parent, key, builder)\n const parent = parentOrKey;\n const key = keyOrBuilder as string;\n return nestImpl(parent, key, builder!);\n } else {\n // Curried: nest(key, builder)\n const key = parentOrKey as string;\n const builder = keyOrBuilder as FormBuilder;\n return (parent: FormBuilder) => nestImpl(parent, key, builder);\n }\n}\n\n// Implementation helper\nconst optionImpl = <T>(\n builder: FormBuilder,\n key: string,\n value: Option.Option<T>,\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): FormBuilder => {\n if (Option.isSome(value)) {\n return setImpl(builder, key, value.value, color);\n }\n return builder;\n};\n\n/**\n * Adds an optional value if it exists.\n */\nexport function option<T>(\n builder: FormBuilder,\n key: string,\n value: Option.Option<T>,\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): FormBuilder;\nexport function option<T>(\n key: string,\n value: Option.Option<T>,\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): (builder: FormBuilder) => FormBuilder;\nexport function option<T>(\n builderOrKey: FormBuilder | string,\n keyOrValue?: string | Option.Option<T>,\n valueOrColor?: Option.Option<T> | Ansi.Ansi | ((value: T) => Ansi.Ansi),\n color?: Ansi.Ansi | ((value: T) => Ansi.Ansi),\n): FormBuilder | ((builder: FormBuilder) => FormBuilder) {\n if (builderOrKey instanceof FormBuilderImpl) {\n // Direct: option(builder, key, value, color?)\n const builder = builderOrKey;\n const key = keyOrValue as string;\n const value = valueOrColor as Option.Option<T>;\n return optionImpl(builder, key, value, color);\n } else {\n // Curried: option(key, value, color?)\n const key = builderOrKey as string;\n const value = keyOrValue as Option.Option<T>;\n const color = valueOrColor as Ansi.Ansi | ((value: T) => Ansi.Ansi) | undefined;\n return (builder: FormBuilder) => optionImpl(builder, key, value, color);\n }\n}\n\n// Implementation helper\nconst nestedOptionImpl = (builder: FormBuilder, key: string, value: Option.Option<FormBuilder>): FormBuilder => {\n if (Option.isSome(value)) {\n return nestImpl(builder, key, value.value);\n }\n return builder;\n};\n\n/**\n * Nests an optional form builder if it exists.\n */\nexport function nestedOption(builder: FormBuilder, key: string, value: Option.Option<FormBuilder>): FormBuilder;\nexport function nestedOption(key: string, value: Option.Option<FormBuilder>): (builder: FormBuilder) => FormBuilder;\nexport function nestedOption(\n builderOrKey: FormBuilder | string,\n keyOrValue?: string | Option.Option<FormBuilder>,\n value?: Option.Option<FormBuilder>,\n): FormBuilder | ((builder: FormBuilder) => FormBuilder) {\n if (builderOrKey instanceof FormBuilderImpl) {\n // Direct: nestedOption(builder, key, value)\n const builder = builderOrKey;\n const key = keyOrValue as string;\n return nestedOptionImpl(builder, key, value!);\n } else {\n // Curried: nestedOption(key, value)\n const key = builderOrKey as string;\n const value = keyOrValue as Option.Option<FormBuilder>;\n return (builder: FormBuilder) => nestedOptionImpl(builder, key, value);\n }\n}\n\n// Implementation helper\nconst whenImpl = (builder: FormBuilder, condition: any, ...ops: ((b: FormBuilder) => FormBuilder)[]): FormBuilder => {\n if (condition) {\n for (const op of ops) {\n op(builder);\n }\n }\n return builder;\n};\n\n/**\n * Conditionally executes operations.\n */\nexport function when(builder: FormBuilder, condition: any, ...ops: ((b: FormBuilder) => FormBuilder)[]): FormBuilder;\nexport function when(\n condition: any,\n ...ops: ((b: FormBuilder) => FormBuilder)[]\n): (builder: FormBuilder) => FormBuilder;\nexport function when(\n builderOrCondition: FormBuilder | any,\n conditionOrOp?: any | ((b: FormBuilder) => FormBuilder),\n ...ops: ((b: FormBuilder) => FormBuilder)[]\n): FormBuilder | ((builder: FormBuilder) => FormBuilder) {\n if (builderOrCondition instanceof FormBuilderImpl) {\n // Direct: when(builder, condition, ...ops)\n const builder = builderOrCondition;\n const condition = conditionOrOp;\n return whenImpl(builder, condition, ...ops);\n } else {\n // Curried: when(condition, ...ops)\n const condition = builderOrCondition;\n const allOps = [conditionOrOp, ...ops].filter(\n (op): op is (b: FormBuilder) => FormBuilder => typeof op === 'function',\n );\n return (builder: FormBuilder) => whenImpl(builder, condition, ...allOps);\n }\n}\n\n// Implementation helper\nconst eachImpl = <T>(\n builder: FormBuilder,\n items: T[],\n fn: (item: T) => (b: FormBuilder) => FormBuilder,\n): FormBuilder => {\n items.forEach((item) => fn(item)(builder));\n return builder;\n};\n\n/**\n * Iterates over an array of items.\n */\nexport function each<T>(\n builder: FormBuilder,\n items: T[],\n fn: (item: T) => (b: FormBuilder) => FormBuilder,\n): FormBuilder;\nexport function each<T>(\n items: T[],\n fn: (item: T) => (b: FormBuilder) => FormBuilder,\n): (builder: FormBuilder) => FormBuilder;\nexport function each<T>(\n builderOrItems: FormBuilder | T[],\n itemsOrFn?: T[] | ((item: T) => (b: FormBuilder) => FormBuilder),\n fn?: (item: T) => (b: FormBuilder) => FormBuilder,\n): FormBuilder | ((builder: FormBuilder) => FormBuilder) {\n if (builderOrItems instanceof FormBuilderImpl) {\n // Direct: each(builder, items, fn)\n const builder = builderOrItems;\n const items = itemsOrFn as T[];\n return eachImpl(builder, items, fn!);\n } else {\n // Curried: each(items, fn)\n const items = builderOrItems as T[];\n const fn = itemsOrFn as (item: T) => (b: FormBuilder) => FormBuilder;\n return (builder: FormBuilder) => eachImpl(builder, items, fn);\n }\n}\n\n/**\n * Builds the final document.\n */\nexport const build = (builder: FormBuilder): Doc.Doc<any> => {\n const { targetWidth } = calculateDimensions(builder.entries, builder.prefix);\n const entryLines: Doc.Doc<any>[] = [];\n\n builder.entries.forEach(({ key, value, isNested }) => {\n const keyLine = buildKeyLine(builder.prefix, key, targetWidth);\n if (isNested) {\n // Nested content should start on a new line.\n // value is already indented by nestImpl, so we just cat with hardLine.\n entryLines.push(Doc.hcat([keyLine, Doc.hardLine, value]));\n } else {\n // Single-line value, combine key and value.\n // If the value itself is multiline (e.g. from Doc.string with newlines, though Doc handles that specifically),\n // we might want layout flexibility.\n // For now, standard behavior:\n entryLines.push(Doc.hcat([keyLine, value]));\n }\n });\n\n const entriesDoc = Doc.vsep(entryLines);\n\n if (builder.title) {\n const titleDoc = Doc.hcat([Doc.annotate(Doc.text(builder.title), Ansi.combine(Ansi.bold, Ansi.cyan))]);\n // Join title and entries with a single line break, no extra spacing\n return Doc.cat(titleDoc, Doc.cat(Doc.line, entriesDoc));\n }\n\n return entriesDoc;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Options from '@effect/cli/Options';\n\nimport { Key } from '@dxos/echo';\n\n//\n// Common options.\n// NOTE: Sub-commands should Function.pipe(Options.optional) if required.\n//\n\nexport const Common = {\n functionId: Options.text('function-id').pipe(Options.withDescription('EDGE Function ID.')),\n spaceId: Options.text('space-id').pipe(Options.withSchema(Key.SpaceId), Options.withDescription('Space ID.')),\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { spawn } from 'node:child_process';\n\nimport * as Effect from 'effect/Effect';\n\n/**\n * Copy text to the system clipboard.\n * Supports macOS (pbcopy), Windows (clip), and Linux (xclip/xsel).\n */\nexport const copyToClipboard = (text: string): Effect.Effect<void, Error> =>\n Effect.tryPromise({\n try: () => {\n return new Promise<void>((resolve, reject) => {\n const platform = process.platform;\n let command: string;\n let args: string[];\n\n if (platform === 'darwin') {\n command = 'pbcopy';\n args = [];\n } else if (platform === 'win32') {\n command = 'clip';\n args = [];\n } else {\n // Linux - try xclip or xsel\n command = 'xclip';\n args = ['-selection', 'clipboard'];\n }\n\n const proc = spawn(command, args);\n proc.stdin?.write(text);\n proc.stdin?.end();\n\n proc.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n // Try xsel as fallback on Linux\n if (platform === 'linux') {\n const proc2 = spawn('xsel', ['--clipboard', '--input']);\n proc2.stdin?.write(text);\n proc2.stdin?.end();\n proc2.on('close', (code2) => {\n if (code2 === 0) {\n resolve();\n } else {\n reject(new Error('Failed to copy to clipboard'));\n }\n });\n proc2.on('error', reject);\n } else {\n reject(new Error('Failed to copy to clipboard'));\n }\n }\n });\n\n proc.on('error', reject);\n });\n },\n catch: (error) => new Error(`Failed to copy to clipboard: ${error}`),\n });\n\n/**\n * Open a URL in the system's default browser.\n * Supports macOS (open), Windows (start), and Linux (xdg-open).\n */\nexport const openBrowser = (url: string): Effect.Effect<void, Error> =>\n Effect.tryPromise({\n try: () => {\n return new Promise<void>((resolve, reject) => {\n const platform = process.platform;\n let command: string;\n let args: string[];\n\n if (platform === 'darwin') {\n command = 'open';\n args = [url];\n } else if (platform === 'win32') {\n command = 'start';\n args = [url];\n } else {\n command = 'xdg-open';\n args = [url];\n }\n\n const proc = spawn(command, args);\n proc.on('close', (code) => {\n if (code === 0) {\n resolve();\n } else {\n reject(new Error('Failed to open browser'));\n }\n });\n proc.on('error', reject);\n });\n },\n catch: (error) => new Error(`Failed to open browser: ${error}`),\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Doc from '@effect/printer/Doc';\nimport * as AnsiDoc from '@effect/printer-ansi/AnsiDoc';\n\n/**\n * Pretty print document.\n */\nexport const print = (doc: Doc.Doc<any>) => AnsiDoc.render(doc, { style: 'pretty' });\n\n/**\n * Pretty prints a list of documents with ANSI colors.\n */\nexport const printList = (items: Array<Doc.Doc<any>>) =>\n AnsiDoc.render(Doc.vsep(items.map((item) => Doc.cat(item, Doc.hardLine))), { style: 'pretty' });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { ClientService } from '@dxos/client';\nimport { type Type } from '@dxos/echo';\n\n/** @deprecated Migrate to providing types via plugin capabilities. */\nexport const withTypes: (...types: Type.Entity.Any[]) => Effect.Effect<void, never, ClientService> = (...types) =>\n Effect.gen(function* () {\n const client = yield* ClientService;\n yield* Effect.promise(() => client.addTypes(types));\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Console from 'effect/Console';\nimport * as Effect from 'effect/Effect';\nimport * as Layer from 'effect/Layer';\nimport * as Match from 'effect/Match';\nimport * as Option from 'effect/Option';\n\nimport { ClientService } from '@dxos/client';\nimport { type Space } from '@dxos/client/echo';\nimport { Database, type Key } from '@dxos/echo';\nimport { BaseError, type BaseErrorOptions } from '@dxos/errors';\nimport { QueueService } from '@dxos/functions';\nimport { log } from '@dxos/log';\nimport { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';\nimport { isBun } from '@dxos/util';\n\nexport const getSpace = (spaceId: Key.SpaceId): Effect.Effect<Space, SpaceNotFoundError, ClientService> =>\n Effect.gen(function* () {\n const client = yield* ClientService;\n return yield* Option.fromNullable(client.spaces.get(spaceId));\n }).pipe(Effect.catchTag('NoSuchElementException', () => Effect.fail(new SpaceNotFoundError(spaceId))));\n\nexport const spaceIdWithDefault = (spaceId: Option.Option<Key.SpaceId>) =>\n Effect.gen(function* () {\n const client = yield* ClientService;\n yield* Effect.promise(() => client.spaces.waitUntilReady());\n return Option.getOrElse(spaceId, () => client.spaces.default.id);\n });\n\n// TODO(wittjosiah): Factor out.\nexport const spaceLayer = (\n spaceId$: Option.Option<Key.SpaceId>,\n fallbackToDefaultSpace = false,\n): Layer.Layer<Database.Service | QueueService, never, ClientService> => {\n const getSpace = Effect.fn(function* () {\n const client = yield* ClientService;\n yield* Effect.promise(() => client.spaces.waitUntilReady());\n\n const spaceId = Match.value(fallbackToDefaultSpace).pipe(\n Match.when(true, () =>\n spaceId$.pipe(\n Option.getOrElse(() => client.spaces.default.id),\n Option.some,\n ),\n ),\n Match.when(false, () => spaceId$),\n Match.exhaustive,\n );\n\n const space = spaceId.pipe(\n Option.flatMap((id) => Option.fromNullable(client.spaces.get(id))),\n Option.getOrUndefined,\n );\n\n if (space) {\n yield* Effect.promise(() => space.waitUntilReady());\n }\n return space;\n });\n\n const db = Layer.scoped(\n Database.Service,\n Effect.acquireRelease(\n Effect.gen(function* () {\n const space = yield* getSpace();\n if (!space) {\n return {\n get db(): Database.Database {\n throw new Error('Space not found');\n },\n };\n }\n return { db: space.db };\n }),\n ({ db }) => Effect.promise(() => db.flush({ indexes: true })),\n ),\n );\n\n const queue = Layer.effect(\n QueueService,\n Effect.gen(function* () {\n const space = yield* getSpace();\n if (!space) {\n return {\n queues: {\n get: (_dxn) => {\n throw new Error('Queues not available');\n },\n create: () => {\n throw new Error('Queues not available');\n },\n },\n queue: undefined,\n };\n }\n return {\n queues: space.queues,\n queue: undefined,\n };\n }),\n );\n\n return Layer.merge(db, queue);\n};\n\n// TODO(dmaretskyi): There a race condition with edge connection not showing up.\nexport const waitForSync = Effect.fn(function* (space: Space) {\n // TODO(wittjosiah): Find a better way to do this.\n if (!isBun()) {\n // Skipping sync to edge when not in bun env as this indicates running a test.\n return;\n }\n\n // TODO(wittjosiah): This should probably be prompted for.\n if (space.internal.data.edgeReplication !== EdgeReplicationSetting.ENABLED) {\n yield* Console.log('Edge replication is disabled, enabling...');\n yield* Effect.promise(() => space.internal.setEdgeReplicationPreference(EdgeReplicationSetting.ENABLED));\n }\n\n yield* Effect.promise(() =>\n space.internal.syncToEdge({\n onProgress: (state) => log.info('syncing', { state: state ?? 'no connection to edge' }),\n }),\n );\n yield* Console.log('Sync complete');\n});\n\nexport const flushAndSync = Effect.fn(function* (opts?: Database.FlushOptions) {\n yield* Database.flush(opts);\n const spaceId = yield* Database.spaceId;\n const space = yield* getSpace(spaceId);\n yield* waitForSync(space);\n});\n\n// TODO(burdon): Reconcile with @dxos/protocols\nexport class SpaceNotFoundError extends BaseError.extend('SpaceNotFoundError', 'Space not found') {\n constructor(spaceId: string, options?: Omit<BaseErrorOptions, 'context'>) {\n super({ context: { spaceId }, ...options });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { type Space, SpaceState, type SpaceSyncState } from '@dxos/client/echo';\n\nimport * as FormBuilder from './form-builder';\n\n// TODO(wittjosiah): Use @effect/printer.\nexport const formatSpace = Effect.fn(function* (space: Space, options = { verbose: false, truncateKeys: false }) {\n yield* Effect.tryPromise(() => space.waitUntilReady());\n\n // TODO(burdon): Factor out.\n // TODO(burdon): Agent needs to restart before `ready` is available.\n const { open, ready } = space.internal.data.metrics ?? {};\n const startup = open && ready && ready.getTime() - open.getTime();\n\n // TODO(burdon): Get feeds from client-services if verbose (factor out from devtools/diagnostics).\n // const host = client.services.services.DevtoolsHost!;\n const pipeline = space.internal.data.pipeline;\n const epoch = pipeline?.currentEpoch?.subject.assertion.number;\n\n const syncState = aggregateSyncState(yield* Effect.tryPromise(() => space.internal.db.coreDatabase.getSyncState()));\n\n return {\n id: space.id,\n state: SpaceState[space.state.get()],\n name: space.state.get() === SpaceState.SPACE_READY ? space.properties.name : 'loading...',\n\n members: space.members.get().length,\n objects: space.internal.db.coreDatabase.getAllObjectIds().length,\n\n key: options.truncateKeys ? space.key.truncate() : space.key.toHex(),\n epoch,\n startup,\n automergeRoot: space.internal.data.pipeline?.spaceRootUrl,\n // appliedEpoch,\n syncState: `${syncState.count} ${getSyncIndicator(syncState.up, syncState.down)} (${syncState.peers} peers)`,\n };\n});\n\nconst aggregateSyncState = (syncState: SpaceSyncState) => {\n const peers = Object.keys(syncState.peers ?? {}).length;\n const missingOnLocal = Math.max(...Object.values(syncState.peers ?? {}).map((peer) => peer.missingOnLocal), 0);\n const missingOnRemote = Math.max(...Object.values(syncState.peers ?? {}).map((peer) => peer.missingOnRemote), 0);\n const differentDocuments = Math.max(\n ...Object.values(syncState.peers ?? {}).map((peer) => peer.differentDocuments),\n 0,\n );\n\n return {\n count: missingOnLocal + missingOnRemote + differentDocuments,\n peers,\n up: missingOnRemote > 0 || differentDocuments > 0,\n down: missingOnLocal > 0 || differentDocuments > 0,\n };\n};\n\nconst getSyncIndicator = (up: boolean, down: boolean) => {\n if (up) {\n if (down) {\n return '⇅';\n } else {\n return '↑';\n }\n } else {\n if (down) {\n return '↓';\n } else {\n return '✓';\n }\n }\n};\n\nexport type FormattedSpace = {\n id: string;\n state: string;\n name: string | undefined;\n members: number;\n objects: number;\n key: string;\n epoch: any;\n startup: number | undefined;\n automergeRoot: string | undefined;\n syncState: string;\n};\n\n/**\n * Pretty prints a space with ANSI colors.\n */\nexport const printSpace = (spaceData: FormattedSpace) =>\n FormBuilder.make({ title: spaceData.name ?? spaceData.id }).pipe(\n FormBuilder.set('id', spaceData.id),\n FormBuilder.set('state', spaceData.state),\n FormBuilder.set('key', spaceData.key),\n FormBuilder.set('members', spaceData.members),\n FormBuilder.set('objects', spaceData.objects),\n FormBuilder.set('epoch', spaceData.epoch ?? '<none>'),\n FormBuilder.set('startup', spaceData.startup ? `${spaceData.startup}ms` : '<none>'),\n FormBuilder.set('syncState', spaceData.syncState),\n FormBuilder.set('automergeRoot', spaceData.automergeRoot ?? '<none>'),\n FormBuilder.build,\n );\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Cause from 'effect/Cause';\nimport * as Config from 'effect/Config';\nimport type * as ConfigError from 'effect/ConfigError';\nimport * as Duration from 'effect/Duration';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\n\nexport const withTimeout: <A, E, R>(\n effect: Effect.Effect<A, E, R>,\n) => Effect.Effect<A, Cause.TimeoutException | ConfigError.ConfigError | E, R> = Effect.fnUntraced(function* (effect) {\n const timeout = yield* Config.integer('TIMEOUT').pipe(Config.option);\n const duration = timeout.pipe(\n Option.map(Duration.millis),\n Option.getOrElse(() => Duration.infinity),\n );\n return yield* effect.pipe(Effect.timeout(duration));\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAAA;;;;;;;;;;;AAIA,YAAYA,SAAS;AACrB,YAAYC,UAAU;AACtB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAa1B,IAAMC,kBAAN,MAAMA;EACKC,UAA2E,CAAA;EAC3EC;EACAC;EAET,YAAYC,UAA8B,CAAC,GAAG;AAC5C,SAAKF,QAAQE,QAAQF;AACrB,SAAKC,SAASC,QAAQD,UAAU;EAClC;EAEAE,OAAO;AAEL,WAAgBC,uBAAc,MAAMC,SAAAA;EACtC;AACF;AAKO,IAAMC,OAAO,CAACC,UAA4C,IAAIT,gBAAgBS,KAAAA;AAGrF,IAAMC,sBAAsB,CAACT,SAAyCE,WAAAA;AACpE,QAAMQ,YAAYC,KAAKC,IAAI,GAAA,GAAMZ,QAAQa,IAAI,CAACC,UAAUA,MAAMC,IAAIC,MAAM,CAAA;AACxE,QAAMC,cAAcf,OAAOc,SAASN,YAAY;AAChD,SAAO;IAAEA;IAAWO;EAAY;AAClC;AAGA,IAAMC,eAAe,CAAChB,QAAgBa,KAAaE,gBAAAA;AAGjD,SAAWE,aAAaC,SAAKH,WAAAA,EAAiBI,SAAKnB,SAASa,MAAM,IAAA,CAAA,GAAaO,gBAAW;AAC5F;AAGA,IAAMC,UAAU,CACdC,SACAT,KACAU,QACAC,UAAAA;AAEA,MAAID,WAAUE,QAAW;AACvB,QAAIC;AACJ,QAAI,OAAOH,WAAU,YAAYA,WAAU,MAAM;AAE/CG,iBAAWH;IACb,OAAO;AACLG,iBAAeP,SAAKQ,OAAOJ,MAAAA,CAAAA;IAC7B;AAEA,QAAIC,OAAO;AACT,YAAMI,OAAO,OAAOJ,UAAU,aAAaA,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G,GACxByB,IAAI,WAAWJ,UAAUzB,OAAO,GAChC6B,IAAI,WAAWJ,UAAUvB,OAAO,GAChC2B,IAAI,SAASJ,UAAU1C,SAAS,QAAA,GAChC8C,IAAI,WAAWJ,UAAU7C,UAAU,GAAG6C,UAAU7C,OAAO,OAAO,QAAA,GAC9DiD,IAAI,aAAaJ,UAAUrC,SAAS,GACpCyC,IAAI,iBAAiBJ,UAAUlB,iBAAiB,QAAA,GAChDuB,KAAK;;;AClGrB,YAAYC,YAAY;AAExB,YAAYC,cAAc;AAC1B,YAAYC,aAAY;AACxB,YAAYC,aAAY;AAEjB,IAAMC,cAE2EC,mBAAW,WAAWC,SAAM;AAClH,QAAMC,WAAU,OAAcC,eAAQ,SAAA,EAAWC,KAAYC,aAAM;AACnE,QAAMC,WAAWJ,SAAQE,KAChBG,YAAaC,eAAM,GACnBC,kBAAU,MAAeC,iBAAQ,CAAA;AAE1C,SAAO,OAAOT,QAAOG,KAAYF,gBAAQI,QAAAA,CAAAA;AAC3C,CAAA;",
|
|
6
|
+
"names": ["Doc", "Ansi", "Option", "Pipeable", "FormBuilderImpl", "entries", "title", "prefix", "options", "pipe", "pipeArguments", "arguments", "make", "props", "calculateDimensions", "maxKeyLen", "Math", "max", "map", "entry", "key", "length", "targetWidth", "buildKeyLine", "annotate", "fill", "text", "blackBright", "setImpl", "builder", "value", "color", "undefined", "valueDoc", "String", "ansi", "push", "isNested", "set", "builderOrKey", "keyOrValue", "valueOrColor", "nestImpl", "parent", "nestedBuilder", "build", "indent", "nest", "parentOrKey", "keyOrBuilder", "optionImpl", "isSome", "option", "nestedOptionImpl", "nestedOption", "whenImpl", "condition", "ops", "op", "when", "builderOrCondition", "conditionOrOp", "allOps", "filter", "eachImpl", "items", "fn", "forEach", "item", "each", "builderOrItems", "itemsOrFn", "entryLines", "keyLine", "hcat", "hardLine", "entriesDoc", "vsep", "titleDoc", "combine", "bold", "cyan", "cat", "line", "Options", "Key", "Common", "functionId", "text", "pipe", "withDescription", "spaceId", "withSchema", "Key", "SpaceId", "spawn", "Effect", "copyToClipboard", "text", "tryPromise", "try", "Promise", "resolve", "reject", "platform", "process", "command", "args", "proc", "spawn", "stdin", "write", "end", "on", "code", "proc2", "code2", "Error", "catch", "error", "openBrowser", "url", "Doc", "AnsiDoc", "print", "doc", "render", "style", "printList", "items", "vsep", "map", "item", "cat", "hardLine", "Effect", "ClientService", "withTypes", "types", "gen", "client", "ClientService", "promise", "addTypes", "Console", "Effect", "Layer", "Match", "Option", "ClientService", "Database", "BaseError", "QueueService", "log", "EdgeReplicationSetting", "isBun", "getSpace", "spaceId", "gen", "client", "fromNullable", "spaces", "get", "pipe", "catchTag", "fail", "SpaceNotFoundError", "spaceIdWithDefault", "promise", "waitUntilReady", "getOrElse", "default", "id", "spaceLayer", "spaceId$", "fallbackToDefaultSpace", "fn", "value", "when", "some", "exhaustive", "space", "flatMap", "getOrUndefined", "db", "scoped", "Service", "acquireRelease", "Error", "flush", "indexes", "queue", "effect", "queues", "_dxn", "create", "undefined", "merge", "waitForSync", "internal", "data", "edgeReplication", "ENABLED", "setEdgeReplicationPreference", "syncToEdge", "onProgress", "state", "info", "flushAndSync", "opts", "extend", "options", "context", "Effect", "SpaceState", "formatSpace", "fn", "space", "options", "verbose", "truncateKeys", "tryPromise", "waitUntilReady", "open", "ready", "internal", "data", "metrics", "startup", "getTime", "pipeline", "epoch", "currentEpoch", "subject", "assertion", "number", "syncState", "aggregateSyncState", "db", "coreDatabase", "getSyncState", "id", "state", "SpaceState", "get", "name", "SPACE_READY", "properties", "members", "length", "objects", "getAllObjectIds", "key", "truncate", "toHex", "automergeRoot", "spaceRootUrl", "count", "getSyncIndicator", "up", "down", "peers", "Object", "keys", "missingOnLocal", "Math", "max", "values", "map", "peer", "missingOnRemote", "differentDocuments", "printSpace", "spaceData", "make", "title", "pipe", "set", "build", "Config", "Duration", "Effect", "Option", "withTimeout", "fnUntraced", "effect", "timeout", "integer", "pipe", "option", "duration", "map", "millis", "getOrElse", "infinity"]
|
|
7
|
+
}
|