@dxos/migrations 0.8.3 → 0.8.4-main.f9ba587

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.3",
3
+ "version": "0.8.4-main.f9ba587",
4
4
  "description": "",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -24,16 +24,16 @@
24
24
  "src"
25
25
  ],
26
26
  "dependencies": {
27
- "@automerge/automerge": "3.0.0-beta.4",
28
- "@automerge/automerge-repo": "2.0.1",
29
- "@dxos/client": "0.8.3",
30
- "@dxos/echo-db": "0.8.3",
31
- "@dxos/echo-schema": "0.8.3",
32
- "@dxos/invariant": "0.8.3",
33
- "@dxos/log": "0.8.3",
34
- "@dxos/echo-protocol": "0.8.3",
35
- "@dxos/protocols": "0.8.3",
36
- "@dxos/util": "0.8.3"
27
+ "@automerge/automerge": "3.0.0",
28
+ "@automerge/automerge-repo": "2.0.8",
29
+ "@dxos/client": "0.8.4-main.f9ba587",
30
+ "@dxos/echo-db": "0.8.4-main.f9ba587",
31
+ "@dxos/echo-protocol": "0.8.4-main.f9ba587",
32
+ "@dxos/echo-schema": "0.8.4-main.f9ba587",
33
+ "@dxos/invariant": "0.8.4-main.f9ba587",
34
+ "@dxos/log": "0.8.4-main.f9ba587",
35
+ "@dxos/protocols": "0.8.4-main.f9ba587",
36
+ "@dxos/util": "0.8.4-main.f9ba587"
37
37
  },
38
38
  "devDependencies": {},
