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.
@@ -1,5 +1,5 @@
1
1
 
2
- > jazz-tools@0.17.9 build /home/runner/_work/jazz/jazz/packages/jazz-tools
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
  CLI Building entry: {"index":"src/index.ts","testing":"src/testing.ts"}
@@ -102,13 +102,13 @@
102
102
  ESM Build start
103
103
  ESM dist/tiptap/index.js 564.00 B
104
104
  ESM dist/tiptap/index.js.map 1.21 KB
105
- ESM ⚡️ Build success in 11ms
105
+ ESM ⚡️ Build success in 20ms
106
106
  ESM dist/react/ssr.js 688.00 B
107
107
  ESM dist/react/ssr.js.map 1.12 KB
108
- ESM ⚡️ Build success in 13ms
108
+ ESM ⚡️ Build success in 23ms
109
109
  ESM dist/worker/index.js 2.31 KB
110
110
  ESM dist/worker/index.js.map 4.77 KB
111
- ESM ⚡️ Build success in 13ms
111
+ ESM ⚡️ Build success in 21ms
112
112
  ESM dist/media/index.js 236.00 B
113
113
  ESM dist/media/index.browser.js 3.21 KB
114
114
  ESM dist/media/index.native.js 3.53 KB
@@ -117,67 +117,67 @@
117
117
  ESM dist/media/index.browser.js.map 6.02 KB
118
118
  ESM dist/media/index.native.js.map 6.52 KB
119
119
  ESM dist/media/chunk-E5J3WLQW.js.map 15.95 KB
120
- ESM ⚡️ Build success in 24ms
121
- ESM dist/expo/index.js 4.65 KB
122
- ESM dist/expo/testing.js 112.00 B
123
- ESM dist/expo/crypto.js 153.00 B
124
- ESM dist/expo/index.js.map 10.17 KB
125
- ESM dist/expo/testing.js.map 168.00 B
126
- ESM dist/expo/crypto.js.map 189.00 B
127
- ESM ⚡️ Build success in 23ms
120
+ ESM ⚡️ Build success in 28ms
121
+ ESM dist/browser/index.js 13.43 KB
122
+ ESM dist/browser/index.js.map 28.65 KB
123
+ ESM ⚡️ Build success in 31ms
124
+ ESM dist/react-native/index.js 2.53 KB
125
+ ESM dist/react-native/testing.js 120.00 B
126
+ ESM dist/react-native/crypto.js 161.00 B
127
+ ESM dist/react-native/index.js.map 5.68 KB
128
+ ESM dist/react-native/testing.js.map 176.00 B
129
+ ESM dist/react-native/crypto.js.map 197.00 B
130
+ ESM ⚡️ Build success in 28ms
128
131
  ESM dist/react-core/index.js 8.41 KB
129
132
  ESM dist/react-core/testing.js 1.17 KB
130
133
  ESM dist/react-core/chunk-7DYMJ74I.js 279.00 B
131
134
  ESM dist/react-core/index.js.map 20.68 KB
132
135
  ESM dist/react-core/testing.js.map 1.82 KB
133
136
  ESM dist/react-core/chunk-7DYMJ74I.js.map 533.00 B
