jazz-tools 0.8.13 → 0.8.15
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/native/coValues/coList.js +4 -2
- package/dist/native/coValues/coList.js.map +1 -1
- package/dist/native/coValues/interfaces.js +4 -2
- package/dist/native/coValues/interfaces.js.map +1 -1
- package/dist/native/exports.js.map +1 -1
- package/dist/native/implementation/createContext.js +8 -0
- package/dist/native/implementation/createContext.js.map +1 -1
- package/dist/web/coValues/coList.js +4 -2
- package/dist/web/coValues/coList.js.map +1 -1
- package/dist/web/coValues/interfaces.js +4 -2
- package/dist/web/coValues/interfaces.js.map +1 -1
- package/dist/web/exports.js.map +1 -1
- package/dist/web/implementation/createContext.js +8 -0
- package/dist/web/implementation/createContext.js.map +1 -1
- package/package.json +1 -1
- package/src/coValues/coList.ts +6 -2
- package/src/coValues/interfaces.ts +6 -2
- package/src/exports.ts +1 -0
- package/src/implementation/createContext.ts +18 -5
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# jazz-tools
|
2
2
|
|
3
|
+
## 0.8.15
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- cce679b: Export `type Credentials` and mark `AuthResult.saveCredentials` as optional and run if available
|
8
|
+
|
9
|
+
## 0.8.14
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 36273b3: Cache other usages of Account.fromRaw
|
14
|
+
|
3
15
|
## 0.8.13
|
4
16
|
|
5
17
|
### Patch Changes
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { RawAccount } from "cojson";
|
2
2
|
import { Account, AnonymousJazzAgent, Group, ItemsSym, Ref, SchemaInit, co, ensureCoValueLoaded, inspect, isRefEncoded, loadCoValue, makeRefs, subscribeToCoValue, subscribeToExistingCoValue, subscriptionsScopes, } from "../internal.js";
|
3
|
+
import { coValuesCache } from "../lib/cache.js";
|
3
4
|
/**
|
4
5
|
* CoLists are collaborative versions of plain arrays.
|
5
6
|
*
|
@@ -87,8 +88,9 @@ export class CoList extends Array {
|
|
87
88
|
throw new Error("Not implemented");
|
88
89
|
}
|
89
90
|
get _loadedAs() {
|
90
|
-
|
91
|
-
|
91
|
+
const rawAccount = this._raw.core.node.account;
|
92
|
+
if (rawAccount instanceof RawAccount) {
|
93
|
+
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
92
94
|
}
|
93
95
|
return new AnonymousJazzAgent(this._raw.core.node);
|
94
96
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../../src/coValues/coList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../../src/coValues/coList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,8DAA8D;AAC9D,MAAM,OAAO,MAAmB,SAAQ,KAAW;IAC/C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,CAAO,IAAU;QACtB,wCAAwC;QACxC,OAAO,MA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UAAU,CAAC,KAAK;YAChB,GAAG,KAAK,QAAQ;YAChB,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ;YACpC,UAAU,IAAI,UAAU,CAAC,KAAK,EAChC,CAAC;YACE,MAAM,CAAC,WAA6B,CAAC,OAAO,KAAK,EAAE,CAAC;YACpD,MAAM,CAAC,WAA6B,CAAC,OAAO,CAAC,QAAQ,CAAC;gBACnD,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QAChB,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IACD,GAAG,CAAC,MAAM,EAAE,GAAG;QACX,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC;QACtD,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;CACJ,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { RawAccount } from "cojson";
|
2
2
|
import { Account, Group, SubscriptionScope, Ref, inspect, subscriptionsScopes, AnonymousJazzAgent, } from "../internal.js";
|
3
3
|
import { fulfillsDepth } from "./deepLoading.js";
|
4
|
+
import { coValuesCache } from "../lib/cache.js";
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5
6
|
export function isCoValue(value) {
|
6
7
|
return value && value._type !== undefined;
|
@@ -25,8 +26,9 @@ export class CoValueBase {
|
|
25
26
|
}
|
26
27
|
/** @private */
|
27
28
|
get _loadedAs() {
|
28
|
-
|
29
|
-
|
29
|
+
const rawAccount = this._raw.core.node.account;
|
30
|
+
if (rawAccount instanceof RawAccount) {
|
31
|
+
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
30
32
|
}
|
31
33
|
return new AnonymousJazzAgent(this._raw.core.node);
|
32
34
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/coValues/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACH,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/coValues/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EACH,OAAO,EACP,KAAK,EACL,iBAAiB,EACjB,GAAG,EACH,OAAO,EACP,mBAAmB,EACnB,kBAAkB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAmChD,8DAA8D;AAC9D,MAAM,UAAU,SAAS,CAAC,KAAU;IAChC,OAAO,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,cAAc;AAC1B,8DAA8D;AAC9D,KAAU;IAEV,OAAO,OAAO,KAAK,KAAK,UAAU,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC;AACtE,CAAC;AAOD,gBAAgB;AAChB,MAAM,OAAO,WAAW;IAOpB,IAAI,MAAM;QACN,MAAM,KAAK,GACP,IAAI,CAAC,IAAI,CAAC,KAAK,YAAY,UAAU;YACjC,CAAC,CAAC,OA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F,KAAK,EACL,CAAC,KAAK,EAAE,EAAE;YACN,YAAY,GAAG,KAAK,CAAC;YACrB,QAAQ,EAAE,CAAC;QACf,CAAC,EACD,aAAa,CAChB,CAAC;QAEF,OAAO,WAAW,CAAA;IACtB,CAAC;IAED,MAAM,UAAU,GAAG;QACf,eAAe,EAAE,GAAG,EAAE,CAAC,YAAY;QACnC,SAAS;KACZ,CAAC;IAEF,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,0BAA0B,CACtC,QAAW,EACX,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,kBAAkB,CACrB,QAAQ,CAAC,WAA8B,EACvC,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,SAAS,EAClB,KAAK,EACL,QAAQ,CACX,CAAC;AACN,CAAC"}
|
@@ -1 +1 @@
|
|
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,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,
|
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,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAIH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
|
@@ -5,6 +5,7 @@ export const fixedCredentialsAuth = (credentials) => {
|
|
5
5
|
start: async () => ({
|
6
6
|
type: "existing",
|
7
7
|
credentials,
|
8
|
+
saveCredentials: async () => { },
|
8
9
|
onSuccess: () => { },
|
9
10
|
onError: () => { },
|
10
11
|
logOut: () => { },
|
@@ -67,6 +68,13 @@ export async function createJazzContext(options) {
|
|
67
68
|
},
|
68
69
|
});
|
69
70
|
const account = AccountSchema.fromNode(node);
|
71
|
+
if (authResult.saveCredentials) {
|
72
|
+
await authResult.saveCredentials({
|
73
|
+
accountID: node.account
|
74
|
+
.id,
|
75
|
+
secret: node.account.agentSecret,
|
76
|
+
});
|
77
|
+
}
|
70
78
|
authResult.onSuccess();
|
71
79
|
return {
|
72
80
|
account,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;AA8B3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,WAGpC,EAAc,EAAE;IACb,OAAO;QACH,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAChB,IAAI,EAAE,UAAU;YAChB,WAAW;YACX,eAAe,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;YAC/B,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;SACnB,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAe,EAAE;IACrD,OAAO;QACH,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YAChB,IAAI,EAAE,KAAK;YACX,aAAa,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;YACpC,eAAe,EAAE,KAAK,IAAI,EAAE,GAAE,CAAC;YAC/B,SAAS,EAAE,GAAG,EAAE,GAAE,CAAC;YACnB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;YACjB,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;SACnB,CAAC;KACL,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACvC,SAAsB,EACtB,MAAsB;IAEtB,OAAO;QACH,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAChC,SAAoC,CACvC;QACD,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;KACxB,CAAC;AACN,CAAC;AA8CD,M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AAI,CAAW;IAAG,CAAC;CACzC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAC7C,eAAe,EACf,MAAM,GAIT;IACG,MAAM,WAAW,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;IAClD,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE1D,MAAM,IAAI,GAAG,IAAI,SAAS,CACtB,QAAQ,EACR,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,EACtC,MAAM,CACT,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACH,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC;QACnC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB,CAAC;AACN,CAAC"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { RawAccount } from "cojson";
|
2
2
|
import { Account, AnonymousJazzAgent, Group, ItemsSym, Ref, SchemaInit, co, ensureCoValueLoaded, inspect, isRefEncoded, loadCoValue, makeRefs, subscribeToCoValue, subscribeToExistingCoValue, subscriptionsScopes, } from "../internal.js";
|
3
|
+
import { coValuesCache } from "../lib/cache.js";
|
3
4
|
/**
|
4
5
|
* CoLists are collaborative versions of plain arrays.
|
5
6
|
*
|
@@ -87,8 +88,9 @@ export class CoList extends Array {
|
|
87
88
|
throw new Error("Not implemented");
|
88
89
|
}
|
89
90
|
get _loadedAs() {
|
90
|
-
|
91
|
-
|
91
|
+
const rawAccount = this._raw.core.node.account;
|
92
|
+
if (rawAccount instanceof RawAccount) {
|
93
|
+
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
92
94
|
}
|
93
95
|
return new AnonymousJazzAgent(this._raw.core.node);
|
94
96
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../../src/coValues/coList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../../src/coValues/coList.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAapC,OAAO,EACH,OAAO,EACP,kBAAkB,EAClB,KAAK,EACL,QAAQ,EACR,GAAG,EACH,UAAU,EACV,EAAE,EACF,mBAAmB,EACnB,OAAO,EACP,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,mBAAmB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,8DAA8D;AAC9D,MAAM,OAAO,MAAmB,SAAQ,KAAW;IAC/C;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,EAAE,CAAO,IAAU;QACtB,wCAAwC;QACxC,OAAO,MAAM,QAAS,SAAQ,MAAY;YACtC,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;SACrB,CAAC;IACN,CAAC;IAED;;wDAEoD;IACpD,MAAM,CAAC,EAAE,CAAC,GAAG,KAAY;QACrB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC;IAQD;QACI,IAAI,CAAC,SAAS,CAAC,KAAK,GAAG,QAAQ,CAAC;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AU,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QAChB,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,CAAC;QAC3D,CAAC;IACL,CAAC;IACD,GAAG,CAAC,MAAM,EAAE,GAAG;QACX,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,OAAO,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC;QACtD,CAAC;aAAM,CAAC;YACJ,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;CACJ,CAAC"}
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { RawAccount } from "cojson";
|
2
2
|
import { Account, Group, SubscriptionScope, Ref, inspect, subscriptionsScopes, AnonymousJazzAgent, } from "../internal.js";
|
3
3
|
import { fulfillsDepth } from "./deepLoading.js";
|
4
|
+
import { coValuesCache } from "../lib/cache.js";
|
4
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
5
6
|
export function isCoValue(value) {
|
6
7
|
return value && value._type !== undefined;
|
@@ -25,8 +26,9 @@ export class CoValueBase {
|
|
25
26
|
}
|
26
27
|
/** @private */
|
27
28
|
get _loadedAs() {
|
28
|
-
|
29
|
-
|
29
|
+
const rawAccount = this._raw.core.node.account;
|
30
|
+
if (rawAccount instanceof RawAccount) {
|
31
|
+
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount));
|
30
32
|
}
|
31
33
|
return new AnonymousJazzAgent(this._raw.core.node);
|
32
34
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/coValues/interfaces.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QA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CAAC;AAED,MAAM,UAAU,0BAA0B,CACtC,QAAW,EACX,KAA0B,EAC1B,QAAiD;IAEjD,OAAO,kBAAkB,CACrB,QAAQ,CAAC,WAA8B,EACvC,QAAQ,CAAC,EAAE,EACX,QAAQ,CAAC,SAAS,EAClB,KAAK,EACL,QAAQ,CACX,CAAC;AACN,CAAC"}
|
package/dist/web/exports.js.map
CHANGED
@@ -1 +1 @@
|
|
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,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,
|
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,EAAE,KAAK,EAAkB,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAqB,MAAM,eAAe,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAqB,MAAM,eAAe,CAAC;AAG/D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAEzF,OAAO,EAIH,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,0BAA0B,EAC1B,qBAAqB,GACxB,MAAM,eAAe,CAAC"}
|
@@ -5,6 +5,7 @@ export const fixedCredentialsAuth = (credentials) => {
|
|
5
5
|
start: async () => ({
|
6
6
|
type: "existing",
|
7
7
|
credentials,
|
8
|
+
saveCredentials: async () => { },
|
8
9
|
onSuccess: () => { },
|
9
10
|
onError: () => { },
|
10
11
|
logOut: () => { },
|
@@ -67,6 +68,13 @@ export async function createJazzContext(options) {
|
|
67
68
|
},
|
68
69
|
});
|
69
70
|
const account = AccountSchema.fromNode(node);
|
71
|
+
if (authResult.saveCredentials) {
|
72
|
+
await authResult.saveCredentials({
|
73
|
+
accountID: node.account
|
74
|
+
.id,
|
75
|
+
secret: node.account.agentSecret,
|
76
|
+
});
|
77
|
+
}
|
70
78
|
authResult.onSuccess();
|
71
79
|
return {
|
72
80
|
account,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;
|
1
|
+
{"version":3,"file":"createContext.js","sourceRoot":"","sources":["../../../src/implementation/createContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,eAAe,EAEf,SAAS,GAKZ,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,OAAO,EAAoB,MAAM,gBAAgB,CAAC;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,IAAI,SAAS,CACtB,QAAQ,EACR,MAAM,CAAC,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC,EACtC,MAAM,CACT,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACH,KAAK,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC;QACnC,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;QACd,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC;KACnB,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
package/src/coValues/coList.ts
CHANGED
@@ -29,6 +29,7 @@ import {
|
|
29
29
|
subscribeToExistingCoValue,
|
30
30
|
subscriptionsScopes,
|
31
31
|
} from "../internal.js";
|
32
|
+
import { coValuesCache } from "../lib/cache.js";
|
32
33
|
|
33
34
|
/**
|
34
35
|
* CoLists are collaborative versions of plain arrays.
|
@@ -164,9 +165,12 @@ export class CoList<Item = any> extends Array<Item> implements CoValue {
|
|
164
165
|
}
|
165
166
|
|
166
167
|
get _loadedAs() {
|
167
|
-
|
168
|
-
|
168
|
+
const rawAccount = this._raw.core.node.account;
|
169
|
+
|
170
|
+
if (rawAccount instanceof RawAccount) {
|
171
|
+
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount)) ;
|
169
172
|
}
|
173
|
+
|
170
174
|
return new AnonymousJazzAgent(this._raw.core.node);
|
171
175
|
}
|
172
176
|
|
@@ -11,6 +11,7 @@ import {
|
|
11
11
|
AnonymousJazzAgent,
|
12
12
|
} from "../internal.js";
|
13
13
|
import { fulfillsDepth } from "./deepLoading.js";
|
14
|
+
import { coValuesCache } from "../lib/cache.js";
|
14
15
|
|
15
16
|
/** @category Abstract interfaces */
|
16
17
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -87,9 +88,12 @@ export class CoValueBase implements CoValue {
|
|
87
88
|
|
88
89
|
/** @private */
|
89
90
|
get _loadedAs() {
|
90
|
-
|
91
|
-
|
91
|
+
const rawAccount = this._raw.core.node.account;
|
92
|
+
|
93
|
+
if (rawAccount instanceof RawAccount) {
|
94
|
+
return coValuesCache.get(rawAccount, () => Account.fromRaw(rawAccount)) ;
|
92
95
|
}
|
96
|
+
|
93
97
|
return new AnonymousJazzAgent(this._raw.core.node);
|
94
98
|
}
|
95
99
|
|
package/src/exports.ts
CHANGED
@@ -11,10 +11,16 @@ import {
|
|
11
11
|
} from "cojson";
|
12
12
|
import { Account, AccountClass, ID } from "../internal.js";
|
13
13
|
|
14
|
+
export type Credentials = {
|
15
|
+
accountID: ID<Account>;
|
16
|
+
secret: AgentSecret;
|
17
|
+
};
|
18
|
+
|
14
19
|
export type AuthResult =
|
15
20
|
| {
|
16
21
|
type: "existing";
|
17
|
-
credentials:
|
22
|
+
credentials: Credentials;
|
23
|
+
saveCredentials?: (credentials: Credentials) => Promise<void>;
|
18
24
|
onSuccess: () => void;
|
19
25
|
onError: (error: string | Error) => void;
|
20
26
|
logOut: () => void;
|
@@ -23,10 +29,7 @@ export type AuthResult =
|
|
23
29
|
type: "new";
|
24
30
|
creationProps: { name: string };
|
25
31
|
initialSecret?: AgentSecret;
|
26
|
-
saveCredentials: (credentials:
|
27
|
-
accountID: ID<Account>;
|
28
|
-
secret: AgentSecret;
|
29
|
-
}) => Promise<void>;
|
32
|
+
saveCredentials: (credentials: Credentials) => Promise<void>;
|
30
33
|
onSuccess: () => void;
|
31
34
|
onError: (error: string | Error) => void;
|
32
35
|
logOut: () => void;
|
@@ -44,6 +47,7 @@ export const fixedCredentialsAuth = (credentials: {
|
|
44
47
|
start: async () => ({
|
45
48
|
type: "existing",
|
46
49
|
credentials,
|
50
|
+
saveCredentials: async () => {},
|
47
51
|
onSuccess: () => {},
|
48
52
|
onError: () => {},
|
49
53
|
logOut: () => {},
|
@@ -168,6 +172,15 @@ export async function createJazzContext<Acc extends Account>(
|
|
168
172
|
});
|
169
173
|
|
170
174
|
const account = AccountSchema.fromNode(node);
|
175
|
+
|
176
|
+
if (authResult.saveCredentials) {
|
177
|
+
await authResult.saveCredentials({
|
178
|
+
accountID: node.account
|
179
|
+
.id as unknown as ID<Account>,
|
180
|
+
secret: node.account.agentSecret,
|
181
|
+
});
|
182
|
+
}
|
183
|
+
|
171
184
|
authResult.onSuccess();
|
172
185
|
|
173
186
|
return {
|