jazz-tools 0.17.14 → 0.18.0
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/.svelte-kit/__package__/jazz.class.svelte.js +1 -1
- package/.svelte-kit/__package__/media/image.svelte +3 -9
- package/.svelte-kit/__package__/media/image.svelte.d.ts +1 -6
- package/.svelte-kit/__package__/media/image.svelte.d.ts.map +1 -1
- package/.svelte-kit/__package__/media/image.types.d.ts +7 -0
- package/.svelte-kit/__package__/media/image.types.d.ts.map +1 -0
- package/.svelte-kit/__package__/media/image.types.js +1 -0
- package/.svelte-kit/__package__/tests/media/image.svelte.test.js +31 -31
- package/.turbo/turbo-build.log +50 -50
- package/CHANGELOG.md +31 -0
- package/dist/browser/index.js +2 -2
- package/dist/browser/index.js.map +1 -1
- package/dist/{chunk-LZOF6WP5.js → chunk-HJ3GTGY7.js} +1320 -1018
- package/dist/chunk-HJ3GTGY7.js.map +1 -0
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/inspector/{custom-element-ZSNTCECD.js → custom-element-WCY6D3QJ.js} +3 -3
- package/dist/inspector/{custom-element-ZSNTCECD.js.map → custom-element-WCY6D3QJ.js.map} +1 -1
- package/dist/inspector/index.js +1 -1
- package/dist/inspector/index.js.map +1 -1
- package/dist/inspector/register-custom-element.js +1 -1
- package/dist/media/{chunk-E5J3WLQW.js → chunk-KR2V6X2N.js} +14 -9
- package/dist/media/chunk-KR2V6X2N.js.map +1 -0
- package/dist/media/create-image.d.ts +6 -6
- package/dist/media/index.browser.d.ts +6 -6
- package/dist/media/index.browser.js +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.native.d.ts +6 -6
- package/dist/media/index.native.js +1 -1
- package/dist/media/utils.d.ts.map +1 -1
- package/dist/prosemirror/index.js +2 -2
- package/dist/prosemirror/index.js.map +1 -1
- package/dist/react/index.js +7 -5
- package/dist/react/index.js.map +1 -1
- package/dist/react-core/hooks.d.ts.map +1 -1
- package/dist/react-core/index.js +4658 -23
- package/dist/react-core/index.js.map +1 -1
- package/dist/react-native-core/index.js +1 -1
- package/dist/react-native-core/index.js.map +1 -1
- package/dist/svelte/jazz.class.svelte.js +1 -1
- package/dist/svelte/media/image.svelte +3 -9
- package/dist/svelte/media/image.svelte.d.ts +1 -6
- package/dist/svelte/media/image.svelte.d.ts.map +1 -1
- package/dist/svelte/media/image.types.d.ts +7 -0
- package/dist/svelte/media/image.types.d.ts.map +1 -0
- package/dist/svelte/media/image.types.js +1 -0
- package/dist/svelte/tests/media/image.svelte.test.js +31 -31
- package/dist/testing.js +18 -14
- package/dist/testing.js.map +1 -1
- package/dist/tools/coValues/CoFieldInit.d.ts +13 -0
- package/dist/tools/coValues/CoFieldInit.d.ts.map +1 -0
- package/dist/tools/coValues/CoValueBase.d.ts +18 -15
- package/dist/tools/coValues/CoValueBase.d.ts.map +1 -1
- package/dist/tools/coValues/account.d.ts +100 -46
- package/dist/tools/coValues/account.d.ts.map +1 -1
- package/dist/tools/coValues/coFeed.d.ts +78 -62
- package/dist/tools/coValues/coFeed.d.ts.map +1 -1
- package/dist/tools/coValues/coList.d.ts +212 -99
- package/dist/tools/coValues/coList.d.ts.map +1 -1
- package/dist/tools/coValues/coMap.d.ts +200 -192
- package/dist/tools/coValues/coMap.d.ts.map +1 -1
- package/dist/tools/coValues/coPlainText.d.ts +30 -22
- package/dist/tools/coValues/coPlainText.d.ts.map +1 -1
- package/dist/tools/coValues/deepLoading.d.ts +13 -13
- package/dist/tools/coValues/deepLoading.d.ts.map +1 -1
- package/dist/tools/coValues/extensions/imageDef.d.ts +1 -1
- package/dist/tools/coValues/group.d.ts +32 -32
- package/dist/tools/coValues/group.d.ts.map +1 -1
- package/dist/tools/coValues/inbox.d.ts.map +1 -1
- package/dist/tools/coValues/interfaces.d.ts +18 -17
- package/dist/tools/coValues/interfaces.d.ts.map +1 -1
- package/dist/tools/coValues/profile.d.ts +6 -5
- package/dist/tools/coValues/profile.d.ts.map +1 -1
- package/dist/tools/coValues/schemaUnion.d.ts +3 -3
- package/dist/tools/coValues/schemaUnion.d.ts.map +1 -1
- package/dist/tools/exports.d.ts +1 -1
- package/dist/tools/exports.d.ts.map +1 -1
- package/dist/tools/implementation/anonymousJazzAgent.d.ts +2 -1
- package/dist/tools/implementation/anonymousJazzAgent.d.ts.map +1 -1
- package/dist/tools/implementation/schema.d.ts +5 -5
- package/dist/tools/implementation/schema.d.ts.map +1 -1
- package/dist/tools/implementation/symbols.d.ts +2 -0
- package/dist/tools/implementation/symbols.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts +2 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/AccountSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts +6 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts +8 -3
- package/dist/tools/implementation/zodSchema/schemaTypes/CoListSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts +12 -7
- package/dist/tools/implementation/zodSchema/schemaTypes/CoMapSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts +13 -7
- package/dist/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts +11 -2
- package/dist/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts +4 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts +4 -0
- package/dist/tools/implementation/zodSchema/schemaTypes/RichTextSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/{CoFieldInit.d.ts → CoFieldSchemaInit.d.ts} +7 -7
- package/dist/tools/implementation/zodSchema/typeConverters/CoFieldSchemaInit.d.ts.map +1 -0
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts +4 -4
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts +4 -4
- package/dist/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.d.ts.map +1 -1
- package/dist/tools/implementation/zodSchema/zodCo.d.ts +2 -2
- package/dist/tools/implementation/zodSchema/zodCo.d.ts.map +1 -1
- package/dist/tools/internal.d.ts +2 -1
- package/dist/tools/internal.d.ts.map +1 -1
- package/dist/tools/lib/migration.d.ts +1 -1
- package/dist/tools/lib/migration.d.ts.map +1 -1
- package/dist/tools/subscribe/SubscriptionScope.d.ts.map +1 -1
- package/dist/tools/subscribe/index.d.ts +1 -1
- package/dist/tools/subscribe/index.d.ts.map +1 -1
- package/dist/tools/subscribe/utils.d.ts +2 -2
- package/dist/tools/subscribe/utils.d.ts.map +1 -1
- package/dist/tools/testing.d.ts.map +1 -1
- package/dist/tools/tests/utils.d.ts +2 -6
- package/dist/tools/tests/utils.d.ts.map +1 -1
- package/dist/worker/index.js +3 -3
- package/dist/worker/index.js.map +1 -1
- package/package.json +4 -4
- package/src/browser/auth/PasskeyAuth.ts +2 -2
- package/src/browser/createBrowserContext.ts +2 -2
- package/src/browser/tests/PasskeyAuth.test.ts +2 -2
- package/src/inspector/custom-element.tsx +2 -2
- package/src/inspector/viewer/new-app.tsx +1 -1
- package/src/media/create-image.test.ts +7 -7
- package/src/media/create-image.ts +5 -3
- package/src/media/index.ts +1 -1
- package/src/media/utils.test.ts +72 -66
- package/src/media/utils.ts +9 -6
- package/src/prosemirror/lib/plugin.ts +1 -1
- package/src/prosemirror/lib/sync.ts +1 -1
- package/src/prosemirror/tests/plugin.test.ts +4 -4
- package/src/react/media/image.tsx +2 -2
- package/src/react/tests/media/image.test.tsx +52 -32
- package/src/react-core/hooks.ts +11 -5
- package/src/react-core/tests/useAccount.test.ts +16 -22
- package/src/react-core/tests/useCoState.test.ts +19 -19
- package/src/react-core/tests/useInboxSender.test.ts +5 -2
- package/src/react-core/tests/usePassPhraseAuth.test.ts +6 -6
- package/src/react-native-core/media/image.tsx +1 -1
- package/src/svelte/jazz.class.svelte.ts +1 -1
- package/src/svelte/media/image.svelte +3 -9
- package/src/svelte/media/image.types.ts +7 -0
- package/src/svelte/tests/media/image.svelte.test.ts +34 -32
- package/src/tools/auth/DemoAuth.ts +2 -2
- package/src/tools/auth/PassphraseAuth.ts +2 -2
- package/src/tools/auth/clerk/index.ts +2 -2
- package/src/tools/auth/clerk/tests/JazzClerkAuth.test.ts +1 -1
- package/src/tools/coValues/CoFieldInit.ts +20 -0
- package/src/tools/coValues/CoValueBase.ts +40 -60
- package/src/tools/coValues/account.ts +306 -232
- package/src/tools/coValues/coFeed.ts +185 -153
- package/src/tools/coValues/coList.ts +507 -334
- package/src/tools/coValues/coMap.ts +420 -286
- package/src/tools/coValues/coPlainText.ts +94 -110
- package/src/tools/coValues/deepLoading.ts +13 -13
- package/src/tools/coValues/group.ts +100 -114
- package/src/tools/coValues/inbox.ts +16 -14
- package/src/tools/coValues/interfaces.ts +49 -31
- package/src/tools/coValues/profile.ts +8 -6
- package/src/tools/coValues/request.ts +9 -9
- package/src/tools/coValues/schemaUnion.ts +11 -5
- package/src/tools/exports.ts +1 -1
- package/src/tools/implementation/ContextManager.ts +4 -4
- package/src/tools/implementation/anonymousJazzAgent.ts +2 -1
- package/src/tools/implementation/createContext.ts +1 -1
- package/src/tools/implementation/devtoolsFormatters.ts +9 -9
- package/src/tools/implementation/invites.ts +2 -2
- package/src/tools/implementation/schema.ts +7 -7
- package/src/tools/implementation/symbols.ts +3 -0
- package/src/tools/implementation/zodSchema/schemaTypes/AccountSchema.ts +2 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoFeedSchema.ts +11 -2
- package/src/tools/implementation/zodSchema/schemaTypes/CoListSchema.ts +18 -7
- package/src/tools/implementation/zodSchema/schemaTypes/CoMapSchema.ts +17 -7
- package/src/tools/implementation/zodSchema/schemaTypes/CoRecordSchema.ts +20 -11
- package/src/tools/implementation/zodSchema/schemaTypes/FileStreamSchema.ts +19 -2
- package/src/tools/implementation/zodSchema/schemaTypes/PlainTextSchema.ts +6 -0
- package/src/tools/implementation/zodSchema/schemaTypes/RichTextSchema.ts +6 -0
- package/src/tools/implementation/zodSchema/typeConverters/{CoFieldInit.ts → CoFieldSchemaInit.ts} +11 -11
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchema.ts +4 -4
- package/src/tools/implementation/zodSchema/typeConverters/InstanceOfSchemaCoValuesNullable.ts +4 -4
- package/src/tools/implementation/zodSchema/zodCo.ts +2 -2
- package/src/tools/internal.ts +2 -1
- package/src/tools/lib/migration.ts +5 -5
- package/src/tools/subscribe/SubscriptionScope.ts +32 -24
- package/src/tools/subscribe/index.ts +4 -4
- package/src/tools/subscribe/utils.ts +11 -11
- package/src/tools/testing.ts +17 -13
- package/src/tools/tests/ContextManager.test.ts +68 -57
- package/src/tools/tests/PassphraseAuth.test.ts +2 -2
- package/src/tools/tests/account.test.ts +139 -69
- package/src/tools/tests/coDiscriminatedUnion.test-d.ts +12 -6
- package/src/tools/tests/coDiscriminatedUnion.test.ts +26 -17
- package/src/tools/tests/coFeed.test-d.ts +18 -17
- package/src/tools/tests/coFeed.test.ts +108 -97
- package/src/tools/tests/coList.test-d.ts +18 -23
- package/src/tools/tests/coList.test.ts +350 -165
- package/src/tools/tests/coMap.record.test-d.ts +9 -13
- package/src/tools/tests/coMap.record.test.ts +37 -23
- package/src/tools/tests/coMap.test-d.ts +43 -21
- package/src/tools/tests/coMap.test.ts +360 -182
- package/src/tools/tests/coOptional.test.ts +28 -13
- package/src/tools/tests/coPlainText.test.ts +15 -15
- package/src/tools/tests/createContext.test.ts +14 -14
- package/src/tools/tests/deepLoading.test.ts +95 -94
- package/src/tools/tests/exportImport.test.ts +61 -41
- package/src/tools/tests/groupsAndAccounts.test.ts +333 -116
- package/src/tools/tests/inbox.test.ts +22 -17
- package/src/tools/tests/interfaces.test.ts +12 -11
- package/src/tools/tests/invites.test.ts +6 -4
- package/src/tools/tests/load.test.ts +20 -18
- package/src/tools/tests/patterns/notifications.test.ts +6 -6
- package/src/tools/tests/patterns/quest.test.ts +3 -3
- package/src/tools/tests/patterns/requestToJoin.test.ts +22 -22
- package/src/tools/tests/request.test.ts +38 -39
- package/src/tools/tests/schemaUnion.test.ts +64 -10
- package/src/tools/tests/subscribe.test.ts +64 -64
- package/src/tools/tests/testing.test.ts +5 -9
- package/src/tools/tests/utils.ts +3 -3
- package/src/tools/tests/zod.test.ts +3 -3
- package/src/worker/index.ts +3 -3
- package/dist/chunk-LZOF6WP5.js.map +0 -1
- package/dist/media/chunk-E5J3WLQW.js.map +0 -1
- package/dist/tools/implementation/zodSchema/typeConverters/CoFieldInit.d.ts.map +0 -1
@@ -10,10 +10,12 @@ import type {
|
|
10
10
|
SessionID,
|
11
11
|
} from "cojson";
|
12
12
|
import { cojsonInternals } from "cojson";
|
13
|
-
import
|
13
|
+
import {
|
14
14
|
AnonymousJazzAgent,
|
15
|
+
CoFieldInit,
|
15
16
|
CoValue,
|
16
17
|
CoValueClass,
|
18
|
+
getCoValueOwner,
|
17
19
|
Group,
|
18
20
|
ID,
|
19
21
|
RefsToResolve,
|
@@ -23,10 +25,12 @@ import type {
|
|
23
25
|
SchemaFor,
|
24
26
|
SubscribeListenerOptions,
|
25
27
|
SubscribeRestArgs,
|
28
|
+
TypeSym,
|
26
29
|
} from "../internal.js";
|
27
30
|
import {
|
28
31
|
Account,
|
29
32
|
CoValueBase,
|
33
|
+
CoValueJazzApi,
|
30
34
|
ItemsSym,
|
31
35
|
Ref,
|
32
36
|
SchemaInit,
|
@@ -81,6 +85,8 @@ export { CoFeed as CoStream };
|
|
81
85
|
* @category CoValues
|
82
86
|
*/
|
83
87
|
export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
88
|
+
declare $jazz: CoFeedJazzApi<this>;
|
89
|
+
|
84
90
|
/**
|
85
91
|
* Declare a `CoFeed` by subclassing `CoFeed.Of(...)` and passing the item schema using a `co` primitive or a `coField.ref`.
|
86
92
|
*
|
@@ -103,36 +109,25 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
103
109
|
return cls;
|
104
110
|
}
|
105
111
|
|
106
|
-
/**
|
107
|
-
* The ID of this `CoFeed`
|
108
|
-
* @category Content */
|
109
|
-
declare id: ID<this>;
|
110
112
|
/** @category Type Helpers */
|
111
|
-
declare
|
113
|
+
declare [TypeSym]: "CoStream";
|
112
114
|
static {
|
113
|
-
this.prototype
|
115
|
+
this.prototype[TypeSym] = "CoStream";
|
114
116
|
}
|
115
|
-
/** @category Internals */
|
116
|
-
declare _raw: RawCoStream;
|
117
117
|
|
118
118
|
/** @internal This is only a marker type and doesn't exist at runtime */
|
119
119
|
[ItemsSym]!: Item;
|
120
120
|
/** @internal */
|
121
121
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
122
122
|
static _schema: any;
|
123
|
-
|
124
|
-
get _schema(): {
|
125
|
-
[ItemsSym]: SchemaFor<Item> | any;
|
126
|
-
} {
|
127
|
-
return (this.constructor as typeof CoFeed)._schema;
|
128
|
-
}
|
123
|
+
|
129
124
|
/**
|
130
125
|
* The current account's view of this `CoFeed`
|
131
126
|
* @category Content
|
132
127
|
*/
|
133
128
|
get byMe(): CoFeedEntry<Item> | undefined {
|
134
|
-
if (this.
|
135
|
-
return this.perAccount[this.
|
129
|
+
if (this.$jazz.loadedAs[TypeSym] === "Account") {
|
130
|
+
return this.perAccount[this.$jazz.loadedAs.$jazz.id];
|
136
131
|
} else {
|
137
132
|
return undefined;
|
138
133
|
}
|
@@ -187,29 +182,23 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
187
182
|
* @category Content
|
188
183
|
*/
|
189
184
|
get inCurrentSession(): CoFeedEntry<Item> | undefined {
|
190
|
-
if (this.
|
191
|
-
return this.perSession[this.
|
185
|
+
if (this.$jazz.loadedAs[TypeSym] === "Account") {
|
186
|
+
return this.perSession[this.$jazz.loadedAs.$jazz.sessionID!];
|
192
187
|
} else {
|
193
188
|
return undefined;
|
194
189
|
}
|
195
190
|
}
|
196
191
|
|
197
|
-
|
198
|
-
|
199
|
-
| { init: Item[]; owner: Account | Group }
|
200
|
-
| { fromRaw: RawCoStream },
|
201
|
-
) {
|
192
|
+
/** @internal */
|
193
|
+
constructor(options: { fromRaw: RawCoStream }) {
|
202
194
|
super();
|
203
195
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
_raw: { value: options.fromRaw, enumerable: false },
|
211
|
-
});
|
212
|
-
}
|
196
|
+
Object.defineProperties(this, {
|
197
|
+
$jazz: {
|
198
|
+
value: new CoFeedJazzApi(this, options.fromRaw),
|
199
|
+
enumerable: false,
|
200
|
+
},
|
201
|
+
});
|
213
202
|
|
214
203
|
return this;
|
215
204
|
}
|
@@ -217,6 +206,7 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
217
206
|
/**
|
218
207
|
* Create a new `CoFeed`
|
219
208
|
* @category Creation
|
209
|
+
* @deprecated Use `co.feed(...).create` instead.
|
220
210
|
*/
|
221
211
|
static create<S extends CoFeed>(
|
222
212
|
this: CoValueClass<S>,
|
@@ -224,95 +214,32 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
224
214
|
options?: { owner: Account | Group } | Account | Group,
|
225
215
|
) {
|
226
216
|
const { owner } = parseCoValueCreateOptions(options);
|
227
|
-
const
|
228
|
-
const
|
229
|
-
|
230
|
-
Object.defineProperties(instance, {
|
231
|
-
id: {
|
232
|
-
value: raw.id,
|
233
|
-
enumerable: false,
|
234
|
-
},
|
235
|
-
_raw: { value: raw, enumerable: false },
|
236
|
-
});
|
217
|
+
const raw = owner.$jazz.raw.createStream();
|
218
|
+
const instance = new this({ fromRaw: raw });
|
237
219
|
|
238
220
|
if (init) {
|
239
|
-
instance.push(...init);
|
221
|
+
instance.$jazz.push(...init);
|
240
222
|
}
|
241
223
|
return instance;
|
242
224
|
}
|
243
225
|
|
244
|
-
getItemsDescriptor() {
|
245
|
-
return this._schema?.[ItemsSym];
|
246
|
-
}
|
247
|
-
|
248
|
-
/**
|
249
|
-
* Push items to this `CoFeed`
|
250
|
-
*
|
251
|
-
* Items are appended to the current session's log. Each session (tab, device, app instance)
|
252
|
-
* maintains its own append-only log, which is then aggregated into the per-account view.
|
253
|
-
*
|
254
|
-
* @example
|
255
|
-
* ```ts
|
256
|
-
* // Adds items to current session's log
|
257
|
-
* feed.push("item1", "item2");
|
258
|
-
*
|
259
|
-
* // View items from current session
|
260
|
-
* console.log(feed.inCurrentSession);
|
261
|
-
*
|
262
|
-
* // View aggregated items from all sessions for current account
|
263
|
-
* console.log(feed.byMe);
|
264
|
-
* ```
|
265
|
-
*
|
266
|
-
* @category Content
|
267
|
-
*/
|
268
|
-
push(...items: Item[]) {
|
269
|
-
for (const item of items) {
|
270
|
-
this.pushItem(item);
|
271
|
-
}
|
272
|
-
}
|
273
|
-
|
274
|
-
private pushItem(item: Item) {
|
275
|
-
const itemDescriptor = this._schema[ItemsSym] as Schema;
|
276
|
-
|
277
|
-
if (itemDescriptor === "json") {
|
278
|
-
this._raw.push(item as JsonValue);
|
279
|
-
} else if ("encoded" in itemDescriptor) {
|
280
|
-
this._raw.push(itemDescriptor.encoded.encode(item));
|
281
|
-
} else if (isRefEncoded(itemDescriptor)) {
|
282
|
-
let refId = (item as unknown as CoValue).id;
|
283
|
-
if (!refId) {
|
284
|
-
const coValue = instantiateRefEncodedWithInit(
|
285
|
-
itemDescriptor,
|
286
|
-
item,
|
287
|
-
this._owner,
|
288
|
-
);
|
289
|
-
refId = coValue.id;
|
290
|
-
}
|
291
|
-
this._raw.push(refId);
|
292
|
-
}
|
293
|
-
}
|
294
|
-
|
295
226
|
/**
|
296
227
|
* Get a JSON representation of the `CoFeed`
|
297
228
|
* @category
|
298
229
|
*/
|
299
230
|
toJSON(): {
|
300
|
-
id: string;
|
301
|
-
_type: "CoStream";
|
302
231
|
[key: string]: unknown;
|
303
232
|
in: { [key: string]: unknown };
|
304
233
|
} {
|
305
|
-
const itemDescriptor = this.
|
234
|
+
const itemDescriptor = this.$jazz.schema[ItemsSym] as Schema;
|
306
235
|
const mapper =
|
307
236
|
itemDescriptor === "json"
|
308
237
|
? (v: unknown) => v
|
309
238
|
: "encoded" in itemDescriptor
|
310
239
|
? itemDescriptor.encoded.encode
|
311
|
-
: (v: unknown) => v && (v as CoValue).id;
|
240
|
+
: (v: unknown) => v && (v as CoValue).$jazz.id;
|
312
241
|
|
313
242
|
return {
|
314
|
-
id: this.id,
|
315
|
-
_type: this._type,
|
316
243
|
...Object.fromEntries(
|
317
244
|
Object.entries(this).map(([account, entry]) => [
|
318
245
|
account,
|
@@ -330,8 +257,6 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
330
257
|
|
331
258
|
/** @internal */
|
332
259
|
[inspect](): {
|
333
|
-
id: string;
|
334
|
-
_type: "CoStream";
|
335
260
|
[key: string]: unknown;
|
336
261
|
in: { [key: string]: unknown };
|
337
262
|
} {
|
@@ -342,7 +267,7 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
342
267
|
static schema<V extends CoFeed>(
|
343
268
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
344
269
|
this: { new (...args: any): V } & typeof CoFeed,
|
345
|
-
def: { [ItemsSym]: V["
|
270
|
+
def: { [ItemsSym]: V["$jazz"]["schema"][ItemsSym] },
|
346
271
|
) {
|
347
272
|
this._schema ||= {};
|
348
273
|
Object.assign(this._schema, def);
|
@@ -351,6 +276,7 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
351
276
|
/**
|
352
277
|
* Load a `CoFeed`
|
353
278
|
* @category Subscription & Loading
|
279
|
+
* @deprecated Use `co.feed(...).load` instead.
|
354
280
|
*/
|
355
281
|
static load<F extends CoFeed, const R extends RefsToResolve<F> = true>(
|
356
282
|
this: CoValueClass<F>,
|
@@ -366,6 +292,7 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
366
292
|
/**
|
367
293
|
* Subscribe to a `CoFeed`, when you have an ID but don't have a `CoFeed` instance yet
|
368
294
|
* @category Subscription & Loading
|
295
|
+
* @deprecated Use `co.feed(...).subscribe` instead.
|
369
296
|
*/
|
370
297
|
static subscribe<F extends CoFeed, const R extends RefsToResolve<F> = true>(
|
371
298
|
this: CoValueClass<F>,
|
@@ -386,6 +313,77 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
386
313
|
const { options, listener } = parseSubscribeRestArgs(args);
|
387
314
|
return subscribeToCoValueWithoutMe<F, R>(this, id, options, listener);
|
388
315
|
}
|
316
|
+
}
|
317
|
+
|
318
|
+
/** @internal */
|
319
|
+
type CoFeedItem<L> = L extends CoFeed<infer Item> ? Item : never;
|
320
|
+
|
321
|
+
export class CoFeedJazzApi<F extends CoFeed> extends CoValueJazzApi<F> {
|
322
|
+
constructor(
|
323
|
+
private coFeed: F,
|
324
|
+
public raw: RawCoStream,
|
325
|
+
) {
|
326
|
+
super(coFeed);
|
327
|
+
}
|
328
|
+
|
329
|
+
/**
|
330
|
+
* The ID of this `CoFeed`
|
331
|
+
* @category Content
|
332
|
+
*/
|
333
|
+
get id(): ID<F> {
|
334
|
+
return this.raw.id;
|
335
|
+
}
|
336
|
+
|
337
|
+
get owner(): Group {
|
338
|
+
return getCoValueOwner(this.coFeed);
|
339
|
+
}
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Push items to this `CoFeed`
|
343
|
+
*
|
344
|
+
* Items are appended to the current session's log. Each session (tab, device, app instance)
|
345
|
+
* maintains its own append-only log, which is then aggregated into the per-account view.
|
346
|
+
*
|
347
|
+
* @example
|
348
|
+
* ```ts
|
349
|
+
* // Adds items to current session's log
|
350
|
+
* feed.$jazz.push("item1", "item2");
|
351
|
+
*
|
352
|
+
* // View items from current session
|
353
|
+
* console.log(feed.inCurrentSession);
|
354
|
+
*
|
355
|
+
* // View aggregated items from all sessions for current account
|
356
|
+
* console.log(feed.byMe);
|
357
|
+
* ```
|
358
|
+
*
|
359
|
+
* @category Content
|
360
|
+
*/
|
361
|
+
push(...items: CoFieldInit<CoFeedItem<F>>[]): void {
|
362
|
+
for (const item of items) {
|
363
|
+
this.pushItem(item);
|
364
|
+
}
|
365
|
+
}
|
366
|
+
|
367
|
+
private pushItem(item: CoFieldInit<CoFeedItem<F>>) {
|
368
|
+
const itemDescriptor = this.schema[ItemsSym] as Schema;
|
369
|
+
|
370
|
+
if (itemDescriptor === "json") {
|
371
|
+
this.raw.push(item as JsonValue);
|
372
|
+
} else if ("encoded" in itemDescriptor) {
|
373
|
+
this.raw.push(itemDescriptor.encoded.encode(item));
|
374
|
+
} else if (isRefEncoded(itemDescriptor)) {
|
375
|
+
let refId = (item as unknown as CoValue).$jazz?.id;
|
376
|
+
if (!refId) {
|
377
|
+
const coValue = instantiateRefEncodedWithInit(
|
378
|
+
itemDescriptor,
|
379
|
+
item,
|
380
|
+
this.owner,
|
381
|
+
);
|
382
|
+
refId = coValue.$jazz.id;
|
383
|
+
}
|
384
|
+
this.raw.push(refId);
|
385
|
+
}
|
386
|
+
}
|
389
387
|
|
390
388
|
/**
|
391
389
|
* Ensure a `CoFeed` is loaded to the specified depth
|
@@ -394,10 +392,10 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
394
392
|
* @category Subscription & Loading
|
395
393
|
*/
|
396
394
|
ensureLoaded<F extends CoFeed, const R extends RefsToResolve<F>>(
|
397
|
-
this: F
|
395
|
+
this: CoFeedJazzApi<F>,
|
398
396
|
options?: { resolve?: RefsToResolveStrict<F, R> },
|
399
397
|
): Promise<Resolved<F, R>> {
|
400
|
-
return ensureCoValueLoaded(this, options);
|
398
|
+
return ensureCoValueLoaded(this.coFeed, options);
|
401
399
|
}
|
402
400
|
|
403
401
|
/**
|
@@ -407,20 +405,20 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
407
405
|
* @category Subscription & Loading
|
408
406
|
*/
|
409
407
|
subscribe<F extends CoFeed, const R extends RefsToResolve<F>>(
|
410
|
-
this: F
|
408
|
+
this: CoFeedJazzApi<F>,
|
411
409
|
listener: (value: Resolved<F, R>, unsubscribe: () => void) => void,
|
412
410
|
): () => void;
|
413
411
|
subscribe<F extends CoFeed, const R extends RefsToResolve<F>>(
|
414
|
-
this: F
|
412
|
+
this: CoFeedJazzApi<F>,
|
415
413
|
options: { resolve?: RefsToResolveStrict<F, R> },
|
416
414
|
listener: (value: Resolved<F, R>, unsubscribe: () => void) => void,
|
417
415
|
): () => void;
|
418
416
|
subscribe<F extends CoFeed, const R extends RefsToResolve<F>>(
|
419
|
-
this: F
|
417
|
+
this: CoFeedJazzApi<F>,
|
420
418
|
...args: SubscribeRestArgs<F, R>
|
421
419
|
): () => void {
|
422
420
|
const { options, listener } = parseSubscribeRestArgs(args);
|
423
|
-
return subscribeToExistingCoValue(this, options, listener);
|
421
|
+
return subscribeToExistingCoValue(this.coFeed, options, listener);
|
424
422
|
}
|
425
423
|
|
426
424
|
/**
|
@@ -429,7 +427,22 @@ export class CoFeed<out Item = any> extends CoValueBase implements CoValue {
|
|
429
427
|
* @category Subscription & Loading
|
430
428
|
*/
|
431
429
|
waitForSync(options?: { timeout?: number }) {
|
432
|
-
return this.
|
430
|
+
return this.raw.core.waitForSync(options);
|
431
|
+
}
|
432
|
+
|
433
|
+
/**
|
434
|
+
* Get the descriptor for the items in the `CoFeed`
|
435
|
+
* @internal
|
436
|
+
*/
|
437
|
+
getItemsDescriptor(): Schema | undefined {
|
438
|
+
return this.schema[ItemsSym];
|
439
|
+
}
|
440
|
+
|
441
|
+
/** @internal */
|
442
|
+
get schema(): {
|
443
|
+
[ItemsSym]: SchemaFor<CoFeedItem<F>> | any;
|
444
|
+
} {
|
445
|
+
return (this.coFeed.constructor as typeof CoFeed)._schema;
|
433
446
|
}
|
434
447
|
}
|
435
448
|
|
@@ -507,20 +520,22 @@ export const CoStreamPerAccountProxyHandler = (
|
|
507
520
|
): ProxyHandler<{}> => ({
|
508
521
|
get(_target, key, receiver) {
|
509
522
|
if (typeof key === "string" && key.startsWith("co_")) {
|
510
|
-
const rawEntry = innerTarget.
|
523
|
+
const rawEntry = innerTarget.$jazz.raw.lastItemBy(key as RawAccountID);
|
511
524
|
|
512
525
|
if (!rawEntry) return;
|
513
526
|
const entry = entryFromRawEntry(
|
514
527
|
receiver,
|
515
528
|
rawEntry,
|
516
|
-
innerTarget.
|
529
|
+
innerTarget.$jazz.loadedAs,
|
517
530
|
key as unknown as ID<Account>,
|
518
|
-
innerTarget.
|
531
|
+
innerTarget.$jazz.schema[ItemsSym],
|
519
532
|
);
|
520
533
|
|
521
534
|
Object.defineProperty(entry, "all", {
|
522
535
|
get: () => {
|
523
|
-
const allRawEntries = innerTarget.
|
536
|
+
const allRawEntries = innerTarget.$jazz.raw.itemsBy(
|
537
|
+
key as RawAccountID,
|
538
|
+
);
|
524
539
|
return (function* () {
|
525
540
|
while (true) {
|
526
541
|
const rawEntry = allRawEntries.next();
|
@@ -528,9 +543,9 @@ export const CoStreamPerAccountProxyHandler = (
|
|
528
543
|
yield entryFromRawEntry(
|
529
544
|
receiver,
|
530
545
|
rawEntry.value,
|
531
|
-
innerTarget.
|
546
|
+
innerTarget.$jazz.loadedAs,
|
532
547
|
key as unknown as ID<Account>,
|
533
|
-
innerTarget.
|
548
|
+
innerTarget.$jazz.schema[ItemsSym],
|
534
549
|
);
|
535
550
|
}
|
536
551
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -544,7 +559,7 @@ export const CoStreamPerAccountProxyHandler = (
|
|
544
559
|
}
|
545
560
|
},
|
546
561
|
ownKeys(_target) {
|
547
|
-
return Array.from(innerTarget.
|
562
|
+
return Array.from(innerTarget.$jazz.raw.accounts());
|
548
563
|
},
|
549
564
|
getOwnPropertyDescriptor(_target, key) {
|
550
565
|
if (typeof key === "string" && key.startsWith("co_")) {
|
@@ -570,7 +585,7 @@ const CoStreamPerSessionProxyHandler = (
|
|
570
585
|
get(_target, key, receiver) {
|
571
586
|
if (typeof key === "string" && key.includes("session")) {
|
572
587
|
const sessionID = key as SessionID;
|
573
|
-
const rawEntry = innerTarget.
|
588
|
+
const rawEntry = innerTarget.$jazz.raw.lastItemIn(sessionID);
|
574
589
|
|
575
590
|
if (!rawEntry) return;
|
576
591
|
const by = cojsonInternals.accountOrAgentIDfromSessionID(sessionID);
|
@@ -578,16 +593,16 @@ const CoStreamPerSessionProxyHandler = (
|
|
578
593
|
const entry = entryFromRawEntry(
|
579
594
|
accessFrom,
|
580
595
|
rawEntry,
|
581
|
-
innerTarget.
|
596
|
+
innerTarget.$jazz.loadedAs,
|
582
597
|
cojsonInternals.isAccountID(by)
|
583
598
|
? (by as unknown as ID<Account>)
|
584
599
|
: undefined,
|
585
|
-
innerTarget.
|
600
|
+
innerTarget.$jazz.schema[ItemsSym],
|
586
601
|
);
|
587
602
|
|
588
603
|
Object.defineProperty(entry, "all", {
|
589
604
|
get: () => {
|
590
|
-
const allRawEntries = innerTarget.
|
605
|
+
const allRawEntries = innerTarget.$jazz.raw.itemsIn(sessionID);
|
591
606
|
return (function* () {
|
592
607
|
while (true) {
|
593
608
|
const rawEntry = allRawEntries.next();
|
@@ -595,11 +610,11 @@ const CoStreamPerSessionProxyHandler = (
|
|
595
610
|
yield entryFromRawEntry(
|
596
611
|
accessFrom,
|
597
612
|
rawEntry.value,
|
598
|
-
innerTarget.
|
613
|
+
innerTarget.$jazz.loadedAs,
|
599
614
|
cojsonInternals.isAccountID(by)
|
600
615
|
? (by as unknown as ID<Account>)
|
601
616
|
: undefined,
|
602
|
-
innerTarget.
|
617
|
+
innerTarget.$jazz.schema[ItemsSym],
|
603
618
|
);
|
604
619
|
}
|
605
620
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -613,7 +628,7 @@ const CoStreamPerSessionProxyHandler = (
|
|
613
628
|
}
|
614
629
|
},
|
615
630
|
ownKeys() {
|
616
|
-
return innerTarget.
|
631
|
+
return innerTarget.$jazz.raw.sessions();
|
617
632
|
},
|
618
633
|
getOwnPropertyDescriptor(target, key) {
|
619
634
|
if (typeof key === "string" && key.startsWith("co_")) {
|
@@ -648,15 +663,10 @@ export { FileStream as BinaryCoStream };
|
|
648
663
|
* @category CoValues
|
649
664
|
*/
|
650
665
|
export class FileStream extends CoValueBase implements CoValue {
|
651
|
-
|
652
|
-
|
653
|
-
* @category Content
|
654
|
-
*/
|
655
|
-
declare id: ID<this>;
|
666
|
+
declare $jazz: FileStreamJazzApi<this>;
|
667
|
+
|
656
668
|
/** @category Type Helpers */
|
657
|
-
declare
|
658
|
-
/** @internal */
|
659
|
-
declare _raw: RawBinaryCoStream;
|
669
|
+
declare [TypeSym]: "BinaryCoStream";
|
660
670
|
|
661
671
|
constructor(
|
662
672
|
options:
|
@@ -674,17 +684,16 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
674
684
|
if ("fromRaw" in options) {
|
675
685
|
raw = options.fromRaw;
|
676
686
|
} else {
|
677
|
-
const rawOwner = options.owner.
|
687
|
+
const rawOwner = options.owner.$jazz.raw;
|
678
688
|
raw = rawOwner.createBinaryStream();
|
679
689
|
}
|
680
690
|
|
681
691
|
Object.defineProperties(this, {
|
682
|
-
|
683
|
-
|
692
|
+
[TypeSym]: { value: "BinaryCoStream", enumerable: false },
|
693
|
+
$jazz: {
|
694
|
+
value: new FileStreamJazzApi(this, raw),
|
684
695
|
enumerable: false,
|
685
696
|
},
|
686
|
-
_type: { value: "BinaryCoStream", enumerable: false },
|
687
|
-
_raw: { value: raw, enumerable: false },
|
688
697
|
});
|
689
698
|
}
|
690
699
|
|
@@ -710,6 +719,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
710
719
|
* For uploading an existing file or blob, use {@link FileStream.createFromBlob} instead.
|
711
720
|
*
|
712
721
|
* @category Creation
|
722
|
+
* @deprecated Use `co.fileStream(...).create` instead.
|
713
723
|
*/
|
714
724
|
static create<S extends FileStream>(
|
715
725
|
this: CoValueClass<S>,
|
@@ -719,7 +729,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
719
729
|
}
|
720
730
|
|
721
731
|
getMetadata(): BinaryStreamInfo | undefined {
|
722
|
-
return this.
|
732
|
+
return this.$jazz.raw.getBinaryStreamInfo();
|
723
733
|
}
|
724
734
|
|
725
735
|
getChunks(options?: {
|
@@ -727,23 +737,23 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
727
737
|
}):
|
728
738
|
| (BinaryStreamInfo & { chunks: Uint8Array[]; finished: boolean })
|
729
739
|
| undefined {
|
730
|
-
return this.
|
740
|
+
return this.$jazz.raw.getBinaryChunks(options?.allowUnfinished);
|
731
741
|
}
|
732
742
|
|
733
743
|
isBinaryStreamEnded(): boolean {
|
734
|
-
return this.
|
744
|
+
return this.$jazz.raw.isBinaryStreamEnded();
|
735
745
|
}
|
736
746
|
|
737
747
|
start(options: BinaryStreamInfo): void {
|
738
|
-
this.
|
748
|
+
this.$jazz.raw.startBinaryStream(options);
|
739
749
|
}
|
740
750
|
|
741
751
|
push(data: Uint8Array): void {
|
742
|
-
this.
|
752
|
+
this.$jazz.raw.pushBinaryStreamChunk(data);
|
743
753
|
}
|
744
754
|
|
745
755
|
end(): void {
|
746
|
-
this.
|
756
|
+
this.$jazz.raw.endBinaryStream();
|
747
757
|
}
|
748
758
|
|
749
759
|
toBlob(options?: { allowUnfinished?: boolean }): Blob | undefined {
|
@@ -763,6 +773,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
763
773
|
* Load a `FileStream` as a `Blob`
|
764
774
|
*
|
765
775
|
* @category Content
|
776
|
+
* @deprecated Use `co.fileStream(...).loadAsBlob` instead.
|
766
777
|
*/
|
767
778
|
static async loadAsBlob(
|
768
779
|
id: ID<FileStream>,
|
@@ -826,12 +837,13 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
826
837
|
* const fileStream = await FileStream.createFromBlob(file, {owner: group})
|
827
838
|
* ```
|
828
839
|
* @category Content
|
840
|
+
* @deprecated Use `co.fileStream(...).createFromBlob` instead.
|
829
841
|
*/
|
830
842
|
static async createFromBlob(
|
831
843
|
blob: Blob | File,
|
832
844
|
options?:
|
833
845
|
| {
|
834
|
-
owner?:
|
846
|
+
owner?: Account | Group;
|
835
847
|
onProgress?: (progress: number) => void;
|
836
848
|
}
|
837
849
|
| Account
|
@@ -856,6 +868,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
856
868
|
* const fileStream = await FileStream.createFromBlob(file, {owner: group})
|
857
869
|
* ```
|
858
870
|
* @category Content
|
871
|
+
* @deprecated Use `co.fileStream(...).createFromArrayBuffer` instead.
|
859
872
|
*/
|
860
873
|
static async createFromArrayBuffer(
|
861
874
|
arrayBuffer: ArrayBuffer,
|
@@ -863,7 +876,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
863
876
|
fileName: string | undefined,
|
864
877
|
options?:
|
865
878
|
| {
|
866
|
-
owner?:
|
879
|
+
owner?: Account | Group;
|
867
880
|
onProgress?: (progress: number) => void;
|
868
881
|
}
|
869
882
|
| Account
|
@@ -915,8 +928,6 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
915
928
|
* @category Content
|
916
929
|
*/
|
917
930
|
toJSON(): {
|
918
|
-
id: string;
|
919
|
-
_type: "BinaryCoStream";
|
920
931
|
mimeType?: string;
|
921
932
|
totalSizeBytes?: number;
|
922
933
|
fileName?: string;
|
@@ -924,8 +935,6 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
924
935
|
finished?: boolean;
|
925
936
|
} {
|
926
937
|
return {
|
927
|
-
id: this.id,
|
928
|
-
_type: this._type,
|
929
938
|
...this.getChunks(),
|
930
939
|
};
|
931
940
|
}
|
@@ -938,6 +947,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
938
947
|
/**
|
939
948
|
* Load a `FileStream`
|
940
949
|
* @category Subscription & Loading
|
950
|
+
* @deprecated Use `co.fileStream(...).load` instead.
|
941
951
|
*/
|
942
952
|
static async load<C extends FileStream>(
|
943
953
|
this: CoValueClass<C>,
|
@@ -975,6 +985,7 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
975
985
|
/**
|
976
986
|
* Subscribe to a `FileStream`, when you have an ID but don't have a `FileStream` instance yet
|
977
987
|
* @category Subscription & Loading
|
988
|
+
* @deprecated Use `co.fileStream(...).subscribe` instead.
|
978
989
|
*/
|
979
990
|
static subscribe<F extends FileStream, const R extends RefsToResolve<F>>(
|
980
991
|
this: CoValueClass<F>,
|
@@ -995,16 +1006,37 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
995
1006
|
const { options, listener } = parseSubscribeRestArgs(args);
|
996
1007
|
return subscribeToCoValueWithoutMe<F, R>(this, id, options, listener);
|
997
1008
|
}
|
1009
|
+
}
|
1010
|
+
|
1011
|
+
export class FileStreamJazzApi<F extends FileStream> extends CoValueJazzApi<F> {
|
1012
|
+
constructor(
|
1013
|
+
private fileStream: F,
|
1014
|
+
public raw: RawBinaryCoStream,
|
1015
|
+
) {
|
1016
|
+
super(fileStream);
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
/**
|
1020
|
+
* The ID of this `FileStream`
|
1021
|
+
* @category Content
|
1022
|
+
*/
|
1023
|
+
get id(): ID<F> {
|
1024
|
+
return this.raw.id;
|
1025
|
+
}
|
1026
|
+
|
1027
|
+
get owner(): Group {
|
1028
|
+
return getCoValueOwner(this.fileStream);
|
1029
|
+
}
|
998
1030
|
|
999
1031
|
/**
|
1000
1032
|
* An instance method to subscribe to an existing `FileStream`
|
1001
1033
|
* @category Subscription & Loading
|
1002
1034
|
*/
|
1003
1035
|
subscribe<B extends FileStream>(
|
1004
|
-
this: B
|
1036
|
+
this: FileStreamJazzApi<B>,
|
1005
1037
|
listener: (value: Resolved<B, true>) => void,
|
1006
1038
|
): () => void {
|
1007
|
-
return subscribeToExistingCoValue(this, {}, listener);
|
1039
|
+
return subscribeToExistingCoValue(this.fileStream, {}, listener);
|
1008
1040
|
}
|
1009
1041
|
|
1010
1042
|
/**
|
@@ -1013,6 +1045,6 @@ export class FileStream extends CoValueBase implements CoValue {
|
|
1013
1045
|
* @category Subscription & Loading
|
1014
1046
|
*/
|
1015
1047
|
waitForSync(options?: { timeout?: number }) {
|
1016
|
-
return this.
|
1048
|
+
return this.raw.core.waitForSync(options);
|
1017
1049
|
}
|
1018
1050
|
}
|