@dxos/migrations 0.8.4-main.84f28bd → 0.8.4-main.ae835ea

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/migrations",
3
- "version": "0.8.4-main.84f28bd",
3
+ "version": "0.8.4-main.ae835ea",
4
4
  "description": "",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -10,6 +10,7 @@
10
10
  "type": "module",
11
11
  "exports": {
12
12
  ".": {
13
+ "source": "./src/index.ts",
13
14
  "types": "./dist/types/src/index.d.ts",
14
15
  "browser": "./dist/lib/browser/index.mjs",
15
16
  "node": "./dist/lib/node-esm/index.mjs"
@@ -24,16 +25,16 @@
24
25
  "src"
25
26
  ],
26
27
  "dependencies": {
27
- "@automerge/automerge": "3.0.0",
28
- "@automerge/automerge-repo": "2.0.8",
29
- "@dxos/echo-db": "0.8.4-main.84f28bd",
30
- "@dxos/client": "0.8.4-main.84f28bd",
31
- "@dxos/echo-protocol": "0.8.4-main.84f28bd",
32
- "@dxos/echo-schema": "0.8.4-main.84f28bd",
33
- "@dxos/invariant": "0.8.4-main.84f28bd",
34
- "@dxos/log": "0.8.4-main.84f28bd",
35
- "@dxos/protocols": "0.8.4-main.84f28bd",
36
- "@dxos/util": "0.8.4-main.84f28bd"
28
+ "@automerge/automerge": "3.1.2",
29
+ "@automerge/automerge-repo": "2.4.0",
30
+ "@dxos/client": "0.8.4-main.ae835ea",
31
+ "@dxos/echo": "0.8.4-main.ae835ea",
32
+ "@dxos/echo-db": "0.8.4-main.ae835ea",
33
+ "@dxos/echo-protocol": "0.8.4-main.ae835ea",
34
+ "@dxos/invariant": "0.8.4-main.ae835ea",
35
+ "@dxos/protocols": "0.8.4-main.ae835ea",
36
+ "@dxos/util": "0.8.4-main.ae835ea",
37
+ "@dxos/log": "0.8.4-main.ae835ea"
37
38
  },
38
39
  "devDependencies": {},
39
40
  "publishConfig": {
@@ -2,21 +2,21 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { next as am, type Doc } from '@automerge/automerge';
5
+ import { next as A, type Doc } from '@automerge/automerge';
6
6
  import { type AnyDocumentId, type DocumentId } from '@automerge/automerge-repo';
7
- import { type Schema } from 'effect';
7
+ import type * as Schema from 'effect/Schema';
8
8
 
9
9
  import { type Space } from '@dxos/client/echo';
10
10
  import { CreateEpochRequest } from '@dxos/client/halo';
11
- import { ObjectCore, migrateDocument, type DocHandleProxy, type RepoProxy } from '@dxos/echo-db';
11
+ import { requireTypeReference } from '@dxos/echo/internal';
12
+ import { type DocHandleProxy, ObjectCore, type RepoProxy, migrateDocument } from '@dxos/echo-db';
12
13
  import {
14
+ type DatabaseDirectory,
15
+ type ObjectStructure,
13
16
  Reference,
14
17
  SpaceDocVersion,
15
18
  encodeReference,
16
- type DatabaseDirectory,
17
- type ObjectStructure,
18
19
  } from '@dxos/echo-protocol';
19
- import { requireTypeReference } from '@dxos/echo-schema';
20
20
  import { invariant } from '@dxos/invariant';
21
21
  import { type MaybePromise } from '@dxos/util';
22
22
 
@@ -101,7 +101,7 @@ export class MigrationBuilder {
101
101
  },
102
102
  };
103
103
  const migratedDoc = migrateDocument(oldHandle.doc() as Doc<DatabaseDirectory>, newState);
104
- const newHandle = this._repo.import<DatabaseDirectory>(am.save(migratedDoc));
104
+ const newHandle = this._repo.import<DatabaseDirectory>(A.save(migratedDoc));
105
105
  this._newLinks[id] = newHandle.url;
106
106
  this._addHandleToFlushList(newHandle);
107
107
  }
@@ -168,7 +168,7 @@ export class MigrationBuilder {
168
168
  }
169
169
 
170
170
  for (const [id, url] of Object.entries(this._newLinks)) {
171
- links[id] = new am.RawString(url);
171
+ links[id] = new A.RawString(url);
172
172
  }
173
173
 
174
174
  this._newRoot = this._repo.create<DatabaseDirectory>({
@@ -5,9 +5,10 @@
5
5
  import { afterAll, beforeAll, beforeEach, describe, expect, test } from 'vitest';
6
6
 
7
7
  import { Client } from '@dxos/client';
8
- import { live, Filter, type Space } from '@dxos/client/echo';
8
+ import { Filter, type Space } from '@dxos/client/echo';
9
9
  import { TestBuilder } from '@dxos/client/testing';
10
- import { Expando } from '@dxos/echo-schema';
10
+ import { Obj, Type } from '@dxos/echo';
11
+ import { Expando } from '@dxos/echo/internal';
11
12
 
12
13
  import { Migrations } from './migrations';
13
14
 
@@ -22,7 +23,7 @@ Migrations.define('test', [
22
23
  version: '1970-01-02',
23
24
  next: async ({ space, builder }) => {
24
25
  // TODO(dmaretskyi): Is this intended to query only expando objects? Change to `Filter.type(Expando, { namespace: 'test' })`
25
- const { objects } = await space.db.query(Filter._props<any>({ namespace: 'test' })).run();
26
+ const { objects } = await space.db.query(Filter.props<any>({ namespace: 'test' })).run();
26
27
  for (const object of objects) {
27
28
  await builder.migrateObject(object.id, ({ data }) => ({
28
29
  schema: Expando,
@@ -35,7 +36,7 @@ Migrations.define('test', [
35
36
  version: '1970-01-03',
36
37
  next: async ({ space, builder }) => {
37
38
  // TODO(dmaretskyi): Is this intended to query only expando objects? Change to `Filter.type(Expando, { namespace: 'test' })`
38
- const { objects } = await space.db.query(Filter._props<any>({ namespace: 'test' })).run();
39
+ const { objects } = await space.db.query(Filter.props<any>({ namespace: 'test' })).run();
39
40
  for (const object of objects) {
40
41
  await builder.migrateObject(object.id, ({ data }) => ({
41
42
  schema: Expando,
@@ -75,7 +76,7 @@ describe('Migrations', () => {
75
76
 
76
77
  test('if some migrations have been run before, runs only the remaining migrations', async () => {
77
78
  space.properties['test.version'] = '1970-01-02';
78
- space.db.add(live(Expando, { namespace: 'test', count: 5 }));
79
+ space.db.add(Obj.make(Type.Expando, { namespace: 'test', count: 5 }));
79
80
  await Migrations.migrate(space);
80
81
  const { objects } = await space.db.query(Filter.type(Expando, { namespace: 'test' })).run();
81
82
  expect(objects).to.have.length(1);
package/src/migrations.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type Space, live, SpaceState } from '@dxos/client/echo';
5
+ import { type Space, SpaceState, live } from '@dxos/client/echo';
6
6
  import { invariant } from '@dxos/invariant';
7
7
  import { type MaybePromise } from '@dxos/util';
8
8