@dxos/migrations 0.8.3 → 0.8.4-main.05e74ebcff
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/LICENSE +102 -5
- package/README.md +3 -3
- package/dist/lib/browser/index.mjs +72 -106
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +72 -106
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/migration-builder.d.ts +4 -4
- package/dist/types/src/migration-builder.d.ts.map +1 -1
- package/dist/types/src/migrations.d.ts +2 -1
- package/dist/types/src/migrations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +20 -17
- package/src/migration-builder.ts +33 -32
- package/src/migrations.test.ts +25 -17
- package/src/migrations.ts +14 -6
- package/dist/lib/node/index.cjs +0 -290
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# @dxos/
|
|
1
|
+
# @dxos/migrations
|
|
2
2
|
|
|
3
3
|
## Installation
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
pnpm i @dxos/
|
|
6
|
+
pnpm i @dxos/migrations
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## DXOS Resources
|
|
@@ -16,4 +16,4 @@ pnpm i @dxos/echo-signals
|
|
|
16
16
|
|
|
17
17
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
18
18
|
|
|
19
|
-
License: [
|
|
19
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2022 © DXOS
|
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
//
|
|
2
|
-
import { next as
|
|
1
|
+
// src/migration-builder.ts
|
|
2
|
+
import { next as A } from "@automerge/automerge";
|
|
3
3
|
import { CreateEpochRequest } from "@dxos/client/halo";
|
|
4
4
|
import { ObjectCore, migrateDocument } from "@dxos/echo-db";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { EncodedReference, SpaceDocVersion } from "@dxos/echo-protocol";
|
|
6
|
+
import { getSchemaDXN } from "@dxos/echo/internal";
|
|
7
7
|
import { invariant } from "@dxos/invariant";
|
|
8
|
-
|
|
8
|
+
import { DXN } from "@dxos/keys";
|
|
9
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/migrations/src/migration-builder.ts";
|
|
9
10
|
var MigrationBuilder = class {
|
|
11
|
+
_space;
|
|
12
|
+
_repo;
|
|
13
|
+
_rootDoc;
|
|
14
|
+
// echoId -> automergeUrl
|
|
15
|
+
_newLinks = {};
|
|
16
|
+
_flushIds = [];
|
|
17
|
+
_deleteObjects = [];
|
|
18
|
+
_newRoot = void 0;
|
|
10
19
|
constructor(_space) {
|
|
11
20
|
this._space = _space;
|
|
12
|
-
this.
|
|
13
|
-
this.
|
|
14
|
-
this._deleteObjects = [];
|
|
15
|
-
this._newRoot = void 0;
|
|
16
|
-
this._repo = this._space.db.coreDatabase._repo;
|
|
17
|
-
this._rootDoc = this._space.db.coreDatabase._automergeDocLoader.getSpaceRootDocHandle().doc();
|
|
21
|
+
this._repo = this._space.internal.db.coreDatabase._repo;
|
|
22
|
+
this._rootDoc = this._space.internal.db.coreDatabase._automergeDocLoader.getSpaceRootDocHandle().doc();
|
|
18
23
|
}
|
|
19
24
|
async findObject(id) {
|
|
20
25
|
const documentId = (this._rootDoc.links?.[id] || this._newLinks[id])?.toString();
|
|
@@ -33,15 +38,7 @@ var MigrationBuilder = class {
|
|
|
33
38
|
}
|
|
34
39
|
const { schema, props } = await migrate(objectStructure);
|
|
35
40
|
const oldHandle = await this._findObjectContainingHandle(id);
|
|
36
|
-
invariant(oldHandle, void 0, {
|
|
37
|
-
F: __dxlog_file,
|
|
38
|
-
L: 84,
|
|
39
|
-
S: this,
|
|
40
|
-
A: [
|
|
41
|
-
"oldHandle",
|
|
42
|
-
""
|
|
43
|
-
]
|
|
44
|
-
});
|
|
41
|
+
invariant(oldHandle, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 59, S: this, A: ["oldHandle", ""] });
|
|
45
42
|
const newState = {
|
|
46
43
|
version: SpaceDocVersion.CURRENT,
|
|
47
44
|
access: {
|
|
@@ -50,7 +47,7 @@ var MigrationBuilder = class {
|
|
|
50
47
|
objects: {
|
|
51
48
|
[id]: {
|
|
52
49
|
system: {
|
|
53
|
-
type:
|
|
50
|
+
type: EncodedReference.fromDXN(getSchemaDXN(schema))
|
|
54
51
|
},
|
|
55
52
|
data: props,
|
|
56
53
|
meta: {
|
|
@@ -60,59 +57,47 @@ var MigrationBuilder = class {
|
|
|
60
57
|
}
|
|
61
58
|
};
|
|
62
59
|
const migratedDoc = migrateDocument(oldHandle.doc(), newState);
|
|
63
|
-
const newHandle = this._repo.import(
|
|
60
|
+
const newHandle = this._repo.import(A.save(migratedDoc));
|
|
61
|
+
await newHandle.whenReady();
|
|
62
|
+
invariant(newHandle.url, "Migrated document URL not available after whenReady", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 80, S: this, A: ["newHandle.url", "'Migrated document URL not available after whenReady'"] });
|
|
64
63
|
this._newLinks[id] = newHandle.url;
|
|
65
|
-
this._addHandleToFlushList(newHandle);
|
|
64
|
+
this._addHandleToFlushList(newHandle.documentId);
|
|
66
65
|
}
|
|
67
66
|
async addObject(schema, props) {
|
|
68
|
-
const core = this._createObject({
|
|
67
|
+
const core = await this._createObject({
|
|
69
68
|
schema,
|
|
70
69
|
props
|
|
71
70
|
});
|
|
72
71
|
return core.id;
|
|
73
72
|
}
|
|
74
73
|
createReference(id) {
|
|
75
|
-
return
|
|
74
|
+
return EncodedReference.fromDXN(DXN.fromLocalObjectId(id));
|
|
76
75
|
}
|
|
77
76
|
deleteObject(id) {
|
|
78
77
|
this._deleteObjects.push(id);
|
|
79
78
|
}
|
|
80
|
-
changeProperties(changeFn) {
|
|
79
|
+
async changeProperties(changeFn) {
|
|
81
80
|
if (!this._newRoot) {
|
|
82
|
-
this._buildNewRoot();
|
|
81
|
+
await this._buildNewRoot();
|
|
83
82
|
}
|
|
84
|
-
invariant(this._newRoot, "New root not created", {
|
|
85
|
-
F: __dxlog_file,
|
|
86
|
-
L: 126,
|
|
87
|
-
S: this,
|
|
88
|
-
A: [
|
|
89
|
-
"this._newRoot",
|
|
90
|
-
"'New root not created'"
|
|
91
|
-
]
|
|
92
|
-
});
|
|
83
|
+
invariant(this._newRoot, "New root not created", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 101, S: this, A: ["this._newRoot", "'New root not created'"] });
|
|
93
84
|
this._newRoot.change((doc) => {
|
|
94
85
|
const propertiesStructure = doc.objects?.[this._space.properties.id];
|
|
95
86
|
propertiesStructure && changeFn(propertiesStructure);
|
|
96
87
|
});
|
|
97
|
-
this.
|
|
88
|
+
await this._newRoot.whenReady();
|
|
89
|
+
this._addHandleToFlushList(this._newRoot.documentId);
|
|
98
90
|
}
|
|
99
91
|
/**
|
|
100
92
|
* @internal
|
|
101
93
|
*/
|
|
102
94
|
async _commit() {
|
|
103
95
|
if (!this._newRoot) {
|
|
104
|
-
this._buildNewRoot();
|
|
96
|
+
await this._buildNewRoot();
|
|
105
97
|
}
|
|
106
|
-
invariant(this._newRoot, "New root not created", {
|
|
107
|
-
F: __dxlog_file,
|
|
108
|
-
L: 142,
|
|
109
|
-
S: this,
|
|
110
|
-
A: [
|
|
111
|
-
"this._newRoot",
|
|
112
|
-
"'New root not created'"
|
|
113
|
-
]
|
|
114
|
-
});
|
|
98
|
+
invariant(this._newRoot, "New root not created", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 115, S: this, A: ["this._newRoot", "'New root not created'"] });
|
|
115
99
|
await this._space.db.flush();
|
|
100
|
+
invariant(this._newRoot.url, "New root URL not available", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 118, S: this, A: ["this._newRoot.url", "'New root URL not available'"] });
|
|
116
101
|
await this._space.internal.createEpoch({
|
|
117
102
|
migration: CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT,
|
|
118
103
|
automergeRootUrl: this._newRoot.url
|
|
@@ -127,7 +112,7 @@ var MigrationBuilder = class {
|
|
|
127
112
|
await docHandle.whenReady();
|
|
128
113
|
return docHandle;
|
|
129
114
|
}
|
|
130
|
-
_buildNewRoot() {
|
|
115
|
+
async _buildNewRoot() {
|
|
131
116
|
const links = {
|
|
132
117
|
...this._rootDoc.links ?? {}
|
|
133
118
|
};
|
|
@@ -135,7 +120,7 @@ var MigrationBuilder = class {
|
|
|
135
120
|
delete links[id];
|
|
136
121
|
}
|
|
137
122
|
for (const [id, url] of Object.entries(this._newLinks)) {
|
|
138
|
-
links[id] = new
|
|
123
|
+
links[id] = new A.RawString(url);
|
|
139
124
|
}
|
|
140
125
|
this._newRoot = this._repo.create({
|
|
141
126
|
version: SpaceDocVersion.CURRENT,
|
|
@@ -145,15 +130,16 @@ var MigrationBuilder = class {
|
|
|
145
130
|
objects: this._rootDoc.objects,
|
|
146
131
|
links
|
|
147
132
|
});
|
|
148
|
-
this.
|
|
133
|
+
await this._newRoot.whenReady();
|
|
134
|
+
this._addHandleToFlushList(this._newRoot.documentId);
|
|
149
135
|
}
|
|
150
|
-
_createObject({ id, schema, props }) {
|
|
136
|
+
async _createObject({ id, schema, props }) {
|
|
151
137
|
const core = new ObjectCore();
|
|
152
138
|
if (id) {
|
|
153
139
|
core.id = id;
|
|
154
140
|
}
|
|
155
141
|
core.initNewObject(props);
|
|
156
|
-
core.setType(
|
|
142
|
+
core.setType(EncodedReference.fromDXN(getSchemaDXN(schema)));
|
|
157
143
|
const newHandle = this._repo.create({
|
|
158
144
|
version: SpaceDocVersion.CURRENT,
|
|
159
145
|
access: {
|
|
@@ -163,28 +149,29 @@ var MigrationBuilder = class {
|
|
|
163
149
|
[core.id]: core.getDoc()
|
|
164
150
|
}
|
|
165
151
|
});
|
|
152
|
+
await newHandle.whenReady();
|
|
166
153
|
this._newLinks[core.id] = newHandle.url;
|
|
167
|
-
this._addHandleToFlushList(newHandle);
|
|
154
|
+
this._addHandleToFlushList(newHandle.documentId);
|
|
168
155
|
return core;
|
|
169
156
|
}
|
|
170
|
-
_addHandleToFlushList(
|
|
171
|
-
this._flushIds.push(
|
|
157
|
+
_addHandleToFlushList(id) {
|
|
158
|
+
this._flushIds.push(id);
|
|
172
159
|
}
|
|
173
160
|
};
|
|
174
161
|
|
|
175
|
-
//
|
|
176
|
-
import {
|
|
162
|
+
// src/migrations.ts
|
|
163
|
+
import { Atom } from "@effect-atom/atom";
|
|
164
|
+
import * as Registry from "@effect-atom/atom/Registry";
|
|
165
|
+
import { SpaceState } from "@dxos/client/echo";
|
|
177
166
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
178
|
-
var __dxlog_file2 = "/
|
|
167
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/migrations/src/migrations.ts";
|
|
179
168
|
var Migrations = class {
|
|
180
|
-
static
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
static {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
});
|
|
187
|
-
}
|
|
169
|
+
static namespace;
|
|
170
|
+
static migrations = [];
|
|
171
|
+
static _registry = Registry.make();
|
|
172
|
+
static _stateAtom = Atom.make({
|
|
173
|
+
running: []
|
|
174
|
+
}).pipe(Atom.keepAlive);
|
|
188
175
|
static get versionProperty() {
|
|
189
176
|
return this.namespace && `${this.namespace}.version`;
|
|
190
177
|
}
|
|
@@ -192,40 +179,17 @@ var Migrations = class {
|
|
|
192
179
|
return this.migrations[this.migrations.length - 1]?.version;
|
|
193
180
|
}
|
|
194
181
|
static running(space) {
|
|
195
|
-
|
|
182
|
+
const state = this._registry.get(this._stateAtom);
|
|
183
|
+
return state.running.includes(space.key.toHex());
|
|
196
184
|
}
|
|
197
185
|
static define(namespace, migrations) {
|
|
198
186
|
this.namespace = namespace;
|
|
199
187
|
this.migrations = migrations;
|
|
200
188
|
}
|
|
201
189
|
static async migrate(space, targetVersion) {
|
|
202
|
-
invariant2(!this.running(space), "Migration already running", {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
S: this,
|
|
206
|
-
A: [
|
|
207
|
-
"!this.running(space)",
|
|
208
|
-
"'Migration already running'"
|
|
209
|
-
]
|
|
210
|
-
});
|
|
211
|
-
invariant2(this.versionProperty, "Migrations namespace not set", {
|
|
212
|
-
F: __dxlog_file2,
|
|
213
|
-
L: 45,
|
|
214
|
-
S: this,
|
|
215
|
-
A: [
|
|
216
|
-
"this.versionProperty",
|
|
217
|
-
"'Migrations namespace not set'"
|
|
218
|
-
]
|
|
219
|
-
});
|
|
220
|
-
invariant2(space.state.get() === SpaceState.SPACE_READY, "Space not ready", {
|
|
221
|
-
F: __dxlog_file2,
|
|
222
|
-
L: 46,
|
|
223
|
-
S: this,
|
|
224
|
-
A: [
|
|
225
|
-
"space.state.get() === SpaceState.SPACE_READY",
|
|
226
|
-
"'Space not ready'"
|
|
227
|
-
]
|
|
228
|
-
});
|
|
190
|
+
invariant2(!this.running(space), "Migration already running", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 31, S: this, A: ["!this.running(space)", "'Migration already running'"] });
|
|
191
|
+
invariant2(this.versionProperty, "Migrations namespace not set", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 32, S: this, A: ["this.versionProperty", "'Migrations namespace not set'"] });
|
|
192
|
+
invariant2(space.state.get() === SpaceState.SPACE_READY, "Space not ready", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 33, S: this, A: ["space.state.get() === SpaceState.SPACE_READY", "'Space not ready'"] });
|
|
229
193
|
const currentVersion = space.properties[this.versionProperty];
|
|
230
194
|
const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;
|
|
231
195
|
const i = this.migrations.findIndex((m) => m.version === targetVersion);
|
|
@@ -233,7 +197,14 @@ var Migrations = class {
|
|
|
233
197
|
if (currentIndex === targetIndex) {
|
|
234
198
|
return false;
|
|
235
199
|
}
|
|
236
|
-
|
|
200
|
+
const spaceKey = space.key.toHex();
|
|
201
|
+
const currentState = this._registry.get(this._stateAtom);
|
|
202
|
+
this._registry.set(this._stateAtom, {
|
|
203
|
+
running: [
|
|
204
|
+
...currentState.running,
|
|
205
|
+
spaceKey
|
|
206
|
+
]
|
|
207
|
+
});
|
|
237
208
|
if (targetIndex > currentIndex) {
|
|
238
209
|
const migrations = this.migrations.slice(currentIndex, targetIndex);
|
|
239
210
|
for (const migration of migrations) {
|
|
@@ -242,22 +213,17 @@ var Migrations = class {
|
|
|
242
213
|
space,
|
|
243
214
|
builder
|
|
244
215
|
});
|
|
245
|
-
builder.changeProperties((propertiesStructure) => {
|
|
246
|
-
invariant2(this.versionProperty, "Migrations namespace not set", {
|
|
247
|
-
F: __dxlog_file2,
|
|
248
|
-
L: 62,
|
|
249
|
-
S: this,
|
|
250
|
-
A: [
|
|
251
|
-
"this.versionProperty",
|
|
252
|
-
"'Migrations namespace not set'"
|
|
253
|
-
]
|
|
254
|
-
});
|
|
216
|
+
await builder.changeProperties((propertiesStructure) => {
|
|
217
|
+
invariant2(this.versionProperty, "Migrations namespace not set", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 58, S: this, A: ["this.versionProperty", "'Migrations namespace not set'"] });
|
|
255
218
|
propertiesStructure.data[this.versionProperty] = migration.version;
|
|
256
219
|
});
|
|
257
220
|
await builder._commit();
|
|
258
221
|
}
|
|
259
222
|
}
|
|
260
|
-
this.
|
|
223
|
+
const finalState = this._registry.get(this._stateAtom);
|
|
224
|
+
this._registry.set(this._stateAtom, {
|
|
225
|
+
running: finalState.running.filter((key) => key !== spaceKey)
|
|
226
|
+
});
|
|
261
227
|
return true;
|
|
262
228
|
}
|
|
263
229
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/migration-builder.ts", "../../../src/migrations.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { next as
|
|
5
|
-
"mappings": ";AAIA,SAASA,QAAQC,
|
|
6
|
-
"names": ["next", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { next as A, type Doc } from '@automerge/automerge';\nimport { type AnyDocumentId, type DocumentId } from '@automerge/automerge-repo';\nimport type * as Schema from 'effect/Schema';\n\nimport { type Space } from '@dxos/client/echo';\nimport { CreateEpochRequest } from '@dxos/client/halo';\nimport { type DocHandleProxy, ObjectCore, type RepoProxy, migrateDocument } from '@dxos/echo-db';\nimport { type DatabaseDirectory, EncodedReference, type ObjectStructure, SpaceDocVersion } from '@dxos/echo-protocol';\nimport { getSchemaDXN } from '@dxos/echo/internal';\nimport { invariant } from '@dxos/invariant';\nimport { DXN } from '@dxos/keys';\nimport { type MaybePromise } from '@dxos/util';\n\n/*\n\nConsidering a better API for this:\n\n```ts\nconst migration = space.db.beginMigration(); // all actions are not visible to queries and are only applied once you call `apply`\n\nmigration.applyObjectMigration(defineMigration(From, To, { ... }));\n\nmigration.delete(id);\nmigration.add(obj);\n\nawait migration.apply(); // Will create new epoch.\n```\n\n*/\n\n// TODO(dmaretskyi): We no longer need to hook into ECHO internals, with the changes to echo APIs.\nexport class MigrationBuilder {\n private readonly _repo: RepoProxy;\n private readonly _rootDoc: Doc<DatabaseDirectory>;\n\n // echoId -> automergeUrl\n private readonly _newLinks: Record<string, string> = {};\n private readonly _flushIds: DocumentId[] = [];\n private readonly _deleteObjects: string[] = [];\n\n private _newRoot?: DocHandleProxy<DatabaseDirectory> = undefined;\n\n constructor(private readonly _space: Space) {\n this._repo = this._space.internal.db.coreDatabase._repo;\n // TODO(wittjosiah): Accessing private API.\n this._rootDoc = (this._space.internal.db.coreDatabase as any)._automergeDocLoader\n .getSpaceRootDocHandle()\n .doc() as Doc<DatabaseDirectory>;\n }\n\n async findObject(id: string): Promise<ObjectStructure | undefined> {\n const documentId = (this._rootDoc.links?.[id] || this._newLinks[id])?.toString() as AnyDocumentId | undefined;\n const docHandle = documentId && this._repo.find(documentId);\n if (!docHandle) {\n return undefined;\n }\n\n await docHandle.whenReady();\n const doc = docHandle.doc() as Doc<DatabaseDirectory>;\n return doc.objects?.[id];\n }\n\n async migrateObject(\n id: string,\n migrate: (objectStructure: ObjectStructure) => MaybePromise<{ schema: Schema.Schema.AnyNoContext; props: any }>,\n ): Promise<void> {\n const objectStructure = await this.findObject(id);\n if (!objectStructure) {\n return;\n }\n\n const { schema, props } = await migrate(objectStructure);\n\n const oldHandle = await this._findObjectContainingHandle(id);\n invariant(oldHandle);\n\n const newState: DatabaseDirectory = {\n version: SpaceDocVersion.CURRENT,\n access: {\n spaceKey: this._space.key.toHex(),\n },\n objects: {\n [id]: {\n system: {\n type: EncodedReference.fromDXN(getSchemaDXN(schema)!),\n },\n data: props,\n meta: {\n keys: [],\n },\n },\n },\n };\n const migratedDoc = migrateDocument(oldHandle.doc() as Doc<DatabaseDirectory>, newState);\n const newHandle = this._repo.import<DatabaseDirectory>(A.save(migratedDoc));\n await newHandle.whenReady();\n invariant(newHandle.url, 'Migrated document URL not available after whenReady');\n this._newLinks[id] = newHandle.url;\n this._addHandleToFlushList(newHandle.documentId!);\n }\n\n async addObject(schema: Schema.Schema.AnyNoContext, props: any): Promise<string> {\n const core = await this._createObject({ schema, props });\n return core.id;\n }\n\n createReference(id: string) {\n return EncodedReference.fromDXN(DXN.fromLocalObjectId(id));\n }\n\n deleteObject(id: string): void {\n this._deleteObjects.push(id);\n }\n\n async changeProperties(changeFn: (properties: ObjectStructure) => void): Promise<void> {\n if (!this._newRoot) {\n await this._buildNewRoot();\n }\n invariant(this._newRoot, 'New root not created');\n\n this._newRoot.change((doc: DatabaseDirectory) => {\n const propertiesStructure = doc.objects?.[this._space.properties.id];\n propertiesStructure && changeFn(propertiesStructure);\n });\n await this._newRoot.whenReady();\n this._addHandleToFlushList(this._newRoot.documentId!);\n }\n\n /**\n * @internal\n */\n async _commit(): Promise<void> {\n if (!this._newRoot) {\n await this._buildNewRoot();\n }\n invariant(this._newRoot, 'New root not created');\n\n await this._space.db.flush();\n\n // Create new epoch.\n invariant(this._newRoot.url, 'New root URL not available');\n await this._space.internal.createEpoch({\n migration: CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT,\n automergeRootUrl: this._newRoot.url,\n });\n }\n\n private async _findObjectContainingHandle(id: string): Promise<DocHandleProxy<DatabaseDirectory> | undefined> {\n const documentId = (this._rootDoc.links?.[id] || this._newLinks[id])?.toString() as AnyDocumentId | undefined;\n const docHandle = documentId && this._repo.find(documentId);\n if (!docHandle) {\n return undefined;\n }\n\n await docHandle.whenReady();\n return docHandle;\n }\n\n private async _buildNewRoot(): Promise<void> {\n const links = { ...(this._rootDoc.links ?? {}) };\n for (const id of this._deleteObjects) {\n delete links[id];\n }\n\n for (const [id, url] of Object.entries(this._newLinks)) {\n links[id] = new A.RawString(url);\n }\n\n this._newRoot = this._repo.create<DatabaseDirectory>({\n version: SpaceDocVersion.CURRENT,\n access: {\n spaceKey: this._space.key.toHex(),\n },\n objects: this._rootDoc.objects,\n links,\n });\n await this._newRoot.whenReady();\n this._addHandleToFlushList(this._newRoot.documentId!);\n }\n\n private async _createObject({\n id,\n schema,\n props,\n }: {\n id?: string;\n schema: Schema.Schema.AnyNoContext;\n props: any;\n }): Promise<ObjectCore> {\n const core = new ObjectCore();\n if (id) {\n core.id = id;\n }\n\n core.initNewObject(props);\n core.setType(EncodedReference.fromDXN(getSchemaDXN(schema)!));\n const newHandle = this._repo.create<DatabaseDirectory>({\n version: SpaceDocVersion.CURRENT,\n access: {\n spaceKey: this._space.key.toHex(),\n },\n objects: {\n [core.id]: core.getDoc() as ObjectStructure,\n },\n });\n await newHandle.whenReady();\n this._newLinks[core.id] = newHandle.url!;\n this._addHandleToFlushList(newHandle.documentId!);\n\n return core;\n }\n\n private _addHandleToFlushList(id: DocumentId): void {\n this._flushIds.push(id);\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { Atom } from '@effect-atom/atom';\nimport * as Registry from '@effect-atom/atom/Registry';\n\nimport { type Space, SpaceState } from '@dxos/client/echo';\nimport { invariant } from '@dxos/invariant';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { MigrationBuilder } from './migration-builder';\n\nexport type MigrationContext = {\n space: Space;\n builder: MigrationBuilder;\n};\n\nexport type Migration = {\n version: string;\n next: (context: MigrationContext) => MaybePromise<void>;\n};\n\nexport class Migrations {\n static namespace?: string;\n static migrations: Migration[] = [];\n private static _registry = Registry.make();\n private static _stateAtom = Atom.make<{ running: string[] }>({ running: [] }).pipe(Atom.keepAlive);\n\n static get versionProperty() {\n return this.namespace && `${this.namespace}.version`;\n }\n\n static get targetVersion() {\n return this.migrations[this.migrations.length - 1]?.version;\n }\n\n static running(space: Space): boolean {\n const state = this._registry.get(this._stateAtom);\n return state.running.includes(space.key.toHex());\n }\n\n static define(namespace: string, migrations: Migration[]): void {\n this.namespace = namespace;\n this.migrations = migrations;\n }\n\n static async migrate(space: Space, targetVersion?: string | number): Promise<boolean> {\n invariant(!this.running(space), 'Migration already running');\n invariant(this.versionProperty, 'Migrations namespace not set');\n invariant(space.state.get() === SpaceState.SPACE_READY, 'Space not ready');\n const currentVersion = space.properties[this.versionProperty];\n const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;\n const i = this.migrations.findIndex((m) => m.version === targetVersion);\n const targetIndex = i === -1 ? this.migrations.length : i + 1;\n if (currentIndex === targetIndex) {\n return false;\n }\n\n const spaceKey = space.key.toHex();\n const currentState = this._registry.get(this._stateAtom);\n this._registry.set(this._stateAtom, { running: [...currentState.running, spaceKey] });\n if (targetIndex > currentIndex) {\n const migrations = this.migrations.slice(currentIndex, targetIndex);\n for (const migration of migrations) {\n const builder = new MigrationBuilder(space);\n await migration.next({ space, builder });\n await builder.changeProperties((propertiesStructure) => {\n invariant(this.versionProperty, 'Migrations namespace not set');\n propertiesStructure.data[this.versionProperty] = migration.version;\n });\n await builder._commit();\n }\n }\n const finalState = this._registry.get(this._stateAtom);\n this._registry.set(this._stateAtom, { running: finalState.running.filter((key) => key !== spaceKey) });\n\n return true;\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,QAAQC,SAAmB;AAKpC,SAASC,0BAA0B;AACnC,SAA8BC,YAA4BC,uBAAuB;AACjF,SAAiCC,kBAAwCC,uBAAuB;AAChG,SAASC,oBAAoB;AAC7B,SAASC,iBAAiB;AAC1B,SAASC,WAAW;AAGpB,IAAA,eAAA;AAmBmBC,IAAiB,mBAAjBA,MAAiB;EACjBC;EAEjB;EACiBC;;EAEAC,YAAAA,CAAAA;EAETC,YAA+CC,CAAAA;EAEvD,iBAA6BC,CAAa;aAAbA;cACtBN,QAAQ;AACb,SAAA,SAAA;AACA,SAAKC,QAAQ,KAAI,OAA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AA,WAAiBK,UAAa,CAAA,MAAA,EAAA,YAAA,aAAA;UAChC,cAAO,MAAA,KAAA,KAAA,WAAA,SAAA,IAAA;AACT,QAAA,iBAAA,aAAA;AAEA,aAAME;IACN;AACA,UAAKvB,WAAUwB,MAAQ,IAACvB,MAAAA;UAAcE,eAAS,KAAA,UAAA,IAAA,KAAA,UAAA;mBAAIsB,IAAAA,KAAatB,YAAO;eAAEoB;QAAS,GAAA,aAAA;QAAC;MAC/EF;;QAEF,cAAWK,cAAa3B;YACtB,aAAM4B,KAAcC,WAAAA,MAAiBpB,cAAAA,WAAAA;iBAC/BkB,aAAc,YAAC;cAAElB,UAAAA,IAAAA,iBAAAA,KAAAA;cAAOmB,UAAAA,KAAAA;UAAQ;UACtC;;cAEEE,QAAAA,iBAAyB,CAAA,wBAAwBH;AACnD,UAAAf,WAAA,KAAA,iBAAA,gCAAA,EAAA,YAAA,YAAA,GAAAd,eAAA,GAAA,IAAA,GAAA,MAAA,GAAA,CAAA,wBAAA,gCAAA,EAAA,CAAA;AACA,8BAAqB,KAAA,KAAA,eAAA,IAAA,UAAA;QACvB,CAAA;AACF,cAAA,QAAA,QAAA;MACA;IACA;UAAsCM,aAAS2B,KAAW3B,UAAQ4B,IAAM,KAAEC,UAAQA;AAAkB,SAAA,UAAA,IAAA,KAAA,YAAA;MAEpG,SAAO,WAAA,QAAA,OAAA,CAAA,QAAA,QAAA,QAAA;IACT,CAAA;AACF,WAAA;;;",
|
|
6
|
+
"names": ["next", "A", "CreateEpochRequest", "ObjectCore", "migrateDocument", "EncodedReference", "SpaceDocVersion", "getSchemaDXN", "invariant", "DXN", "_repo", "_rootDoc", "_newLinks", "_deleteObjects", "_newRoot", "undefined", "_space", "internal", "db", "coreDatabase", "findObject", "docHandle", "objects", "migrateObject", "migrate", "objectStructure", "oldHandle", "newState", "version", "access", "spaceKey", "system", "data", "props", "meta", "keys", "newHandle", "whenReady", "id", "_addHandleToFlushList", "addObject", "schema", "createReference", "deleteObject", "changeProperties", "changeFn", "_buildNewRoot", "propertiesStructure", "properties", "migration", "REPLACE_AUTOMERGE_ROOT", "automergeRootUrl", "documentId", "url", "create", "links", "_createObject", "core", "initNewObject", "CURRENT", "Atom", "Registry", "SpaceState", "invariant", "__dxlog_file", "Migrations", "migrations", "_registry", "_stateAtom", "Atom", "running", "keepAlive", "versionProperty", "namespace", "targetVersion", "space", "state", "define", "invariant", "get", "SpaceState", "currentVersion", "properties", "currentIndex", "findIndex", "version", "i", "m", "targetIndex", "length", "spaceKey", "set", "currentState", "migration", "builder", "MigrationBuilder", "propertiesStructure", "finalState", "filter", "key"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"
|
|
1
|
+
{"inputs":{"src/migration-builder.ts":{"bytes":23409,"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/client/halo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true}],"format":"esm"},"src/migrations.ts":{"bytes":10982,"imports":[{"path":"@effect-atom/atom","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"src/migration-builder.ts","kind":"import-statement","original":"./migration-builder"}],"format":"esm"},"src/index.ts":{"bytes":575,"imports":[{"path":"src/migration-builder.ts","kind":"import-statement","original":"./migration-builder"},{"path":"src/migrations.ts","kind":"import-statement","original":"./migrations"}],"format":"esm"}},"outputs":{"dist/lib/browser/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16635},"dist/lib/browser/index.mjs":{"imports":[{"path":"@automerge/automerge","kind":"import-statement","external":true},{"path":"@dxos/client/halo","kind":"import-statement","external":true},{"path":"@dxos/echo-db","kind":"import-statement","external":true},{"path":"@dxos/echo-protocol","kind":"import-statement","external":true},{"path":"@dxos/echo/internal","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"@dxos/keys","kind":"import-statement","external":true},{"path":"@effect-atom/atom","kind":"import-statement","external":true},{"path":"@effect-atom/atom/Registry","kind":"import-statement","external":true},{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"exports":["MigrationBuilder","Migrations"],"entryPoint":"src/index.ts","inputs":{"src/migration-builder.ts":{"bytesInOutput":5430},"src/index.ts":{"bytesInOutput":0},"src/migrations.ts":{"bytesInOutput":3055}},"bytes":8615}}}
|