jazz-tools 0.17.9 → 0.17.10
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/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.17.
|
2
|
+
> jazz-tools@0.17.10 build /home/runner/_work/jazz/jazz/packages/jazz-tools
|
3
3
|
> tsup && pnpm types && pnpm build:svelte
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
|
@@ -102,13 +102,13 @@
|
|
102
102
|
[34mESM[39m Build start
|
103
103
|
[32mESM[39m [1mdist/tiptap/index.js [22m[32m564.00 B[39m
|
104
104
|
[32mESM[39m [1mdist/tiptap/index.js.map [22m[32m1.21 KB[39m
|
105
|
-
[32mESM[39m ⚡️ Build success in
|
105
|
+
[32mESM[39m ⚡️ Build success in 20ms
|
106
106
|
[32mESM[39m [1mdist/react/ssr.js [22m[32m688.00 B[39m
|
107
107
|
[32mESM[39m [1mdist/react/ssr.js.map [22m[32m1.12 KB[39m
|
108
|
-
[32mESM[39m ⚡️ Build success in
|
108
|
+
[32mESM[39m ⚡️ Build success in 23ms
|
109
109
|
[32mESM[39m [1mdist/worker/index.js [22m[32m2.31 KB[39m
|
110
110
|
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.77 KB[39m
|
111
|
-
[32mESM[39m ⚡️ Build success in
|
111
|
+
[32mESM[39m ⚡️ Build success in 21ms
|
112
112
|
[32mESM[39m [1mdist/media/index.js [22m[32m236.00 B[39m
|
113
113
|
[32mESM[39m [1mdist/media/index.browser.js [22m[32m3.21 KB[39m
|
114
114
|
[32mESM[39m [1mdist/media/index.native.js [22m[32m3.53 KB[39m
|
@@ -117,67 +117,67 @@
|
|
117
117
|
[32mESM[39m [1mdist/media/index.browser.js.map [22m[32m6.02 KB[39m
|
118
118
|
[32mESM[39m [1mdist/media/index.native.js.map [22m[32m6.52 KB[39m
|
119
119
|
[32mESM[39m [1mdist/media/chunk-E5J3WLQW.js.map [22m[32m15.95 KB[39m
|
120
|
-
[32mESM[39m ⚡️ Build success in
|
121
|
-
[32mESM[39m [1mdist/
|
122
|
-
[32mESM[39m [1mdist/
|
123
|
-
[32mESM[39m
|
124
|
-
[32mESM[39m [1mdist/
|
125
|
-
[32mESM[39m [1mdist/
|
126
|
-
[32mESM[39m [1mdist/
|
127
|
-
[32mESM[39m
|
120
|
+
[32mESM[39m ⚡️ Build success in 28ms
|
121
|
+
[32mESM[39m [1mdist/browser/index.js [22m[32m13.43 KB[39m
|
122
|
+
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.65 KB[39m
|
123
|
+
[32mESM[39m ⚡️ Build success in 31ms
|
124
|
+
[32mESM[39m [1mdist/react-native/index.js [22m[32m2.53 KB[39m
|
125
|
+
[32mESM[39m [1mdist/react-native/testing.js [22m[32m120.00 B[39m
|
126
|
+
[32mESM[39m [1mdist/react-native/crypto.js [22m[32m161.00 B[39m
|
127
|
+
[32mESM[39m [1mdist/react-native/index.js.map [22m[32m5.68 KB[39m
|
128
|
+
[32mESM[39m [1mdist/react-native/testing.js.map [22m[32m176.00 B[39m
|
129
|
+
[32mESM[39m [1mdist/react-native/crypto.js.map [22m[32m197.00 B[39m
|
130
|
+
[32mESM[39m ⚡️ Build success in 28ms
|
128
131
|
[32mESM[39m [1mdist/react-core/index.js [22m[32m8.41 KB[39m
|
129
132
|
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
130
133
|
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js [22m[32m279.00 B[39m
|
131
134
|
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m20.68 KB[39m
|
132
135
|
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
133
136
|
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
134
|
-
[32mESM[39m ⚡️ Build success in
|
135
|
-
[32mESM[39m [1mdist/
|
136
|
-
[32mESM[39m [1mdist/
|
137
|
-
[32mESM[39m [1mdist/
|
138
|
-
[32mESM[39m [1mdist/
|
139
|
-
[32mESM[39m [1mdist/
|
140
|
-
[32mESM[39m [1mdist/
|
141
|
-
[32mESM[39m ⚡️ Build success in
|
142
|
-
[32mESM[39m [1mdist/
|
143
|
-
[32mESM[39m [1mdist/
|
144
|
-
[32mESM[39m
|
137
|
+
[32mESM[39m ⚡️ Build success in 28ms
|
138
|
+
[32mESM[39m [1mdist/expo/index.js [22m[32m4.65 KB[39m
|
139
|
+
[32mESM[39m [1mdist/expo/testing.js [22m[32m112.00 B[39m
|
140
|
+
[32mESM[39m [1mdist/expo/crypto.js [22m[32m153.00 B[39m
|
141
|
+
[32mESM[39m [1mdist/expo/index.js.map [22m[32m10.17 KB[39m
|
142
|
+
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
143
|
+
[32mESM[39m [1mdist/expo/crypto.js.map [22m[32m189.00 B[39m
|
144
|
+
[32mESM[39m ⚡️ Build success in 31ms
|
145
|
+
[32mESM[39m [1mdist/react-native-core/crypto.js [22m[32m2.10 KB[39m
|
146
|
+
[32mESM[39m [1mdist/react-native-core/testing.js [22m[32m119.00 B[39m
|
147
|
+
[32mESM[39m [1mdist/react-native-core/index.js [22m[32m17.90 KB[39m
|
148
|
+
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
149
|
+
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
150
|
+
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m36.65 KB[39m
|
151
|
+
[32mESM[39m ⚡️ Build success in 34ms
|
145
152
|
[32mESM[39m [1mdist/react/testing.js [22m[32m122.00 B[39m
|
146
153
|
[32mESM[39m [1mdist/react/index.js [22m[32m24.59 KB[39m
|
147
154
|
[32mESM[39m [1mdist/react/testing.js.map [22m[32m165.00 B[39m
|
148
155
|
[32mESM[39m [1mdist/react/index.js.map [22m[32m52.82 KB[39m
|
149
|
-
[32mESM[39m ⚡️ Build success in
|
150
|
-
[32mESM[39m [1mdist/react-native-core/index.js [22m[32m17.90 KB[39m
|
151
|
-
[32mESM[39m [1mdist/react-native-core/testing.js [22m[32m119.00 B[39m
|
152
|
-
[32mESM[39m [1mdist/react-native-core/crypto.js [22m[32m2.10 KB[39m
|
153
|
-
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m36.65 KB[39m
|
154
|
-
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
155
|
-
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
156
|
-
[32mESM[39m ⚡️ Build success in 32ms
|
156
|
+
[32mESM[39m ⚡️ Build success in 40ms
|
157
157
|
[32mESM[39m [1mdist/prosemirror/index.js [22m[32m77.61 KB[39m
|
158
158
|
[32mESM[39m [1mdist/prosemirror/index.js.map [22m[32m306.96 KB[39m
|
159
|
-
[32mESM[39m ⚡️ Build success in
|
159
|
+
[32mESM[39m ⚡️ Build success in 48ms
|
160
160
|
[32mESM[39m [1mdist/inspector/index.js [22m[32m60.40 KB[39m
|
161
161
|
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m107.91 KB[39m
|
162
|
-
[32mESM[39m ⚡️ Build success in
|
163
|
-
[32mESM[39m [1mdist/testing.js [22m[32m6.97 KB[39m
|
162
|
+
[32mESM[39m ⚡️ Build success in 58ms
|
164
163
|
[32mESM[39m [1mdist/index.js [22m[32m25.96 KB[39m
|
164
|
+
[32mESM[39m [1mdist/testing.js [22m[32m6.97 KB[39m
|
165
165
|
[32mESM[39m [1mdist/chunk-33NYHM7D.js [22m[32m154.05 KB[39m
|
166
166
|
[32mESM[39m [1mdist/testing.js.map [22m[32m13.65 KB[39m
|
167
167
|
[32mESM[39m [1mdist/index.js.map [22m[32m52.62 KB[39m
|
168
168
|
[32mESM[39m [1mdist/chunk-33NYHM7D.js.map [22m[32m369.04 KB[39m
|
169
|
-
[32mESM[39m ⚡️ Build success in
|
169
|
+
[32mESM[39m ⚡️ Build success in 77ms
|
170
170
|
[32mESM[39m [1mdist/inspector/register-custom-element.js [22m[32m218.00 B[39m
|
171
171
|
[32mESM[39m [1mdist/inspector/register-custom-element.js.map [22m[32m314.00 B[39m
|
172
172
|
[32mESM[39m [1mdist/inspector/custom-element-I7L56H6B.js [22m[32m1.53 MB[39m
|
173
173
|
[32mESM[39m [1mdist/inspector/custom-element-I7L56H6B.js.map [22m[32m2.35 MB[39m
|
174
|
-
[32mESM[39m ⚡️ Build success in
|
174
|
+
[32mESM[39m ⚡️ Build success in 112ms
|
175
175
|
|
176
|
-
> jazz-tools@0.17.
|
176
|
+
> jazz-tools@0.17.10 types /home/runner/_work/jazz/jazz/packages/jazz-tools
|
177
177
|
> tsc --outDir dist
|
178
178
|
|
179
179
|
|
180
|
-
> jazz-tools@0.17.
|
180
|
+
> jazz-tools@0.17.10 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
|
181
181
|
> rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
|
182
182
|
|
183
183
|
src/svelte -> dist/svelte
|
package/CHANGELOG.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"quest.test.d.ts","sourceRoot":"","sources":["../../../../src/tools/tests/patterns/quest.test.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
@@ -140,7 +140,7 @@
|
|
140
140
|
},
|
141
141
|
"type": "module",
|
142
142
|
"license": "MIT",
|
143
|
-
"version": "0.17.
|
143
|
+
"version": "0.17.10",
|
144
144
|
"dependencies": {
|
145
145
|
"@manuscripts/prosemirror-recreate-steps": "^0.1.4",
|
146
146
|
"@scure/base": "1.2.1",
|
@@ -156,9 +156,9 @@
|
|
156
156
|
"prosemirror-state": "^1.4.3",
|
157
157
|
"prosemirror-transform": "^1.9.0",
|
158
158
|
"zod": "3.25.76",
|
159
|
-
"cojson": "0.17.
|
160
|
-
"cojson-storage-indexeddb": "0.17.
|
161
|
-
"cojson-transport-ws": "0.17.
|
159
|
+
"cojson": "0.17.10",
|
160
|
+
"cojson-storage-indexeddb": "0.17.10",
|
161
|
+
"cojson-transport-ws": "0.17.10"
|
162
162
|
},
|
163
163
|
"devDependencies": {
|
164
164
|
"@scure/bip39": "^1.3.0",
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { assert, beforeEach, describe, expect, test } from "vitest";
|
2
|
+
import { co, z } from "../../exports.js";
|
3
|
+
import { createJazzTestAccount, setupJazzTestSync } from "../../testing.js";
|
4
|
+
|
5
|
+
// Define the difficulty levels enum
|
6
|
+
const difficultyLevels = ["easy", "medium", "hard"] as const;
|
7
|
+
|
8
|
+
// Define the Quest schema with migration
|
9
|
+
const QuestSchema = co
|
10
|
+
.map({
|
11
|
+
title: z.string(),
|
12
|
+
description: z.string(),
|
13
|
+
imageUrl: z.string(),
|
14
|
+
twigs: z.number(),
|
15
|
+
difficulty: z.enum(difficultyLevels),
|
16
|
+
category: z.string(),
|
17
|
+
categories: z.array(z.string()),
|
18
|
+
completed: z.boolean(),
|
19
|
+
})
|
20
|
+
.withMigration((quest) => {
|
21
|
+
if (quest.categories === undefined) {
|
22
|
+
quest.categories = [quest.category];
|
23
|
+
}
|
24
|
+
});
|
25
|
+
|
26
|
+
beforeEach(async () => {
|
27
|
+
await setupJazzTestSync();
|
28
|
+
|
29
|
+
await createJazzTestAccount({
|
30
|
+
isCurrentActiveAccount: true,
|
31
|
+
creationProps: { name: "Quest Tester" },
|
32
|
+
});
|
33
|
+
});
|
34
|
+
|
35
|
+
describe("QuestSchema", () => {
|
36
|
+
test("should fill categories array with category when categories is undefined", async () => {
|
37
|
+
// Create a quest without categories
|
38
|
+
// @ts-expect-error - (simulating old data)
|
39
|
+
const quest = QuestSchema.create({
|
40
|
+
title: "Test Quest",
|
41
|
+
description: "A test quest description",
|
42
|
+
imageUrl: "https://example.com/image.jpg",
|
43
|
+
twigs: 100,
|
44
|
+
difficulty: "medium",
|
45
|
+
category: "adventure",
|
46
|
+
completed: false,
|
47
|
+
});
|
48
|
+
|
49
|
+
// Initially categories should be undefined
|
50
|
+
expect(quest.categories).toBeUndefined();
|
51
|
+
|
52
|
+
// Load the quest to trigger the migration
|
53
|
+
const loadedQuest = await QuestSchema.load(quest.id);
|
54
|
+
assert(loadedQuest);
|
55
|
+
|
56
|
+
// After loading, the migration should have run and filled categories
|
57
|
+
expect(loadedQuest.categories).toEqual(["adventure"]);
|
58
|
+
expect(loadedQuest.category).toEqual("adventure");
|
59
|
+
});
|
60
|
+
|
61
|
+
test("should preserve existing categories when they are already defined", async () => {
|
62
|
+
// Create a quest with categories already defined
|
63
|
+
const quest = QuestSchema.create({
|
64
|
+
title: "Test Quest",
|
65
|
+
description: "A test quest description",
|
66
|
+
imageUrl: "https://example.com/image.jpg",
|
67
|
+
twigs: 150,
|
68
|
+
difficulty: "hard",
|
69
|
+
category: "combat",
|
70
|
+
categories: ["combat", "boss-fight", "endgame"],
|
71
|
+
completed: false,
|
72
|
+
});
|
73
|
+
|
74
|
+
// Categories should be defined initially
|
75
|
+
expect(quest.categories).toEqual(["combat", "boss-fight", "endgame"]);
|
76
|
+
|
77
|
+
// Load the quest to ensure migration doesn't change existing categories
|
78
|
+
const loadedQuest = await QuestSchema.load(quest.id);
|
79
|
+
assert(loadedQuest);
|
80
|
+
|
81
|
+
// Categories should remain unchanged after migration
|
82
|
+
expect(loadedQuest.categories).toEqual(["combat", "boss-fight", "endgame"]);
|
83
|
+
expect(loadedQuest.category).toEqual("combat");
|
84
|
+
});
|
85
|
+
});
|