@squidcloud/client 1.0.145 → 1.0.146-beta

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.
Files changed (206) hide show
  1. package/dist/cjs/index.js +1 -53942
  2. package/dist/esm/index.js +1 -0
  3. package/dist/internal-common/src/metric-name.d.ts +9 -0
  4. package/dist/internal-common/src/public-types/ai-agent-integrations.public-types.d.ts +47 -0
  5. package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +895 -0
  6. package/dist/internal-common/src/public-types/ai-assistant.public-types.d.ts +31 -0
  7. package/dist/internal-common/src/public-types/ai-common.public-types.d.ts +185 -0
  8. package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +431 -0
  9. package/dist/internal-common/src/public-types/ai-matchmaking.public-types.d.ts +186 -0
  10. package/dist/internal-common/src/public-types/ai-query.public-types.d.ts +170 -0
  11. package/dist/internal-common/src/public-types/api-client.public-types.d.ts +9 -0
  12. package/dist/internal-common/src/public-types/api.public-types.d.ts +91 -0
  13. package/dist/internal-common/src/public-types/backend.public-types.d.ts +50 -0
  14. package/dist/{common/src/backend-function.schemas.d.ts → internal-common/src/public-types/code-executor.public-types.d.ts} +1 -1
  15. package/dist/internal-common/src/public-types/communication.public-types.d.ts +30 -0
  16. package/dist/internal-common/src/public-types/context.public-types.d.ts +83 -0
  17. package/dist/internal-common/src/public-types/document.public-types.d.ts +71 -0
  18. package/dist/internal-common/src/public-types/external-auth/external-auth.public-types.d.ts +39 -0
  19. package/dist/internal-common/src/public-types/extraction.public-types.d.ts +183 -0
  20. package/dist/internal-common/src/public-types/http-status.public-types.d.ts +415 -0
  21. package/dist/internal-common/src/public-types/integration.public-types.d.ts +51 -0
  22. package/dist/internal-common/src/public-types/job.public-types.d.ts +59 -0
  23. package/dist/internal-common/src/public-types/metric.public-types.d.ts +154 -0
  24. package/dist/internal-common/src/public-types/openapi.public-types.d.ts +9 -0
  25. package/dist/internal-common/src/public-types/query.public-types.d.ts +113 -0
  26. package/dist/internal-common/src/public-types/regions.public-types.d.ts +4 -0
  27. package/dist/internal-common/src/public-types/scheduler.public-types.d.ts +43 -0
  28. package/dist/{common/src/schema/schema.types.d.ts → internal-common/src/public-types/schema.public-types.d.ts} +54 -54
  29. package/dist/internal-common/src/public-types/secret.public-types.d.ts +51 -0
  30. package/dist/internal-common/src/public-types/serialized-query.public-types.d.ts +60 -0
  31. package/dist/internal-common/src/public-types/socket.public-types.d.ts +4 -0
  32. package/dist/{common/src/types.d.ts → internal-common/src/public-types/typescript.public-types.d.ts} +20 -14
  33. package/dist/internal-common/src/public-types/web.public-types.d.ts +93 -0
  34. package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
  35. package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +148 -0
  36. package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +72 -0
  37. package/dist/{common/src/query/query-context.d.ts → internal-common/src/public-types-backend/query.public-context.d.ts} +177 -137
  38. package/dist/{common/src/ai-chatbot.schemas.d.ts → internal-common/src/public-utils/context-utils.d.ts} +1 -1
  39. package/dist/internal-common/src/public-utils/id-utils.d.ts +44 -0
  40. package/dist/internal-common/src/types/ai-agent.types.d.ts +199 -0
  41. package/dist/{common/src/mutation.schemas.d.ts → internal-common/src/types/ai-assistant.types.d.ts} +1 -1
  42. package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +202 -0
  43. package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +59 -0
  44. package/dist/{common/src → internal-common/src/types}/backend-function.types.d.ts +1 -1
  45. package/dist/internal-common/src/types/communication.types.d.ts +1 -0
  46. package/dist/internal-common/src/types/document.types.d.ts +1 -0
  47. package/dist/internal-common/src/types/file.types.d.ts +6 -0
  48. package/dist/internal-common/src/types/headers.types.d.ts +17 -0
  49. package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
  50. package/dist/internal-common/src/types/notification.types.d.ts +5 -0
  51. package/dist/internal-common/src/types/observability.types.d.ts +78 -0
  52. package/dist/internal-common/src/types/query.types.d.ts +13 -0
  53. package/dist/internal-common/src/types/secret.types.d.ts +7 -0
  54. package/dist/internal-common/src/types/socket.types.d.ts +1 -0
  55. package/dist/internal-common/src/types/stage.d.ts +9 -0
  56. package/dist/{common/src → internal-common/src/types}/time-units.d.ts +1 -1
  57. package/dist/internal-common/src/types/url-shortener.types.d.ts +41 -0
  58. package/dist/internal-common/src/utils/array.d.ts +7 -0
  59. package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
  60. package/dist/{common → internal-common}/src/utils/global.utils.d.ts +1 -1
  61. package/dist/internal-common/src/utils/http.d.ts +5 -0
  62. package/dist/{common → internal-common}/src/utils/lock.manager.d.ts +14 -14
  63. package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
  64. package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
  65. package/dist/internal-common/src/utils/object.d.ts +58 -0
  66. package/dist/internal-common/src/utils/serialization.d.ts +17 -0
  67. package/dist/internal-common/src/utils/squid.constants.d.ts +1 -0
  68. package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
  69. package/dist/internal-common/src/utils/validation.d.ts +19 -0
  70. package/dist/{common → internal-common}/src/websocket.impl.d.ts +26 -21
  71. package/dist/node_modules/json-schema-typed/draft-2020-12.d.ts +1239 -1239
  72. package/dist/typescript-client/src/admin-client.d.ts +23 -0
  73. package/dist/typescript-client/src/agent/ai-agent-client-reference.d.ts +181 -0
  74. package/dist/typescript-client/src/agent/ai-agent-client.d.ts +37 -0
  75. package/dist/typescript-client/src/agent/ai-agent-client.types.d.ts +69 -0
  76. package/dist/typescript-client/src/ai-assistant-client.d.ts +72 -73
  77. package/dist/typescript-client/src/ai-audio-client.d.ts +25 -0
  78. package/dist/typescript-client/src/ai-client.d.ts +129 -0
  79. package/dist/typescript-client/src/ai-files-client.d.ts +33 -0
  80. package/dist/typescript-client/src/ai-image-client.d.ts +25 -0
  81. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client-reference.d.ts +86 -0
  82. package/dist/typescript-client/src/ai-knowledge-base/ai-knowledge-base-client.d.ts +28 -0
  83. package/dist/typescript-client/src/ai-matchmaking-client.d.ts +99 -0
  84. package/dist/typescript-client/src/api-client.d.ts +69 -0
  85. package/dist/typescript-client/src/auth.manager.d.ts +11 -26
  86. package/dist/typescript-client/src/backend-function.manager.d.ts +1 -9
  87. package/dist/typescript-client/src/client-customization.utils.d.ts +1 -0
  88. package/dist/typescript-client/src/client-id.service.d.ts +1 -27
  89. package/dist/typescript-client/src/collection-reference.d.ts +105 -80
  90. package/dist/typescript-client/src/collection-reference.factory.d.ts +1 -13
  91. package/dist/typescript-client/src/connection-details.d.ts +24 -23
  92. package/dist/typescript-client/src/console-utils.d.ts +1 -0
  93. package/dist/typescript-client/src/data.manager.d.ts +1 -173
  94. package/dist/typescript-client/src/destruct.manager.d.ts +1 -12
  95. package/dist/typescript-client/src/distributed-lock.manager.d.ts +39 -16
  96. package/dist/typescript-client/src/document-identity.service.d.ts +1 -12
  97. package/dist/typescript-client/src/document-reference.d.ts +151 -140
  98. package/dist/typescript-client/src/document-reference.factory.d.ts +1 -13
  99. package/dist/typescript-client/src/document-store.d.ts +1 -14
  100. package/dist/typescript-client/src/execute-function-options.d.ts +73 -0
  101. package/dist/typescript-client/src/external-auth-client.d.ts +36 -0
  102. package/dist/typescript-client/src/extraction-client.d.ts +32 -0
  103. package/dist/typescript-client/src/file-args-transformer.d.ts +1 -0
  104. package/dist/typescript-client/src/file-utils.d.ts +1 -0
  105. package/dist/typescript-client/src/index.d.ts +63 -9
  106. package/dist/typescript-client/src/integration-client.d.ts +60 -0
  107. package/dist/typescript-client/src/job-client.d.ts +32 -0
  108. package/dist/typescript-client/src/mutation/mutation-sender.d.ts +1 -10
  109. package/dist/typescript-client/src/native-query-manager.d.ts +1 -7
  110. package/dist/typescript-client/src/notification-client.d.ts +20 -0
  111. package/dist/typescript-client/src/observability-client.d.ts +43 -0
  112. package/dist/typescript-client/src/public-types.d.ts +30 -0
  113. package/dist/typescript-client/src/public-utils.d.ts +1 -0
  114. package/dist/typescript-client/src/query/deserializer.d.ts +10 -3
  115. package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +316 -161
  116. package/dist/typescript-client/src/query/local-query-manager.d.ts +1 -9
  117. package/dist/{common → typescript-client}/src/query/pagination.d.ts +65 -62
  118. package/dist/typescript-client/src/query/query-builder.factory.d.ts +228 -77
  119. package/dist/typescript-client/src/query/query-sender.d.ts +1 -33
  120. package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -130
  121. package/dist/typescript-client/src/query/query.types.d.ts +16 -49
  122. package/dist/typescript-client/src/query/snapshot-emitter.d.ts +41 -0
  123. package/dist/typescript-client/src/query-utils.d.ts +18 -0
  124. package/dist/typescript-client/src/queue.manager.d.ts +12 -0
  125. package/dist/typescript-client/src/rate-limiter.d.ts +1 -32
  126. package/dist/typescript-client/src/rpc.manager.d.ts +1 -30
  127. package/dist/typescript-client/src/scheduler-client.d.ts +31 -0
  128. package/dist/typescript-client/src/secret.client.d.ts +96 -22
  129. package/dist/typescript-client/src/socket.manager.d.ts +1 -43
  130. package/dist/typescript-client/src/squid-http-client.d.ts +11 -0
  131. package/dist/typescript-client/src/squid.d.ts +378 -269
  132. package/dist/typescript-client/src/state/state.service.spec.d.ts +1 -1
  133. package/dist/typescript-client/src/storage-client.d.ts +145 -0
  134. package/dist/typescript-client/src/types.d.ts +27 -2
  135. package/dist/typescript-client/src/version.d.ts +5 -0
  136. package/dist/typescript-client/src/web-client.d.ts +63 -0
  137. package/dist/typescript-client/src/webhook.manager.d.ts +10 -0
  138. package/package.json +34 -18
  139. package/dist/common/src/ai-assistant.types.d.ts +0 -25
  140. package/dist/common/src/ai-chatbot.context.d.ts +0 -12
  141. package/dist/common/src/ai-chatbot.types.d.ts +0 -27
  142. package/dist/common/src/api-call.context.d.ts +0 -13
  143. package/dist/common/src/api.types.d.ts +0 -4
  144. package/dist/common/src/application.schemas.d.ts +0 -66
  145. package/dist/common/src/application.types.d.ts +0 -143
  146. package/dist/common/src/backend-run.types.d.ts +0 -2
  147. package/dist/common/src/bundle-api.types.d.ts +0 -43
  148. package/dist/common/src/bundle-data.types.d.ts +0 -5
  149. package/dist/common/src/communication.types.d.ts +0 -8
  150. package/dist/common/src/context.types.d.ts +0 -40
  151. package/dist/common/src/distributed-lock.context.d.ts +0 -4
  152. package/dist/common/src/document.types.d.ts +0 -22
  153. package/dist/common/src/graphql.context.d.ts +0 -7
  154. package/dist/common/src/graphql.types.d.ts +0 -9
  155. package/dist/common/src/heartbeat.types.d.ts +0 -1
  156. package/dist/common/src/http-status.enum.d.ts +0 -50
  157. package/dist/common/src/index.d.ts +0 -57
  158. package/dist/common/src/integrations/ai_chatbot.types.d.ts +0 -31
  159. package/dist/common/src/integrations/api.types.d.ts +0 -80
  160. package/dist/common/src/integrations/auth.types.d.ts +0 -47
  161. package/dist/common/src/integrations/database.types.d.ts +0 -274
  162. package/dist/common/src/integrations/index.d.ts +0 -134
  163. package/dist/common/src/integrations/observability.types.d.ts +0 -23
  164. package/dist/common/src/logger.types.d.ts +0 -21
  165. package/dist/common/src/metrics.types.d.ts +0 -1
  166. package/dist/common/src/mutation.context.d.ts +0 -14
  167. package/dist/common/src/mutation.types.d.ts +0 -53
  168. package/dist/common/src/named-query.context.d.ts +0 -4
  169. package/dist/common/src/named-query.schemas.d.ts +0 -1
  170. package/dist/common/src/named-query.types.d.ts +0 -1
  171. package/dist/common/src/native-query.context.d.ts +0 -7
  172. package/dist/common/src/native-query.types.d.ts +0 -16
  173. package/dist/common/src/query/base-query-builder.d.ts +0 -147
  174. package/dist/common/src/query/index.d.ts +0 -4
  175. package/dist/common/src/query/serialized-query.types.d.ts +0 -24
  176. package/dist/common/src/query.types.d.ts +0 -64
  177. package/dist/common/src/regions.d.ts +0 -1
  178. package/dist/common/src/secret.schemas.d.ts +0 -1
  179. package/dist/common/src/secret.types.d.ts +0 -22
  180. package/dist/common/src/security.types.d.ts +0 -1
  181. package/dist/common/src/socket.schemas.d.ts +0 -1
  182. package/dist/common/src/socket.types.d.ts +0 -5
  183. package/dist/common/src/trigger.types.d.ts +0 -1
  184. package/dist/common/src/utils/array.d.ts +0 -1
  185. package/dist/common/src/utils/assert.d.ts +0 -1
  186. package/dist/common/src/utils/error.d.ts +0 -4
  187. package/dist/common/src/utils/http.d.ts +0 -2
  188. package/dist/common/src/utils/id.d.ts +0 -2
  189. package/dist/common/src/utils/object.d.ts +0 -5
  190. package/dist/common/src/utils/serialization.d.ts +0 -6
  191. package/dist/common/src/utils/transforms.d.ts +0 -18
  192. package/dist/common/src/utils/url.d.ts +0 -1
  193. package/dist/common/src/utils/validation.d.ts +0 -25
  194. package/dist/common/src/webhook-response.d.ts +0 -1
  195. package/dist/typescript-client/src/ai-chatbot-client.d.ts +0 -174
  196. package/dist/typescript-client/src/ai-chatbot-client.factory.d.ts +0 -8
  197. package/dist/typescript-client/src/ai.types.d.ts +0 -61
  198. package/dist/typescript-client/src/api.manager.d.ts +0 -11
  199. package/dist/typescript-client/src/graphql-client.d.ts +0 -14
  200. package/dist/typescript-client/src/graphql-client.factory.d.ts +0 -11
  201. package/dist/typescript-client/src/named-query.manager.d.ts +0 -11
  202. package/dist/typescript-client/src/state/action.applier.d.ts +0 -7
  203. package/dist/typescript-client/src/state/actions.d.ts +0 -29
  204. package/dist/typescript-client/src/state/path_trie.d.ts +0 -27
  205. package/dist/typescript-client/src/state/state.service.d.ts +0 -22
  206. package/dist/typescript-client/src/testing/setup-tests.d.ts +0 -1
