@squidcloud/client 1.0.99 → 1.0.100

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.
@@ -5,7 +5,7 @@ export declare class DocumentStore {
5
5
  hasData(squidDocId: SquidDocId): boolean;
6
6
  getDocument(squidDocId: SquidDocId): SquidDocument;
7
7
  getDocumentOrUndefined(squidDocId: SquidDocId): SquidDocument | undefined;
8
- sortAndLimitDocs(docIdSet: Set<SquidDocId> | undefined, query: Query): Array<SquidDocument>;
8
+ sortAndLimitDocs(docIdSet: Set<SquidDocId>, query: Query): Array<SquidDocument>;
9
9
  private removeInternalProperties;
10
10
  migrateDocId(squidDocId: SquidDocId, newSquidDocId: SquidDocId): void;
11
11
  }
@@ -5,6 +5,8 @@ import DocumentIdentityService from '../document-identity.service';
5
5
  import { DocumentStore } from '../document-store';
6
6
  import { RpcManager } from '../rpc.manager';
7
7
  import { ClientIdService } from '../client-id.service';
8
+ export declare const FETCH_BEYOND_LIMIT = 100;
9
+ export declare const LIMIT_UNDERFLOW_TRIGGER = 20;
8
10
  interface OngoingQuery {
9
11
  clientRequestId: ClientRequestId;
10
12
  query: Query;
@@ -33,6 +35,20 @@ interface OngoingQuery {
33
35
  done: boolean;
34
36
  isInFlight: boolean;
35
37
  forceFetchFromServer: boolean;
38
+ /**
39
+ * If there's a limit, we request `limit + FETCH_BEYOND_LIMIT` documents from the server.
40
+ * If we got that many documents, that means there may be even more. In that case, if our result set goes below
41
+ * `limit + LIMIT_UNDERFLOW_TRIGGER` documents (due to local or remote deletions), we need to resend the query to the
42
+ * server to potentially get more documents.
43
+ * If the number of documents is less than `limit + FETCH_BEYOND_LIMIT`, that means there are not that many documents
44
+ * on the server, so we don't need to resend the query regardless of how small our result size is or becomes.
45
+ */
46
+ limitUnderflowState: LimitUnderflowState;
47
+ }
48
+ declare enum LimitUnderflowState {
49
+ UNKNOWN = 0,
50
+ DISABLED = 1,
51
+ ENABLED = 2
36
52
  }
37
53
  interface DocsAndAlias {
38
54
  docs: Array<SquidDocument>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.99",
3
+ "version": "1.0.100",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",