@dxos/cli-util 0.8.4-main.937b3ca → 0.8.4-main.9be5663bfe
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/index.mjs +16 -13
- 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 +1 -1
- 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.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/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.d.ts +1 -1
- package/dist/types/src/util/space.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -14
- 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.ts +15 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/cli-util",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.9be5663bfe",
|
|
4
4
|
"description": "Shared CLI utilities for DXOS CLI commands and plugins",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -30,26 +30,27 @@
|
|
|
30
30
|
"src"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@effect/cli": "0.
|
|
33
|
+
"@effect/cli": "0.73.2",
|
|
34
34
|
"@effect/printer": "0.47.0",
|
|
35
35
|
"@effect/printer-ansi": "0.47.0",
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/errors": "0.8.4-main.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/util": "0.8.4-main.
|
|
36
|
+
"@dxos/app-toolkit": "0.8.4-main.9be5663bfe",
|
|
37
|
+
"@dxos/debug": "0.8.4-main.9be5663bfe",
|
|
38
|
+
"@dxos/client": "0.8.4-main.9be5663bfe",
|
|
39
|
+
"@dxos/echo": "0.8.4-main.9be5663bfe",
|
|
40
|
+
"@dxos/errors": "0.8.4-main.9be5663bfe",
|
|
41
|
+
"@dxos/functions": "0.8.4-main.9be5663bfe",
|
|
42
|
+
"@dxos/effect": "0.8.4-main.9be5663bfe",
|
|
43
|
+
"@dxos/log": "0.8.4-main.9be5663bfe",
|
|
44
|
+
"@dxos/util": "0.8.4-main.9be5663bfe",
|
|
45
|
+
"@dxos/protocols": "0.8.4-main.9be5663bfe"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"effect": "3.
|
|
48
|
-
"typescript": "^
|
|
48
|
+
"effect": "3.20.0",
|
|
49
|
+
"typescript": "^6.0.2",
|
|
49
50
|
"vitest": "3.2.4"
|
|
50
51
|
},
|
|
51
52
|
"peerDependencies": {
|
|
52
|
-
"effect": "3.
|
|
53
|
+
"effect": "3.20.0"
|
|
53
54
|
},
|
|
54
55
|
"publishConfig": {
|
|
55
56
|
"access": "public"
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { inspect } from 'node:util';
|
|
6
|
-
|
|
7
5
|
import * as Console from 'effect/Console';
|
|
8
6
|
import * as Context from 'effect/Context';
|
|
9
7
|
import * as Effect from 'effect/Effect';
|
|
10
8
|
import * as Layer from 'effect/Layer';
|
|
9
|
+
import { inspect } from 'node:util';
|
|
11
10
|
|
|
12
11
|
function logToString(...args: any[]): string {
|
|
13
12
|
return args
|
package/src/util/form-builder.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import * as Doc from '@effect/printer/Doc';
|
|
6
5
|
import * as Ansi from '@effect/printer-ansi/Ansi';
|
|
6
|
+
import * as Doc from '@effect/printer/Doc';
|
|
7
7
|
import * as Option from 'effect/Option';
|
|
8
8
|
import * as Pipeable from 'effect/Pipeable';
|
|
9
9
|
|
package/src/util/platform.ts
CHANGED
package/src/util/printer.ts
CHANGED
package/src/util/runtime.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { ClientService } from '@dxos/client';
|
|
|
8
8
|
import { type Type } from '@dxos/echo';
|
|
9
9
|
|
|
10
10
|
/** @deprecated Migrate to providing types via plugin capabilities. */
|
|
11
|
-
export const withTypes: (...types: Type.
|
|
11
|
+
export const withTypes: (...types: Type.AnyEntity[]) => Effect.Effect<void, never, ClientService> = (...types) =>
|
|
12
12
|
Effect.gen(function* () {
|
|
13
13
|
const client = yield* ClientService;
|
|
14
14
|
yield* Effect.promise(() => client.addTypes(types));
|
package/src/util/space.ts
CHANGED
|
@@ -8,6 +8,7 @@ import * as Layer from 'effect/Layer';
|
|
|
8
8
|
import * as Match from 'effect/Match';
|
|
9
9
|
import * as Option from 'effect/Option';
|
|
10
10
|
|
|
11
|
+
import { getPersonalSpace } from '@dxos/app-toolkit';
|
|
11
12
|
import { ClientService } from '@dxos/client';
|
|
12
13
|
import { type Space } from '@dxos/client/echo';
|
|
13
14
|
import { Database, type Key } from '@dxos/echo';
|
|
@@ -26,26 +27,25 @@ export const getSpace = (spaceId: Key.SpaceId): Effect.Effect<Space, SpaceNotFou
|
|
|
26
27
|
export const spaceIdWithDefault = (spaceId: Option.Option<Key.SpaceId>) =>
|
|
27
28
|
Effect.gen(function* () {
|
|
28
29
|
const client = yield* ClientService;
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
return Option.getOrElse(spaceId, () => {
|
|
31
|
+
const personal = getPersonalSpace(client);
|
|
32
|
+
if (!personal) {
|
|
33
|
+
throw new Error('No space ID provided and no personal space found.');
|
|
34
|
+
}
|
|
35
|
+
return personal.id;
|
|
36
|
+
});
|
|
31
37
|
});
|
|
32
38
|
|
|
33
39
|
// TODO(wittjosiah): Factor out.
|
|
34
40
|
export const spaceLayer = (
|
|
35
41
|
spaceId$: Option.Option<Key.SpaceId>,
|
|
36
|
-
|
|
42
|
+
fallbackToPersonalSpace = false,
|
|
37
43
|
): Layer.Layer<Database.Service | QueueService, never, ClientService> => {
|
|
38
44
|
const getSpace = Effect.fn(function* () {
|
|
39
45
|
const client = yield* ClientService;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Match.when(true, () =>
|
|
44
|
-
spaceId$.pipe(
|
|
45
|
-
Option.getOrElse(() => client.spaces.default.id),
|
|
46
|
-
Option.some,
|
|
47
|
-
),
|
|
48
|
-
),
|
|
46
|
+
|
|
47
|
+
const spaceId = Match.value(fallbackToPersonalSpace).pipe(
|
|
48
|
+
Match.when(true, () => spaceId$.pipe(Option.orElse(() => Option.fromNullable(getPersonalSpace(client)?.id)))),
|
|
49
49
|
Match.when(false, () => spaceId$),
|
|
50
50
|
Match.exhaustive,
|
|
51
51
|
);
|
|
@@ -75,7 +75,7 @@ export const spaceLayer = (
|
|
|
75
75
|
}
|
|
76
76
|
return { db: space.db };
|
|
77
77
|
}),
|
|
78
|
-
({ db }) => Effect.promise(() => db.flush(
|
|
78
|
+
({ db }) => Effect.promise(() => db.flush()),
|
|
79
79
|
),
|
|
80
80
|
);
|
|
81
81
|
|
|
@@ -129,8 +129,8 @@ export const waitForSync = Effect.fn(function* (space: Space) {
|
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
export const flushAndSync = Effect.fn(function* (opts?: Database.FlushOptions) {
|
|
132
|
-
yield* Database.
|
|
133
|
-
const spaceId = yield* Database.
|
|
132
|
+
yield* Database.flush(opts);
|
|
133
|
+
const spaceId = yield* Database.spaceId;
|
|
134
134
|
const space = yield* getSpace(spaceId);
|
|
135
135
|
yield* waitForSync(space);
|
|
136
136
|
});
|