@gaganref/confect-test 10.3.1-fork.91 → 10.3.1-fork.93
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/dist/TestConfect.d.ts +26 -0
- package/dist/TestConfect.d.ts.map +1 -1
- package/dist/TestConfect.js +9 -1
- package/dist/TestConfect.js.map +1 -1
- package/dist/internal/Attempt.d.ts +14 -1
- package/dist/internal/Attempt.d.ts.map +1 -1
- package/dist/internal/Attempt.js +18 -1
- package/dist/internal/Attempt.js.map +1 -1
- package/dist/internal/ConvexTest.d.ts +26 -1
- package/dist/internal/ConvexTest.d.ts.map +1 -1
- package/dist/internal/ConvexTest.js +55 -27
- package/dist/internal/ConvexTest.js.map +1 -1
- package/dist/internal/Execution.d.ts +151 -1
- package/dist/internal/Execution.d.ts.map +1 -1
- package/dist/internal/Execution.js +731 -214
- package/dist/internal/Execution.js.map +1 -1
- package/dist/internal/KernelQuery.d.ts +8 -3
- package/dist/internal/KernelQuery.d.ts.map +1 -1
- package/dist/internal/KernelQuery.js +10 -3
- package/dist/internal/KernelQuery.js.map +1 -1
- package/dist/internal/KernelRefusal.d.ts +134 -0
- package/dist/internal/KernelRefusal.d.ts.map +1 -1
- package/dist/internal/KernelRefusal.js +134 -1
- package/dist/internal/KernelRefusal.js.map +1 -1
- package/dist/internal/Metering.d.ts +186 -0
- package/dist/internal/Metering.d.ts.map +1 -0
- package/dist/internal/Metering.js +401 -0
- package/dist/internal/Metering.js.map +1 -0
- package/dist/internal/Redaction.d.ts +142 -0
- package/dist/internal/Redaction.d.ts.map +1 -0
- package/dist/internal/Redaction.js +448 -0
- package/dist/internal/Redaction.js.map +1 -0
- package/dist/internal/Snapshot.d.ts +298 -0
- package/dist/internal/Snapshot.d.ts.map +1 -0
- package/dist/internal/Snapshot.js +532 -0
- package/dist/internal/Snapshot.js.map +1 -0
- package/dist/internal/Subscriptions.d.ts +13 -0
- package/dist/internal/Subscriptions.d.ts.map +1 -1
- package/dist/internal/Subscriptions.js +27 -3
- package/dist/internal/Subscriptions.js.map +1 -1
- package/package.json +3 -3
- package/src/TestConfect.ts +63 -4
- package/src/internal/Attempt.ts +24 -0
- package/src/internal/ConvexTest.ts +135 -38
- package/src/internal/Execution.ts +1141 -324
- package/src/internal/KernelQuery.ts +17 -6
- package/src/internal/KernelRefusal.ts +160 -0
- package/src/internal/Metering.ts +520 -0
- package/src/internal/Redaction.ts +730 -0
- package/src/internal/Snapshot.ts +945 -0
- package/src/internal/Subscriptions.ts +34 -4
|
@@ -136,12 +136,14 @@ interface Live {
|
|
|
136
136
|
* `authenticate` replaces, bumping the identity version.
|
|
137
137
|
*/
|
|
138
138
|
export class Subscriber {
|
|
139
|
-
private version
|
|
139
|
+
private version: number;
|
|
140
140
|
|
|
141
141
|
constructor(
|
|
142
142
|
private readonly registry: Registry,
|
|
143
143
|
private who: Execution.Caller,
|
|
144
|
-
) {
|
|
144
|
+
) {
|
|
145
|
+
this.version = registry.identityEpoch();
|
|
146
|
+
}
|
|
145
147
|
|
|
146
148
|
get caller(): Execution.Caller {
|
|
147
149
|
return this.who;
|
|
@@ -164,7 +166,7 @@ export class Subscriber {
|
|
|
164
166
|
identity === null
|
|
165
167
|
? { ...this.who, identity: null, token: null }
|
|
166
168
|
: Execution.withIdentity(this.who, identity);
|
|
167
|
-
this.version
|
|
169
|
+
this.version = this.registry.nextIdentityEpoch();
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
|
|
@@ -180,9 +182,32 @@ export class Registry {
|
|
|
180
182
|
constructor(private readonly world: Execution.World) {}
|
|
181
183
|
|
|
182
184
|
subscriber(caller: Execution.Caller): Subscriber {
|
|
185
|
+
this.world.registerSubscriber();
|
|
183
186
|
return new Subscriber(this, caller);
|
|
184
187
|
}
|
|
185
188
|
|
|
189
|
+
/**
|
|
190
|
+
* The reference a live subscription runs, for marking its diffs by the shape
|
|
191
|
+
* of what its query returns.
|
|
192
|
+
*/
|
|
193
|
+
referenceOf(subscription: string): unknown {
|
|
194
|
+
return this.live.get(subscription)?.reference;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The world's identity epoch, where a new subscriber's version starts.
|
|
199
|
+
*/
|
|
200
|
+
identityEpoch(): number {
|
|
201
|
+
return this.world.currentIdentityEpoch();
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Advance the world's identity epoch for a subscriber whose identity changed.
|
|
206
|
+
*/
|
|
207
|
+
nextIdentityEpoch(): number {
|
|
208
|
+
return this.world.nextIdentityEpoch();
|
|
209
|
+
}
|
|
210
|
+
|
|
186
211
|
subscribe(
|
|
187
212
|
subscriber: Subscriber,
|
|
188
213
|
reference: unknown,
|
|
@@ -200,7 +225,12 @@ export class Registry {
|
|
|
200
225
|
this.live.set(live.id, live);
|
|
201
226
|
return {
|
|
202
227
|
id: live.id,
|
|
203
|
-
|
|
228
|
+
// The run's value is the client's own, so it stays raw. Its read
|
|
229
|
+
// records are the kernel's, so they leave projected.
|
|
230
|
+
current: () => ({
|
|
231
|
+
...live.run,
|
|
232
|
+
reads: this.world.projectReads(live.run.reads),
|
|
233
|
+
}),
|
|
204
234
|
unsubscribe: () => {
|
|
205
235
|
this.live.delete(live.id);
|
|
206
236
|
},
|