@dxos/cli-util 0.8.4-main.fcc0d83b33 → 0.8.4-staging.60fe92afc8

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.fcc0d83b33",
3
+ "version": "0.8.4-staging.60fe92afc8",
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",
@@ -8,7 +8,7 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/dxos/dxos"
10
10
  },
11
- "license": "MIT",
11
+ "license": "FSL-1.1-Apache-2.0",
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": false,
14
14
  "type": "module",
@@ -30,27 +30,29 @@
30
30
  "src"
31
31
  ],
32
32
  "dependencies": {
33
- "@effect/cli": "0.73.2",
34
- "@effect/printer": "0.47.0",
35
- "@effect/printer-ansi": "0.47.0",
36
- "@dxos/app-toolkit": "0.8.4-main.fcc0d83b33",
37
- "@dxos/client": "0.8.4-main.fcc0d83b33",
38
- "@dxos/echo": "0.8.4-main.fcc0d83b33",
39
- "@dxos/compute": "0.8.4-main.fcc0d83b33",
40
- "@dxos/effect": "0.8.4-main.fcc0d83b33",
41
- "@dxos/protocols": "0.8.4-main.fcc0d83b33",
42
- "@dxos/debug": "0.8.4-main.fcc0d83b33",
43
- "@dxos/log": "0.8.4-main.fcc0d83b33",
44
- "@dxos/util": "0.8.4-main.fcc0d83b33",
45
- "@dxos/errors": "0.8.4-main.fcc0d83b33"
33
+ "@effect/cli": "0.75.2",
34
+ "@effect/printer": "0.49.0",
35
+ "@effect/printer-ansi": "0.49.0",
36
+ "@dxos/app-toolkit": "0.8.4-staging.60fe92afc8",
37
+ "@dxos/client": "0.8.4-staging.60fe92afc8",
38
+ "@dxos/compute": "0.8.4-staging.60fe92afc8",
39
+ "@dxos/debug": "0.8.4-staging.60fe92afc8",
40
+ "@dxos/echo-client": "0.8.4-staging.60fe92afc8",
41
+ "@dxos/effect": "0.8.4-staging.60fe92afc8",
42
+ "@dxos/echo": "0.8.4-staging.60fe92afc8",
43
+ "@dxos/errors": "0.8.4-staging.60fe92afc8",
44
+ "@dxos/log": "0.8.4-staging.60fe92afc8",
45
+ "@dxos/functions": "0.8.4-staging.60fe92afc8",
46
+ "@dxos/protocols": "0.8.4-staging.60fe92afc8",
47
+ "@dxos/util": "0.8.4-staging.60fe92afc8"
46
48
  },
47
49
  "devDependencies": {
48
- "effect": "3.20.0",
50
+ "effect": "3.21.3",
49
51
  "typescript": "^6.0.3",
50
- "vitest": "4.1.5"
52
+ "vitest": "4.1.7"
51
53
  },
52
54
  "peerDependencies": {
53
- "effect": "3.20.0"
55
+ "effect": "3.21.3"
54
56
  },
