@tldraw/store
Advanced tools
Comparing version 2.0.0-canary.7fd0ab75edc8 to 2.0.0-canary.81ee3381bfd1
@@ -0,1 +1,44 @@ | ||
# v2.0.0-alpha.13 (Wed Jun 28 2023) | ||
### Release Notes | ||
#### [improvement] store snapshot types ([#1657](https://github.com/tldraw/tldraw/pull/1657)) | ||
- [dev] Rename `StoreSnapshot` to `SerializedStore` | ||
- [dev] Create new `StoreSnapshot` as type related to `getSnapshot`/`loadSnapshot` | ||
#### tlschema cleanup ([#1509](https://github.com/tldraw/tldraw/pull/1509)) | ||
- [editor] Remove `app.createShapeId` | ||
- [tlschema] Cleans up exports | ||
#### Rename tlstore to store ([#1507](https://github.com/tldraw/tldraw/pull/1507)) | ||
- Replace @tldraw/tlstore with @tldraw/store | ||
--- | ||
#### 💥 Breaking Change | ||
- [tweak] migrate store snapshot arguments [#1659](https://github.com/tldraw/tldraw/pull/1659) ([@steveruizok](https://github.com/steveruizok)) | ||
- [improvement] store snapshot types [#1657](https://github.com/tldraw/tldraw/pull/1657) ([@steveruizok](https://github.com/steveruizok)) | ||
- Independent instance state persistence [#1493](https://github.com/tldraw/tldraw/pull/1493) ([@ds300](https://github.com/ds300)) | ||
- tlschema cleanup [#1509](https://github.com/tldraw/tldraw/pull/1509) ([@steveruizok](https://github.com/steveruizok)) | ||
- Rename tlstore to store [#1507](https://github.com/tldraw/tldraw/pull/1507) ([@steveruizok](https://github.com/steveruizok)) | ||
#### ⚠️ Pushed to `main` | ||
- update lazyrepo ([@ds300](https://github.com/ds300)) | ||
#### 🔩 Dependency Updates | ||
- Incorporate signia as @tldraw/state [#1620](https://github.com/tldraw/tldraw/pull/1620) ([@steveruizok](https://github.com/steveruizok) [@ds300](https://github.com/ds300)) | ||
#### Authors: 2 | ||
- David Sheldrick ([@ds300](https://github.com/ds300)) | ||
- Steve Ruiz ([@steveruizok](https://github.com/steveruizok)) | ||
--- | ||
# v2.0.0-alpha.12 (Mon Apr 03 2023) | ||
@@ -2,0 +45,0 @@ |
@@ -111,5 +111,6 @@ "use strict"; | ||
migrateStoreSnapshot(snapshot) { | ||
let { store } = snapshot; | ||
const migrations = this.options.snapshotMigrations; | ||
if (!migrations) { | ||
return { type: "success", value: snapshot.store }; | ||
return { type: "success", value: store }; | ||
} | ||
@@ -123,3 +124,3 @@ const ourStoreVersion = migrations.currentVersion; | ||
const result = (0, import_migrate.migrate)({ | ||
value: snapshot.store, | ||
value: store, | ||
migrations, | ||
@@ -132,6 +133,6 @@ fromVersion: persistedStoreVersion, | ||
} | ||
snapshot.store = result.value; | ||
store = result.value; | ||
} | ||
const updated = []; | ||
for (const r of (0, import_utils.objectMapValues)(snapshot.store)) { | ||
for (const r of (0, import_utils.objectMapValues)(store)) { | ||
const result = this.migratePersistedRecord(r, snapshot.schema); | ||
@@ -145,8 +146,8 @@ if (result.type === "error") { | ||
if (updated.length) { | ||
snapshot.store = { ...snapshot.store }; | ||
store = { ...store }; | ||
for (const r of updated) { | ||
snapshot.store[r.id] = r; | ||
store[r.id] = r; | ||
} | ||
} | ||
return { type: "success", value: snapshot.store }; | ||
return { type: "success", value: store }; | ||
} | ||
@@ -153,0 +154,0 @@ /** @internal */ |
{ | ||
"name": "@tldraw/store", | ||
"description": "A tiny little drawing app (store).", | ||
"version": "2.0.0-canary.7fd0ab75edc8", | ||
"version": "2.0.0-canary.81ee3381bfd1", | ||
"packageManager": "yarn@3.5.0", | ||
@@ -45,4 +45,4 @@ "author": { | ||
"dependencies": { | ||
"@tldraw/state": "2.0.0-canary.7fd0ab75edc8", | ||
"@tldraw/utils": "2.0.0-canary.7fd0ab75edc8", | ||
"@tldraw/state": "2.0.0-canary.81ee3381bfd1", | ||
"@tldraw/utils": "2.0.0-canary.81ee3381bfd1", | ||
"lodash.isequal": "^4.5.0", | ||
@@ -49,0 +49,0 @@ "nanoid": "4.0.2" |
@@ -192,5 +192,7 @@ import { getOwnProperty, objectMapValues } from '@tldraw/utils' | ||
migrateStoreSnapshot(snapshot: StoreSnapshot<R>): MigrationResult<SerializedStore<R>> { | ||
let { store } = snapshot | ||
const migrations = this.options.snapshotMigrations | ||
if (!migrations) { | ||
return { type: 'success', value: snapshot.store } | ||
return { type: 'success', value: store } | ||
} | ||
@@ -207,3 +209,3 @@ // apply store migrations first | ||
const result = migrate<SerializedStore<R>>({ | ||
value: snapshot.store, | ||
value: store, | ||
migrations, | ||
@@ -217,7 +219,7 @@ fromVersion: persistedStoreVersion, | ||
} | ||
snapshot.store = result.value | ||
store = result.value | ||
} | ||
const updated: R[] = [] | ||
for (const r of objectMapValues(snapshot.store)) { | ||
for (const r of objectMapValues(store)) { | ||
const result = this.migratePersistedRecord(r, snapshot.schema) | ||
@@ -231,8 +233,8 @@ if (result.type === 'error') { | ||
if (updated.length) { | ||
snapshot.store = { ...snapshot.store } | ||
store = { ...store } | ||
for (const r of updated) { | ||
snapshot.store[r.id as IdOf<R>] = r | ||
store[r.id as IdOf<R>] = r | ||
} | ||
} | ||
return { type: 'success', value: snapshot.store } | ||
return { type: 'success', value: store } | ||
} | ||
@@ -239,0 +241,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
580160
10072
+ Added@tldraw/state@2.0.0-canary.81ee3381bfd1(transitive)
+ Added@tldraw/utils@2.0.0-canary.81ee3381bfd1(transitive)
- Removed@tldraw/state@2.0.0-canary.7fd0ab75edc8(transitive)
- Removed@tldraw/utils@2.0.0-canary.7fd0ab75edc8(transitive)