jazz-tools 0.15.0 → 0.15.2
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 +47 -47
- package/CHANGELOG.md +23 -0
- package/dist/{chunk-FSIM7N33.js → chunk-VBDJM6Z5.js} +142 -31
- package/dist/chunk-VBDJM6Z5.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/inspector/index.js +147 -102
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/viewer/co-plain-text-view.d.ts +5 -0
- package/dist/inspector/viewer/co-plain-text-view.d.ts.map +1 -0
- package/dist/inspector/viewer/new-app.d.ts.map +1 -1
- package/dist/inspector/viewer/page.d.ts.map +1 -1
- package/dist/inspector/viewer/type-icon.d.ts.map +1 -1
- package/dist/inspector/viewer/use-open-inspector.d.ts +2 -0
- package/dist/inspector/viewer/use-open-inspector.d.ts.map +1 -0
- package/dist/inspector/viewer/use-page-path.d.ts.map +1 -1
- package/dist/inspector/viewer/use-resolve-covalue.d.ts +1 -1
- package/dist/inspector/viewer/use-resolve-covalue.d.ts.map +1 -1
- package/dist/inspector/viewer/value-renderer.d.ts.map +1 -1
- package/dist/react-native-core/index.js +2 -18
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/react-native-core/media.d.ts.map +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/coValues/coFeed.d.ts +9 -0
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/coValues/coMap.d.ts +98 -2
- package/dist/tools/coValues/coMap.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +3 -0
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +12 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.d.ts +2 -1
- package/dist/tools/subscribe/CoValueCoreSubscription.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts +2 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/inspector/viewer/co-plain-text-view.tsx +17 -0
- package/src/inspector/viewer/new-app.tsx +2 -1
- package/src/inspector/viewer/page.tsx +5 -0
- package/src/inspector/viewer/type-icon.tsx +1 -0
- package/src/inspector/viewer/use-open-inspector.ts +18 -0
- package/src/inspector/viewer/use-page-path.ts +14 -1
- package/src/inspector/viewer/use-resolve-covalue.ts +1 -1
- package/src/inspector/viewer/value-renderer.tsx +4 -0
- package/src/react-native-core/media.tsx +2 -22
- package/src/tools/coValues/coFeed.ts +38 -0
- package/src/tools/coValues/coMap.ts +118 -14
- package/src/tools/coValues/interfaces.ts +14 -4
- package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +38 -0
- package/src/tools/implementation/zodSchema/zodCo.ts +6 -0
- package/src/tools/subscribe/CoValueCoreSubscription.ts +12 -9
- package/src/tools/subscribe/SubscriptionScope.ts +31 -19
- package/src/tools/tests/coFeed.test.ts +69 -0
- package/src/tools/tests/coMap.test.ts +480 -4
- package/src/tools/tests/load.test.ts +2 -1
- package/dist/chunk-FSIM7N33.js.map +0 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.15.
|
2
|
+
> jazz-tools@0.15.2 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"}
|
@@ -107,85 +107,85 @@
|
|
107
107
|
[34mESM[39m Build start
|
108
108
|
[34mCLI[39m Cleaning output folder
|
109
109
|
[34mESM[39m Build start
|
110
|
-
[32mESM[39m [1mdist/browser-media-images/index.js [22m[32m3.01 KB[39m
|
111
|
-
[32mESM[39m [1mdist/browser-media-images/index.js.map [22m[32m5.68 KB[39m
|
112
|
-
[32mESM[39m ⚡️ Build success in 24ms
|
113
110
|
[32mESM[39m [1mdist/worker/index.js [22m[32m2.34 KB[39m
|
114
111
|
[32mESM[39m [1mdist/worker/index.js.map [22m[32m4.82 KB[39m
|
115
|
-
[32mESM[39m ⚡️ Build success in
|
116
|
-
[32mESM[39m [1mdist/react-native-media-images/index.js [22m[32m6.19 KB[39m
|
117
|
-
[32mESM[39m [1mdist/react-native-media-images/index.js.map [22m[32m10.96 KB[39m
|
118
|
-
[32mESM[39m ⚡️ Build success in 19ms
|
112
|
+
[32mESM[39m ⚡️ Build success in 13ms
|
119
113
|
[32mESM[39m [1mdist/tiptap/index.js [22m[32m564.00 B[39m
|
120
114
|
[32mESM[39m [1mdist/tiptap/index.js.map [22m[32m1.21 KB[39m
|
121
|
-
[32mESM[39m ⚡️ Build success in
|
122
|
-
[32mESM[39m [1mdist/
|
123
|
-
[32mESM[39m [1mdist/
|
124
|
-
[32mESM[39m
|
125
|
-
[32mESM[39m [1mdist/react-native/index.js
|
126
|
-
[32mESM[39m [1mdist/react-native/
|
127
|
-
[32mESM[39m
|
128
|
-
[32mESM[39m ⚡️ Build success in 26ms
|
115
|
+
[32mESM[39m ⚡️ Build success in 14ms
|
116
|
+
[32mESM[39m [1mdist/browser-media-images/index.js [22m[32m3.01 KB[39m
|
117
|
+
[32mESM[39m [1mdist/browser-media-images/index.js.map [22m[32m5.68 KB[39m
|
118
|
+
[32mESM[39m ⚡️ Build success in 19ms
|
119
|
+
[32mESM[39m [1mdist/react-native-media-images/index.js [22m[32m6.19 KB[39m
|
120
|
+
[32mESM[39m [1mdist/react-native-media-images/index.js.map [22m[32m10.96 KB[39m
|
121
|
+
[32mESM[39m ⚡️ Build success in 16ms
|
129
122
|
[32mESM[39m [1mdist/react-core/index.js [22m[32m8.37 KB[39m
|
130
|
-
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
131
123
|
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js [22m[32m279.00 B[39m
|
132
|
-
[32mESM[39m [1mdist/react-core/testing.js
|
124
|
+
[32mESM[39m [1mdist/react-core/testing.js [22m[32m1.17 KB[39m
|
133
125
|
[32mESM[39m [1mdist/react-core/index.js.map [22m[32m16.39 KB[39m
|
134
126
|
[32mESM[39m [1mdist/react-core/chunk-7DYMJ74I.js.map [22m[32m533.00 B[39m
|
135
|
-
[32mESM[39m
|
127
|
+
[32mESM[39m [1mdist/react-core/testing.js.map [22m[32m1.82 KB[39m
|
128
|
+
[32mESM[39m ⚡️ Build success in 19ms
|
136
129
|
[32mESM[39m [1mdist/expo/index.js [22m[32m4.65 KB[39m
|
137
130
|
[32mESM[39m [1mdist/expo/testing.js [22m[32m112.00 B[39m
|
138
131
|
[32mESM[39m [1mdist/expo/crypto.js [22m[32m109.00 B[39m
|
139
132
|
[32mESM[39m [1mdist/expo/index.js.map [22m[32m10.17 KB[39m
|
140
|
-
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
141
133
|
[32mESM[39m [1mdist/expo/crypto.js.map [22m[32m166.00 B[39m
|
142
|
-
[32mESM[39m
|
134
|
+
[32mESM[39m [1mdist/expo/testing.js.map [22m[32m168.00 B[39m
|
135
|
+
[32mESM[39m ⚡️ Build success in 24ms
|
136
|
+
[32mESM[39m [1mdist/react-native/index.js [22m[32m2.53 KB[39m
|
137
|
+
[32mESM[39m [1mdist/react-native/crypto.js [22m[32m117.00 B[39m
|
138
|
+
[32mESM[39m [1mdist/react-native/testing.js [22m[32m120.00 B[39m
|
139
|
+
[32mESM[39m [1mdist/react-native/index.js.map [22m[32m5.68 KB[39m
|
140
|
+
[32mESM[39m [1mdist/react-native/crypto.js.map [22m[32m174.00 B[39m
|
141
|
+
[32mESM[39m [1mdist/react-native/testing.js.map [22m[32m176.00 B[39m
|
142
|
+
[32mESM[39m ⚡️ Build success in 22ms
|
143
143
|
[32mESM[39m [1mdist/browser/index.js [22m[32m13.36 KB[39m
|
144
144
|
[32mESM[39m [1mdist/browser/index.js.map [22m[32m28.57 KB[39m
|
145
|
-
[32mESM[39m ⚡️ Build success in
|
145
|
+
[32mESM[39m ⚡️ Build success in 26ms
|
146
|
+
[32mESM[39m [1mdist/react-native-core/index.js [22m[32m17.42 KB[39m
|
147
|
+
[32mESM[39m [1mdist/react-native-core/crypto.js [22m[32m2.10 KB[39m
|
148
|
+
[32mESM[39m [1mdist/react-native-core/testing.js [22m[32m119.00 B[39m
|
149
|
+
[32mESM[39m [1mdist/react-native-core/index.js.map [22m[32m34.49 KB[39m
|
150
|
+
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
151
|
+
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
152
|
+
[32mESM[39m ⚡️ Build success in 34ms
|
146
153
|
[32mESM[39m [1mdist/react/index.js [22m[32m20.64 KB[39m
|
147
|
-
[32mESM[39m [1mdist/react/testing.js [22m[32m107.00 B[39m
|
148
154
|
[32mESM[39m [1mdist/react/ssr.js [22m[32m688.00 B[39m
|
155
|
+
[32mESM[39m [1mdist/react/testing.js [22m[32m107.00 B[39m
|
149
156
|
[32mESM[39m [1mdist/react/index.js.map [22m[32m34.07 KB[39m
|
150
|
-
[32mESM[39m [1mdist/react/testing.js.map [22m[32m163.00 B[39m
|
151
157
|
[32mESM[39m [1mdist/react/ssr.js.map [22m[32m1.12 KB[39m
|
152
|
-
[32mESM[39m
|
153
|
-
[32mESM[39m
|
154
|
-
[32mESM[39m [1mdist/
|
155
|
-
[32mESM[39m [1mdist/
|
156
|
-
[32mESM[39m
|
157
|
-
[32mESM[39m [1mdist/react-native-core/testing.js.map [22m[32m175.00 B[39m
|
158
|
-
[32mESM[39m [1mdist/react-native-core/crypto.js.map [22m[32m4.25 KB[39m
|
159
|
-
[32mESM[39m ⚡️ Build success in 47ms
|
160
|
-
[32mESM[39m [1mdist/react/testing.js [22m[32m122.00 B[39m
|
158
|
+
[32mESM[39m [1mdist/react/testing.js.map [22m[32m163.00 B[39m
|
159
|
+
[32mESM[39m ⚡️ Build success in 35ms
|
160
|
+
[32mESM[39m [1mdist/prosemirror/index.js [22m[32m76.90 KB[39m
|
161
|
+
[32mESM[39m [1mdist/prosemirror/index.js.map [22m[32m305.53 KB[39m
|
162
|
+
[32mESM[39m ⚡️ Build success in 37ms
|
161
163
|
[32mESM[39m [1mdist/react/index.js [22m[32m20.66 KB[39m
|
164
|
+
[32mESM[39m [1mdist/react/testing.js [22m[32m122.00 B[39m
|
162
165
|
[32mESM[39m [1mdist/react/testing.js.map [22m[32m165.00 B[39m
|
163
166
|
[32mESM[39m [1mdist/react/index.js.map [22m[32m34.07 KB[39m
|
164
|
-
[32mESM[39m ⚡️ Build success in
|
165
|
-
[32mESM[39m [1mdist/
|
166
|
-
[32mESM[39m [1mdist/
|
167
|
-
[32mESM[39m ⚡️ Build success in
|
168
|
-
[32mESM[39m [1mdist/inspector/index.js [22m[32m58.92 KB[39m
|
169
|
-
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m105.21 KB[39m
|
170
|
-
[32mESM[39m ⚡️ Build success in 75ms
|
171
|
-
[32mESM[39m [1mdist/testing.js [22m[32m6.32 KB[39m
|
167
|
+
[32mESM[39m ⚡️ Build success in 36ms
|
168
|
+
[32mESM[39m [1mdist/inspector/index.js [22m[32m60.37 KB[39m
|
169
|
+
[32mESM[39m [1mdist/inspector/index.js.map [22m[32m107.85 KB[39m
|
170
|
+
[32mESM[39m ⚡️ Build success in 46ms
|
172
171
|
[32mESM[39m [1mdist/index.js [22m[32m16.19 KB[39m
|
173
|
-
[32mESM[39m [1mdist/
|
172
|
+
[32mESM[39m [1mdist/testing.js [22m[32m6.32 KB[39m
|
173
|
+
[32mESM[39m [1mdist/chunk-VBDJM6Z5.js [22m[32m140.80 KB[39m
|
174
174
|
[32mESM[39m [1mdist/testing.js.map [22m[32m12.22 KB[39m
|
175
175
|
[32mESM[39m [1mdist/index.js.map [22m[32m29.03 KB[39m
|
176
|
-
[32mESM[39m [1mdist/chunk-
|
177
|
-
[32mESM[39m ⚡️ Build success in
|
176
|
+
[32mESM[39m [1mdist/chunk-VBDJM6Z5.js.map [22m[32m320.73 KB[39m
|
177
|
+
[32mESM[39m ⚡️ Build success in 59ms
|
178
178
|
[32mESM[39m [1mdist/inspector/register-custom-element.js [22m[32m218.00 B[39m
|
179
179
|
[32mESM[39m [1mdist/inspector/register-custom-element.js.map [22m[32m314.00 B[39m
|
180
180
|
[32mESM[39m [1mdist/inspector/custom-element-CWW72LEG.js [22m[32m1.47 MB[39m
|
181
181
|
[32mESM[39m [1mdist/inspector/custom-element-CWW72LEG.js.map [22m[32m2.26 MB[39m
|
182
|
-
[32mESM[39m ⚡️ Build success in
|
182
|
+
[32mESM[39m ⚡️ Build success in 89ms
|
183
183
|
|
184
|
-
> jazz-tools@0.15.
|
184
|
+
> jazz-tools@0.15.2 types /home/runner/_work/jazz/jazz/packages/jazz-tools
|
185
185
|
> tsc --outDir dist
|
186
186
|
|
187
187
|
|
188
|
-
> jazz-tools@0.15.
|
188
|
+
> jazz-tools@0.15.2 build:svelte /home/runner/_work/jazz/jazz/packages/jazz-tools
|
189
189
|
> rm -rf dist/svelte && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json
|
190
190
|
|
191
191
|
src/svelte -> dist/svelte
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,28 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.15.2
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 0e7e532: inspector: improve CoPlainText view
|
8
|
+
- Updated dependencies [4b964ed]
|
9
|
+
- cojson@0.15.2
|
10
|
+
- cojson-storage@0.15.2
|
11
|
+
- cojson-storage-indexeddb@0.15.2
|
12
|
+
- cojson-transport-ws@0.15.2
|
13
|
+
|
14
|
+
## 0.15.1
|
15
|
+
|
16
|
+
### Patch Changes
|
17
|
+
|
18
|
+
- 0e3a4d2: Add FileStream.loadAsBase64 API
|
19
|
+
- b110f00: Added `CoMap.upsertUnique` & `CoMap.loadUnique` methods (deprecating `CoMap.findUnique`) and added `skipRetry` option to `CoMap.load`
|
20
|
+
- Updated dependencies [b110f00]
|
21
|
+
- cojson@0.15.1
|
22
|
+
- cojson-storage@0.15.1
|
23
|
+
- cojson-storage-indexeddb@0.15.1
|
24
|
+
- cojson-transport-ws@0.15.1
|
25
|
+
|
3
26
|
## 0.15.0
|
4
27
|
|
5
28
|
### Minor Changes
|
@@ -287,16 +287,7 @@ var _CoMap = class _CoMap extends CoValueBase {
|
|
287
287
|
**/
|
288
288
|
static create(init, options) {
|
289
289
|
const instance = new this();
|
290
|
-
|
291
|
-
const raw = instance.rawFromInit(init, owner, uniqueness);
|
292
|
-
Object.defineProperties(instance, {
|
293
|
-
id: {
|
294
|
-
value: raw.id,
|
295
|
-
enumerable: false
|
296
|
-
},
|
297
|
-
_raw: { value: raw, enumerable: false }
|
298
|
-
});
|
299
|
-
return instance;
|
290
|
+
return instance._createCoMap(init, options);
|
300
291
|
}
|
301
292
|
/**
|
302
293
|
* Return a JSON representation of the `CoMap`
|
@@ -339,6 +330,18 @@ var _CoMap = class _CoMap extends CoValueBase {
|
|
339
330
|
[inspect]() {
|
340
331
|
return this.toJSON();
|
341
332
|
}
|
333
|
+
_createCoMap(init, options) {
|
334
|
+
const { owner, uniqueness } = parseCoValueCreateOptions(options);
|
335
|
+
const raw = this.rawFromInit(init, owner, uniqueness);
|
336
|
+
Object.defineProperties(this, {
|
337
|
+
id: {
|
338
|
+
value: raw.id,
|
339
|
+
enumerable: false
|
340
|
+
},
|
341
|
+
_raw: { value: raw, enumerable: false }
|
342
|
+
});
|
343
|
+
return this;
|
344
|
+
}
|
342
345
|
/**
|
343
346
|
* Create a new `RawCoMap` from an initialization object
|
344
347
|
* @internal
|
@@ -427,7 +430,12 @@ var _CoMap = class _CoMap extends CoValueBase {
|
|
427
430
|
const { options, listener } = parseSubscribeRestArgs(args);
|
428
431
|
return subscribeToCoValueWithoutMe(this, id, options, listener);
|
429
432
|
}
|
433
|
+
/** @deprecated Use `CoMap.upsertUnique` and `CoMap.loadUnique` instead. */
|
430
434
|
static findUnique(unique, ownerID, as) {
|
435
|
+
return _CoMap._findUnique(unique, ownerID, as);
|
436
|
+
}
|
437
|
+
/** @internal */
|
438
|
+
static _findUnique(unique, ownerID, as) {
|
431
439
|
as ||= activeAccountContext.get();
|
432
440
|
const header = {
|
433
441
|
type: "comap",
|
@@ -441,6 +449,65 @@ var _CoMap = class _CoMap extends CoValueBase {
|
|
441
449
|
const crypto = as._type === "Anonymous" ? as.node.crypto : as._raw.core.node.crypto;
|
442
450
|
return cojsonInternals.idforHeader(header, crypto);
|
443
451
|
}
|
452
|
+
/**
|
453
|
+
* Given some data, updates an existing CoMap or initialises a new one if none exists.
|
454
|
+
*
|
455
|
+
* Note: This method respects resolve options, and thus can return `null` if the references cannot be resolved.
|
456
|
+
*
|
457
|
+
* @example
|
458
|
+
* ```ts
|
459
|
+
* const activeEvent = await Event.upsertUnique(
|
460
|
+
* sourceData.identifier,
|
461
|
+
* workspace.id,
|
462
|
+
* {
|
463
|
+
* title: sourceData.title,
|
464
|
+
* identifier: sourceData.identifier,
|
465
|
+
* external_id: sourceData._id,
|
466
|
+
* },
|
467
|
+
* workspace
|
468
|
+
* );
|
469
|
+
* ```
|
470
|
+
*
|
471
|
+
* @param options The options for creating or loading the CoMap. This includes the intended state of the CoMap, its unique identifier, its owner, and the references to resolve.
|
472
|
+
* @returns Either an existing & modified CoMap, or a new initialised CoMap if none exists.
|
473
|
+
* @category Subscription & Loading
|
474
|
+
*/
|
475
|
+
static async upsertUnique(options) {
|
476
|
+
let mapId = _CoMap._findUnique(options.unique, options.owner.id);
|
477
|
+
let map = await loadCoValueWithoutMe(this, mapId, {
|
478
|
+
...options,
|
479
|
+
loadAs: options.owner._loadedAs,
|
480
|
+
skipRetry: true
|
481
|
+
});
|
482
|
+
if (!map) {
|
483
|
+
const instance = new this();
|
484
|
+
map = instance._createCoMap(options.value, {
|
485
|
+
owner: options.owner,
|
486
|
+
unique: options.unique
|
487
|
+
});
|
488
|
+
} else {
|
489
|
+
map.applyDiff(options.value);
|
490
|
+
}
|
491
|
+
return await loadCoValueWithoutMe(this, mapId, {
|
492
|
+
...options,
|
493
|
+
loadAs: options.owner._loadedAs,
|
494
|
+
skipRetry: true
|
495
|
+
});
|
496
|
+
}
|
497
|
+
/**
|
498
|
+
* Loads a CoMap by its unique identifier and owner's ID.
|
499
|
+
* @param unique The unique identifier of the CoMap to load.
|
500
|
+
* @param ownerID The ID of the owner of the CoMap.
|
501
|
+
* @param options Additional options for loading the CoMap.
|
502
|
+
* @returns The loaded CoMap, or null if unavailable.
|
503
|
+
*/
|
504
|
+
static loadUnique(unique, ownerID, options) {
|
505
|
+
return loadCoValueWithoutMe(
|
506
|
+
this,
|
507
|
+
_CoMap._findUnique(unique, ownerID, options?.loadAs),
|
508
|
+
{ ...options, skipRetry: true }
|
509
|
+
);
|
510
|
+
}
|
444
511
|
/**
|
445
512
|
* Given an already loaded `CoMap`, ensure that the specified fields are loaded to the specified depth.
|
446
513
|
*
|
@@ -1448,6 +1515,25 @@ var FileStream = class extends CoValueBase {
|
|
1448
1515
|
allowUnfinished: options?.allowUnfinished
|
1449
1516
|
});
|
1450
1517
|
}
|
1518
|
+
static async loadAsBase64(id, options) {
|
1519
|
+
const stream = await this.load(id, options);
|
1520
|
+
return stream?.asBase64(options);
|
1521
|
+
}
|
1522
|
+
asBase64(options) {
|
1523
|
+
const chunks = this.getChunks(options);
|
1524
|
+
if (!chunks) return void 0;
|
1525
|
+
const output = [];
|
1526
|
+
for (const chunk of chunks.chunks) {
|
1527
|
+
for (const byte of chunk) {
|
1528
|
+
output.push(String.fromCharCode(byte));
|
1529
|
+
}
|
1530
|
+
}
|
1531
|
+
const base642 = btoa(output.join(""));
|
1532
|
+
if (options?.dataURL) {
|
1533
|
+
return `data:${chunks.mimeType};base64,${base642}`;
|
1534
|
+
}
|
1535
|
+
return base642;
|
1536
|
+
}
|
1451
1537
|
/**
|
1452
1538
|
* Create a `FileStream` from a `Blob` or `File`
|
1453
1539
|
*
|
@@ -2778,10 +2864,11 @@ function applyCoValueMigrations(instance) {
|
|
2778
2864
|
|
2779
2865
|
// src/tools/subscribe/CoValueCoreSubscription.ts
|
2780
2866
|
var CoValueCoreSubscription = class {
|
2781
|
-
constructor(node, id, listener) {
|
2867
|
+
constructor(node, id, listener, skipRetry) {
|
2782
2868
|
this.node = node;
|
2783
2869
|
this.id = id;
|
2784
2870
|
this.listener = listener;
|
2871
|
+
this.skipRetry = skipRetry;
|
2785
2872
|
this._unsubscribe = () => {
|
2786
2873
|
};
|
2787
2874
|
this.unsubscribed = false;
|
@@ -2789,13 +2876,13 @@ var CoValueCoreSubscription = class {
|
|
2789
2876
|
if (entry?.isAvailable()) {
|
2790
2877
|
this.subscribe(entry.getCurrentContent());
|
2791
2878
|
} else {
|
2792
|
-
this.node.loadCoValueCore(this.id).then((value) => {
|
2879
|
+
this.node.loadCoValueCore(this.id, void 0, skipRetry).then((value) => {
|
2793
2880
|
if (this.unsubscribed) return;
|
2794
2881
|
if (value.isAvailable()) {
|
2795
2882
|
this.subscribe(value.getCurrentContent());
|
2796
2883
|
} else {
|
2797
|
-
this.listener("unavailable");
|
2798
2884
|
this.subscribeToState();
|
2885
|
+
this.listener("unavailable");
|
2799
2886
|
}
|
2800
2887
|
});
|
2801
2888
|
}
|
@@ -2890,10 +2977,11 @@ function createCoValue(ref2, raw, subscriptionScope) {
|
|
2890
2977
|
|
2891
2978
|
// src/tools/subscribe/SubscriptionScope.ts
|
2892
2979
|
var SubscriptionScope = class _SubscriptionScope {
|
2893
|
-
constructor(node, resolve, id, schema) {
|
2980
|
+
constructor(node, resolve, id, schema, skipRetry) {
|
2894
2981
|
this.node = node;
|
2895
2982
|
this.id = id;
|
2896
2983
|
this.schema = schema;
|
2984
|
+
this.skipRetry = skipRetry;
|
2897
2985
|
this.childNodes = /* @__PURE__ */ new Map();
|
2898
2986
|
this.childValues = /* @__PURE__ */ new Map();
|
2899
2987
|
this.childErrors = /* @__PURE__ */ new Map();
|
@@ -2932,20 +3020,30 @@ var SubscriptionScope = class _SubscriptionScope {
|
|
2932
3020
|
this.resolve = resolve;
|
2933
3021
|
this.value = { type: "unloaded", id };
|
2934
3022
|
let lastUpdate;
|
2935
|
-
this.subscription = new CoValueCoreSubscription(
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
3023
|
+
this.subscription = new CoValueCoreSubscription(
|
3024
|
+
node,
|
3025
|
+
id,
|
3026
|
+
(value) => {
|
3027
|
+
lastUpdate = value;
|
3028
|
+
if (skipRetry && value === "unavailable") {
|
3029
|
+
this.handleUpdate(value);
|
3030
|
+
this.destroy();
|
2939
3031
|
return;
|
2940
3032
|
}
|
2941
|
-
this.
|
2942
|
-
|
2943
|
-
|
2944
|
-
|
2945
|
-
|
2946
|
-
|
2947
|
-
|
2948
|
-
|
3033
|
+
if (!this.migrated && value !== "unavailable") {
|
3034
|
+
if (this.migrating) {
|
3035
|
+
return;
|
3036
|
+
}
|
3037
|
+
this.migrating = true;
|
3038
|
+
applyCoValueMigrations(instantiateRefEncoded(this.schema, value));
|
3039
|
+
this.migrated = true;
|
3040
|
+
this.handleUpdate(lastUpdate);
|
3041
|
+
return;
|
3042
|
+
}
|
3043
|
+
this.handleUpdate(value);
|
3044
|
+
},
|
3045
|
+
skipRetry
|
3046
|
+
);
|
2949
3047
|
}
|
2950
3048
|
updateValue(value) {
|
2951
3049
|
this.value = value;
|
@@ -3554,6 +3652,12 @@ function enrichCoMapSchema(schema) {
|
|
3554
3652
|
findUnique: (...args) => {
|
3555
3653
|
return coSchema.findUnique(...args);
|
3556
3654
|
},
|
3655
|
+
upsertUnique: (...args) => {
|
3656
|
+
return coSchema.upsertUnique(...args);
|
3657
|
+
},
|
3658
|
+
loadUnique: (...args) => {
|
3659
|
+
return coSchema.loadUnique(...args);
|
3660
|
+
},
|
3557
3661
|
catchall: (index) => {
|
3558
3662
|
return enrichCoMapSchema(baseCatchall(index));
|
3559
3663
|
},
|
@@ -4603,6 +4707,7 @@ function loadCoValue(cls, id, options) {
|
|
4603
4707
|
resolve: options.resolve,
|
4604
4708
|
loadAs: options.loadAs,
|
4605
4709
|
syncResolution: true,
|
4710
|
+
skipRetry: options.skipRetry,
|
4606
4711
|
onUnavailable: () => {
|
4607
4712
|
resolve(null);
|
4608
4713
|
},
|
@@ -4670,10 +4775,16 @@ function subscribeToCoValue(cls, id, options, listener) {
|
|
4670
4775
|
const node = "node" in loadAs ? loadAs.node : loadAs._raw.core.node;
|
4671
4776
|
const resolve = options.resolve ?? true;
|
4672
4777
|
let unsubscribed = false;
|
4673
|
-
const rootNode = new SubscriptionScope(
|
4674
|
-
|
4675
|
-
|
4676
|
-
|
4778
|
+
const rootNode = new SubscriptionScope(
|
4779
|
+
node,
|
4780
|
+
resolve,
|
4781
|
+
id,
|
4782
|
+
{
|
4783
|
+
ref: cls,
|
4784
|
+
optional: false
|
4785
|
+
},
|
4786
|
+
options.skipRetry
|
4787
|
+
);
|
4677
4788
|
const handleUpdate = (value) => {
|
4678
4789
|
if (unsubscribed) return;
|
4679
4790
|
if (value.type === "unavailable") {
|
@@ -4824,4 +4935,4 @@ export {
|
|
4824
4935
|
JazzContextManager
|
4825
4936
|
};
|
4826
4937
|
/* istanbul ignore file -- @preserve */
|
4827
|
-
//# sourceMappingURL=chunk-
|
4938
|
+
//# sourceMappingURL=chunk-VBDJM6Z5.js.map
|