1
1
import type {
2
+ DeepReadonly ,
3
+ IndexKey ,
2
4
JSONValue ,
3
- KeyTypeForScanOptions ,
4
5
ReadTransaction ,
6
+ ReadonlyJSONValue ,
7
+ ScanIndexOptions ,
8
+ ScanNoIndexOptions ,
5
9
ScanOptions ,
6
10
ScanResult ,
7
11
TransactionEnvironment ,
@@ -56,6 +60,10 @@ export class ReplicacheTransaction implements WriteTransaction {
56
60
return "server" ;
57
61
}
58
62
63
+ get location ( ) {
64
+ return this . environment ;
65
+ }
66
+
59
67
get mutationID ( ) : number {
60
68
return this . _mutationID ;
61
69
}
@@ -65,6 +73,9 @@ export class ReplicacheTransaction implements WriteTransaction {
65
73
}
66
74
67
75
async put ( key : string , value : JSONValue ) : Promise < void > {
76
+ await this . set ( key , value ) ;
77
+ }
78
+ async set ( key : string , value : JSONValue ) : Promise < void > {
68
79
this . _cache . set ( key , { value, dirty : true } ) ;
69
80
}
70
81
async del ( key : string ) : Promise < boolean > {
@@ -90,10 +101,20 @@ export class ReplicacheTransaction implements WriteTransaction {
90
101
async isEmpty ( ) : Promise < boolean > {
91
102
throw new Error ( "Method isEmpty not implemented" ) ;
92
103
}
93
- scan ( ) : ScanResult < string > ;
94
- scan < Options extends ScanOptions > (
95
- _options ?: Options
96
- ) : ScanResult < KeyTypeForScanOptions < Options > > {
104
+
105
+ scan ( options : ScanIndexOptions ) : ScanResult < IndexKey , ReadonlyJSONValue > ;
106
+ scan ( options ?: ScanNoIndexOptions ) : ScanResult < string , ReadonlyJSONValue > ;
107
+ scan ( options ?: ScanOptions ) : ScanResult < IndexKey | string , ReadonlyJSONValue > ;
108
+ scan < V extends ReadonlyJSONValue > (
109
+ options : ScanIndexOptions
110
+ ) : ScanResult < IndexKey , DeepReadonly < V > > ;
111
+ scan < V extends ReadonlyJSONValue > (
112
+ options ?: ScanNoIndexOptions
113
+ ) : ScanResult < string , DeepReadonly < V > > ;
114
+ scan < V extends ReadonlyJSONValue > (
115
+ options ?: ScanOptions
116
+ ) : ScanResult < IndexKey | string , DeepReadonly < V > > ;
117
+ scan ( ) : ScanResult < IndexKey | string , ReadonlyJSONValue > {
97
118
throw new Error ( "Method scan not implemented." ) ;
98
119
}
99
120
0 commit comments