cojson 0.7.0 → 0.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +330 -330
- package/CHANGELOG.md +56 -44
- package/LICENSE.txt +1 -1
- package/dist/coValues/account.js +10 -1
- package/dist/coValues/account.js.map +1 -1
- package/package.json +1 -1
- package/src/coValues/account.ts +13 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,183 +1,195 @@
|
|
|
1
1
|
# cojson
|
|
2
2
|
|
|
3
|
+
## 0.7.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Also cache agent ID in RawControlledAccount
|
|
8
|
+
|
|
9
|
+
## 0.7.9
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Cache currentAgentID in RawAccount
|
|
14
|
+
|
|
3
15
|
## 0.7.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
6
18
|
|
|
7
|
-
-
|
|
19
|
+
- e299c3e: New simplified API
|
|
8
20
|
|
|
9
21
|
### Patch Changes
|
|
10
22
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
23
|
+
- 1a35307: WIP working-ish version of LSM storage
|
|
24
|
+
- 96c494f: Implement profile visibility based on groups & new migration signature
|
|
25
|
+
- 19f52b7: Fixed bug with newRandomSessionID being called before crypto was ready
|
|
26
|
+
- d8fe2b1: Expose experimental OPFS storage
|
|
27
|
+
- 1200aae: CoJSON performance improvement
|
|
28
|
+
- 52675c9: Fix CoList.splice / RawCoList.append
|
|
29
|
+
- 1a35307: Optimizations for incoming sync messages
|
|
30
|
+
- bf0f8ec: Fix noble curves dependency
|
|
31
|
+
- c4151fc: Support stricter TS lint rules
|
|
32
|
+
- 8636319: Factor out implementation of crypto provider and provide pure JS implementation
|
|
33
|
+
- 952982e: Consistent proxy based API
|
|
34
|
+
- 21771c4: Reintroduce changes from main
|
|
35
|
+
- 69ac514: Use effect schema much less
|
|
36
|
+
- f0f6f1b: Clean up API more & re-add jazz-nodejs
|
|
37
|
+
- 1a44f87: Refactoring
|
|
38
|
+
- 63374cc: Make sure delete on CoMaps deletes keys
|
|
27
39
|
|
|
28
40
|
## 0.7.0-alpha.42
|
|
29
41
|
|
|
30
42
|
### Patch Changes
|
|
31
43
|
|
|
32
|
-
-
|
|
44
|
+
- Fixed bug with newRandomSessionID being called before crypto was ready
|
|
33
45
|
|
|
34
46
|
## 0.7.0-alpha.39
|
|
35
47
|
|
|
36
48
|
### Patch Changes
|
|
37
49
|
|
|
38
|
-
-
|
|
50
|
+
- Fix noble curves dependency
|
|
39
51
|
|
|
40
52
|
## 0.7.0-alpha.38
|
|
41
53
|
|
|
42
54
|
### Patch Changes
|
|
43
55
|
|
|
44
|
-
-
|
|
56
|
+
- Factor out implementation of crypto provider and provide pure JS implementation
|
|
45
57
|
|
|
46
58
|
## 0.7.0-alpha.37
|
|
47
59
|
|
|
48
60
|
### Patch Changes
|
|
49
61
|
|
|
50
|
-
-
|
|
62
|
+
- Expose experimental OPFS storage
|
|
51
63
|
|
|
52
64
|
## 0.7.0-alpha.36
|
|
53
65
|
|
|
54
66
|
### Patch Changes
|
|
55
67
|
|
|
56
|
-
-
|
|
57
|
-
-
|
|
68
|
+
- 1a35307: WIP working-ish version of LSM storage
|
|
69
|
+
- 1a35307: Optimizations for incoming sync messages
|
|
58
70
|
|
|
59
71
|
## 0.7.0-alpha.35
|
|
60
72
|
|
|
61
73
|
### Patch Changes
|
|
62
74
|
|
|
63
|
-
-
|
|
75
|
+
- CoJSON performance improvement
|
|
64
76
|
|
|
65
77
|
## 0.7.0-alpha.29
|
|
66
78
|
|
|
67
79
|
### Patch Changes
|
|
68
80
|
|
|
69
|
-
-
|
|
81
|
+
- Reintroduce changes from main
|
|
70
82
|
|
|
71
83
|
## 0.7.0-alpha.28
|
|
72
84
|
|
|
73
85
|
### Patch Changes
|
|
74
86
|
|
|
75
|
-
-
|
|
87
|
+
- Implement profile visibility based on groups & new migration signature
|
|
76
88
|
|
|
77
89
|
## 0.7.0-alpha.27
|
|
78
90
|
|
|
79
91
|
### Patch Changes
|
|
80
92
|
|
|
81
|
-
-
|
|
93
|
+
- Fix CoList.splice / RawCoList.append
|
|
82
94
|
|
|
83
95
|
## 0.7.0-alpha.24
|
|
84
96
|
|
|
85
97
|
### Patch Changes
|
|
86
98
|
|
|
87
|
-
-
|
|
99
|
+
- Make sure delete on CoMaps deletes keys
|
|
88
100
|
|
|
89
101
|
## 0.7.0-alpha.11
|
|
90
102
|
|
|
91
103
|
### Patch Changes
|
|
92
104
|
|
|
93
|
-
-
|
|
105
|
+
- Support stricter TS lint rules
|
|
94
106
|
|
|
95
107
|
## 0.7.0-alpha.10
|
|
96
108
|
|
|
97
109
|
### Patch Changes
|
|
98
110
|
|
|
99
|
-
-
|
|
111
|
+
- Clean up API more & re-add jazz-nodejs
|
|
100
112
|
|
|
101
113
|
## 0.7.0-alpha.7
|
|
102
114
|
|
|
103
115
|
### Patch Changes
|
|
104
116
|
|
|
105
|
-
-
|
|
117
|
+
- Consistent proxy based API
|
|
106
118
|
|
|
107
119
|
## 0.7.0-alpha.5
|
|
108
120
|
|
|
109
121
|
### Patch Changes
|
|
110
122
|
|
|
111
|
-
-
|
|
123
|
+
- Refactoring
|
|
112
124
|
|
|
113
125
|
## 0.7.0-alpha.1
|
|
114
126
|
|
|
115
127
|
### Patch Changes
|
|
116
128
|
|
|
117
|
-
-
|
|
129
|
+
- Use effect schema much less
|
|
118
130
|
|
|
119
131
|
## 0.7.0-alpha.0
|
|
120
132
|
|
|
121
133
|
### Minor Changes
|
|
122
134
|
|
|
123
|
-
-
|
|
135
|
+
- New simplified API
|
|
124
136
|
|
|
125
137
|
## 0.6.6
|
|
126
138
|
|
|
127
139
|
### Patch Changes
|
|
128
140
|
|
|
129
|
-
-
|
|
141
|
+
- Fix migration changes being lost on loaded account
|
|
130
142
|
|
|
131
143
|
## 0.6.5
|
|
132
144
|
|
|
133
145
|
### Patch Changes
|
|
134
146
|
|
|
135
|
-
-
|
|
147
|
+
- Fix loading of accounts
|
|
136
148
|
|
|
137
149
|
## 0.6.4
|
|
138
150
|
|
|
139
151
|
### Patch Changes
|
|
140
152
|
|
|
141
|
-
-
|
|
153
|
+
- IndexedDB & timer perf improvements
|
|
142
154
|
|
|
143
155
|
## 0.6.3
|
|
144
156
|
|
|
145
157
|
### Patch Changes
|
|
146
158
|
|
|
147
|
-
-
|
|
159
|
+
- Implement passphrase based auth
|
|
148
160
|
|
|
149
161
|
## 0.6.2
|
|
150
162
|
|
|
151
163
|
### Patch Changes
|
|
152
164
|
|
|
153
|
-
-
|
|
165
|
+
- Add peersToLoadFrom for node creation as well
|
|
154
166
|
|
|
155
167
|
## 0.6.1
|
|
156
168
|
|
|
157
169
|
### Patch Changes
|
|
158
170
|
|
|
159
|
-
-
|
|
171
|
+
- Provide localNode to AccountMigrations
|
|
160
172
|
|
|
161
173
|
## 0.6.0
|
|
162
174
|
|
|
163
175
|
### Minor Changes
|
|
164
176
|
|
|
165
|
-
-
|
|
177
|
+
- Make addMember and removeMember take loaded Accounts instead of just IDs
|
|
166
178
|
|
|
167
179
|
## 0.5.2
|
|
168
180
|
|
|
169
181
|
### Patch Changes
|
|
170
182
|
|
|
171
|
-
-
|
|
183
|
+
- Allow account migrations to be async
|
|
172
184
|
|
|
173
185
|
## 0.5.1
|
|
174
186
|
|
|
175
187
|
### Patch Changes
|
|
176
188
|
|
|
177
|
-
-
|
|
189
|
+
- Fix bug where accounts, profiles and data created in migrations isn't synced on account creation
|
|
178
190
|
|
|
179
191
|
## 0.5.0
|
|
180
192
|
|
|
181
193
|
### Minor Changes
|
|
182
194
|
|
|
183
|
-
-
|
|
195
|
+
- Adding a lot of performance improvements to cojson, add a stresstest for the twit example and make that run smoother in a lot of ways.
|
package/LICENSE.txt
CHANGED
package/dist/coValues/account.js
CHANGED
|
@@ -14,10 +14,14 @@ export function accountHeaderForInitialAgentSecret(agentSecret, crypto) {
|
|
|
14
14
|
}
|
|
15
15
|
export class RawAccount extends RawGroup {
|
|
16
16
|
currentAgentID() {
|
|
17
|
+
if (this._cachedCurrentAgentID) {
|
|
18
|
+
return this._cachedCurrentAgentID;
|
|
19
|
+
}
|
|
17
20
|
const agents = this.keys().filter((k) => k.startsWith("sealer_"));
|
|
18
21
|
if (agents.length !== 1) {
|
|
19
22
|
throw new Error("Expected exactly one agent in account, got " + agents.length);
|
|
20
23
|
}
|
|
24
|
+
this._cachedCurrentAgentID = agents[0];
|
|
21
25
|
return agents[0];
|
|
22
26
|
}
|
|
23
27
|
}
|
|
@@ -39,7 +43,12 @@ export class RawControlledAccount extends RawAccount {
|
|
|
39
43
|
return this.core.node.acceptInvite(groupOrOwnedValueID, inviteSecret);
|
|
40
44
|
}
|
|
41
45
|
currentAgentID() {
|
|
42
|
-
|
|
46
|
+
if (this._cachedCurrentAgentID) {
|
|
47
|
+
return this._cachedCurrentAgentID;
|
|
48
|
+
}
|
|
49
|
+
const agentID = this.crypto.getAgentID(this.agentSecret);
|
|
50
|
+
this._cachedCurrentAgentID = agentID;
|
|
51
|
+
return agentID;
|
|
43
52
|
}
|
|
44
53
|
currentSignerID() {
|
|
45
54
|
return this.crypto.getAgentSignerID(this.currentAgentID());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAgB,MAAM,YAAY,CAAC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B,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,mBAAmB;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;CACJ;AAED,cAAc;AACd,MAAM,OAAO,eAAe;IACxB,YACW,WAAwB,EACxB,MAAsB;QADtB,gBAAW,GAAX,WAAW,CAAa;QACxB,WAAM,GAAN,MAAM,CAAgB;IAC9B,CAAC;IAEJ,IAAI,EAAE;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,mBAAmB;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;IAED,eAAe;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,mBAAmB;QACf,OAAO,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC9D,CAAC;CACJ;AASD,MAAM,OAAO,UAGX,SAAQ,QAAqB;CAAG"}
|
package/package.json
CHANGED
package/src/coValues/account.ts
CHANGED
|
@@ -33,7 +33,12 @@ export function accountHeaderForInitialAgentSecret(
|
|
|
33
33
|
export class RawAccount<
|
|
34
34
|
Meta extends AccountMeta = AccountMeta,
|
|
35
35
|
> extends RawGroup<Meta> {
|
|
36
|
+
_cachedCurrentAgentID: AgentID | undefined;
|
|
37
|
+
|
|
36
38
|
currentAgentID(): AgentID {
|
|
39
|
+
if (this._cachedCurrentAgentID) {
|
|
40
|
+
return this._cachedCurrentAgentID;
|
|
41
|
+
}
|
|
37
42
|
const agents = this.keys().filter((k): k is AgentID =>
|
|
38
43
|
k.startsWith("sealer_"),
|
|
39
44
|
);
|
|
@@ -44,6 +49,8 @@ export class RawAccount<
|
|
|
44
49
|
);
|
|
45
50
|
}
|
|
46
51
|
|
|
52
|
+
this._cachedCurrentAgentID = agents[0];
|
|
53
|
+
|
|
47
54
|
return agents[0]!;
|
|
48
55
|
}
|
|
49
56
|
}
|
|
@@ -90,7 +97,12 @@ export class RawControlledAccount<Meta extends AccountMeta = AccountMeta>
|
|
|
90
97
|
}
|
|
91
98
|
|
|
92
99
|
currentAgentID(): AgentID {
|
|
93
|
-
|
|
100
|
+
if (this._cachedCurrentAgentID) {
|
|
101
|
+
return this._cachedCurrentAgentID;
|
|
102
|
+
}
|
|
103
|
+
const agentID = this.crypto.getAgentID(this.agentSecret);
|
|
104
|
+
this._cachedCurrentAgentID = agentID;
|
|
105
|
+
return agentID;
|
|
94
106
|
}
|
|
95
107
|
|
|
96
108
|
currentSignerID(): SignerID {
|