@@ -90,8 +90,6 @@ export const OrderedKeyValueApi = ({
9090} : {
9191 database : InternalDatabase ;
9292} ) => {
93- const { addOperation, log } = database ;
94-
9593 const put = async (
9694 key : string ,
9795 value : DagCborEncodable ,
@@ -103,21 +101,21 @@ export const OrderedKeyValueApi = ({
103101 if ( position !== undefined ) {
104102 entryValue . position = position ;
105103 }
106- return addOperation ( { op : "PUT" , key, value : entryValue } ) ;
104+ return database . addOperation ( { op : "PUT" , key, value : entryValue } ) ;
107105 } ;
108106
109107 const move = async ( key : string , position : number ) : Promise < string > => {
110- return addOperation ( { op : "MOVE" , key, value : position } ) ;
108+ return database . addOperation ( { op : "MOVE" , key, value : position } ) ;
111109 } ;
112110
113111 const del = async ( key : string ) : Promise < string > => {
114- return addOperation ( { op : "DEL" , key, value : null } ) ;
112+ return database . addOperation ( { op : "DEL" , key, value : null } ) ;
115113 } ;
116114
117115 const get = async (
118116 key : string ,
119117 ) : Promise < { value : unknown ; position ?: number } | undefined > => {
120- for await ( const entry of log . traverse ( ) ) {
118+ for await ( const entry of database . log . traverse ( ) ) {
121119 const { op, key : k , value } = entry . payload ;
122120 if ( op === "PUT" && k === key ) {
123121 return value as { value : unknown ; position ?: number } ;
@@ -142,7 +140,7 @@ export const OrderedKeyValueApi = ({
142140 > {
143141 let count = 0 ;
144142 const orderedLogEntries : LogEntry < DagCborEncodable > [ ] = [ ] ;
145- for await ( const entry of log . traverse ( ) ) {
143+ for await ( const entry of database . log . traverse ( ) ) {
146144 orderedLogEntries . unshift ( entry ) ;
147145 }
148146
0 commit comments