lsync API
Preparing search index...
@lsync/client
Client
Interface Client<TApi>
interface
Client
<
TApi
extends
ApiContract
=
ApiContract
>
{
clientId
:
string
;
call
<
TPath
extends
string
>
(
path
:
TPath
,
...
args
:
ApiCallArgs
<
TApi
,
TPath
>
,
)
:
Promise
<
ApiOutput
<
TApi
,
TPath
>
>
;
changes
(
query
:
{
collections
:
Record
<
string
,
number
>
;
limit
?:
number
}
,
)
:
Promise
<
|
{
cursors
?:
Record
<
string
,
number
>
;
hasMore
:
boolean
;
type
:
"changes"
;
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
sequence
:
number
;
serverCreatedAt
:
string
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
watermark
:
number
;
}
|
{
collections
:
string
[]
;
type
:
"resyncRequired"
;
watermark
:
number
}
,
>
;
close
()
:
void
;
push
(
batch
:
{
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
}
,
)
:
Promise
<
{
accepted
:
number
;
watermark
:
number
}
>
;
read
<
T
=
unknown
>
(
query
:
ReadQueryInput
)
:
Promise
<
ReadResult
<
T
>
>
;
subscribe
(
collection
:
string
,
listener
:
(
broadcast
:
{
invalidations
?:
{
collection
:
string
}
[]
;
shardId
:
string
;
type
:
"updates"
;
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
sequence
:
number
;
serverCreatedAt
:
string
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
watermark
:
number
;
}
,
)
=>
void
,
)
:
ClientSubscription
;
}
Type Parameters
TApi
extends
ApiContract
=
ApiContract
Index
Properties
client
Id
Methods
call
changes
close
push
read
subscribe
Properties
Readonly
client
Id
clientId
:
string
Methods
call
call
<
TPath
extends
string
>
(
path
:
TPath
,
...
args
:
ApiCallArgs
<
TApi
,
TPath
>
,
)
:
Promise
<
ApiOutput
<
TApi
,
TPath
>
>
Type Parameters
TPath
extends
string
Parameters
path
:
TPath
...
args
:
ApiCallArgs
<
TApi
,
TPath
>
Returns
Promise
<
ApiOutput
<
TApi
,
TPath
>
>
changes
changes
(
query
:
{
collections
:
Record
<
string
,
number
>
;
limit
?:
number
}
,
)
:
Promise
<
|
{
cursors
?:
Record
<
string
,
number
>
;
hasMore
:
boolean
;
type
:
"changes"
;
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
sequence
:
number
;
serverCreatedAt
:
string
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
watermark
:
number
;
}
|
{
collections
:
string
[]
;
type
:
"resyncRequired"
;
watermark
:
number
}
,
>
Parameters
query
:
{
collections
:
Record
<
string
,
number
>
;
limit
?:
number
}
Returns
Promise
<
|
{
cursors
?:
Record
<
string
,
number
>
;
hasMore
:
boolean
;
type
:
"changes"
;
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
sequence
:
number
;
serverCreatedAt
:
string
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
watermark
:
number
;
}
|
{
collections
:
string
[]
;
type
:
"resyncRequired"
;
watermark
:
number
}
,
>
close
close
()
:
void
Returns
void
push
push
(
batch
:
{
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
}
,
)
:
Promise
<
{
accepted
:
number
;
watermark
:
number
}
>
Parameters
batch
:
{
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
}
Returns
Promise
<
{
accepted
:
number
;
watermark
:
number
}
>
read
read
<
T
=
unknown
>
(
query
:
ReadQueryInput
)
:
Promise
<
ReadResult
<
T
>
>
Type Parameters
T
=
unknown
Parameters
query
:
ReadQueryInput
Returns
Promise
<
ReadResult
<
T
>
>
subscribe
subscribe
(
collection
:
string
,
listener
:
(
broadcast
:
{
invalidations
?:
{
collection
:
string
}
[]
;
shardId
:
string
;
type
:
"updates"
;
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
sequence
:
number
;
serverCreatedAt
:
string
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
watermark
:
number
;
}
,
)
=>
void
,
)
:
ClientSubscription
Parameters
collection
:
string
listener
:
(
broadcast
:
{
invalidations
?:
{
collection
:
string
}
[]
;
shardId
:
string
;
type
:
"updates"
;
updates
:
{
clientId
?:
string
;
collection
:
string
;
createdAt
:
number
;
id
:
string
;
key
:
string
|
number
;
path
?:
string
;
previousValue
?:
unknown
;
sequence
:
number
;
serverCreatedAt
:
string
;
type
:
"insert"
|
"update"
|
"delete"
;
value
?:
unknown
;
}
[]
;
watermark
:
number
;
}
,
)
=>
void
Returns
ClientSubscription
Settings
Member Visibility
Inherited
External
Theme
OS
Light
Dark
On This Page
Properties
client
Id
Methods
call
changes
close
push
read
subscribe
lsync API
Loading...