jazz-tools 0.8.44 → 0.8.48
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +16 -10
- package/CHANGELOG.md +21 -0
- package/dist/chunk-6OHBW32Q.js +2853 -0
- package/dist/chunk-6OHBW32Q.js.map +1 -0
- package/dist/index.native.js +63 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.web.js +61 -0
- package/dist/index.web.js.map +1 -0
- package/package.json +9 -12
- package/src/coValues/account.ts +29 -10
- package/src/coValues/coFeed.ts +4 -3
- package/src/coValues/coList.ts +8 -5
- package/src/coValues/coMap.ts +14 -5
- package/src/coValues/deepLoading.ts +6 -12
- package/src/coValues/extensions/imageDef.ts +3 -1
- package/src/coValues/group.ts +8 -11
- package/src/coValues/inbox.ts +377 -0
- package/src/coValues/interfaces.ts +9 -6
- package/src/coValues/profile.ts +11 -0
- package/src/coValues/registeredSchemas.ts +12 -0
- package/src/exports.ts +21 -15
- package/src/implementation/anonymousJazzAgent.ts +6 -0
- package/src/implementation/createContext.ts +8 -9
- package/src/implementation/refs.ts +1 -1
- package/src/implementation/subscriptionScope.ts +1 -1
- package/src/index.native.ts +0 -1
- package/src/internal.ts +1 -9
- package/src/tests/account.test.ts +2 -2
- package/src/tests/coFeed.test.ts +0 -9
- package/src/tests/coMap.test.ts +11 -8
- package/src/tests/groupsAndAccounts.test.ts +1 -63
- package/src/tests/inbox.test.ts +299 -0
- package/src/tests/schemaUnion.test.ts +1 -1
- package/src/tests/utils.ts +14 -0
- package/tsup.config.ts +13 -0
- package/dist/native/coValues/account.js +0 -221
- package/dist/native/coValues/account.js.map +0 -1
- package/dist/native/coValues/coFeed.js +0 -571
- package/dist/native/coValues/coFeed.js.map +0 -1
- package/dist/native/coValues/coList.js +0 -404
- package/dist/native/coValues/coList.js.map +0 -1
- package/dist/native/coValues/coMap.js +0 -537
- package/dist/native/coValues/coMap.js.map +0 -1
- package/dist/native/coValues/deepLoading.js +0 -63
- package/dist/native/coValues/deepLoading.js.map +0 -1
- package/dist/native/coValues/extensions/imageDef.js +0 -42
- package/dist/native/coValues/extensions/imageDef.js.map +0 -1
- package/dist/native/coValues/group.js +0 -136
- package/dist/native/coValues/group.js.map +0 -1
- package/dist/native/coValues/interfaces.js +0 -135
- package/dist/native/coValues/interfaces.js.map +0 -1
- package/dist/native/coValues/schemaUnion.js +0 -89
- package/dist/native/coValues/schemaUnion.js.map +0 -1
- package/dist/native/exports.js +0 -5
- package/dist/native/exports.js.map +0 -1
- package/dist/native/implementation/createContext.js +0 -157
- package/dist/native/implementation/createContext.js.map +0 -1
- package/dist/native/implementation/devtoolsFormatters.js +0 -95
- package/dist/native/implementation/devtoolsFormatters.js.map +0 -1
- package/dist/native/implementation/errors.js +0 -2
- package/dist/native/implementation/errors.js.map +0 -1
- package/dist/native/implementation/inspect.js +0 -2
- package/dist/native/implementation/inspect.js.map +0 -1
- package/dist/native/implementation/refs.js +0 -115
- package/dist/native/implementation/refs.js.map +0 -1
- package/dist/native/implementation/schema.js +0 -96
- package/dist/native/implementation/schema.js.map +0 -1
- package/dist/native/implementation/subscriptionScope.js +0 -91
- package/dist/native/implementation/subscriptionScope.js.map +0 -1
- package/dist/native/implementation/symbols.js +0 -4
- package/dist/native/implementation/symbols.js.map +0 -1
- package/dist/native/index.native.js +0 -3
- package/dist/native/index.native.js.map +0 -1
- package/dist/native/internal.js +0 -18
- package/dist/native/internal.js.map +0 -1
- package/dist/native/lib/cache.js +0 -13
- package/dist/native/lib/cache.js.map +0 -1
- package/dist/native/lib/cache.test.js +0 -52
- package/dist/native/lib/cache.test.js.map +0 -1
- package/dist/web/coValues/account.js +0 -221
- package/dist/web/coValues/account.js.map +0 -1
- package/dist/web/coValues/coFeed.js +0 -571
- package/dist/web/coValues/coFeed.js.map +0 -1
- package/dist/web/coValues/coList.js +0 -404
- package/dist/web/coValues/coList.js.map +0 -1
- package/dist/web/coValues/coMap.js +0 -537
- package/dist/web/coValues/coMap.js.map +0 -1
- package/dist/web/coValues/deepLoading.js +0 -63
- package/dist/web/coValues/deepLoading.js.map +0 -1
- package/dist/web/coValues/extensions/imageDef.js +0 -42
- package/dist/web/coValues/extensions/imageDef.js.map +0 -1
- package/dist/web/coValues/group.js +0 -136
- package/dist/web/coValues/group.js.map +0 -1
- package/dist/web/coValues/interfaces.js +0 -135
- package/dist/web/coValues/interfaces.js.map +0 -1
- package/dist/web/coValues/schemaUnion.js +0 -89
- package/dist/web/coValues/schemaUnion.js.map +0 -1
- package/dist/web/exports.js +0 -5
- package/dist/web/exports.js.map +0 -1
- package/dist/web/implementation/createContext.js +0 -157
- package/dist/web/implementation/createContext.js.map +0 -1
- package/dist/web/implementation/devtoolsFormatters.js +0 -95
- package/dist/web/implementation/devtoolsFormatters.js.map +0 -1
- package/dist/web/implementation/errors.js +0 -2
- package/dist/web/implementation/errors.js.map +0 -1
- package/dist/web/implementation/inspect.js +0 -2
- package/dist/web/implementation/inspect.js.map +0 -1
- package/dist/web/implementation/refs.js +0 -115
- package/dist/web/implementation/refs.js.map +0 -1
- package/dist/web/implementation/schema.js +0 -96
- package/dist/web/implementation/schema.js.map +0 -1
- package/dist/web/implementation/subscriptionScope.js +0 -91
- package/dist/web/implementation/subscriptionScope.js.map +0 -1
- package/dist/web/implementation/symbols.js +0 -4
- package/dist/web/implementation/symbols.js.map +0 -1
- package/dist/web/index.web.js +0 -3
- package/dist/web/index.web.js.map +0 -1
- package/dist/web/internal.js +0 -18
- package/dist/web/internal.js.map +0 -1
- package/dist/web/lib/cache.js +0 -13
- package/dist/web/lib/cache.js.map +0 -1
- package/dist/web/lib/cache.test.js +0 -52
- package/dist/web/lib/cache.test.js.map +0 -1
@@ -1,136 +0,0 @@
|
|
1
|
-
var _a;
|
2
|
-
import { Account, AccountAndGroupProxyHandler, CoMap, CoValueBase, MembersSym, Ref, co, ensureCoValueLoaded, isControlledAccount, loadCoValue, subscribeToCoValue, subscribeToExistingCoValue, } from "../internal.js";
|
3
|
-
/** @category Identity & Permissions */
|
4
|
-
export class Profile extends CoMap {
|
5
|
-
constructor() {
|
6
|
-
super(...arguments);
|
7
|
-
this.name = co.string;
|
8
|
-
}
|
9
|
-
}
|
10
|
-
/** @category Identity & Permissions */
|
11
|
-
export class Group extends CoValueBase {
|
12
|
-
get _schema() {
|
13
|
-
return this.constructor._schema;
|
14
|
-
}
|
15
|
-
get _refs() {
|
16
|
-
const profileID = this._raw.get("profile");
|
17
|
-
const rootID = this._raw.get("root");
|
18
|
-
return {
|
19
|
-
profile: profileID &&
|
20
|
-
new Ref(profileID, this._loadedAs, this._schema.profile),
|
21
|
-
root: rootID &&
|
22
|
-
new Ref(rootID, this._loadedAs, this._schema.root),
|
23
|
-
};
|
24
|
-
}
|
25
|
-
/** @deprecated Don't use constructor directly, use .create */
|
26
|
-
constructor(options) {
|
27
|
-
super();
|
28
|
-
let raw;
|
29
|
-
if (options && "fromRaw" in options) {
|
30
|
-
raw = options.fromRaw;
|
31
|
-
}
|
32
|
-
else {
|
33
|
-
const initOwner = options.owner;
|
34
|
-
if (!initOwner)
|
35
|
-
throw new Error("No owner provided");
|
36
|
-
if (initOwner._type === "Account" && isControlledAccount(initOwner)) {
|
37
|
-
const rawOwner = initOwner._raw;
|
38
|
-
raw = rawOwner.createGroup();
|
39
|
-
}
|
40
|
-
else {
|
41
|
-
throw new Error("Can only construct group as a controlled account");
|
42
|
-
}
|
43
|
-
}
|
44
|
-
Object.defineProperties(this, {
|
45
|
-
id: {
|
46
|
-
value: raw.id,
|
47
|
-
enumerable: false,
|
48
|
-
},
|
49
|
-
_raw: { value: raw, enumerable: false },
|
50
|
-
});
|
51
|
-
return new Proxy(this, AccountAndGroupProxyHandler);
|
52
|
-
}
|
53
|
-
static create(options) {
|
54
|
-
return new this(options);
|
55
|
-
}
|
56
|
-
myRole() {
|
57
|
-
return this._raw.myRole();
|
58
|
-
}
|
59
|
-
addMember(member, role) {
|
60
|
-
this._raw.addMember(member === "everyone" ? member : member._raw, role);
|
61
|
-
return this;
|
62
|
-
}
|
63
|
-
removeMember(member) {
|
64
|
-
this._raw.removeMember(member === "everyone" ? member : member._raw);
|
65
|
-
return this;
|
66
|
-
}
|
67
|
-
get members() {
|
68
|
-
return this._raw
|
69
|
-
.keys()
|
70
|
-
.filter((key) => {
|
71
|
-
return key === "everyone" || key.startsWith("co_");
|
72
|
-
})
|
73
|
-
.map((id) => {
|
74
|
-
const role = this._raw.get(id);
|
75
|
-
const accountID = id === "everyone" ? undefined : id;
|
76
|
-
const ref = accountID &&
|
77
|
-
new Ref(accountID, this._loadedAs, this._schema[MembersSym]);
|
78
|
-
const accessRef = () => ref?.accessFrom(this, "members." + id);
|
79
|
-
return {
|
80
|
-
id: id,
|
81
|
-
role,
|
82
|
-
ref,
|
83
|
-
get account() {
|
84
|
-
return accessRef();
|
85
|
-
},
|
86
|
-
};
|
87
|
-
});
|
88
|
-
}
|
89
|
-
extend(parent) {
|
90
|
-
this._raw.extend(parent._raw);
|
91
|
-
return this;
|
92
|
-
}
|
93
|
-
/** @category Subscription & Loading */
|
94
|
-
static load(id, as, depth) {
|
95
|
-
return loadCoValue(this, id, as, depth);
|
96
|
-
}
|
97
|
-
/** @category Subscription & Loading */
|
98
|
-
static subscribe(id, as, depth, listener) {
|
99
|
-
return subscribeToCoValue(this, id, as, depth, listener);
|
100
|
-
}
|
101
|
-
/** @category Subscription & Loading */
|
102
|
-
ensureLoaded(depth) {
|
103
|
-
return ensureCoValueLoaded(this, depth);
|
104
|
-
}
|
105
|
-
/** @category Subscription & Loading */
|
106
|
-
subscribe(depth, listener) {
|
107
|
-
return subscribeToExistingCoValue(this, depth, listener);
|
108
|
-
}
|
109
|
-
/**
|
110
|
-
* Wait for the `Group` to be uploaded to the other peers.
|
111
|
-
*
|
112
|
-
* @category Subscription & Loading
|
113
|
-
*/
|
114
|
-
waitForSync(options) {
|
115
|
-
return this._raw.core.waitForSync(options);
|
116
|
-
}
|
117
|
-
}
|
118
|
-
_a = Group;
|
119
|
-
(() => {
|
120
|
-
_a.prototype._type = "Group";
|
121
|
-
})();
|
122
|
-
(() => {
|
123
|
-
_a._schema = {
|
124
|
-
profile: "json",
|
125
|
-
root: "json",
|
126
|
-
[MembersSym]: {
|
127
|
-
ref: () => Account,
|
128
|
-
optional: false,
|
129
|
-
},
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
131
|
-
};
|
132
|
-
Object.defineProperty(_a.prototype, "_schema", {
|
133
|
-
get: () => _a._schema,
|
134
|
-
});
|
135
|
-
})();
|
136
|
-
//# sourceMappingURL=group.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"group.js","sourceRoot":"","sources":["../../../src/coValues/group.ts"],"names":[],"mappings":";AAUA,OAAO,EACL,OAAO,EACP,2BAA2B,EAC3B,KAAK,EACL,WAAW,EACX,UAAU,EACV,GAAG,EACH,EAAE,EACF,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,uCAAuC;AACvC,MAAM,OAAO,OAAQ,SAAQ,KAAK;IAAlC;;QACE,SAAI,GAAG,EAAE,CAAC,MAAM,CAAC;IACnB,CAAC;CAAA;AAED,uCAAuC;AACvC,MAAM,OAAO,KAAM,SAAQ,WAAW;IAUpC,IAAI,OAAO;QAKT,OAAQ,IAAI,CAAC,WAA4B,CAAC,OAAO,CAAC;IACpD,CAAC;IAoBD,IAAI,KAAK;QAIP,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAE5B,CAAC;QACd,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAEtB,CAAC;QACd,OAAO;YACL,OAAO,EACL,SAAS;gBACR,IAAI,GAAG,CACN,SAAS,EACT,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,OAAO,CAAC,OAAmD,CAIxD;YACZ,IAAI,EACF,MAAM;gBACL,IAAI,GAAG,CACN,MAAM,EACN,IAAI,CAAC,SAAS,EACd,IAA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 +0,0 @@
|
|
1
|
-
import { RawAccount } from "cojson";
|
2
|
-
import { Account, AnonymousJazzAgent, Group, Ref, SubscriptionScope, inspect, subscriptionsScopes, } from "../internal.js";
|
3
|
-
import { coValuesCache } from "../lib/cache.js";
|
4
|
-
import { fulfillsDepth } from "./deepLoading.js";
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
6
|
-
export function isCoValue(value) {
|
7
|
-
return value && value._type !== undefined;
|
8
|
-
}
|
9
|
-
export function isCoValueClass(
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
11
|
-
value) {
|
12
|
-
return typeof value === "function" && value.fromRaw !== undefined;
|
13
|
-
}
|
14
|
-
/** @internal */
|
15
|
-
export class CoValueBase {
|
16
|
-
get _owner() {
|
17
|
-
const owner = this._raw.group instanceof RawAccount
|
18
|
-
? Account.fromRaw(this._raw.group)
|
19
|
-
: Group.fromRaw(this._raw.group);
|
20
|
-
const subScope = subscriptionsScopes.get(this);
|
21
|
-
if (subScope) {
|
22
|
-
subScope.onRefAccessedOrSet(this.id, owner.id);
|
23
|
-
subscriptionsScopes.set(owner, subScope);
|
24
|
-
}
|
25
|
-
return owner;
|
26
|
-
}
|
27
|
-
/** @private */
|
28
|
-
get _loadedAs() {
|
29
|
-
const rawAccount = this._raw.core.node.account;
|
30
|
-
if (rawAccount instanceof RawAccount) {
|
31
|
-
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
32
|
-
}
|
33
|
-
return new AnonymousJazzAgent(this._raw.core.node);
|
34
|
-
}
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
36
|
-
constructor(..._args) {
|
37
|
-
Object.defineProperty(this, "_instanceID", {
|
38
|
-
value: `instance-${Math.random().toString(36).slice(2)}`,
|
39
|
-
enumerable: false,
|
40
|
-
});
|
41
|
-
}
|
42
|
-
/** @category Internals */
|
43
|
-
static fromRaw(raw) {
|
44
|
-
return new this({ fromRaw: raw });
|
45
|
-
}
|
46
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
47
|
-
toJSON() {
|
48
|
-
return {
|
49
|
-
id: this.id,
|
50
|
-
type: this._type,
|
51
|
-
error: "unknown CoValue class",
|
52
|
-
};
|
53
|
-
}
|
54
|
-
[inspect]() {
|
55
|
-
return this.toJSON();
|
56
|
-
}
|
57
|
-
/** @category Type Helpers */
|
58
|
-
castAs(cl) {
|
59
|
-
const casted = cl.fromRaw(this._raw);
|
60
|
-
const subscriptionScope = subscriptionsScopes.get(this);
|
61
|
-
if (subscriptionScope) {
|
62
|
-
subscriptionsScopes.set(casted, subscriptionScope);
|
63
|
-
}
|
64
|
-
return casted;
|
65
|
-
}
|
66
|
-
}
|
67
|
-
export function loadCoValue(cls, id, as, depth) {
|
68
|
-
return new Promise((resolve) => {
|
69
|
-
const unsubscribe = subscribeToCoValue(cls, id, as, depth, (value) => {
|
70
|
-
resolve(value);
|
71
|
-
unsubscribe();
|
72
|
-
}, () => {
|
73
|
-
resolve(undefined);
|
74
|
-
unsubscribe();
|
75
|
-
});
|
76
|
-
});
|
77
|
-
}
|
78
|
-
export function ensureCoValueLoaded(existing, depth) {
|
79
|
-
return loadCoValue(existing.constructor, existing.id, existing._loadedAs, depth);
|
80
|
-
}
|
81
|
-
export function subscribeToCoValue(cls, id, as, depth, listener, onUnavailable) {
|
82
|
-
const ref = new Ref(id, as, { ref: cls, optional: false });
|
83
|
-
let unsubscribed = false;
|
84
|
-
let unsubscribe;
|
85
|
-
ref
|
86
|
-
.load()
|
87
|
-
.then((value) => {
|
88
|
-
if (!value) {
|
89
|
-
onUnavailable && onUnavailable();
|
90
|
-
return;
|
91
|
-
}
|
92
|
-
if (unsubscribed)
|
93
|
-
return;
|
94
|
-
const subscription = new SubscriptionScope(value, cls, (update) => {
|
95
|
-
if (fulfillsDepth(depth, update)) {
|
96
|
-
listener(update);
|
97
|
-
}
|
98
|
-
});
|
99
|
-
unsubscribe = () => subscription.unsubscribeAll();
|
100
|
-
})
|
101
|
-
.catch((e) => {
|
102
|
-
console.error("Failed to load / subscribe to CoValue", e);
|
103
|
-
});
|
104
|
-
return function unsubscribeAtAnyPoint() {
|
105
|
-
unsubscribed = true;
|
106
|
-
unsubscribe && unsubscribe();
|
107
|
-
};
|
108
|
-
}
|
109
|
-
export function createCoValueObservable() {
|
110
|
-
let currentValue = undefined;
|
111
|
-
let subscriberCount = 0;
|
112
|
-
function subscribe(cls, id, as, depth, listener, onUnavailable) {
|
113
|
-
subscriberCount++;
|
114
|
-
const unsubscribe = subscribeToCoValue(cls, id, as, depth, (value) => {
|
115
|
-
currentValue = value;
|
116
|
-
listener();
|
117
|
-
}, onUnavailable);
|
118
|
-
return () => {
|
119
|
-
unsubscribe();
|
120
|
-
subscriberCount--;
|
121
|
-
if (subscriberCount === 0) {
|
122
|
-
currentValue = undefined;
|
123
|
-
}
|
124
|
-
};
|
125
|
-
}
|
126
|
-
const observable = {
|
127
|
-
getCurrentValue: () => currentValue,
|
128
|
-
subscribe,
|
129
|
-
};
|
130
|
-
return observable;
|
131
|
-
}
|
132
|
-
export function subscribeToExistingCoValue(existing, depth, listener) {
|
133
|
-
return subscribeToCoValue(existing.constructor, existing.id, existing._loadedAs, depth, listener);
|
134
|
-
}
|
135
|
-
//# sourceMappingURL=interfaces.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/coValues/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACL,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,GAAG,EACH,iBAAiB,EACjB,OAAO,EACP,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAmCjD,8DAA8D;AAC9D,MAAM,UAAU,SAAS,CAAC,KAAU;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CAAC;IAEL,OAAO,SAAS,qBAAqB;QACnC,YAAY,GAAG,IAAI,CAAC;QACpB,WAAW,IAAI,WAAW,EAAE,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,IAAI,YAAY,GAAuC,SAAS,CAAC;IACjE,IAAI,eAAe,GAAG,CAAC,CAAC;IAExB,SAAS,SAAS,CAChB,GAAoB,EACpB,EAAS,EACT,EAAgC,EAChC,KAA0B,EAC1B,QAAoB,EACpB,aAA0B;QAE1B,eAAe,EAAE,CAAC;QAElB,MAAM,WAAW,GAAG,kBAAkB,CACpC,GAAG,EACH,EAAE,EACF,EAAE,EACF,KAAK,EACL,CAAC,KAAK,EAAE,EAAE;YACR,YAAY,GAAG,KAAK,CAAC;YACrB,QAAQ,EAAE,CAAC;QACb,CAAC,EACD,aAAa,CACd,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,CAAC;YAClB,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;gBAC1B,YAAY,GAAG,SAAS,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,UAAU,GAAG;QACjB,eAAe,EAAE,GAAG,EAAE,CAAC,YAAY;QACnC,SAAS;KACV,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,QAAW,EACX,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,kBAAkB,CACvB,QAAQ,CAAC,WAA8B,EACvC,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,SAAS,EAClB,KAAK,EACL,QAAQ,CACT,CAAC;AACJ,CAAC"}
|
@@ -1,89 +0,0 @@
|
|
1
|
-
import { CoValueBase, } from "../internal.js";
|
2
|
-
/**
|
3
|
-
* SchemaUnion allows you to create union types of CoValues that can be discriminated at runtime.
|
4
|
-
*
|
5
|
-
* @categoryDescription Declaration
|
6
|
-
* Declare your union types by extending `SchemaUnion.Of(...)` and passing a discriminator function that determines which concrete type to use based on the raw data.
|
7
|
-
*
|
8
|
-
* ```ts
|
9
|
-
* import { SchemaUnion, CoMap } from "jazz-tools";
|
10
|
-
*
|
11
|
-
* class BaseWidget extends CoMap {
|
12
|
-
* type = co.string;
|
13
|
-
* }
|
14
|
-
*
|
15
|
-
* class ButtonWidget extends BaseWidget {
|
16
|
-
* type = co.literal("button");
|
17
|
-
* label = co.string;
|
18
|
-
* }
|
19
|
-
*
|
20
|
-
* class SliderWidget extends BaseWidget {
|
21
|
-
* type = co.literal("slider");
|
22
|
-
* min = co.number;
|
23
|
-
* max = co.number;
|
24
|
-
* }
|
25
|
-
*
|
26
|
-
* const WidgetUnion = SchemaUnion.Of<BaseWidget>((raw) => {
|
27
|
-
* switch (raw.get("type")) {
|
28
|
-
* case "button": return ButtonWidget;
|
29
|
-
* case "slider": return SliderWidget;
|
30
|
-
* default: throw new Error("Unknown widget type");
|
31
|
-
* }
|
32
|
-
* });
|
33
|
-
* ```
|
34
|
-
*
|
35
|
-
* @category CoValues
|
36
|
-
*/
|
37
|
-
export class SchemaUnion extends CoValueBase {
|
38
|
-
/**
|
39
|
-
* Create a new union type from a discriminator function.
|
40
|
-
*
|
41
|
-
* The discriminator function receives the raw data and should return the appropriate concrete class to use for that data.
|
42
|
-
*
|
43
|
-
* When loading a SchemaUnion, the correct subclass will be instantiated based on the discriminator.
|
44
|
-
*
|
45
|
-
* @param discriminator - Function that determines which concrete type to use
|
46
|
-
* @returns A new class that can create/load instances of the union type
|
47
|
-
*
|
48
|
-
* @example
|
49
|
-
* ```ts
|
50
|
-
* const WidgetUnion = SchemaUnion.Of<BaseWidget>((raw) => {
|
51
|
-
* switch (raw.get("type")) {
|
52
|
-
* case "button": return ButtonWidget;
|
53
|
-
* case "slider": return SliderWidget;
|
54
|
-
* default: throw new Error("Unknown widget type");
|
55
|
-
* }
|
56
|
-
* });
|
57
|
-
*
|
58
|
-
* const widget = await loadCoValue(WidgetUnion, id, me, {});
|
59
|
-
*
|
60
|
-
* // You can narrow the returned instance to a subclass by using `instanceof`
|
61
|
-
* if (widget instanceof ButtonWidget) {
|
62
|
-
* console.log(widget.label);
|
63
|
-
* } else if (widget instanceof SliderWidget) {
|
64
|
-
* console.log(widget.min, widget.max);
|
65
|
-
* }
|
66
|
-
* ```
|
67
|
-
*
|
68
|
-
* @category Declaration
|
69
|
-
**/
|
70
|
-
static Of(discriminator) {
|
71
|
-
return class SchemaUnionClass extends SchemaUnion {
|
72
|
-
static fromRaw(raw) {
|
73
|
-
const ResolvedClass = discriminator(raw);
|
74
|
-
return ResolvedClass.fromRaw(raw);
|
75
|
-
}
|
76
|
-
};
|
77
|
-
}
|
78
|
-
/**
|
79
|
-
* Create an instance from raw data. This is called internally and should not be used directly.
|
80
|
-
* Use {@link SchemaUnion.Of} to create a union type instead.
|
81
|
-
*
|
82
|
-
* @internal
|
83
|
-
*/
|
84
|
-
// @ts-ignore
|
85
|
-
static fromRaw(raw) {
|
86
|
-
throw new Error("Not implemented");
|
87
|
-
}
|
88
|
-
}
|
89
|
-
//# sourceMappingURL=schemaUnion.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"schemaUnion.js","sourceRoot":"","sources":["../../../src/coValues/schemaUnion.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,GAGZ,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,OAAgB,WAAY,SAAQ,WAAW;IACnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QA+BI;IACJ,MAAM,CAAC,EAAE,CACP,aAAsE;QAEtE,OAAO,MAAM,gBAAiB,SAAQ,WAAW;YAC/C,MAAM,CAAU,OAAO,CAErB,GAAc;gBAEd,MAAM,aAAa,GAAG,aAAa,CACjC,GAAgB,CACiC,CAAC;gBACpD,OAAO,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACpC,CAAC;SACiD,CAAC;IACvD,CAAC;IAED;;;;;OAKG;IACH,aAAa;IACb,MAAM,CAAC,OAAO,CAA2C,GAAc;QACrE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;CACF"}
|
package/dist/native/exports.js
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
export { Encoders, co } from "./internal.js";
|
2
|
-
export { Account, FileStream, BinaryCoStream, CoList, CoMap, CoFeed, CoStream, CoValueBase, Group, ImageDefinition, Profile, isControlledAccount, SchemaUnion, } from "./internal.js";
|
3
|
-
export { createCoValueObservable, loadCoValue, subscribeToCoValue, } from "./internal.js";
|
4
|
-
export { AnonymousJazzAgent, createAnonymousJazzContext, createJazzContext, ephemeralCredentialsAuth, fixedCredentialsAuth, randomSessionProvider, } from "./internal.js";
|
5
|
-
//# sourceMappingURL=exports.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../src/exports.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EACL,OAAO,EACP,UAAU,EACV,cAAc,EACd,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,WAAW,EACX,KAAK,EACL,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,WAAW,GAIZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,kBAAkB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,GAItB,MAAM,eAAe,CAAC"}
|
@@ -1,157 +0,0 @@
|
|
1
|
-
import { ControlledAgent, LocalNode, } from "cojson";
|
2
|
-
import { Account } from "../internal.js";
|
3
|
-
export const fixedCredentialsAuth = (credentials) => {
|
4
|
-
return {
|
5
|
-
start: async () => ({
|
6
|
-
type: "existing",
|
7
|
-
credentials,
|
8
|
-
saveCredentials: async () => { },
|
9
|
-
onSuccess: () => { },
|
10
|
-
onError: () => { },
|
11
|
-
logOut: () => { },
|
12
|
-
}),
|
13
|
-
};
|
14
|
-
};
|
15
|
-
export const ephemeralCredentialsAuth = () => {
|
16
|
-
return {
|
17
|
-
start: async () => ({
|
18
|
-
type: "new",
|
19
|
-
creationProps: { name: "Ephemeral" },
|
20
|
-
saveCredentials: async () => { },
|
21
|
-
onSuccess: () => { },
|
22
|
-
onError: () => { },
|
23
|
-
logOut: () => { },
|
24
|
-
}),
|
25
|
-
};
|
26
|
-
};
|
27
|
-
export async function randomSessionProvider(accountID, crypto) {
|
28
|
-
return {
|
29
|
-
sessionID: crypto.newRandomSessionID(accountID),
|
30
|
-
sessionDone: () => { },
|
31
|
-
};
|
32
|
-
}
|
33
|
-
export async function createJazzContext(options) {
|
34
|
-
// eslint-disable-next-line no-constant-condition
|
35
|
-
while (true) {
|
36
|
-
if (!("auth" in options)) {
|
37
|
-
return createAnonymousJazzContext({
|
38
|
-
peersToLoadFrom: options.peersToLoadFrom,
|
39
|
-
crypto: options.crypto,
|
40
|
-
});
|
41
|
-
}
|
42
|
-
const { auth, sessionProvider, peersToLoadFrom, crypto } = options;
|
43
|
-
const AccountSchema = options.AccountSchema ?? Account;
|
44
|
-
let authResult;
|
45
|
-
try {
|
46
|
-
authResult = await auth.start(crypto);
|
47
|
-
}
|
48
|
-
catch (e) {
|
49
|
-
console.error("error", e);
|
50
|
-
throw e;
|
51
|
-
}
|
52
|
-
if (authResult.type === "existing") {
|
53
|
-
try {
|
54
|
-
const { sessionID, sessionDone } = await sessionProvider(authResult.credentials.accountID, crypto);
|
55
|
-
try {
|
56
|
-
const node = await LocalNode.withLoadedAccount({
|
57
|
-
accountID: authResult.credentials
|
58
|
-
.accountID,
|
59
|
-
accountSecret: authResult.credentials.secret,
|
60
|
-
sessionID: sessionID,
|
61
|
-
peersToLoadFrom: peersToLoadFrom,
|
62
|
-
crypto: crypto,
|
63
|
-
migration: async (rawAccount, _node, creationProps) => {
|
64
|
-
const account = new AccountSchema({
|
65
|
-
fromRaw: rawAccount,
|
66
|
-
});
|
67
|
-
await account.migrate?.(creationProps);
|
68
|
-
},
|
69
|
-
});
|
70
|
-
const account = AccountSchema.fromNode(node);
|
71
|
-
if (authResult.saveCredentials) {
|
72
|
-
await authResult.saveCredentials({
|
73
|
-
accountID: node.account.id,
|
74
|
-
secret: node.account.agentSecret,
|
75
|
-
});
|
76
|
-
}
|
77
|
-
authResult.onSuccess();
|
78
|
-
return {
|
79
|
-
account,
|
80
|
-
done: () => {
|
81
|
-
node.gracefulShutdown();
|
82
|
-
sessionDone();
|
83
|
-
},
|
84
|
-
logOut: () => {
|
85
|
-
node.gracefulShutdown();
|
86
|
-
sessionDone();
|
87
|
-
authResult.logOut();
|
88
|
-
},
|
89
|
-
};
|
90
|
-
}
|
91
|
-
catch (e) {
|
92
|
-
authResult.onError(new Error("Error loading account", { cause: e }));
|
93
|
-
sessionDone();
|
94
|
-
}
|
95
|
-
}
|
96
|
-
catch (e) {
|
97
|
-
authResult.onError(new Error("Error acquiring sessionID", { cause: e }));
|
98
|
-
}
|
99
|
-
}
|
100
|
-
else if (authResult.type === "new") {
|
101
|
-
try {
|
102
|
-
// TODO: figure out a way to not "waste" the first SessionID
|
103
|
-
const { node } = await LocalNode.withNewlyCreatedAccount({
|
104
|
-
creationProps: authResult.creationProps,
|
105
|
-
peersToLoadFrom: peersToLoadFrom,
|
106
|
-
crypto: crypto,
|
107
|
-
initialAgentSecret: authResult.initialSecret,
|
108
|
-
migration: async (rawAccount, _node, creationProps) => {
|
109
|
-
const account = new AccountSchema({
|
110
|
-
fromRaw: rawAccount,
|
111
|
-
});
|
112
|
-
await account.migrate?.(creationProps);
|
113
|
-
},
|
114
|
-
});
|
115
|
-
const account = AccountSchema.fromNode(node);
|
116
|
-
await authResult.saveCredentials({
|
117
|
-
accountID: node.account.id,
|
118
|
-
secret: node.account.agentSecret,
|
119
|
-
});
|
120
|
-
authResult.onSuccess();
|
121
|
-
return {
|
122
|
-
account,
|
123
|
-
done: () => {
|
124
|
-
node.gracefulShutdown();
|
125
|
-
},
|
126
|
-
logOut: () => {
|
127
|
-
node.gracefulShutdown();
|
128
|
-
authResult.logOut();
|
129
|
-
},
|
130
|
-
};
|
131
|
-
}
|
132
|
-
catch (e) {
|
133
|
-
authResult.onError(new Error("Error creating account", { cause: e }));
|
134
|
-
}
|
135
|
-
}
|
136
|
-
}
|
137
|
-
}
|
138
|
-
export class AnonymousJazzAgent {
|
139
|
-
constructor(node) {
|
140
|
-
this.node = node;
|
141
|
-
this._type = "Anonymous";
|
142
|
-
}
|
143
|
-
}
|
144
|
-
export async function createAnonymousJazzContext({ peersToLoadFrom, crypto, }) {
|
145
|
-
const agentSecret = crypto.newRandomAgentSecret();
|
146
|
-
const rawAgent = new ControlledAgent(agentSecret, crypto);
|
147
|
-
const node = new LocalNode(rawAgent, crypto.newRandomSessionID(rawAgent.id), crypto);
|
148
|
-
for (const peer of peersToLoadFrom) {
|
149
|
-
node.syncManager.addPeer(peer);
|
150
|
-
}
|
151
|
-
return {
|
152
|
-
agent: new AnonymousJazzAgent(node),
|
153
|
-
done: () => { },
|
154
|
-
logOut: () => { },
|
155
|
-
};
|
156
|
-
}
|
157
|
-
//# sourceMappingURL=createContext.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEf,SAAS,GAKV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;AA8B3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAGpC,EAAc,EAAE;IACf,OAAO;QACL,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAClB,IAAI,EAAE,UAAU;YAChB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QACnC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IAED,OAAO;QACL,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC;QACnC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;KACjB,CAAC;AACJ,CAAC"}
|
@@ -1,95 +0,0 @@
|
|
1
|
-
/* istanbul ignore file -- @preserve */
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
-
import { ItemsSym } from "./symbols.js";
|
4
|
-
globalThis.devtoolsFormatters = [
|
5
|
-
{
|
6
|
-
header: (object) => {
|
7
|
-
if (object._type === "CoMap") {
|
8
|
-
return ["div", {}, ["span", {}, object.constructor.name]];
|
9
|
-
}
|
10
|
-
else if (object._type === "CoList") {
|
11
|
-
return [
|
12
|
-
"div",
|
13
|
-
{},
|
14
|
-
["span", {}, object.constructor.name + "(" + object.length + ") "],
|
15
|
-
];
|
16
|
-
}
|
17
|
-
else if (object._type === "Account") {
|
18
|
-
return [
|
19
|
-
"div",
|
20
|
-
{},
|
21
|
-
[
|
22
|
-
"span",
|
23
|
-
{},
|
24
|
-
object.constructor.name +
|
25
|
-
"(" +
|
26
|
-
object._refs.profile.value?.name +
|
27
|
-
(object.isMe ? " ME" : "") +
|
28
|
-
")",
|
29
|
-
],
|
30
|
-
];
|
31
|
-
}
|
32
|
-
else {
|
33
|
-
return null;
|
34
|
-
}
|
35
|
-
},
|
36
|
-
hasBody: function () {
|
37
|
-
return true;
|
38
|
-
},
|
39
|
-
body: function (object) {
|
40
|
-
if (object._type === "CoMap" || object._type === "Account") {
|
41
|
-
return [
|
42
|
-
"div",
|
43
|
-
{ style: "margin-left: 15px" },
|
44
|
-
["div", "id: ", ["object", { object: object.id }]],
|
45
|
-
...Object.entries(object).map(([k, v]) => [
|
46
|
-
"div",
|
47
|
-
{ style: "white-space: nowrap;" },
|
48
|
-
["span", { style: "font-weight: bold; opacity: 0.6" }, k, ": "],
|
49
|
-
["object", { object: v }],
|
50
|
-
...(typeof object._schema[k] === "function"
|
51
|
-
? v === null
|
52
|
-
? [
|
53
|
-
[
|
54
|
-
"span",
|
55
|
-
{ style: "opacity: 0.5" },
|
56
|
-
` (pending ${object._schema[k].name} `,
|
57
|
-
["object", { object: object._refs[k] }],
|
58
|
-
")",
|
59
|
-
],
|
60
|
-
]
|
61
|
-
: []
|
62
|
-
: []),
|
63
|
-
]),
|
64
|
-
];
|
65
|
-
}
|
66
|
-
else if (object._type === "CoList") {
|
67
|
-
return [
|
68
|
-
"div",
|
69
|
-
{ style: "margin-left: 15px" },
|
70
|
-
["div", "id: ", ["object", { object: object.id }]],
|
71
|
-
...object.map((v, i) => [
|
72
|
-
"div",
|
73
|
-
{ style: "white-space: nowrap;" },
|
74
|
-
["span", { style: "font-weight: bold; opacity: 0.6" }, i, ": "],
|
75
|
-
["object", { object: v }],
|
76
|
-
...(typeof object._schema[ItemsSym] === "function"
|
77
|
-
? v === null
|
78
|
-
? [
|
79
|
-
[
|
80
|
-
"span",
|
81
|
-
{ style: "opacity: 0.5" },
|
82
|
-
` (pending ${object._schema[ItemsSym].name} `,
|
83
|
-
["object", { object: object._refs[i] }],
|
84
|
-
")",
|
85
|
-
],
|
86
|
-
]
|
87
|
-
: []
|
88
|
-
: []),
|
89
|
-
]),
|
90
|
-
];
|
91
|
-
}
|
92
|
-
},
|
93
|
-
},
|
94
|
-
];
|
95
|
-
//# sourceMappingURL=devtoolsFormatters.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"devtoolsFormatters.js","sourceRoot":"","sources":["../../../src/implementation/devtoolsFormatters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,uDAAuD;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAEvC,UAAkB,CAAC,kBAAkB,GAAG;IACvC;QACE,MAAM,EAAE,CAAC,MAAW,EAAE,EAAE;Y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