134
- ESM ⚡️ Build success in 21ms
135
- ESM dist/react-native/index.js 2.53 KB
136
- ESM dist/react-native/crypto.js 161.00 B
137
- ESM dist/react-native/testing.js 120.00 B
138
- ESM dist/react-native/index.js.map 5.68 KB
139
- ESM dist/react-native/crypto.js.map 197.00 B
140
- ESM dist/react-native/testing.js.map 176.00 B
141
- ESM ⚡️ Build success in 21ms
142
- ESM dist/browser/index.js 13.43 KB
143
- ESM dist/browser/index.js.map 28.65 KB
144
- ESM ⚡️ Build success in 35ms
137
+ ESM ⚡️ Build success in 28ms
138
+ ESM dist/expo/index.js 4.65 KB
139
+ ESM dist/expo/testing.js 112.00 B
140
+ ESM dist/expo/crypto.js 153.00 B
141
+ ESM dist/expo/index.js.map 10.17 KB
142
+ ESM dist/expo/testing.js.map 168.00 B
143
+ ESM dist/expo/crypto.js.map 189.00 B
144
+ ESM ⚡️ Build success in 31ms
145
+ ESM dist/react-native-core/crypto.js 2.10 KB
146
+ ESM dist/react-native-core/testing.js 119.00 B
147
+ ESM dist/react-native-core/index.js 17.90 KB
148
+ ESM dist/react-native-core/crypto.js.map 4.25 KB
149
+ ESM dist/react-native-core/testing.js.map 175.00 B
150
+ ESM dist/react-native-core/index.js.map 36.65 KB
151
+ ESM ⚡️ Build success in 34ms
145
152
  ESM dist/react/testing.js 122.00 B
146
153
  ESM dist/react/index.js 24.59 KB
147
154
  ESM dist/react/testing.js.map 165.00 B
148
155
  ESM dist/react/index.js.map 52.82 KB
149
- ESM ⚡️ Build success in 32ms
150
- ESM dist/react-native-core/index.js 17.90 KB
151
- ESM dist/react-native-core/testing.js 119.00 B
152
- ESM dist/react-native-core/crypto.js 2.10 KB
153
- ESM dist/react-native-core/index.js.map 36.65 KB
154
- ESM dist/react-native-core/testing.js.map 175.00 B
155
- ESM dist/react-native-core/crypto.js.map 4.25 KB
156
- ESM ⚡️ Build success in 32ms
156
+ ESM ⚡️ Build success in 40ms
157
157
  ESM dist/prosemirror/index.js 77.61 KB
158
158
  ESM dist/prosemirror/index.js.map 306.96 KB
159
- ESM ⚡️ Build success in 42ms
159
+ ESM ⚡️ Build success in 48ms
160
160
  ESM dist/inspector/index.js 60.40 KB
161
161
  ESM dist/inspector/index.js.map 107.91 KB
162
- ESM ⚡️ Build success in 48ms
163
- ESM dist/testing.js 6.97 KB
162
+ ESM ⚡️ Build success in 58ms
164
163
  ESM dist/index.js 25.96 KB
164
+ ESM dist/testing.js 6.97 KB
165
165
  ESM dist/chunk-33NYHM7D.js 154.05 KB
166
166
  ESM dist/testing.js.map 13.65 KB
167
167
  ESM dist/index.js.map 52.62 KB
168
168
  ESM dist/chunk-33NYHM7D.js.map 369.04 KB
169
- ESM ⚡️ Build success in 59ms
169
+ ESM ⚡️ Build success in 77ms
170
170
  ESM dist/inspector/register-custom-element.js 218.00 B
171
171
  ESM dist/inspector/register-custom-element.js.map 314.00 B
172
172
  ESM dist/inspector/custom-element-I7L56H6B.js 1.53 MB
173
173
  ESM dist/inspector/custom-element-I7L56H6B.js.map 2.35 MB
174
- ESM ⚡️ Build success in 104ms
174
+ ESM ⚡️ Build success in 112ms
175
175
 
176
- > jazz-tools@0.17.9 types /home/runner/_work/jazz/jazz/packages/jazz-tools
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.9 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
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
@@ -1,5 +1,14 @@
1
1
  # jazz-tools
2
2
 
3
+ ## 0.17.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [c55297c]
8
+ - cojson@0.17.10
9
+ - cojson-storage-indexeddb@0.17.10
10
+ - cojson-transport-ws@0.17.10
11
+
3
12
  ## 0.17.9
4
13
 
5
14
  ### Patch Changes
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=quest.test.d.ts.map
@@ -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.9",
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.9",
160
- "cojson-storage-indexeddb": "0.17.9",
161
- "cojson-transport-ws": "0.17.9"
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
+ });