@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/cli-util",
3
- "version": "0.8.4-main.937b3ca",
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.72.1",
33
+ "@effect/cli": "0.73.2",
34
34
  "@effect/printer": "0.47.0",
35
35
  "@effect/printer-ansi": "0.47.0",
36
- "@dxos/debug": "0.8.4-main.937b3ca",
37
- "@dxos/client": "0.8.4-main.937b3ca",
38
- "@dxos/echo": "0.8.4-main.937b3ca",
39
- "@dxos/effect": "0.8.4-main.937b3ca",
40
- "@dxos/errors": "0.8.4-main.937b3ca",
41
- "@dxos/log": "0.8.4-main.937b3ca",
42
- "@dxos/protocols": "0.8.4-main.937b3ca",
43
- "@dxos/functions": "0.8.4-main.937b3ca",
44
- "@dxos/util": "0.8.4-main.937b3ca"
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.19.11",
48
- "typescript": "^5.9.3",
48
+ "effect": "3.20.0",
49
+ "typescript": "^6.0.2",
49
50
  "vitest": "3.2.4"
50
51
  },
51
52
  "peerDependencies": {
52
- "effect": "3.19.11"
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
@@ -8,7 +8,6 @@ import * as Layer from 'effect/Layer';
8
8
  import { ClientService, ConfigService } from '@dxos/client';
9
9
 
10
10
  import { CommandConfig } from '../services';
11
-
12
11
  import { TestConsole } from './test-console';
13
12
 
14
13
  export const TestLayer = Function.pipe(
@@ -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
 
@@ -2,9 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { spawn } from 'node:child_process';
6
-
7
5
  import * as Effect from 'effect/Effect';
6
+ import { spawn } from 'node:child_process';
8
7
 
9
8
  /**
10
9
  * Copy text to the system clipboard.
@@ -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 AnsiDoc from '@effect/printer-ansi/AnsiDoc';
6
+ import * as Doc from '@effect/printer/Doc';
7
7
 
8
8
  /**
9
9
  * Pretty print document.
@@ -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.Entity.Any[]) => Effect.Effect<void, never, ClientService> = (...types) =>
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
- yield* Effect.promise(() => client.spaces.waitUntilReady());
30
- return Option.getOrElse(spaceId, () => client.spaces.default.id);
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
- fallbackToDefaultSpace = false,
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
- yield* Effect.promise(() => client.spaces.waitUntilReady());
41
-
42
- const spaceId = Match.value(fallbackToDefaultSpace).pipe(
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({ indexes: true })),
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.Service.flush(opts);
133
- const spaceId = yield* Database.Service.spaceId;
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
  });