@dxos/cli-util 0.8.4-main.6fa680abb7 → 0.8.4-main.7996785055

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.6fa680abb7",
3
+ "version": "0.8.4-main.7996785055",
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",
@@ -33,23 +33,24 @@
33
33
  "@effect/cli": "0.73.2",
34
34
  "@effect/printer": "0.47.0",
35
35
  "@effect/printer-ansi": "0.47.0",
36
- "@dxos/client": "0.8.4-main.6fa680abb7",
37
- "@dxos/echo": "0.8.4-main.6fa680abb7",
38
- "@dxos/effect": "0.8.4-main.6fa680abb7",
39
- "@dxos/errors": "0.8.4-main.6fa680abb7",
40
- "@dxos/log": "0.8.4-main.6fa680abb7",
41
- "@dxos/functions": "0.8.4-main.6fa680abb7",
42
- "@dxos/protocols": "0.8.4-main.6fa680abb7",
43
- "@dxos/debug": "0.8.4-main.6fa680abb7",
44
- "@dxos/util": "0.8.4-main.6fa680abb7"
36
+ "@dxos/app-toolkit": "0.8.4-main.7996785055",
37
+ "@dxos/client": "0.8.4-main.7996785055",
38
+ "@dxos/echo": "0.8.4-main.7996785055",
39
+ "@dxos/effect": "0.8.4-main.7996785055",
40
+ "@dxos/debug": "0.8.4-main.7996785055",
41
+ "@dxos/functions": "0.8.4-main.7996785055",
42
+ "@dxos/errors": "0.8.4-main.7996785055",
43
+ "@dxos/log": "0.8.4-main.7996785055",
44
+ "@dxos/protocols": "0.8.4-main.7996785055",
45
+ "@dxos/util": "0.8.4-main.7996785055"
45
46
  },
46
47
  "devDependencies": {
47
- "effect": "3.19.16",
48
+ "effect": "3.20.0",
48
49
  "typescript": "^5.9.3",
49
50
  "vitest": "3.2.4"
50
51
  },
51
52
  "peerDependencies": {
52
- "effect": "3.19.16"
53
+ "effect": "3.20.0"
53
54
  },
54
55
  "publishConfig": {
55
56
  "access": "public"
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