@dxos/migrations 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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/dist/lib/browser/index.mjs +9 -81
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +9 -81
- package/dist/lib/node-esm/index.mjs.map +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/migration-builder.d.ts.map +1 -1
- package/dist/types/src/migrations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -13
- package/src/migrations.test.ts +2 -2
|
@@ -38,15 +38,7 @@ var MigrationBuilder = class {
|
|
|
38
38
|
}
|
|
39
39
|
const { schema, props } = await migrate(objectStructure);
|
|
40
40
|
const oldHandle = await this._findObjectContainingHandle(id);
|
|
41
|
-
invariant(oldHandle, void 0, {
|
|
42
|
-
F: __dxlog_file,
|
|
43
|
-
L: 79,
|
|
44
|
-
S: this,
|
|
45
|
-
A: [
|
|
46
|
-
"oldHandle",
|
|
47
|
-
""
|
|
48
|
-
]
|
|
49
|
-
});
|
|
41
|
+
invariant(oldHandle, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 59, S: this, A: ["oldHandle", ""] });
|
|
50
42
|
const newState = {
|
|
51
43
|
version: SpaceDocVersion.CURRENT,
|
|
52
44
|
access: {
|
|
@@ -67,15 +59,7 @@ var MigrationBuilder = class {
|
|
|
67
59
|
const migratedDoc = migrateDocument(oldHandle.doc(), newState);
|
|
68
60
|
const newHandle = this._repo.import(A.save(migratedDoc));
|
|
69
61
|
await newHandle.whenReady();
|
|
70
|
-
invariant(newHandle.url, "Migrated document URL not available after whenReady", {
|
|
71
|
-
F: __dxlog_file,
|
|
72
|
-
L: 101,
|
|
73
|
-
S: this,
|
|
74
|
-
A: [
|
|
75
|
-
"newHandle.url",
|
|
76
|
-
"'Migrated document URL not available after whenReady'"
|
|
77
|
-
]
|
|
78
|
-
});
|
|
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'"] });
|
|
79
63
|
this._newLinks[id] = newHandle.url;
|
|
80
64
|
this._addHandleToFlushList(newHandle.documentId);
|
|
81
65
|
}
|
|
@@ -96,15 +80,7 @@ var MigrationBuilder = class {
|
|
|
96
80
|
if (!this._newRoot) {
|
|
97
81
|
await this._buildNewRoot();
|
|
98
82
|
}
|
|
99
|
-
invariant(this._newRoot, "New root not created", {
|
|
100
|
-
F: __dxlog_file,
|
|
101
|
-
L: 123,
|
|
102
|
-
S: this,
|
|
103
|
-
A: [
|
|
104
|
-
"this._newRoot",
|
|
105
|
-
"'New root not created'"
|
|
106
|
-
]
|
|
107
|
-
});
|
|
83
|
+
invariant(this._newRoot, "New root not created", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 101, S: this, A: ["this._newRoot", "'New root not created'"] });
|
|
108
84
|
this._newRoot.change((doc) => {
|
|
109
85
|
const propertiesStructure = doc.objects?.[this._space.properties.id];
|
|
110
86
|
propertiesStructure && changeFn(propertiesStructure);
|
|
@@ -119,25 +95,9 @@ var MigrationBuilder = class {
|
|
|
119
95
|
if (!this._newRoot) {
|
|
120
96
|
await this._buildNewRoot();
|
|
121
97
|
}
|
|
122
|
-
invariant(this._newRoot, "New root not created", {
|
|
123
|
-
F: __dxlog_file,
|
|
124
|
-
L: 140,
|
|
125
|
-
S: this,
|
|
126
|
-
A: [
|
|
127
|
-
"this._newRoot",
|
|
128
|
-
"'New root not created'"
|
|
129
|
-
]
|
|
130
|
-
});
|
|
98
|
+
invariant(this._newRoot, "New root not created", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 115, S: this, A: ["this._newRoot", "'New root not created'"] });
|
|
131
99
|
await this._space.db.flush();
|
|
132
|
-
invariant(this._newRoot.url, "New root URL not available", {
|
|
133
|
-
F: __dxlog_file,
|
|
134
|
-
L: 145,
|
|
135
|
-
S: this,
|
|
136
|
-
A: [
|
|
137
|
-
"this._newRoot.url",
|
|
138
|
-
"'New root URL not available'"
|
|
139
|
-
]
|
|
140
|
-
});
|
|
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'"] });
|
|
141
101
|
await this._space.internal.createEpoch({
|
|
142
102
|
migration: CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT,
|
|
143
103
|
automergeRootUrl: this._newRoot.url
|
|
@@ -227,33 +187,9 @@ var Migrations = class {
|
|
|
227
187
|
this.migrations = migrations;
|
|
228
188
|
}
|
|
229
189
|
static async migrate(space, targetVersion) {
|
|
230
|
-
invariant2(!this.running(space), "Migration already running", {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
S: this,
|
|
234
|
-
A: [
|
|
235
|
-
"!this.running(space)",
|
|
236
|
-
"'Migration already running'"
|
|
237
|
-
]
|
|
238
|
-
});
|
|
239
|
-
invariant2(this.versionProperty, "Migrations namespace not set", {
|
|
240
|
-
F: __dxlog_file2,
|
|
241
|
-
L: 50,
|
|
242
|
-
S: this,
|
|
243
|
-
A: [
|
|
244
|
-
"this.versionProperty",
|
|
245
|
-
"'Migrations namespace not set'"
|
|
246
|
-
]
|
|
247
|
-
});
|
|
248
|
-
invariant2(space.state.get() === SpaceState.SPACE_READY, "Space not ready", {
|
|
249
|
-
F: __dxlog_file2,
|
|
250
|
-
L: 51,
|
|
251
|
-
S: this,
|
|
252
|
-
A: [
|
|
253
|
-
"space.state.get() === SpaceState.SPACE_READY",
|
|
254
|
-
"'Space not ready'"
|
|
255
|
-
]
|
|
256
|
-
});
|
|
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'"] });
|
|
257
193
|
const currentVersion = space.properties[this.versionProperty];
|
|
258
194
|
const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;
|
|
259
195
|
const i = this.migrations.findIndex((m) => m.version === targetVersion);
|
|
@@ -278,15 +214,7 @@ var Migrations = class {
|
|
|
278
214
|
builder
|
|
279
215
|
});
|
|
280
216
|
await builder.changeProperties((propertiesStructure) => {
|
|
281
|
-
invariant2(this.versionProperty, "Migrations namespace not set", {
|
|
282
|
-
F: __dxlog_file2,
|
|
283
|
-
L: 69,
|
|
284
|
-
S: this,
|
|
285
|
-
A: [
|
|
286
|
-
"this.versionProperty",
|
|
287
|
-
"'Migrations namespace not set'"
|
|
288
|
-
]
|
|
289
|
-
});
|
|
217
|
+
invariant2(this.versionProperty, "Migrations namespace not set", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 58, S: this, A: ["this.versionProperty", "'Migrations namespace not set'"] });
|
|
290
218
|
propertiesStructure.data[this.versionProperty] = migration.version;
|
|
291
219
|
});
|
|
292
220
|
await builder._commit();
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/migration-builder.ts", "../../../src/migrations.ts"],
|
|
4
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
|
|
6
|
-
"names": ["next", "A", "C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3B,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":{"src/migration-builder.ts":{"bytes":
|
|
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}}}
|
|
@@ -40,15 +40,7 @@ var MigrationBuilder = class {
|
|
|
40
40
|
}
|
|
41
41
|
const { schema, props } = await migrate(objectStructure);
|
|
42
42
|
const oldHandle = await this._findObjectContainingHandle(id);
|
|
43
|
-
invariant(oldHandle, void 0, {
|
|
44
|
-
F: __dxlog_file,
|
|
45
|
-
L: 79,
|
|
46
|
-
S: this,
|
|
47
|
-
A: [
|
|
48
|
-
"oldHandle",
|
|
49
|
-
""
|
|
50
|
-
]
|
|
51
|
-
});
|
|
43
|
+
invariant(oldHandle, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 59, S: this, A: ["oldHandle", ""] });
|
|
52
44
|
const newState = {
|
|
53
45
|
version: SpaceDocVersion.CURRENT,
|
|
54
46
|
access: {
|
|
@@ -69,15 +61,7 @@ var MigrationBuilder = class {
|
|
|
69
61
|
const migratedDoc = migrateDocument(oldHandle.doc(), newState);
|
|
70
62
|
const newHandle = this._repo.import(A.save(migratedDoc));
|
|
71
63
|
await newHandle.whenReady();
|
|
72
|
-
invariant(newHandle.url, "Migrated document URL not available after whenReady", {
|
|
73
|
-
F: __dxlog_file,
|
|
74
|
-
L: 101,
|
|
75
|
-
S: this,
|
|
76
|
-
A: [
|
|
77
|
-
"newHandle.url",
|
|
78
|
-
"'Migrated document URL not available after whenReady'"
|
|
79
|
-
]
|
|
80
|
-
});
|
|
64
|
+
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'"] });
|
|
81
65
|
this._newLinks[id] = newHandle.url;
|
|
82
66
|
this._addHandleToFlushList(newHandle.documentId);
|
|
83
67
|
}
|
|
@@ -98,15 +82,7 @@ var MigrationBuilder = class {
|
|
|
98
82
|
if (!this._newRoot) {
|
|
99
83
|
await this._buildNewRoot();
|
|
100
84
|
}
|
|
101
|
-
invariant(this._newRoot, "New root not created", {
|
|
102
|
-
F: __dxlog_file,
|
|
103
|
-
L: 123,
|
|
104
|
-
S: this,
|
|
105
|
-
A: [
|
|
106
|
-
"this._newRoot",
|
|
107
|
-
"'New root not created'"
|
|
108
|
-
]
|
|
109
|
-
});
|
|
85
|
+
invariant(this._newRoot, "New root not created", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 101, S: this, A: ["this._newRoot", "'New root not created'"] });
|
|
110
86
|
this._newRoot.change((doc) => {
|
|
111
87
|
const propertiesStructure = doc.objects?.[this._space.properties.id];
|
|
112
88
|
propertiesStructure && changeFn(propertiesStructure);
|
|
@@ -121,25 +97,9 @@ var MigrationBuilder = class {
|
|
|
121
97
|
if (!this._newRoot) {
|
|
122
98
|
await this._buildNewRoot();
|
|
123
99
|
}
|
|
124
|
-
invariant(this._newRoot, "New root not created", {
|
|
125
|
-
F: __dxlog_file,
|
|
126
|
-
L: 140,
|
|
127
|
-
S: this,
|
|
128
|
-
A: [
|
|
129
|
-
"this._newRoot",
|
|
130
|
-
"'New root not created'"
|
|
131
|
-
]
|
|
132
|
-
});
|
|
100
|
+
invariant(this._newRoot, "New root not created", { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 115, S: this, A: ["this._newRoot", "'New root not created'"] });
|
|
133
101
|
await this._space.db.flush();
|
|
134
|
-
invariant(this._newRoot.url, "New root URL not available", {
|
|
135
|
-
F: __dxlog_file,
|
|
136
|
-
L: 145,
|
|
137
|
-
S: this,
|
|
138
|
-
A: [
|
|
139
|
-
"this._newRoot.url",
|
|
140
|
-
"'New root URL not available'"
|
|
141
|
-
]
|
|
142
|
-
});
|
|
102
|
+
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'"] });
|
|
143
103
|
await this._space.internal.createEpoch({
|
|
144
104
|
migration: CreateEpochRequest.Migration.REPLACE_AUTOMERGE_ROOT,
|
|
145
105
|
automergeRootUrl: this._newRoot.url
|
|
@@ -229,33 +189,9 @@ var Migrations = class {
|
|
|
229
189
|
this.migrations = migrations;
|
|
230
190
|
}
|
|
231
191
|
static async migrate(space, targetVersion) {
|
|
232
|
-
invariant2(!this.running(space), "Migration already running", {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
S: this,
|
|
236
|
-
A: [
|
|
237
|
-
"!this.running(space)",
|
|
238
|
-
"'Migration already running'"
|
|
239
|
-
]
|
|
240
|
-
});
|
|
241
|
-
invariant2(this.versionProperty, "Migrations namespace not set", {
|
|
242
|
-
F: __dxlog_file2,
|
|
243
|
-
L: 50,
|
|
244
|
-
S: this,
|
|
245
|
-
A: [
|
|
246
|
-
"this.versionProperty",
|
|
247
|
-
"'Migrations namespace not set'"
|
|
248
|
-
]
|
|
249
|
-
});
|
|
250
|
-
invariant2(space.state.get() === SpaceState.SPACE_READY, "Space not ready", {
|
|
251
|
-
F: __dxlog_file2,
|
|
252
|
-
L: 51,
|
|
253
|
-
S: this,
|
|
254
|
-
A: [
|
|
255
|
-
"space.state.get() === SpaceState.SPACE_READY",
|
|
256
|
-
"'Space not ready'"
|
|
257
|
-
]
|
|
258
|
-
});
|
|
192
|
+
invariant2(!this.running(space), "Migration already running", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 31, S: this, A: ["!this.running(space)", "'Migration already running'"] });
|
|
193
|
+
invariant2(this.versionProperty, "Migrations namespace not set", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 32, S: this, A: ["this.versionProperty", "'Migrations namespace not set'"] });
|
|
194
|
+
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'"] });
|
|
259
195
|
const currentVersion = space.properties[this.versionProperty];
|
|
260
196
|
const currentIndex = this.migrations.findIndex((m) => m.version === currentVersion) + 1;
|
|
261
197
|
const i = this.migrations.findIndex((m) => m.version === targetVersion);
|
|
@@ -280,15 +216,7 @@ var Migrations = class {
|
|
|
280
216
|
builder
|
|
281
217
|
});
|
|
282
218
|
await builder.changeProperties((propertiesStructure) => {
|
|
283
|
-
invariant2(this.versionProperty, "Migrations namespace not set", {
|
|
284
|
-
F: __dxlog_file2,
|
|
285
|
-
L: 69,
|
|
286
|
-
S: this,
|
|
287
|
-
A: [
|
|
288
|
-
"this.versionProperty",
|
|
289
|
-
"'Migrations namespace not set'"
|
|
290
|
-
]
|
|
291
|
-
});
|
|
219
|
+
invariant2(this.versionProperty, "Migrations namespace not set", { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 58, S: this, A: ["this.versionProperty", "'Migrations namespace not set'"] });
|
|
292
220
|
propertiesStructure.data[this.versionProperty] = migration.version;
|
|
293
221
|
});
|
|
294
222
|
await builder._commit();
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/migration-builder.ts", "../../../src/migrations.ts"],
|
|
4
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
|
|
6
|
-
"names": ["next", "A", "CreateEpochRequest", "ObjectCore", "migrateDocument", "EncodedReference", "SpaceDocVersion", "getSchemaDXN", "invariant", "DXN", "
|
|
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,OAAKK,SAAOC,GAASC,aAAGC;AAK3C,SAAMC,WAAqB,KAAwC,OAAA,SAAA,GAAA,aAAA,oBAAA,sBAAA,EAAA,IAAA;;QAEjE,WAAMC,IAAAA;AACN,UAAKA,cAAW,KAAA,SAAA,QAAA,EAAA,KAAA,KAAA,UAAA,EAAA,IAAA,SAAA;UACd,YAAON,cAAAA,KAAAA,MAAA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AAAA,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":{"src/migration-builder.ts":{"bytes":
|
|
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/node-esm/index.mjs.map":{"imports":[],"exports":[],"inputs":{},"bytes":16637},"dist/lib/node-esm/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":8708}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration-builder.d.ts","sourceRoot":"","sources":["../../../src/migration-builder.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAA0B,gBAAgB,EAAE,KAAK,eAAe,EAAmB,MAAM,qBAAqB,CAAC;AAItH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAoB/C,qBAAa,gBAAgB;IAWf,OAAO,CAAC,QAAQ,CAAC,MAAM;IAVnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyB;IAGlD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;IACxD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAE/C,OAAO,CAAC,QAAQ,CAAC,CAAgD;
|
|
1
|
+
{"version":3,"file":"migration-builder.d.ts","sourceRoot":"","sources":["../../../src/migration-builder.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAA0B,gBAAgB,EAAE,KAAK,eAAe,EAAmB,MAAM,qBAAqB,CAAC;AAItH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AA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