55
57
  "publishConfig": {
56
58
  "access": "public"
@@ -8,11 +8,11 @@ import * as Effect from 'effect/Effect';
8
8
  import * as Option from 'effect/Option';
9
9
 
10
10
  import { FormBuilder, print } from '@dxos/cli-util';
11
- import { runAndForwardErrors } from '@dxos/effect';
11
+ import { EffectEx } from '@dxos/effect';
12
12
 
13
13
  describe('FormBuilder', () => {
14
14
  it('option', () =>
15
- runAndForwardErrors(
15
+ EffectEx.runAndForwardErrors(
16
16
  Effect.gen(function* () {
17
17
  const builder = FormBuilder.make({ title: 'Option Test' }).pipe(
18
18
  FormBuilder.option('some', Option.some('value')),
@@ -25,7 +25,7 @@ describe('FormBuilder', () => {
25
25
  ));
26
26
 
27
27
  it('when', () =>
28
- runAndForwardErrors(
28
+ EffectEx.runAndForwardErrors(
29
29
  Effect.gen(function* () {
30
30
  const builder = FormBuilder.make({ title: 'When Test' }).pipe(
31
31
  FormBuilder.when(true, FormBuilder.set('included', 'true')),
@@ -38,7 +38,7 @@ describe('FormBuilder', () => {
38
38
  ));
39
39
 
40
40
  it('each', () =>
41
- runAndForwardErrors(
41
+ EffectEx.runAndForwardErrors(
42
42
  Effect.gen(function* () {
43
43
  const items = ['a', 'b', 'c'];
44
44
  const builder = FormBuilder.make({ title: 'Each Test' }).pipe(
@@ -51,7 +51,7 @@ describe('FormBuilder', () => {
51
51
  ));
52
52
 
53
53
  it('build', () =>
54
- runAndForwardErrors(
54
+ EffectEx.runAndForwardErrors(
55
55
  Effect.gen(function* () {
56
56
  const builder = FormBuilder.make({ title: 'Test' }).pipe(
57
57
  FormBuilder.set('foo', 100),
@@ -64,7 +64,7 @@ describe('FormBuilder', () => {
64
64
  ));
65
65
 
66
66
  it('nest', () =>
67
- runAndForwardErrors(
67
+ EffectEx.runAndForwardErrors(
68
68
  Effect.gen(function* () {
69
69
  const nested = FormBuilder.make({ title: 'Nested' }).pipe(
70
70
  FormBuilder.set('nested1', 'value1'),
@@ -83,7 +83,7 @@ describe('FormBuilder', () => {
83
83
  ));
84
84
 
85
85
  it('nestedOption', () =>
86
- runAndForwardErrors(
86
+ EffectEx.runAndForwardErrors(
87
87
  Effect.gen(function* () {
88
88
  const nested = FormBuilder.make({ title: 'Nested' }).pipe(FormBuilder.set('key', 'value'));
89
89
 
@@ -98,7 +98,7 @@ describe('FormBuilder', () => {
98
98
  ));
99
99
 
100
100
  it('multi-level nesting', () =>
101
- runAndForwardErrors(
101
+ EffectEx.runAndForwardErrors(
102
102
  Effect.gen(function* () {
103
103
  const grandchild = FormBuilder.make({ title: 'Grandchild' }).pipe(
104
104
  FormBuilder.set('grandchild1', 'value1'),
@@ -123,7 +123,7 @@ describe('FormBuilder', () => {
123
123
  ));
124
124
 
125
125
  it('pipeable build', () =>
126
- runAndForwardErrors(
126
+ EffectEx.runAndForwardErrors(
127
127
  Effect.gen(function* () {
128
128
  const doc = FormBuilder.make({ title: 'Pipeable' }).pipe(
129
129
  FormBuilder.set('foo', 100),
@@ -135,7 +135,7 @@ describe('FormBuilder', () => {
135
135
  ));
136
136
 
137
137
  it('dual calling styles', () =>
138
- runAndForwardErrors(
138
+ EffectEx.runAndForwardErrors(
139
139
  Effect.gen(function* () {
140
140
  // Curried style (pipe)
141
141
  const builder1 = FormBuilder.make({ title: 'Curried' }).pipe(
@@ -86,14 +86,14 @@ export const formatSpace = Effect.fn(function* (space: Space, options: FormatSpa
86
86
 
87
87
  // The sync-state read does IO; cap it so a stuck space can't hang the
88
88
  // command. Falls back to a "no peers" placeholder.
89
- const syncStateRaw = yield* tryWithFallback('getSyncState', () => space.internal.db.coreDatabase.getSyncState(), {
89
+ const syncStateRaw = yield* tryWithFallback('getSyncState', () => space.internal.db.getSyncState(), {
90
90
  peers: {},
91
91
  } as SpaceSyncState);
92
92
  const syncState = aggregateSyncState(syncStateRaw);
93
93
 
94
94
  const name = ready ? tryWithFallbackSync(() => space.properties.name, undefined) : 'loading...';
95
95
  const members = tryWithFallbackSync(() => space.members.get().length, 0);
96
- const objects = tryWithFallbackSync(() => space.internal.db.coreDatabase.getAllObjectIds().length, 0);
96
+ const objects = tryWithFallbackSync(() => space.internal.db.getAllObjectIds().length, 0);
97
97
  const key = options.truncateKeys
98
98
  ? tryWithFallbackSync(() => space.key.truncate(), '')
99
99
  : tryWithFallbackSync(() => space.key.toHex(), '');
package/src/util/space.ts CHANGED
@@ -10,8 +10,8 @@ import * as Option from 'effect/Option';
10
10
  import { getPersonalSpace } from '@dxos/app-toolkit';
11
11
  import { ClientService } from '@dxos/client';
12
12
  import { type Space } from '@dxos/client/echo';
13
- import { QueueService } from '@dxos/compute';
14
- import { Database, type Key } from '@dxos/echo';
13
+ import { Database, Feed, type Key } from '@dxos/echo';
14
+ import { createFeedServiceLayer } from '@dxos/echo-client';
15
15
  import { BaseError, type BaseErrorOptions } from '@dxos/errors';
16
16
  import { log } from '@dxos/log';
17
17
  import { EdgeReplicationSetting } from '@dxos/protocols/proto/dxos/echo/metadata';
@@ -39,7 +39,7 @@ export const spaceIdWithDefault = (spaceId: Option.Option<Key.SpaceId>) =>
39
39
  export const spaceLayer = (
40
40
  spaceId$: Option.Option<Key.SpaceId>,
41
41
  fallbackToPersonalSpace = false,
42
- ): Layer.Layer<Database.Service | QueueService, never, ClientService> => {
42
+ ): Layer.Layer<Database.Service | Feed.FeedService, never, ClientService> => {
43
43
  const getSpace = Effect.fn(function* () {
44
44
  const client = yield* ClientService;
45
45
 
@@ -93,31 +93,17 @@ export const spaceLayer = (
93
93
  ),
94
94
  );
95
95
 
96
- const queue = Layer.effect(
97
- QueueService,
96
+ const feed = Layer.unwrapEffect(
98
97
  Effect.gen(function* () {
99
98
  const space = yield* getSpace();
100
99
  if (!space) {
101
- return {
102
- queues: {
103
- get: (_dxn) => {
104
- throw new Error('Queues not available');
105
- },
106
- create: () => {
107
- throw new Error('Queues not available');
108
- },
109
- },
110
- queue: undefined,
111
- };
100
+ return Feed.notAvailable;
112
101
  }
113
- return {
114
- queues: space.queues,
115
- queue: undefined,
116
- };
102
+ return createFeedServiceLayer(space.queues);
117
103
  }),
118
104
  );
119
105
 
120
- return Layer.merge(db, queue);
106
+ return Layer.merge(db, feed);
121
107
  };
122
108
 
123
109
  // TODO(dmaretskyi): There a race condition with edge connection not showing up.