@@ -1,161 +1,316 @@
1
- import { Alias, BaseQueryBuilder, DocumentData, FieldName, FieldSort, HasDereference, Operator, Pagination, PaginationOptions, PrimitiveFieldType, SerializedJoinQuery, SimpleCondition, SnapshotEmitter } from '@squidcloud/common';
2
- import { Observable } from 'rxjs';
3
- import { DocumentReference } from '../document-reference';
4
- import { QueryBuilder } from './query-builder.factory';
5
- type WithDocumentReferences<T extends Record<any, DocumentData>> = {
6
- [k in keyof T]: DocumentReference<Required<T>[k]>;
7
- };
8
- type Grouped<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, RootAlias extends Alias> = Aliases[RootAlias] extends [] ? Required<ReturnType>[RootAlias] : Record<RootAlias, Required<ReturnType>[RootAlias]> & OtherGroups<Aliases, ReturnType, Aliases[RootAlias]>;
9
- type OtherGroups<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, ManyRootAliases extends Alias[]> = ManyRootAliases extends [infer First extends Alias, ...infer Rest extends Alias[]] ? Record<First, Array<Grouped<Aliases, ReturnType, First>>> & OtherGroups<Aliases, ReturnType, Rest> : Record<Alias, never>;
10
- interface HasGrouped {
11
- /**
12
- * Transforms this join query result to a nested data structure. For example, a join between teachers and students
13
- * normally returns a result of the form:
14
- * [
15
- * { teacher: {name: 'Mr. Smith'}, student: {name: 'John Doe'} },
16
- * { teacher: {name: 'Mr. Smith'}, student: {name: 'Jane Smith'} },
17
- * { teacher: {name: 'Mr. EmptyClass'}, student: undefined },
18
- * ]
19
- * into a result of the form:
20
- * [
21
- * { teacher: {name: 'Mr. Smith'}, students: [
22
- * { name: 'John Doe' },
23
- * { name: 'Jane Smith' },
24
- * ]},
25
- * { teacher: {name: 'Mr. EmptyClass'}, students: [] },
26
- * ]
27
- */
28
- grouped(): any;
29
- }
30
- /**
31
- * A query builder that can participate in a join.
32
- * To learn more about join queries, see the
33
- * {@link https://docs.squid.cloud/docs/development-tools/client-sdk/queries#joining-data-across-collections-and-integrations documentation}.
34
- */
35
- export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, LatestAlias extends Alias, RootAlias extends Alias> extends BaseQueryBuilder<ReturnType> implements SnapshotEmitter<WithDocumentReferences<ReturnType>>, HasGrouped, HasDereference {
36
- private readonly collectionName;
37
- private readonly integrationId;
38
- private readonly querySubscriptionManager;
39
- private readonly documentReferenceFactory;
40
- private readonly queryBuilderFactory;
41
- private readonly latestAlias;
42
- private readonly joins;
43
- private readonly joinConditions;
44
- private readonly queryBuilder;
45
- /**
46
- * Adds a condition to the query.
47
- *
48
- * @param fieldName The name of the field to query
49
- * @param operator The operator to use
50
- * @param value The value to compare against
51
- * @returns The query builder
52
- */
53
- where(fieldName: (keyof ReturnType[LatestAlias] & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
54
- /**
55
- * Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
56
- * if none is provided.
57
- *
58
- * @param limit The maximum number of results to return
59
- * @returns The query builder
60
- */
61
- limit(limit: number): this;
62
- getLimit(): number;
63
- /**
64
- * Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
65
- * determines the order in which they are applied.
66
- * @param fieldName The name of the field to sort by
67
- * @param asc Whether to sort in ascending order. Defaults to true.
68
- * @returns The query builder
69
- */
70
- sortBy(fieldName: keyof ReturnType[RootAlias] & FieldName, asc?: boolean): this;
71
- /**
72
- * Joins this query with another join query and return a new query builder that can be used to query the joined
73
- * documents.
74
- * @param queryBuilder The query builder to join with
75
- * @param alias TODO
76
- * @param joinFields TODO
77
- * @param options TODO
78
- * @returns A new query builder that can be used to query the joined documents
79
- */
80
- join<NewAlias extends string, NewReturnType extends DocumentData, LeftAlias extends Extract<keyof ReturnType, Alias>, IsInner extends boolean = false>(queryBuilder: QueryBuilder<NewReturnType>, alias: Exclude<NewAlias, keyof ReturnType>, joinFields: {
81
- left: keyof Required<ReturnType>[LeftAlias] & FieldName;
82
- right: keyof NewReturnType & FieldName;
83
- }, options: {
84
- leftAlias: LeftAlias;
85
- isInner?: IsInner;
86
- }): JoinQueryBuilder<Omit<Aliases, LeftAlias> & Record<LeftAlias, [...Aliases[LeftAlias], NewAlias]> & Record<NewAlias, []>, ReturnType & (IsInner extends true ? Record<NewAlias, NewReturnType> : Partial<Record<NewAlias, NewReturnType>>), NewAlias, RootAlias>;
87
- join<NewAlias extends string, NewReturnType extends DocumentData, IsInner extends boolean = false>(queryBuilder: QueryBuilder<NewReturnType>, alias: Exclude<NewAlias, keyof ReturnType>, joinFields: {
88
- left: keyof Required<ReturnType>[LatestAlias] & FieldName;
89
- right: keyof NewReturnType & FieldName;
90
- }, options?: {
91
- isInner?: IsInner;
92
- }): JoinQueryBuilder<Omit<Aliases, LatestAlias> & Record<LatestAlias, [...Aliases[LatestAlias], NewAlias]> & Record<NewAlias, []>, ReturnType & (IsInner extends true ? Record<NewAlias, NewReturnType> : Partial<Record<NewAlias, NewReturnType>>), NewAlias, RootAlias>;
93
- /** @inheritDoc */
94
- snapshot(): Promise<Array<WithDocumentReferences<ReturnType>>>;
95
- /** @inheritDoc */
96
- snapshots(subscribe?: boolean): Observable<Array<WithDocumentReferences<ReturnType>>>;
97
- /**
98
- * @inheritDoc
99
- */
100
- peek(): Array<WithDocumentReferences<ReturnType>>;
101
- /** @inheritDoc */
102
- grouped(): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
103
- /** @inheritDoc */
104
- dereference(): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
105
- getSortOrders(): Array<FieldSort<any>>;
106
- clone(): JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
107
- addCompositeCondition(conditions: Array<SimpleCondition>): JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
108
- flipSortOrder(): JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
109
- extractData(data: WithDocumentReferences<ReturnType>): any;
110
- serialize(): SerializedJoinQuery;
111
- paginate(options?: Partial<PaginationOptions>): Pagination<WithDocumentReferences<ReturnType>>;
112
- }
113
- declare class DereferencedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<ReturnType>, HasGrouped {
114
- private readonly joinQueryBuilder;
115
- constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
116
- /** @inheritDoc */
117
- grouped(): SnapshotEmitter<Grouped<Aliases, ReturnType, RootAlias>>;
118
- /** @inheritDoc */
119
- snapshot(): Promise<Array<ReturnType>>;
120
- /** @inheritDoc */
121
- snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
122
- /**
123
- * @inheritDoc
124
- */
125
- peek(): Array<ReturnType>;
126
- getSortOrders(): Array<FieldSort<any>>;
127
- clone(): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
128
- addCompositeCondition(conditions: Array<SimpleCondition>): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
129
- flipSortOrder(): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
130
- limit(limit: number): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
131
- extractData(data: ReturnType): any;
132
- paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
133
- serialize(): SerializedJoinQuery;
134
- getLimit(): number;
135
- }
136
- declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>, HasDereference {
137
- readonly joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
138
- /** internal */
139
- constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
140
- /** @inheritDoc */
141
- snapshot(): Promise<Array<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>>;
142
- /** @inheritDoc */
143
- snapshots(subscribe?: boolean): Observable<Array<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>>;
144
- /**
145
- * @inheritDoc
146
- */
147
- peek(): Array<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
148
- /** @inheritDoc */
149
- dereference(): SnapshotEmitter<Grouped<Aliases, ReturnType, RootAlias>>;
150
- private groupData;
151
- getSortOrders(): Array<FieldSort<any>>;
152
- clone(): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
153
- addCompositeCondition(conditions: Array<SimpleCondition>): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
154
- flipSortOrder(): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
155
- limit(limit: number): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
156
- getLimit(): number;
157
- extractData(data: Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>): any;
158
- serialize(): SerializedJoinQuery;
159
- paginate(options?: Partial<PaginationOptions>): Pagination<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
160
- }
161
- export {};
1
+ import { Observable } from 'rxjs';
2
+ import { DocumentReference } from '../document-reference';
3
+ import { Alias, DocumentData, FieldName, FieldSort, Operator, PrimitiveFieldType, Query, SerializedJoinQuery, SimpleCondition } from '../public-types';
4
+ import { Pagination, PaginationOptions } from './pagination';
5
+ import { BaseQueryBuilder, HasDereference, QueryBuilder } from './query-builder.factory';
6
+ import { SnapshotEmitter } from './snapshot-emitter';
7
+ /**
8
+ * Represents the result of a join query where each property is a document reference,
9
+ * grouped by alias instead of containing DocumentData.
10
+ * @category Database
11
+ */
12
+ export type WithDocumentReferences<T extends Record<any, DocumentData>> = {
13
+ [k in keyof T]: DocumentReference<Required<T>[k]>;
14
+ };
15
+ /**
16
+ * Defines the fields used for joining two collections in a query.
17
+ * Specifies the left and right fields that establish the join relationship.
18
+ * @category Database
19
+ */
20
+ export interface JoinFields<ReturnType> {
21
+ /** Field from the left collection to be used in the join. */
22
+ left: FieldName;
23
+ /** Field from the right collection to be used in the join. */
24
+ right: keyof ReturnType & FieldName;
25
+ }
26
+ /**
27
+ * Options for configuring a join query.
28
+ * Specifies aliasing and whether the join is inner or outer.
29
+ * @category Database
30
+ */
31
+ export interface JoinOptions {
32
+ /** Alias for the left collection in the join. */
33
+ leftAlias: Alias;
34
+ /** Whether the join should be an inner join (default is outer join). */
35
+ isInner?: boolean;
36
+ }
37
+ /**
38
+ * A join query result that has been grouped by alias.
39
+ * @category Database
40
+ */
41
+ export type Grouped<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, RootAlias extends Alias> = Aliases[RootAlias] extends [] ? Required<ReturnType>[RootAlias] : Record<RootAlias, Required<ReturnType>[RootAlias]> & OtherGroups<Aliases, ReturnType, Aliases[RootAlias]>;
42
+ /**
43
+ * A helper type for Groups.
44
+ * @category Database
45
+ */
46
+ export type OtherGroups<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, any>, ManyRootAliases extends Alias[]> = ManyRootAliases extends [infer First extends Alias, ...infer Rest extends Alias[]] ? Record<First, Array<Grouped<Aliases, ReturnType, First>>> & OtherGroups<Aliases, ReturnType, Rest> : Record<Alias, never>;
47
+ /**
48
+ * A join query result that has been grouped by alias.
49
+ * @category Database
50
+ */
51
+ export interface HasGrouped {
52
+ /**
53
+ * Transforms this join query result to a nested data structure. For example, a join between teachers and students
54
+ * normally returns a result of the form:
55
+ * [
56
+ * { teacher: {name: 'Mr. Smith'}, student: {name: 'John Doe'} },
57
+ * { teacher: {name: 'Mr. Smith'}, student: {name: 'Jane Smith'} },
58
+ * { teacher: {name: 'Mr. EmptyClass'}, student: undefined },
59
+ * ]
60
+ * into a result of the form:
61
+ * [
62
+ * { teacher: {name: 'Mr. Smith'}, students: [
63
+ * { name: 'John Doe' },
64
+ * { name: 'Jane Smith' },
65
+ * ]},
66
+ * { teacher: {name: 'Mr. EmptyClass'}, students: [] },
67
+ * ]
68
+ */
69
+ grouped(): any;
70
+ }
71
+ /**
72
+ * A query builder that can participate in a join.
73
+ * To learn more about join queries, see the
74
+ * {@link https://docs.getsquid.ai/docs/sdk/client-sdk/database/queries#joining-data-across-collections-and-connectors
75
+ * documentation}.
76
+ * @category Database
77
+ */
78
+ export declare class JoinQueryBuilder<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, LatestAlias extends Alias, RootAlias extends Alias> extends BaseQueryBuilder<ReturnType> implements SnapshotEmitter<WithDocumentReferences<ReturnType>>, HasGrouped, HasDereference {
79
+ private readonly collectionName;
80
+ private readonly integrationId;
81
+ private readonly querySubscriptionManager;
82
+ private readonly documentReferenceFactory;
83
+ private readonly queryBuilderFactory;
84
+ private readonly latestAlias;
85
+ private readonly joins;
86
+ private readonly joinConditions;
87
+ private readonly queryBuilder;
88
+ /**
89
+ * Adds a condition to the query.
90
+ *
91
+ * @param fieldName The name of the field to query
92
+ * @param operator The operator to use
93
+ * @param value The value to compare against
94
+ * @returns The query builder
95
+ */
96
+ where(fieldName: (keyof ReturnType[LatestAlias] & FieldName) | string, operator: Operator | 'in' | 'not in', value: PrimitiveFieldType | Array<PrimitiveFieldType>): this;
97
+ /**
98
+ * Sets a limit to the number of results returned by the query. The maximum limit is 20,000 and the default is 1,000
99
+ * if none is provided.
100
+ *
101
+ * @param limit The maximum number of results to return
102
+ * @returns The query builder
103
+ */
104
+ limit(limit: number): this;
105
+ /**
106
+ * Adds a sort order to the query. You can add multiple sort orders to the query. The order in which you add them
107
+ * determines the order in which they are applied.
108
+ * @param fieldName The name of the field to sort by
109
+ * @param asc Whether to sort in ascending order. Defaults to true.
110
+ * @returns The query builder
111
+ */
112
+ sortBy(fieldName: (keyof ReturnType[RootAlias] & FieldName) | string, asc?: boolean): this;
113
+ /**
114
+ * Joins this query with another collection using a specified alias from the left side of the join,
115
+ * allowing you to build complex multi-level joins. The join is defined by specifying which fields
116
+ * to use on both sides of the relationship.
117
+ *
118
+ * @param queryBuilder - The query builder for the collection you want to join with.
119
+ * @param alias - A unique alias for the joined collection. Must not conflict with existing aliases.
120
+ * @param joinFields - The join condition specifying which fields to join: `left` is from the `leftAlias` collection,
121
+ * `right` is from the joined collection.
122
+ * @param options - Configuration for the join:
123
+ * - `leftAlias`: the alias of the collection on the left-hand side of the join.
124
+ * - `isInner`: whether this should be an inner join (default is outer join).
125
+ * @returns A new `JoinQueryBuilder` instance including the joined collection, allowing you to continue building the
126
+ * query.
127
+ */
128
+ join<NewAlias extends string, NewReturnType extends DocumentData, LeftAlias extends Extract<keyof ReturnType, Alias>, IsInner extends boolean = false>(queryBuilder: QueryBuilder<NewReturnType>, alias: Exclude<NewAlias, keyof ReturnType>, joinFields: {
129
+ left: keyof Required<ReturnType>[LeftAlias] & FieldName;
130
+ right: keyof NewReturnType & FieldName;
131
+ }, options: {
132
+ leftAlias: LeftAlias;
133
+ isInner?: IsInner;
134
+ }): Omit<JoinQueryBuilder<Omit<Aliases, LeftAlias> & Record<LeftAlias, [...Aliases[LeftAlias], NewAlias]> & Record<NewAlias, []>, ReturnType & (IsInner extends true ? Record<NewAlias, NewReturnType> : Partial<Record<NewAlias, NewReturnType>>), NewAlias, RootAlias>, 'limit' | 'getLimit'>;
135
+ /**
136
+ * Joins this query with another collection using a specified alias from the left side.
137
+ *
138
+ * @param queryBuilder - The query builder for the collection to be joined.
139
+ * @param alias - A unique alias for the joined collection.
140
+ * @param joinFields - Fields that define the join relationship (`left` and `right`).
141
+ * @param options - Options including the left alias to join from and whether the join is inner.
142
+ * @returns A new `JoinQueryBuilder` including the joined collection.
143
+ */
144
+ join<NewAlias extends string, NewReturnType extends DocumentData, IsInner extends boolean = false>(queryBuilder: QueryBuilder<NewReturnType>, alias: Exclude<NewAlias, keyof ReturnType>, joinFields: {
145
+ left: keyof Required<ReturnType>[LatestAlias] & FieldName;
146
+ right: keyof NewReturnType & FieldName;
147
+ }, options?: {
148
+ isInner?: IsInner;
149
+ }): Omit<JoinQueryBuilder<Omit<Aliases, LatestAlias> & Record<LatestAlias, [...Aliases[LatestAlias], NewAlias]> & Record<NewAlias, []>, ReturnType & (IsInner extends true ? Record<NewAlias, NewReturnType> : Partial<Record<NewAlias, NewReturnType>>), NewAlias, RootAlias>, 'limit' | 'getLimit'>;
150
+ /** @inheritDoc */
151
+ snapshot(): Promise<Array<WithDocumentReferences<ReturnType>>>;
152
+ /** @inheritDoc */
153
+ snapshots(subscribe?: boolean): Observable<Array<WithDocumentReferences<ReturnType>>>;
154
+ /**
155
+ * @inheritDoc
156
+ */
157
+ peek(): Array<WithDocumentReferences<ReturnType>>;
158
+ /** @inheritDoc */
159
+ grouped(): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
160
+ /** @inheritDoc */
161
+ dereference(): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
162
+ /** @inheritDoc */
163
+ build(): Query;
164
+ /**
165
+ * Gets the list of sort orders applied to the query.
166
+ *
167
+ * @returns An array of field sort configurations.
168
+ */
169
+ getSortOrders(): Array<FieldSort<any>>;
170
+ /**
171
+ * Creates a deep copy of the current query builder.
172
+ *
173
+ * @returns A cloned instance of the query builder.
174
+ */
175
+ clone(): JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
176
+ /**
177
+ * Adds a composite condition (AND of multiple conditions) to the query.
178
+ *
179
+ * @param conditions An array of simple conditions to apply.
180
+ * @returns The updated query builder.
181
+ */
182
+ addCompositeCondition(conditions: Array<SimpleCondition>): JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
183
+ /**
184
+ * Reverses the current sort order(s) of the query.
185
+ *
186
+ * @returns The updated query builder with reversed sort order(s).
187
+ */
188
+ flipSortOrder(): JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
189
+ /**
190
+ * Extracts the root document's data from a join query result.
191
+ *
192
+ * @param data A result object with document references.
193
+ * @returns The root alias's document reference data.
194
+ */
195
+ extractData(data: WithDocumentReferences<ReturnType>): Required<ReturnType>[RootAlias];
196
+ /**
197
+ * Serializes the join query into a plain object.
198
+ *
199
+ * @returns A serialized representation of the query, suitable for transport or logging.
200
+ */
201
+ serialize(): SerializedJoinQuery;
202
+ /**
203
+ * Enables pagination for the join query results.
204
+ *
205
+ * @param options Optional pagination configuration such as page size and cursor.
206
+ * @returns A {@link Pagination} object for fetching paginated results.
207
+ */
208
+ paginate(options?: Partial<PaginationOptions>): Pagination<WithDocumentReferences<ReturnType>>;
209
+ /**
210
+ * Checks whether the join query contains any inner joins.
211
+ *
212
+ * @returns `true` if at least one join is inner; otherwise `false`.
213
+ */
214
+ hasIsInner(): boolean;
215
+ }
216
+ /**
217
+ * A join query result that has been grouped by alias and returns the DocumentData.
218
+ * @category Database
219
+ */
220
+ export declare class DereferencedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<ReturnType>, HasGrouped {
221
+ private readonly joinQueryBuilder;
222
+ /** @inheritDoc */
223
+ grouped(): SnapshotEmitter<Grouped<Aliases, ReturnType, RootAlias>>;
224
+ /** @inheritDoc */
225
+ snapshot(): Promise<Array<ReturnType>>;
226
+ /** @inheritDoc */
227
+ snapshots(subscribe?: boolean): Observable<Array<ReturnType>>;
228
+ /**
229
+ * @inheritDoc
230
+ */
231
+ peek(): Array<ReturnType>;
232
+ /**
233
+ * Returns the current sort orders applied to the query.
234
+ *
235
+ * @returns An array of field sort definitions.
236
+ */
237
+ getSortOrders(): Array<FieldSort<any>>;
238
+ /**
239
+ * Clones the current join query builder instance.
240
+ *
241
+ * @returns A deep copy of the join query builder.
242
+ */
243
+ clone(): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
244
+ /**
245
+ * Adds multiple conditions that are combined with an AND operator.
246
+ *
247
+ * @param conditions An array of conditions to be applied together.
248
+ * @returns The updated query builder.
249
+ */
250
+ addCompositeCondition(conditions: Array<SimpleCondition>): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
251
+ /**
252
+ * Reverses the direction of all currently applied sort orders.
253
+ *
254
+ * @returns The updated query builder.
255
+ */
256
+ flipSortOrder(): DereferencedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
257
+ /**
258
+ * Extracts the root document's data from the given join result.
259
+ *
260
+ * @param data A record containing document references.
261
+ * @returns The root document's data.
262
+ */
263
+ extractData(data: ReturnType): any;
264
+ /**
265
+ * Enables pagination for the join query results.
266
+ *
267
+ * @param options Optional pagination configuration such as page size and cursor.
268
+ * @returns A {@link Pagination} object for fetching paginated results.
269
+ */
270
+ paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
271
+ /**
272
+ * Serializes the join query into a plain object.
273
+ *
274
+ * @returns A serialized representation of the query, suitable for transport or logging.
275
+ */
276
+ serialize(): SerializedJoinQuery;
277
+ }
278
+ /**
279
+ * A join query result that has been grouped by alias.
280
+ * @category Database
281
+ */
282
+ export declare class GroupedJoin<Aliases extends Record<Alias, Alias[]>, ReturnType extends Record<Alias, DocumentData>, RootAlias extends Alias, LatestAlias extends Alias> implements SnapshotEmitter<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>, HasDereference {
283
+ readonly joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>;
284
+ /** internal */
285
+ constructor(joinQueryBuilder: JoinQueryBuilder<Aliases, ReturnType, LatestAlias, RootAlias>);
286
+ /** @inheritDoc */
287
+ snapshot(): Promise<Array<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>>;
288
+ /** @inheritDoc */
289
+ snapshots(subscribe?: boolean): Observable<Array<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>>;
290
+ /**
291
+ * @inheritDoc
292
+ */
293
+ peek(): Array<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
294
+ /** @inheritDoc */
295
+ dereference(): SnapshotEmitter<Grouped<Aliases, ReturnType, RootAlias>>;
296
+ /** @inheritDoc */
297
+ getSortOrders(): Array<FieldSort<any>>;
298
+ /** @inheritDoc */
299
+ clone(): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
300
+ /** @inheritDoc */
301
+ addCompositeCondition(conditions: Array<SimpleCondition>): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
302
+ /** @inheritDoc */
303
+ flipSortOrder(): GroupedJoin<Aliases, ReturnType, RootAlias, LatestAlias>;
304
+ /** @inheritDoc */
305
+ extractData(data: Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>): any;
306
+ /** @inheritDoc */
307
+ serialize(): SerializedJoinQuery;
308
+ /**
309
+ * Enables pagination for the join query results.
310
+ *
311
+ * @param options Optional pagination configuration such as page size and cursor.
312
+ * @returns A {@link Pagination} object for fetching paginated results.
313
+ */
314
+ paginate(options?: Partial<PaginationOptions>): Pagination<Grouped<Aliases, WithDocumentReferences<ReturnType>, RootAlias>>;
315
+ private groupData;
316
+ }
@@ -1,9 +1 @@
1
- import { DocumentReferenceFactory } from '../document-reference.factory';
2
- import { DocumentStore } from '../document-store';
3
- import { QuerySubscriptionManager } from './query-subscription.manager';
4
- export declare class LocalQueryManager {
5
- private readonly documentStore;
6
- private readonly documentReferenceFactory;
7
- private readonly querySubscriptionManager;
8
- constructor(documentStore: DocumentStore, documentReferenceFactory: DocumentReferenceFactory, querySubscriptionManager: QuerySubscriptionManager);
9
- }
1
+ export {};
@@ -1,62 +1,65 @@
1
- import { Observable } from 'rxjs';
2
- /** The state of a pagination. */
3
- export interface PaginationState<ReturnType> {
4
- /** The page data. */
5
- data: Array<ReturnType>;
6
- /** Whether there is a next page. */
7
- hasNext: boolean;
8
- /** Whether there is a previous page. */
9
- hasPrev: boolean;
10
- }
11
- /** Pagination options */
12
- export interface PaginationOptions {
13
- /** Whether to show real-time updates. Defaults to true. */
14
- subscribe: boolean;
15
- /** The number of items in a page. Defaults to 100. */
16
- pageSize: number;
17
- }
18
- interface InternalState<ReturnType> {
19
- data: ReturnType[];
20
- extractedData: any[];
21
- numBefore: number;
22
- numAfter: number;
23
- }
24
- export declare class Pagination<ReturnType> {
25
- private readonly options;
26
- private internalStateObserver;
27
- private firstElement;
28
- private readonly isDestroyed;
29
- private templateSnapshotEmitter;
30
- private snapshotSubject;
31
- private onFirstPage;
32
- private navigatingToLastPage;
33
- private lastElement;
34
- private goToFirstPage;
35
- private static compareValues;
36
- private compare;
37
- private dataReceived;
38
- private doNewQuery;
39
- private waitForInternalState;
40
- private internalStateToState;
41
- /** Unsubscribes from the pagination. */
42
- unsubscribe(): void;
43
- prevInternal(internalState: InternalState<ReturnType>): void;
44
- /** Returns a promise that resolves when the previous page of data is available. */
45
- prev(): Promise<PaginationState<ReturnType>>;
46
- /** Returns a promise that resolves when the next page of data is available. */
47
- next(): Promise<PaginationState<ReturnType>>;
48
- /** Returns a promise that resolves when the page data is available. */
49
- waitForData(): Promise<PaginationState<ReturnType>>;
50
- /** Returns an observable that emits the current state of the pagination. */
51
- observeState(): Observable<PaginationState<ReturnType>>;
52
- /** Jumps to the first page of the pagination. */
53
- first(): Promise<PaginationState<ReturnType>>;
54
- /** Refreshes the current page of the pagination. */
55
- refreshPage(): Promise<PaginationState<ReturnType>>;
56
- /**
57
- * Jumps to the last page of the pagination. This page will always have the last <pageSize> elements of the
58
- * underlying query, regardless of whether the total document count is evenly divisible by the page size.
59
- */
60
- last(): Promise<PaginationState<ReturnType>>;
61
- }
62
- export {};
1
+ import { Observable } from 'rxjs';
2
+ /**
3
+ * The state of a pagination.
4
+ * @category Database
5
+ */
6
+ export interface PaginationState<ReturnType> {
7
+ /** The page data. */
8
+ data: Array<ReturnType>;
9
+ /** Whether there is a next page. */
10
+ hasNext: boolean;
11
+ /** Whether there is a previous page. */
12
+ hasPrev: boolean;
13
+ }
14
+ /**
15
+ * Pagination options.
16
+ * @category Database
17
+ */
18
+ export interface PaginationOptions {
19
+ /** Whether to show real-time updates. Defaults to true. */
20
+ subscribe: boolean;
21
+ /** The number of items in a page. Defaults to 100. */
22
+ pageSize: number;
23
+ }
24
+ /**
25
+ * Pagination provides a paginated view over a dataset, supporting navigation
26
+ * through pages, real-time updates, and sorting based on predefined criteria.
27
+ * @category Database
28
+ */
29
+ export declare class Pagination<ReturnType> {
30
+ private readonly paginateOptions;
31
+ private internalStateObserver;
32
+ private firstElement;
33
+ private readonly isDestroyed;
34
+ private templateSnapshotEmitter;
35
+ private snapshotSubject;
36
+ private onFirstPage;
37
+ private navigatingToLastPage;
38
+ private lastElement;
39
+ /** Unsubscribes from the pagination. */
40
+ unsubscribe(): void;
41
+ /** Returns a promise that resolves when the previous page of data is available. */
42
+ prev(): Promise<PaginationState<ReturnType>>;
43
+ /** Returns a promise that resolves when the next page of data is available. */
44
+ next(): Promise<PaginationState<ReturnType>>;
45
+ /** Returns a promise that resolves when the page data is available. */
46
+ waitForData(): Promise<PaginationState<ReturnType>>;
47
+ /** Returns an observable that emits the current state of the pagination. */
48
+ observeState(): Observable<PaginationState<ReturnType>>;
49
+ /** Jumps to the first page of the pagination. */
50
+ first(): Promise<PaginationState<ReturnType>>;
51
+ /** Refreshes the current page of the pagination. */
52
+ refreshPage(): Promise<PaginationState<ReturnType>>;
53
+ /**
54
+ * Jumps to the last page of the pagination. This page will always have the last `pageSize` elements of the
55
+ * underlying query, regardless of whether the total document count is evenly divisible by the page size.
56
+ */
57
+ last(): Promise<PaginationState<ReturnType>>;
58
+ private goToFirstPage;
59
+ private compareObjects;
60
+ private dataReceived;
61
+ private doNewQuery;
62
+ private waitForInternalState;
63
+ private internalStateToState;
64
+ private prevInternal;
65
+ }