39
39
  "publishConfig": {
@@ -1,290 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var node_exports = {};
20
- __export(node_exports, {
21
- MigrationBuilder: () => MigrationBuilder,
22
- Migrations: () => Migrations
23
- });
24
- module.exports = __toCommonJS(node_exports);
25
- var import_automerge = require("@automerge/automerge");
26
- var import_halo = require("@dxos/client/halo");
27
- var import_echo_db = require("@dxos/echo-db");
28
- var import_echo_protocol = require("@dxos/echo-protocol");
29
- var import_echo_schema = require("@dxos/echo-schema");
30
- var import_invariant = require("@dxos/invariant");
31
- var import_echo = require("@dxos/client/echo");
32
- var import_invariant2 = require("@dxos/invariant");
33
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/migrations/src/migration-builder.ts";
34
- var MigrationBuilder = class {
35
- constructor(_space) {
36
- this._space = _space;
37
- this._newLinks = {};
38
- this._flushIds = [];
39
- this._deleteObjects = [];
40
- this._newRoot = void 0;
41
- this._repo = this._space.db.coreDatabase._repo;
42
- this._rootDoc = this._space.db.coreDatabase._automergeDocLoader.getSpaceRootDocHandle().doc();
43
- }
44
- async findObject(id) {
45
- const documentId = (this._rootDoc.links?.[id] || this._newLinks[id])?.toString();
46
- const docHandle = documentId && this._repo.find(documentId);
47
- if (!docHandle) {
48
- return void 0;
49
- }
50
- await docHandle.whenReady();
51
- const doc = docHandle.doc();
52
- return doc.objects?.[id];
53
- }
54
- async migrateObject(id, migrate) {
55
- const objectStructure = await this.findObject(id);
56
- if (!objectStructure) {
57
- return;
58
- }
59
- const { schema, props } = await migrate(objectStructure);
60
- const oldHandle = await this._findObjectContainingHandle(id);
61
- (0, import_invariant.invariant)(oldHandle, void 0, {
62
- F: __dxlog_file,
63
- L: 84,
64
- S: this,
65
- A: [
66
- "oldHandle",
67
- ""
68
- ]
69
- });
70
- const newState = {
71
- version: import_echo_protocol.SpaceDocVersion.CURRENT,
72
- access: {
73
- spaceKey: this._space.key.toHex()
74
- },
75
- objects: {
76
- [id]: {
77
- system: {
78
- type: (0, import_echo_protocol.encodeReference)((0, import_echo_schema.requireTypeReference)(schema))
79
- },
80
- data: props,
81
- meta: {
82
- keys: []
83
- }
84
- }
85
- }
86
- };
87
- const migratedDoc = (0, import_echo_db.migrateDocument)(oldHandle.doc(), newState);
88
- const newHandle = this._repo.import(import_automerge.next.save(migratedDoc));
89
- this._newLinks[id] = newHandle.url;
90
- this._addHandleToFlushList(newHandle);
91
- }
92
- async addObject(schema, props) {
93
- const core = this._createObject({
94
- schema,
95
- props
96
- });
97
- return core.id;
98
- }
99
- createReference(id) {
100
- return (0, import_echo_protocol.encodeReference)(import_echo_protocol.Reference.localObjectReference(id));
101
- }
102
- deleteObject(id) {
103
- this._deleteObjects.push(id);
104
- }
105
- changeProperties(changeFn) {
106
- if (!this._newRoot) {
107
- this._buildNewRoot();
108
- }
109
- (0, import_invariant.invariant)(this._newRoot, "New root not created", {
110
- F: __dxlog_file,
111
- L: 126,
112
- S: this,
113
- A: [
114
- "this._newRoot",
115
- "'New root not created'"
116
- ]
117
- });
118
- this._newRoot.change((doc) => {
119
- const propertiesStructure = doc.objects?.[this._space.properties.id];
120
- propertiesStructure && changeFn(propertiesStructure);
121
- });
122
- this._addHandleToFlushList(this._newRoot);
123
- }
124
- /**
125
- * @internal
126
- */
127
- async _commit() {
128
- if (!this._newRoot) {
129
- this._buildNewRoot();
130
- }
131
- (0, import_invariant.invariant)(this._newRoot, "New root not created", {
132
- F: __dxlog_file,
133
- L: 142,
134
- S: this,
135
- A: [
136
- "this._newRoot",
137
- "'New root not created'"
138
- ]
139
- });
140
- await this._space.db.flush();
141
- await this._space.internal.createEpoch({
142
- migration: import_halo.CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT,
143
- automergeRootUrl: this._newRoot.url
144
- });
145
- }
146
- async _findObjectContainingHandle(id) {
147
- const documentId = (this._rootDoc.links?.[id] || this._newLinks[id])?.toString();
148
- const docHandle = documentId && this._repo.find(documentId);
149
- if (!docHandle) {
150
- return void 0;
151
- }
152
- await docHandle.whenReady();
153
- return docHandle;
154
- }
155
- _buildNewRoot() {
156
- const links = {
157
- ...this._rootDoc.links ?? {}
158
- };
159
- for (const id of this._deleteObjects) {
160
- delete links[id];
161
- }
162
- for (const [id, url] of Object.entries(this._newLinks)) {
163
- links[id] = new import_automerge.next.RawString(url);
164
- }
165
- this._newRoot = this._repo.create({
166
- version: import_echo_protocol.SpaceDocVersion.CURRENT,
167
- access: {
168
- spaceKey: this._space.key.toHex()
169
- },
170
- objects: this._rootDoc.objects,
171
- links
172
- });
173
- this._addHandleToFlushList(this._newRoot);
174
- }
175
- _createObject({ id, schema, props }) {
176
- const core = new import_echo_db.ObjectCore();
177
- if (id) {
178
- core.id = id;
179
- }
180
- core.initNewObject(props);
181
- core.setType((0, import_echo_schema.requireTypeReference)(schema));
182
- const newHandle = this._repo.create({
183
- version: import_echo_protocol.SpaceDocVersion.CURRENT,
184
- access: {
185
- spaceKey: this._space.key.toHex()
186
- },
187
- objects: {
188
- [core.id]: core.getDoc()
189
- }
190
- });
191
- this._newLinks[core.id] = newHandle.url;
192
- this._addHandleToFlushList(newHandle);
193
- return core;
194
- }
195
- _addHandleToFlushList(handle) {
196
- this._flushIds.push(handle.documentId);
197
- }
198
- };
199
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/migrations/src/migrations.ts";
200
- var Migrations = class {
201
- static {
202
- this.migrations = [];
203
- }
204
- static {
205
- this._state = (0, import_echo.live)({
206
- running: []
207
- });
208
- }
209
- static get versionProperty() {
210
- return this.namespace && `${this.namespace}.version`;
211
- }
212
- static get targetVersion() {
213
- return this.migrations[this.migrations.length - 1]?.version;
214
- }
215
- static running(space) {
216
- return this._state.running.includes(space.key.toHex());
217
- }
218
- static define(namespace, migrations) {
219
- this.namespace = namespace;
220
- this.migrations = migrations;
221
- }
222
- static async migrate(space, targetVersion) {
223
- (0, import_invariant2.invariant)(!this.running(space), "Migration already running", {
224
- F: __dxlog_file2,
225
- L: 44,
226
- S: this,
227
- A: [
228
- "!this.running(space)",
229
- "'Migration already running'"
230
- ]
231
- });
232
- (0, import_invariant2.invariant)(this.versionProperty, "Migrations namespace not set", {
233
- F: __dxlog_file2,
234
- L: 45,
235
- S: this,
236
- A: [
237
- "this.versionProperty",
238
- "'Migrations namespace not set'"
239
- ]
240
- });
241
- (0, import_invariant2.invariant)(space.state.get() === import_echo.SpaceState.SPACE_READY, "Space not ready", {
242
- F: __dxlog_file2,
243
- L: 46,
244
- S: this,
245
- A: [
246
- "space.state.get() === SpaceState.SPACE_READY",
247
- "'Space not ready'"
248
- ]
249
- });
250
- const currentVersion = space.properties[this.versionProperty];
251
- const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;
252
- const i = this.migrations.findIndex((m) => m.version === targetVersion);
253
- const targetIndex = i === -1 ? this.migrations.length : i + 1;
254
- if (currentIndex === targetIndex) {
255
- return false;
256
- }
257
- this._state.running.push(space.key.toHex());
258
- if (targetIndex > currentIndex) {
259
- const migrations = this.migrations.slice(currentIndex, targetIndex);
260
- for (const migration of migrations) {
261
- const builder = new MigrationBuilder(space);
262
- await migration.next({
263
- space,
264
- builder
265
- });
266
- builder.changeProperties((propertiesStructure) => {
267
- (0, import_invariant2.invariant)(this.versionProperty, "Migrations namespace not set", {
268
- F: __dxlog_file2,
269
- L: 62,
270
- S: this,
271
- A: [
272
- "this.versionProperty",
273
- "'Migrations namespace not set'"
274
- ]
275
- });
276
- propertiesStructure.data[this.versionProperty] = migration.version;
277
- });
278
- await builder._commit();
279
- }
280
- }
281
- this._state.running.splice(this._state.running.indexOf(space.key.toHex()), 1);
282
- return true;
283
- }
284
- };
285
- // Annotate the CommonJS export names for ESM import in node:
286
- 0 && (module.exports = {
287
- MigrationBuilder,
288
- Migrations
289
- });
290
- //# sourceMappingURL=index.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/migration-builder.ts", "../../../src/migrations.ts"],
4
- "sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { next as am, type Doc } from '@automerge/automerge';\nimport { type AnyDocumentId, type DocumentId } from '@automerge/automerge-repo';\nimport { type Schema } from 'effect';\n\nimport { type Space } from '@dxos/client/echo';\nimport { CreateEpochRequest } from '@dxos/client/halo';\nimport { ObjectCore, migrateDocument, type DocHandleProxy, type RepoProxy } from '@dxos/echo-db';\nimport {\n Reference,\n SpaceDocVersion,\n encodeReference,\n type DatabaseDirectory,\n type ObjectStructure,\n} from '@dxos/echo-protocol';\nimport { requireTypeReference } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\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.db.coreDatabase._repo;\n // TODO(wittjosiah): Accessing private API.\n this._rootDoc = (this._space.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: encodeReference(requireTypeReference(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>(am.save(migratedDoc));\n this._newLinks[id] = newHandle.url;\n this._addHandleToFlushList(newHandle);\n }\n\n async addObject(schema: Schema.Schema.AnyNoContext, props: any): Promise<string> {\n const core = this._createObject({ schema, props });\n return core.id;\n }\n\n createReference(id: string) {\n return encodeReference(Reference.localObjectReference(id));\n }\n\n deleteObject(id: string): void {\n this._deleteObjects.push(id);\n }\n\n changeProperties(changeFn: (properties: ObjectStructure) => void): void {\n if (!this._newRoot) {\n 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 this._addHandleToFlushList(this._newRoot);\n }\n\n /**\n * @internal\n */\n async _commit(): Promise<void> {\n if (!this._newRoot) {\n this._buildNewRoot();\n }\n invariant(this._newRoot, 'New root not created');\n\n await this._space.db.flush();\n\n // Create new epoch.\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 _buildNewRoot(): 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 am.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 this._addHandleToFlushList(this._newRoot);\n }\n\n private _createObject({\n id,\n schema,\n props,\n }: {\n id?: string;\n schema: Schema.Schema.AnyNoContext;\n props: any;\n }): ObjectCore {\n const core = new ObjectCore();\n if (id) {\n core.id = id;\n }\n\n core.initNewObject(props);\n core.setType(requireTypeReference(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 this._newLinks[core.id] = newHandle.url;\n this._addHandleToFlushList(newHandle);\n\n return core;\n }\n\n private _addHandleToFlushList(handle: DocHandleProxy<any>): void {\n this._flushIds.push(handle.documentId);\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Space, live, 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 _state = live<{ running: string[] }>({ running: [] });\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 return this._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 this._state.running.push(space.key.toHex());\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 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 this._state.running.splice(this._state.running.indexOf(space.key.toHex()), 1);\n\n return true;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,uBAAqC;AAKrC,kBAAmC;AACnC,qBAAiF;AACjF,2BAMO;AACP,yBAAqC;AACrC,uBAA0B;ACf1B,kBAA6C;AAC7C,IAAAA,oBAA0B;;ADmCnB,IAAMC,mBAAN,MAAMA;EAWX,YAA6BC,QAAe;SAAfA,SAAAA;SANZC,YAAoC,CAAC;SACrCC,YAA0B,CAAA;SAC1BC,iBAA2B,C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C,iBAAiB,CAACI,wBAAAA;AACxBpC,gCAAAA,WAAU,KAAK6D,iBAAiB,gCAAA;;;;;;;;;AAChCzB,8BAAoBvB,KAAK,KAAKgD,eAAe,IAAInB,UAAUxC;QAC7D,CAAA;AACA,cAAM6E,QAAQzC,QAAO;MACvB;IACF;AACA,SAAKoB,OAAOE,QAAQqB,OAAO,KAAKvB,OAAOE,QAAQsB,QAAQjB,MAAM1D,IAAIC,MAAK,CAAA,GAAK,CAAA;AAE3E,WAAO;EACT;AACF;",
6
- "names": ["import_invariant", "MigrationBuilder", "_space", "_newLinks", "_flushIds", "_deleteObjects", "_newRoot", "undefined", "_repo", "db", "coreDatabase", "_rootDoc", "_automergeDocLoader", "getSpaceRootDocHandle", "doc", "findObject", "id", "documentId", "links", "toString", "docHandle", "find", "whenReady", "objects", "migrateObject", "migrate", "objectStructure", "schema", "props", "oldHandle", "_findObjectContainingHandle", "invariant", "newState", "version", "SpaceDocVersion", "CURRENT", "access", "spaceKey", "key", "toHex", "system", "type", "encodeReference", "requireTypeReference", "data", "meta", "keys", "migratedDoc", "migrateDocument", "newHandle", "import", "am", "save", "url", "_addHandleToFlushList", "addObject", "core", "_createObject", "createReference", "Reference", "localObjectReference", "deleteObject", "push", "changeProperties", "changeFn", "_buildNewRoot", "change", "propertiesStructure", "properties", "_commit", "flush", "internal", "createEpoch", "migration", "CreateEpochRequest", "Migration", "REPLACE_AUTOMERGE_ROOT", "automergeRootUrl", "Object", "entries", "RawString", "create", "ObjectCore", "initNewObject", "setType", "getDoc", "handle", "Migrations", "migrations", "_state", "live", "running", "versionProperty", "namespace", "targetVersion", "length", "space", "includes", "define", "state", "get", "SpaceState", "SPACE_READY", "currentVersion", "currentIndex", "findIndex", "m", "i", "targetIndex", "slice", "builder", "next", "splice", "indexOf"]
7
- }
@@ -1 +0,0 @@
1
- {"inputs":{"packages/sdk/migrations/src/migration-builder.ts":{"bytes":22181,"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-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true}],"format":"esm"},"packages/sdk/migrations/src/migrations.ts":{"bytes":9722,"imports":[{"path":"@dxos/client/echo","kind":"import-statement","external":true},{"path":"@dxos/invariant","kind":"import-statement","external":true},{"path":"packages/sdk/migrations/src/migration-builder.ts","kind":"import-statement","original":"./migration-builder"}],"format":"esm"},"packages/sdk/migrations/src/index.ts":{"bytes":666,"imports":[{"path":"packages/sdk/migrations/src/migration-builder.ts","kind":"import-statement","original":"./migration-builder"},{"path":"packages/sdk/migrations/src/migrations.ts","kind":"import-statement","original":"./migrations"}],"format":"esm"}},"outputs":{"packages/sdk/migrations/dist/lib/node/index.cjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":15579},"packages/sdk/migrations/dist/lib/node/index.cjs":{"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-schema","kind":"import-statement","external":true},{"path":"@dxos/invariant","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":"packages/sdk/migrations/src/index.ts","inputs":{"packages/sdk/migrations/src/migration-builder.ts":{"bytesInOutput":4834},"packages/sdk/migrations/src/index.ts":{"bytesInOutput":0},"packages/sdk/migrations/src/migrations.ts":{"bytesInOutput":2754}},"bytes":7766}}}