jazz-tools 0.7.35 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +1 -1
- package/CHANGELOG.md +23 -1
- package/dist/coValues/account.js +27 -36
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +19 -21
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +29 -23
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +26 -21
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/extensions/imageDef.js +3 -8
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +20 -23
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +5 -2
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/createContext.js +144 -0
- package/dist/implementation/createContext.js.map +1 -0
- package/dist/implementation/refs.js +11 -2
- package/dist/implementation/refs.js.map +1 -1
- package/dist/implementation/subscriptionScope.js +12 -8
- package/dist/implementation/subscriptionScope.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal.js +1 -0
- package/dist/internal.js.map +1 -1
- package/dist/tests/coList.test.js +23 -15
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +89 -139
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +26 -22
- package/dist/tests/coStream.test.js.map +1 -1
- package/dist/tests/deepLoading.test.js +21 -34
- package/dist/tests/deepLoading.test.js.map +1 -1
- package/dist/tests/groupsAndAccounts.test.js +8 -22
- package/dist/tests/groupsAndAccounts.test.js.map +1 -1
- package/package.json +3 -3
- package/src/coValues/account.ts +14 -31
- package/src/coValues/coList.ts +9 -5
- package/src/coValues/coMap.ts +40 -9
- package/src/coValues/coStream.ts +16 -7
- package/src/coValues/group.ts +2 -2
- package/src/coValues/interfaces.ts +12 -8
- package/src/implementation/createContext.ts +268 -0
- package/src/implementation/refs.ts +13 -6
- package/src/implementation/subscriptionScope.ts +28 -25
- package/src/index.ts +12 -1
- package/src/internal.ts +2 -0
- package/src/tests/coList.test.ts +30 -14
- package/src/tests/coMap.test.ts +56 -27
- package/src/tests/coStream.test.ts +27 -21
- package/src/tests/deepLoading.test.ts +15 -11
- package/tsconfig.json +1 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
|
2
|
-
> jazz-tools@0.7.
|
2
|
+
> jazz-tools@0.7.35-guest-auth.5 build /Users/anselm/jazz/jazz/packages/jazz-tools
|
3
3
|
> npm run lint && rm -rf ./dist && tsc --sourceMap --outDir dist
|
4
4
|
|
5
5
|
|
6
|
-
> jazz-tools@0.7.
|
6
|
+
> jazz-tools@0.7.35-guest-auth.5 lint
|
7
7
|
> eslint . --ext ts,tsx
|
8
8
|
|
package/.turbo/turbo-lint.log
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,4 +1,26 @@
|
|
1
|
-
# jazz-
|
1
|
+
# jazz-tools
|
2
|
+
|
3
|
+
## 0.8.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- bcec3be: Implement new top-level context creation and auth method API
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- ad40b88: First sketch of API for creating and finding unique CoValues
|
12
|
+
- 23369dc: Re-add logout functionality to AuthMethods
|
13
|
+
- c2b62a0: Make anonymous auth work better
|
14
|
+
- 1a979b6: Implement guest auth without account
|
15
|
+
- Updated dependencies [6a147c2]
|
16
|
+
- Updated dependencies [ad40b88]
|
17
|
+
- cojson@0.8.0
|
18
|
+
|
19
|
+
## 0.7.35-guest-auth.6
|
20
|
+
|
21
|
+
### Patch Changes
|
22
|
+
|
23
|
+
- Re-add logout functionality to AuthMethods
|
2
24
|
|
3
25
|
## 0.7.35
|
4
26
|
|
package/dist/coValues/account.js
CHANGED
@@ -1,17 +1,36 @@
|
|
1
|
-
var _a;
|
2
1
|
import { LocalNode, cojsonInternals } from "cojson";
|
3
|
-
import {
|
2
|
+
import { RawAccount, } from "cojson";
|
3
|
+
import { CoMap, AnonymousJazzAgent, } from "../internal.js";
|
4
4
|
import { Group, CoValueBase, MembersSym, Profile, Ref, SchemaInit, inspect, subscriptionsScopes, loadCoValue, subscribeToCoValue, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
5
5
|
/** @category Identity & Permissions */
|
6
6
|
export class Account extends CoValueBase {
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
8
|
+
static _schema;
|
7
9
|
get _schema() {
|
8
10
|
return this.constructor._schema;
|
9
11
|
}
|
12
|
+
static {
|
13
|
+
this._schema = {
|
14
|
+
profile: {
|
15
|
+
ref: () => Profile,
|
16
|
+
optional: false,
|
17
|
+
},
|
18
|
+
root: {
|
19
|
+
ref: () => CoMap,
|
20
|
+
optional: true,
|
21
|
+
},
|
22
|
+
};
|
23
|
+
}
|
10
24
|
get _owner() {
|
11
25
|
return this;
|
12
26
|
}
|
13
27
|
get _loadedAs() {
|
14
|
-
|
28
|
+
if (this.isMe)
|
29
|
+
return this;
|
30
|
+
if (this._raw.core.node.account instanceof RawAccount) {
|
31
|
+
return Account.fromRaw(this._raw.core.node.account);
|
32
|
+
}
|
33
|
+
return new AnonymousJazzAgent(this._raw.core.node);
|
15
34
|
}
|
16
35
|
get _refs() {
|
17
36
|
const profileID = this._raw.get("profile");
|
@@ -23,6 +42,8 @@ export class Account extends CoValueBase {
|
|
23
42
|
new Ref(rootID, this._loadedAs, this._schema.root),
|
24
43
|
};
|
25
44
|
}
|
45
|
+
isMe;
|
46
|
+
sessionID;
|
26
47
|
constructor(options) {
|
27
48
|
super();
|
28
49
|
if (!("fromRaw" in options)) {
|
@@ -55,6 +76,7 @@ export class Account extends CoValueBase {
|
|
55
76
|
return loadCoValue(coValueClass, valueID, this, []);
|
56
77
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
57
78
|
}
|
79
|
+
/** @private */
|
58
80
|
static async create(options) {
|
59
81
|
const { node } = await LocalNode.withNewlyCreatedAccount({
|
60
82
|
...options,
|
@@ -67,22 +89,6 @@ export class Account extends CoValueBase {
|
|
67
89
|
});
|
68
90
|
return this.fromNode(node);
|
69
91
|
}
|
70
|
-
static async become(options) {
|
71
|
-
const node = await LocalNode.withLoadedAccount({
|
72
|
-
accountID: options.accountID,
|
73
|
-
accountSecret: options.accountSecret,
|
74
|
-
sessionID: options.sessionID,
|
75
|
-
peersToLoadFrom: options.peersToLoadFrom,
|
76
|
-
crypto: options.crypto,
|
77
|
-
migration: async (rawAccount, _node, creationProps) => {
|
78
|
-
const account = new this({
|
79
|
-
fromRaw: rawAccount,
|
80
|
-
});
|
81
|
-
await account.migrate?.(creationProps);
|
82
|
-
},
|
83
|
-
});
|
84
|
-
return this.fromNode(node);
|
85
|
-
}
|
86
92
|
static async createAs(as, options) {
|
87
93
|
// TODO: is there a cleaner way to do this?
|
88
94
|
const connectedPeers = cojsonInternals.connectedPeers("creatingAccount", "createdAccount", { peer1role: "server", peer2role: "client" });
|
@@ -132,19 +138,6 @@ export class Account extends CoValueBase {
|
|
132
138
|
return subscribeToExistingCoValue(this, depth, listener);
|
133
139
|
}
|
134
140
|
}
|
135
|
-
_a = Account;
|
136
|
-
(() => {
|
137
|
-
_a._schema = {
|
138
|
-
profile: {
|
139
|
-
ref: () => Profile,
|
140
|
-
optional: false,
|
141
|
-
},
|
142
|
-
root: {
|
143
|
-
ref: () => CoMap,
|
144
|
-
optional: true,
|
145
|
-
},
|
146
|
-
};
|
147
|
-
})();
|
148
141
|
export const AccountAndGroupProxyHandler = {
|
149
142
|
get(target, key, receiver) {
|
150
143
|
if (key === "profile") {
|
@@ -164,11 +157,10 @@ export const AccountAndGroupProxyHandler = {
|
|
164
157
|
}
|
165
158
|
},
|
166
159
|
set(target, key, value, receiver) {
|
167
|
-
var _b;
|
168
160
|
if ((key === "profile" || key === "root" || key === MembersSym) &&
|
169
161
|
typeof value === "object" &&
|
170
162
|
SchemaInit in value) {
|
171
|
-
|
163
|
+
target.constructor._schema ||= {};
|
172
164
|
target.constructor._schema[key] =
|
173
165
|
value[SchemaInit];
|
174
166
|
return true;
|
@@ -196,11 +188,10 @@ export const AccountAndGroupProxyHandler = {
|
|
196
188
|
}
|
197
189
|
},
|
198
190
|
defineProperty(target, key, descriptor) {
|
199
|
-
var _b;
|
200
191
|
if ((key === "profile" || key === "root" || key === MembersSym) &&
|
201
192
|
typeof descriptor.value === "object" &&
|
202
193
|
SchemaInit in descriptor.value) {
|
203
|
-
|
194
|
+
target.constructor._schema ||= {};
|
204
195
|
target.constructor._schema[key] =
|
205
196
|
descriptor.value[SchemaInit];
|
206
197
|
return true;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAMH,UAAU,GAKb,MAAM,QAAQ,CAAC;AAChB,OAAO,EACH,KAAK,EASL,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACH,KAAK,EACL,WAAW,EACX,UAAU,EACV,OAAO,EACP,GAAG,EACH,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAExB,uCAAuC;AACvC,MAAM,OAAO,OAAQ,SAAQ,WAAW;IAKpC,8DAA8D;IAC9D,MAAM,CAAC,OAAO,CAAM;IACpB,IAAI,OAAO;QAIP,OAAQ,IAAI,CAAC,WAA8B,CAAC,OAAO,CAAC;IACxD,CAAC;IACD;QACI,IAAI,CAAC,OAAO,GAAG;YACX,OAAO,EAAE;gBACL,GAAG,EAAE,GAAG,EAAE,CAAC,OA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, SchemaInit, co, ensureCoValueLoaded, inspect, isRefEncoded, loadCoValue, makeRefs, subscribeToCoValue, subscribeToExistingCoValue, subscriptionsScopes, } from "../internal.js";
|
2
|
+
import { Account, AnonymousJazzAgent, Group, ItemsSym, Ref, SchemaInit, co, ensureCoValueLoaded, inspect, isRefEncoded, loadCoValue, makeRefs, subscribeToCoValue, subscribeToExistingCoValue, subscriptionsScopes, } from "../internal.js";
|
4
3
|
/**
|
5
4
|
* CoLists are collaborative versions of plain arrays.
|
6
5
|
*
|
@@ -36,16 +35,10 @@ export class CoList extends Array {
|
|
36
35
|
* @category Declaration
|
37
36
|
*/
|
38
37
|
static Of(item) {
|
39
|
-
var _b, _c;
|
40
38
|
// TODO: cache superclass for item class
|
41
|
-
return
|
42
|
-
|
43
|
-
|
44
|
-
this[_b] = item;
|
45
|
-
}
|
46
|
-
},
|
47
|
-
_b = co.items,
|
48
|
-
_c;
|
39
|
+
return class CoListOf extends CoList {
|
40
|
+
[co.items] = item;
|
41
|
+
};
|
49
42
|
}
|
50
43
|
/**
|
51
44
|
* @ignore
|
@@ -53,6 +46,14 @@ export class CoList extends Array {
|
|
53
46
|
static of(..._args) {
|
54
47
|
throw new Error("Can't use Array.of with CoLists");
|
55
48
|
}
|
49
|
+
static {
|
50
|
+
this.prototype._type = "CoList";
|
51
|
+
}
|
52
|
+
/** @internal This is only a marker type and doesn't exist at runtime */
|
53
|
+
[ItemsSym];
|
54
|
+
/** @internal */
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
56
|
+
static _schema;
|
56
57
|
/** @internal */
|
57
58
|
get _schema() {
|
58
59
|
return this.constructor._schema;
|
@@ -86,7 +87,10 @@ export class CoList extends Array {
|
|
86
87
|
throw new Error("Not implemented");
|
87
88
|
}
|
88
89
|
get _loadedAs() {
|
89
|
-
|
90
|
+
if (this._raw.core.node.account instanceof RawAccount) {
|
91
|
+
return Account.fromRaw(this._raw.core.node.account);
|
92
|
+
}
|
93
|
+
return new AnonymousJazzAgent(this._raw.core.node);
|
90
94
|
}
|
91
95
|
static get [Symbol.species]() {
|
92
96
|
return Array;
|
@@ -208,7 +212,7 @@ export class CoList extends Array {
|
|
208
212
|
}
|
209
213
|
/** @internal */
|
210
214
|
static schema(def) {
|
211
|
-
this._schema
|
215
|
+
this._schema ||= {};
|
212
216
|
Object.assign(this._schema, def);
|
213
217
|
}
|
214
218
|
/**
|
@@ -299,10 +303,6 @@ export class CoList extends Array {
|
|
299
303
|
return casted;
|
300
304
|
}
|
301
305
|
}
|
302
|
-
_a = CoList;
|
303
|
-
(() => {
|
304
|
-
_a.prototype._type = "CoList";
|
305
|
-
})();
|
306
306
|
function toRawItems(items, itemDescriptor) {
|
307
307
|
const rawItems = itemDescriptor === "json"
|
308
308
|
? items
|
@@ -342,11 +342,10 @@ const CoListProxyHandler = {
|
|
342
342
|
}
|
343
343
|
},
|
344
344
|
set(target, key, value, receiver) {
|
345
|
-
var _b;
|
346
345
|
if (key === ItemsSym &&
|
347
346
|
typeof value === "object" &&
|
348
347
|
SchemaInit in value) {
|
349
|
-
|
348
|
+
target.constructor._schema ||= {};
|
350
349
|
target.constructor._schema[ItemsSym] =
|
351
350
|
value[SchemaInit];
|
352
351
|
return true;
|
@@ -371,12 +370,11 @@ const CoListProxyHandler = {
|
|
371
370
|
}
|
372
371
|
},
|
373
372
|
defineProperty(target, key, descriptor) {
|
374
|
-
var _b;
|
375
373
|
if (descriptor.value &&
|
376
374
|
key === ItemsSym &&
|
377
375
|
typeof descriptor.value === "object" &&
|
378
376
|
SchemaInit in descriptor.value) {
|
379
|
-
|
377
|
+
target.constructor._schema ||= {};
|
380
378
|
target.constructor._schema[ItemsSym] =
|
381
379
|
descriptor.value[SchemaInit];
|
382
380
|
return true;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.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HANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
import { cojsonInternals, } from "cojson";
|
2
2
|
import { Account, CoValueBase, Ref, SchemaInit, inspect, makeRefs, subscriptionsScopes, ItemsSym, isRefEncoded, loadCoValue, subscribeToCoValue, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
3
3
|
/**
|
4
4
|
* CoMaps are collaborative versions of plain objects, mapping string-like keys to values.
|
@@ -34,6 +34,12 @@ import { Account, CoValueBase, Ref, SchemaInit, inspect, makeRefs, subscriptions
|
|
34
34
|
* @category CoValues
|
35
35
|
* */
|
36
36
|
export class CoMap extends CoValueBase {
|
37
|
+
static {
|
38
|
+
this.prototype._type = "CoMap";
|
39
|
+
}
|
40
|
+
/** @internal */
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
42
|
+
static _schema;
|
37
43
|
/** @internal */
|
38
44
|
get _schema() {
|
39
45
|
return this.constructor._schema;
|
@@ -93,10 +99,6 @@ export class CoMap extends CoValueBase {
|
|
93
99
|
});
|
94
100
|
}
|
95
101
|
/** @internal */
|
96
|
-
get _loadedAs() {
|
97
|
-
return Account.fromNode(this._raw.core.node);
|
98
|
-
}
|
99
|
-
/** @internal */
|
100
102
|
constructor(
|
101
103
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
102
104
|
options) {
|
@@ -137,7 +139,9 @@ export class CoMap extends CoValueBase {
|
|
137
139
|
**/
|
138
140
|
static create(init, options) {
|
139
141
|
const instance = new this();
|
140
|
-
const raw = instance.rawFromInit(init, options.owner
|
142
|
+
const raw = instance.rawFromInit(init, options.owner, options.unique === undefined
|
143
|
+
? undefined
|
144
|
+
: { uniqueness: options.unique });
|
141
145
|
Object.defineProperties(instance, {
|
142
146
|
id: {
|
143
147
|
value: raw.id,
|
@@ -184,7 +188,7 @@ export class CoMap extends CoValueBase {
|
|
184
188
|
}
|
185
189
|
/** @internal */
|
186
190
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
187
|
-
rawFromInit(init, owner) {
|
191
|
+
rawFromInit(init, owner, uniqueness) {
|
188
192
|
const rawOwner = owner._raw;
|
189
193
|
const rawInit = {};
|
190
194
|
if (init)
|
@@ -208,7 +212,7 @@ export class CoMap extends CoValueBase {
|
|
208
212
|
initValue);
|
209
213
|
}
|
210
214
|
}
|
211
|
-
return rawOwner.createMap(rawInit);
|
215
|
+
return rawOwner.createMap(rawInit, null, "private", uniqueness);
|
212
216
|
}
|
213
217
|
/**
|
214
218
|
* Declare a Record-like CoMap schema, by extending `CoMap.Record(...)` and passing the value schema using `co`. Keys are always `string`.
|
@@ -229,15 +233,10 @@ export class CoMap extends CoValueBase {
|
|
229
233
|
* @category Declaration
|
230
234
|
*/
|
231
235
|
static Record(value) {
|
232
|
-
var _b;
|
233
236
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
|
234
|
-
class RecordLikeCoMap extends
|
235
|
-
|
236
|
-
super(...arguments);
|
237
|
-
this[_b] = value;
|
238
|
-
}
|
237
|
+
class RecordLikeCoMap extends CoMap {
|
238
|
+
[ItemsSym] = value;
|
239
239
|
}
|
240
|
-
_b = ItemsSym;
|
241
240
|
return RecordLikeCoMap;
|
242
241
|
}
|
243
242
|
/**
|
@@ -295,6 +294,19 @@ export class CoMap extends CoValueBase {
|
|
295
294
|
static subscribe(id, as, depth, listener) {
|
296
295
|
return subscribeToCoValue(this, id, as, depth, listener);
|
297
296
|
}
|
297
|
+
static findUnique(unique, ownerID, as) {
|
298
|
+
const header = {
|
299
|
+
type: "comap",
|
300
|
+
ruleset: {
|
301
|
+
type: "ownedByGroup",
|
302
|
+
group: ownerID,
|
303
|
+
},
|
304
|
+
meta: null,
|
305
|
+
uniqueness: unique,
|
306
|
+
};
|
307
|
+
const crypto = as._type === "Anonymous" ? as.node.crypto : as._raw.core.crypto;
|
308
|
+
return cojsonInternals.idforHeader(header, crypto);
|
309
|
+
}
|
298
310
|
/**
|
299
311
|
* Given an already loaded `CoMap`, ensure that the specified fields are loaded to the specified depth.
|
300
312
|
*
|
@@ -347,10 +359,6 @@ export class CoMap extends CoValueBase {
|
|
347
359
|
return this;
|
348
360
|
}
|
349
361
|
}
|
350
|
-
_a = CoMap;
|
351
|
-
(() => {
|
352
|
-
_a.prototype._type = "CoMap";
|
353
|
-
})();
|
354
362
|
// TODO: cache handlers per descriptor for performance?
|
355
363
|
const CoMapProxyHandler = {
|
356
364
|
get(target, key, receiver) {
|
@@ -385,12 +393,11 @@ const CoMapProxyHandler = {
|
|
385
393
|
}
|
386
394
|
},
|
387
395
|
set(target, key, value, receiver) {
|
388
|
-
var _b;
|
389
396
|
if ((typeof key === "string" || ItemsSym) &&
|
390
397
|
typeof value === "object" &&
|
391
398
|
value !== null &&
|
392
399
|
SchemaInit in value) {
|
393
|
-
|
400
|
+
target.constructor._schema ||= {};
|
394
401
|
target.constructor._schema[key] =
|
395
402
|
value[SchemaInit];
|
396
403
|
return true;
|
@@ -427,11 +434,10 @@ const CoMapProxyHandler = {
|
|
427
434
|
}
|
428
435
|
},
|
429
436
|
defineProperty(target, key, attributes) {
|
430
|
-
var _b;
|
431
437
|
if ("value" in attributes &&
|
432
438
|
typeof attributes.value === "object" &&
|
433
439
|
SchemaInit in attributes.value) {
|
434
|
-
|
440
|
+
target.constructor._schema ||= {};
|
435
441
|
target.constructor._schema[key] =
|
436
442
|
attributes.value[SchemaInit];
|
437
443
|
return true;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coMap.js","sourceRoot":"","sources":["../../src/coValues/coMap.ts"],"names":[],"mappings":";AAcA,OAAO,EACH,OAAO,EACP,WAAW,EACX,GAAG,EACH,UAAU,EACV,OAAO,EACP,QAAQ,EACR,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,GAC7B,MAAM,gBAAgB,CAAC;AAexB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAgCM;AACN,MAAM,OAAO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;YAC/D,MAAM,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,CAAW,CAAC;QAE1C,IAAI,MAAM,CAAC,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,UAAU,EAAE,CAAC;YACvD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC;QAC9C,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IACD,cAAc,CAAC,MAAM,EAAE,GAAG;QACtB,MAAM,UAAU,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAA6B,CAAC;YAC7D,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAW,CAAC;QACxC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,UAAU,EAAE,CAAC;YACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC;QAChB,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC/C,CAAC;IACL,CAAC;CACJ,CAAC"}
|
@@ -1,28 +1,39 @@
|
|
1
|
-
var _a;
|
2
1
|
import { MAX_RECOMMENDED_TX_SIZE, cojsonInternals } from "cojson";
|
3
2
|
import { ItemsSym, Account, CoValueBase, Ref, inspect, co, SchemaInit, isRefEncoded, loadCoValue, subscribeToCoValue, ensureCoValueLoaded, subscribeToExistingCoValue, } from "../internal.js";
|
4
3
|
/** @category CoValues */
|
5
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6
5
|
export class CoStream extends CoValueBase {
|
7
6
|
static Of(item) {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
},
|
15
|
-
_b = co.items,
|
16
|
-
_c;
|
7
|
+
return class CoStreamOf extends CoStream {
|
8
|
+
[co.items] = item;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
static {
|
12
|
+
this.prototype._type = "CoStream";
|
17
13
|
}
|
14
|
+
/** @internal This is only a marker type and doesn't exist at runtime */
|
15
|
+
[ItemsSym];
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
17
|
+
static _schema;
|
18
18
|
get _schema() {
|
19
19
|
return this.constructor._schema;
|
20
20
|
}
|
21
21
|
get byMe() {
|
22
|
-
|
22
|
+
if (this._loadedAs._type === "Account") {
|
23
|
+
return this[this._loadedAs.id];
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
return undefined;
|
27
|
+
}
|
23
28
|
}
|
29
|
+
perSession;
|
24
30
|
get inCurrentSession() {
|
25
|
-
|
31
|
+
if (this._loadedAs._type === "Account") {
|
32
|
+
return this.perSession[this._loadedAs.sessionID];
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
return undefined;
|
36
|
+
}
|
26
37
|
}
|
27
38
|
constructor(options) {
|
28
39
|
super();
|
@@ -93,7 +104,7 @@ export class CoStream extends CoValueBase {
|
|
93
104
|
return this.toJSON();
|
94
105
|
}
|
95
106
|
static schema(def) {
|
96
|
-
this._schema
|
107
|
+
this._schema ||= {};
|
97
108
|
Object.assign(this._schema, def);
|
98
109
|
}
|
99
110
|
/** @category Subscription & Loading */
|
@@ -113,10 +124,6 @@ export class CoStream extends CoValueBase {
|
|
113
124
|
return subscribeToExistingCoValue(this, depth, listener);
|
114
125
|
}
|
115
126
|
}
|
116
|
-
_a = CoStream;
|
117
|
-
(() => {
|
118
|
-
_a.prototype._type = "CoStream";
|
119
|
-
})();
|
120
127
|
function entryFromRawEntry(accessFrom, rawEntry, loadedAs, accountID, itemField) {
|
121
128
|
return {
|
122
129
|
get value() {
|
@@ -187,11 +194,10 @@ export const CoStreamProxyHandler = {
|
|
187
194
|
}
|
188
195
|
},
|
189
196
|
set(target, key, value, receiver) {
|
190
|
-
var _b;
|
191
197
|
if (key === ItemsSym &&
|
192
198
|
typeof value === "object" &&
|
193
199
|
SchemaInit in value) {
|
194
|
-
|
200
|
+
target.constructor._schema ||= {};
|
195
201
|
target.constructor._schema[ItemsSym] =
|
196
202
|
value[SchemaInit];
|
197
203
|
return true;
|
@@ -201,12 +207,11 @@ export const CoStreamProxyHandler = {
|
|
201
207
|
}
|
202
208
|
},
|
203
209
|
defineProperty(target, key, descriptor) {
|
204
|
-
var _b;
|
205
210
|
if (descriptor.value &&
|
206
211
|
key === ItemsSym &&
|
207
212
|
typeof descriptor.value === "object" &&
|
208
213
|
SchemaInit in descriptor.value) {
|
209
|
-
|
214
|
+
target.constructor._schema ||= {};
|
210
215
|
target.constructor._schema[ItemsSym] =
|
211
216
|
descriptor.value[SchemaInit];
|
212
217
|
return true;
|