@squidcloud/client 1.0.146 → 1.0.148
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.
- package/dist/cjs/index.js +8378 -624
- package/dist/common/src/utils/serialization.d.ts +1 -2
- package/dist/typescript-client/src/backend-function.manager.d.ts +1 -1
- package/dist/typescript-client/src/data.manager.d.ts +2 -1
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +2 -1
- package/dist/typescript-client/src/squid.d.ts +2 -2
- package/package.json +5 -4
- package/dist/typescript-client/src/state/action.applier.d.ts +0 -7
- package/dist/typescript-client/src/state/actions.d.ts +0 -29
- package/dist/typescript-client/src/state/path_trie.d.ts +0 -27
- package/dist/typescript-client/src/state/state.service.d.ts +0 -22
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare function normalizeJsonAsString(json: any): string;
|
|
2
|
-
export declare function serializeObj(obj:
|
|
2
|
+
export declare function serializeObj(obj: unknown): string;
|
|
3
3
|
export declare function deserializeObj<T = any>(str: string): T;
|
|
4
4
|
export declare function encodeValueForMapping(value: any): string;
|
|
5
5
|
export declare function decodeValueForMapping(encodedString: string): any;
|
|
6
|
-
export declare function recodeValue(value: any): any;
|
|
@@ -5,5 +5,5 @@ export declare class BackendFunctionManager {
|
|
|
5
5
|
private readonly clientIdService;
|
|
6
6
|
private readonly rpcManager;
|
|
7
7
|
constructor(clientIdService: ClientIdService, rpcManager: RpcManager);
|
|
8
|
-
executeFunctionAndSubscribe<T>(functionName: string, ...params:
|
|
8
|
+
executeFunctionAndSubscribe<T>(functionName: string, ...params: unknown[]): Observable<T>;
|
|
9
9
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DocTimestamp, LockManager, Mutation, SquidDocId, SquidDocument } from '@squidcloud/common';
|
|
2
|
-
import { QuerySender } from './query/query-sender';
|
|
3
2
|
import { DestructManager } from './destruct.manager';
|
|
4
3
|
import DocumentIdentityService from './document-identity.service';
|
|
5
4
|
import { DocumentStore } from './document-store';
|
|
6
5
|
import { MutationSender } from './mutation/mutation-sender';
|
|
7
6
|
import { QueryBuilderFactory } from './query/query-builder.factory';
|
|
7
|
+
import { QuerySender } from './query/query-sender';
|
|
8
8
|
import { QuerySubscriptionManager } from './query/query-subscription.manager';
|
|
9
9
|
import { SocketManager } from './socket.manager';
|
|
10
10
|
import { TransactionId } from './types';
|
|
@@ -117,6 +117,7 @@ export declare class DataManager {
|
|
|
117
117
|
*/
|
|
118
118
|
private applyIncomingUpdates;
|
|
119
119
|
private maybeApplyIncomingUpdate;
|
|
120
|
+
private refreshQueryMapping;
|
|
120
121
|
private destruct;
|
|
121
122
|
private stopDeleteExpiredTimestampsJob;
|
|
122
123
|
/**
|
|
@@ -48,9 +48,10 @@ export declare class QuerySubscriptionManager {
|
|
|
48
48
|
*/
|
|
49
49
|
getQuery(clientRequestId: ClientRequestId): Query;
|
|
50
50
|
/**
|
|
51
|
-
* A query receives updates from
|
|
51
|
+
* A query receives updates from three different sources:
|
|
52
52
|
* 1 - An initial snapshot from the server or from a parent query
|
|
53
53
|
* 2 - Incremental updates from the server (or from a parent query before the query is registered)
|
|
54
|
+
* 3 - A new snapshot if the query is refreshed after connection has been lost.
|
|
54
55
|
*
|
|
55
56
|
* If an incremental update is received before the snapshot was received, we cannot process it for this query.
|
|
56
57
|
* This boolean indicates whether the initial snapshot was received.
|
|
@@ -129,9 +129,9 @@ export declare class Squid {
|
|
|
129
129
|
* When the provider returns undefined, no authorization information is sent.
|
|
130
130
|
* When a new provider is set, all future Squid backend requests will use the new token provider, and exising
|
|
131
131
|
* in-flight requests won't be affected.
|
|
132
|
-
* @returns void
|
|
132
|
+
* @returns void.
|
|
133
133
|
*/
|
|
134
|
-
setAuthProvider(authProvider: SquidAuthProvider)
|
|
134
|
+
setAuthProvider: (authProvider: SquidAuthProvider) => void;
|
|
135
135
|
/**
|
|
136
136
|
* Returns a reference to the collection in the provided integration.
|
|
137
137
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.148",
|
|
4
4
|
"description": "A typescript implementation of the Squid client",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"types": "dist/typescript-client/src/index.d.ts",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"build:dev": "webpack --mode=development",
|
|
14
14
|
"build:prod": "webpack --mode=production",
|
|
15
15
|
"watch": "webpack --watch",
|
|
16
|
+
"lint": "eslint . --ext .ts",
|
|
16
17
|
"test": "jest --detectOpenHandles",
|
|
17
18
|
"test:watch": "jest --watch",
|
|
18
19
|
"test:cov": "jest --coverage",
|
|
@@ -32,11 +33,12 @@
|
|
|
32
33
|
"license": "ISC",
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"@apollo/client": "^3.7.4",
|
|
35
|
-
"@squidcloud/common": "1.0.
|
|
36
|
+
"@squidcloud/common": "1.0.148",
|
|
36
37
|
"@supercharge/promise-pool": "^2.3.2",
|
|
37
|
-
"cross-fetch": "^3.1.5",
|
|
38
38
|
"axios": "^1.6.2",
|
|
39
|
+
"cross-fetch": "^3.1.5",
|
|
39
40
|
"lodash": "^4.17.21",
|
|
41
|
+
"otrie": "1.1.2",
|
|
40
42
|
"ws": "^8.13.0"
|
|
41
43
|
},
|
|
42
44
|
"peerDependencies": {
|
|
@@ -45,7 +47,6 @@
|
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@types/lodash": "^4.14.186",
|
|
47
49
|
"@webpack-cli/generators": "^3.0.0",
|
|
48
|
-
"assertic": "^1.0.0",
|
|
49
50
|
"copy-webpack-plugin": "^11.0.0",
|
|
50
51
|
"cpx": "^1.5.0",
|
|
51
52
|
"generate-package-json-webpack-plugin": "^2.6.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { BaseAction } from './actions';
|
|
2
|
-
export type StateLeafNode = string | boolean | number | null | undefined | object | Array<StateLeafNode> | State;
|
|
3
|
-
export type State = {
|
|
4
|
-
[key: string]: StateLeafNode;
|
|
5
|
-
};
|
|
6
|
-
export declare function apply(state: State, action: BaseAction): State;
|
|
7
|
-
export declare function isStateObject(state: StateLeafNode): state is State;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { StateLeafNode } from './action.applier';
|
|
2
|
-
export declare enum ActionType {
|
|
3
|
-
DELETE_PATH = "DELETE_PATH",
|
|
4
|
-
SET_PATH = "SET_PATH",
|
|
5
|
-
BATCH_ACTION = "BATCH_ACTION"
|
|
6
|
-
}
|
|
7
|
-
export declare interface BaseAction {
|
|
8
|
-
type: ActionType;
|
|
9
|
-
}
|
|
10
|
-
export declare interface PathAction extends BaseAction {
|
|
11
|
-
path: string[];
|
|
12
|
-
}
|
|
13
|
-
export type DeletePathAction = PathAction;
|
|
14
|
-
export declare interface SetPathAction extends PathAction {
|
|
15
|
-
payload?: StateLeafNode;
|
|
16
|
-
}
|
|
17
|
-
export declare interface BatchAction extends BaseAction {
|
|
18
|
-
payload: BaseAction[];
|
|
19
|
-
}
|
|
20
|
-
export declare interface StateMessage {
|
|
21
|
-
type: 'ACTIONS';
|
|
22
|
-
payload: BaseAction[];
|
|
23
|
-
}
|
|
24
|
-
export declare function isPathAction(action: BaseAction): action is PathAction;
|
|
25
|
-
export declare function isSetPathAction(action: BaseAction): action is SetPathAction;
|
|
26
|
-
export declare function isDeletePathAction(action: BaseAction): action is DeletePathAction;
|
|
27
|
-
export declare function isBatchAction(action: BaseAction): action is BatchAction;
|
|
28
|
-
export declare function extractAllPathActions(action: BaseAction): PathAction[];
|
|
29
|
-
export declare function getSingleAction(actions: BaseAction[]): BaseAction;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BaseAction } from './actions';
|
|
2
|
-
export declare class PathTrie<T> {
|
|
3
|
-
private root;
|
|
4
|
-
getOrCreatePathTrieNode(path: string[], nodeData?: T): PathTrieNode<T>;
|
|
5
|
-
getPathTrieNode(path: string[]): PathTrieNode<T> | undefined;
|
|
6
|
-
getPathTrie(path: string[]): PathTrie<T> | undefined;
|
|
7
|
-
/**
|
|
8
|
-
* If the callback returns false, it will not iterate into the children of the current node.
|
|
9
|
-
*/
|
|
10
|
-
iterateBfs(callback: (data: T, path: string[]) => void | boolean): void;
|
|
11
|
-
removeNode(path: string[]): void;
|
|
12
|
-
clearNodeData(path: string[]): void;
|
|
13
|
-
getNodeList(path: string[]): Array<PathTrieNode<T>>;
|
|
14
|
-
private iterateInternal;
|
|
15
|
-
}
|
|
16
|
-
export declare class PathTrieNode<T> {
|
|
17
|
-
children: Map<string, PathTrieNode<T>>;
|
|
18
|
-
nodeData: T | undefined;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Returns a trie which contains all the paths affected by the action. For
|
|
22
|
-
* example, if the action contains a path action applied on path [A, B, C], then
|
|
23
|
-
* [A], [A, B], [A, B, C] will be in the returned trie. Moreover, if
|
|
24
|
-
* subscriptionTree is provided and contains [A, B, C, ...], then [A, B, C, ...]
|
|
25
|
-
* will also be included in the returned trie.
|
|
26
|
-
*/
|
|
27
|
-
export declare function getPathTrieFromAction(action: BaseAction, subscriptionTree?: PathTrie<{}>): PathTrie<boolean>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { State, StateLeafNode } from './action.applier';
|
|
3
|
-
import { BaseAction } from './actions';
|
|
4
|
-
export declare class StateService {
|
|
5
|
-
private readonly subscriptionsTree;
|
|
6
|
-
private state;
|
|
7
|
-
private batchCount;
|
|
8
|
-
private readonly batchedActions;
|
|
9
|
-
dispatch(action: BaseAction): void;
|
|
10
|
-
runInBatch(fn: () => unknown): void;
|
|
11
|
-
observePath<T>(path: string[], pathsToExcludeFn?: () => Array<string[]>): Observable<T>;
|
|
12
|
-
setKeyInPath<T extends State>(path: string[], key: keyof T & string, value: T[keyof T] & StateLeafNode, noopIfSame?: boolean): void;
|
|
13
|
-
setPartial<T extends State>(path: string[], partialState: Partial<T>, noopIfSame?: boolean): void;
|
|
14
|
-
setInPath(path: string[], payload: StateLeafNode, noopIfSame?: boolean): void;
|
|
15
|
-
pushToArray(path: string[], payload: StateLeafNode): void;
|
|
16
|
-
deletePath(path: string[]): void;
|
|
17
|
-
getState(): State;
|
|
18
|
-
getStateInPath<T extends StateLeafNode>(path: string[]): T;
|
|
19
|
-
destroy(): void;
|
|
20
|
-
private getOrCreateSubjectForPath;
|
|
21
|
-
private dispatchSubscriptions;
|
|
22
|
-
}
|