@tldraw/tlschema 5.5.0-next.4d6473b0bda1 → 5.5.0-next.56e885b43469
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-cjs/index.js
CHANGED
|
@@ -222,7 +222,7 @@ var import_translations = require("./translations/translations");
|
|
|
222
222
|
var import_b64Vecs = require("./misc/b64Vecs");
|
|
223
223
|
(0, import_utils.registerTldrawLibraryVersion)(
|
|
224
224
|
"@tldraw/tlschema",
|
|
225
|
-
"5.5.0-next.
|
|
225
|
+
"5.5.0-next.56e885b43469",
|
|
226
226
|
"cjs"
|
|
227
227
|
);
|
|
228
228
|
//# sourceMappingURL=index.js.map
|
package/dist-esm/index.mjs
CHANGED
|
@@ -214,7 +214,7 @@ import {
|
|
|
214
214
|
} from "./translations/translations.mjs";
|
|
215
215
|
registerTldrawLibraryVersion(
|
|
216
216
|
"@tldraw/tlschema",
|
|
217
|
-
"5.5.0-next.
|
|
217
|
+
"5.5.0-next.56e885b43469",
|
|
218
218
|
"esm"
|
|
219
219
|
);
|
|
220
220
|
import { DIM_2D, DIM_3D, b64Vecs } from "./misc/b64Vecs.mjs";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/tlschema",
|
|
3
3
|
"description": "tldraw infinite canvas SDK (schema).",
|
|
4
|
-
"version": "5.5.0-next.
|
|
4
|
+
"version": "5.5.0-next.56e885b43469",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -54,13 +54,13 @@
|
|
|
54
54
|
"kleur": "^4.1.5",
|
|
55
55
|
"lazyrepo": "0.0.0-alpha.27",
|
|
56
56
|
"react": "^19.2.1",
|
|
57
|
-
"vitest": "^
|
|
57
|
+
"vitest": "^5.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@tldraw/state": "5.5.0-next.
|
|
61
|
-
"@tldraw/store": "5.5.0-next.
|
|
62
|
-
"@tldraw/utils": "5.5.0-next.
|
|
63
|
-
"@tldraw/validate": "5.5.0-next.
|
|
60
|
+
"@tldraw/state": "5.5.0-next.56e885b43469",
|
|
61
|
+
"@tldraw/store": "5.5.0-next.56e885b43469",
|
|
62
|
+
"@tldraw/utils": "5.5.0-next.56e885b43469",
|
|
63
|
+
"@tldraw/validate": "5.5.0-next.56e885b43469"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
66
|
"react": "^18.2.0 || ^19.2.1",
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { devFreeze, Migration, MigrationId } from '@tldraw/store'
|
|
2
2
|
import { mockUniqueId, structuredClone } from '@tldraw/utils'
|
|
3
|
-
import { vi } from 'vitest'
|
|
4
3
|
import { createTLSchema } from '../createTLSchema'
|
|
5
4
|
|
|
6
5
|
let nextNanoId = 0
|
|
@@ -8,11 +7,24 @@ mockUniqueId(() => `nanoid_${++nextNanoId}`)
|
|
|
8
7
|
|
|
9
8
|
export const testSchema = createTLSchema()
|
|
10
9
|
|
|
11
|
-
//
|
|
10
|
+
// Records which migrator fns ran, so migrations.test.ts can assert every one is covered by a
|
|
11
|
+
// test. This deliberately isn't a vi.fn: vitest clears mock call history before each test, which
|
|
12
|
+
// would wipe the record before the coverage check runs.
|
|
13
|
+
const calledMigrators = new Set<string>()
|
|
14
|
+
|
|
15
|
+
/** Whether any test in this run exercised the given migrator. */
|
|
16
|
+
export function wasMigratorCalled(id: MigrationId, direction: 'up' | 'down') {
|
|
17
|
+
return calledMigrators.has(`${id}/${direction}`)
|
|
18
|
+
}
|
|
19
|
+
|
|
12
20
|
for (const migration of testSchema.sortedMigrations) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
for (const direction of ['up', 'down'] as const) {
|
|
22
|
+
const fn = migration[direction]
|
|
23
|
+
if (typeof fn !== 'function') continue
|
|
24
|
+
;(migration as any)[direction] = (...args: any[]) => {
|
|
25
|
+
calledMigrators.add(`${migration.id}/${direction}`)
|
|
26
|
+
return (fn as any)(...args)
|
|
27
|
+
}
|
|
16
28
|
}
|
|
17
29
|
}
|
|
18
30
|
|
package/src/migrations.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRecordType } from '@tldraw/store'
|
|
2
|
-
import { getTestMigration, testSchema } from './__tests__/migrationTestUtils'
|
|
2
|
+
import { getTestMigration, testSchema, wasMigratorCalled } from './__tests__/migrationTestUtils'
|
|
3
3
|
import { bookmarkAssetVersions } from './assets/TLBookmarkAsset'
|
|
4
4
|
import { imageAssetVersions } from './assets/TLImageAsset'
|
|
5
5
|
import { videoAssetVersions } from './assets/TLVideoAsset'
|
|
@@ -2800,9 +2800,9 @@ describe('DrawShapeSegment dim validation', () => {
|
|
|
2800
2800
|
describe('all migrator fns were called at least once', () => {
|
|
2801
2801
|
for (const migration of testSchema.sortedMigrations) {
|
|
2802
2802
|
it(`migration ${migration.id}`, () => {
|
|
2803
|
-
expect((migration
|
|
2803
|
+
expect(wasMigratorCalled(migration.id, 'up')).toBe(true)
|
|
2804
2804
|
if (typeof migration.down === 'function') {
|
|
2805
|
-
expect((migration
|
|
2805
|
+
expect(wasMigratorCalled(migration.id, 'down')).toBe(true)
|
|
2806
2806
|
}
|
|
2807
2807
|
})
|
|
2808
2808
|
}
|