@knocklabs/client 0.9.2 → 0.9.3
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/CHANGELOG.md +6 -0
- package/package.json +4 -1
- package/src/api.ts +110 -0
- package/src/clients/feed/feed.ts +774 -0
- package/src/clients/feed/index.ts +39 -0
- package/src/clients/feed/interfaces.ts +105 -0
- package/src/clients/feed/store.ts +93 -0
- package/src/clients/feed/types.ts +64 -0
- package/src/clients/feed/utils.ts +23 -0
- package/src/clients/objects/constants.ts +1 -0
- package/src/clients/objects/index.ts +61 -0
- package/src/clients/preferences/index.ts +196 -0
- package/src/clients/preferences/interfaces.ts +34 -0
- package/src/clients/slack/index.ts +89 -0
- package/src/clients/slack/interfaces.ts +36 -0
- package/src/clients/users/index.ts +90 -0
- package/src/clients/users/interfaces.ts +8 -0
- package/src/index.ts +16 -0
- package/src/interfaces.ts +52 -0
- package/src/knock.ts +182 -0
- package/src/networkStatus.ts +19 -0
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ApiResponse } from "../../api";
|
|
2
|
+
import Knock from "../../knock";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
AuthCheckInput,
|
|
6
|
+
GetSlackChannelsInput,
|
|
7
|
+
RevokeAccessTokenInput,
|
|
8
|
+
} from "./interfaces";
|
|
9
|
+
|
|
10
|
+
const TENANT_COLLECTION = "$tenants";
|
|
11
|
+
|
|
12
|
+
class SlackClient {
|
|
13
|
+
private instance: Knock;
|
|
14
|
+
|
|
15
|
+
constructor(instance: Knock) {
|
|
16
|
+
this.instance = instance;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async authCheck({ tenant, knockChannelId }: AuthCheckInput) {
|
|
20
|
+
const result = await this.instance.client().makeRequest({
|
|
21
|
+
method: "GET",
|
|
22
|
+
url: `/v1/providers/slack/${knockChannelId}/auth_check`,
|
|
23
|
+
params: {
|
|
24
|
+
access_token_object: {
|
|
25
|
+
object_id: tenant,
|
|
26
|
+
collection: TENANT_COLLECTION,
|
|
27
|
+
},
|
|
28
|
+
channel_id: knockChannelId,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return this.handleResponse(result);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async getChannels(input: GetSlackChannelsInput) {
|
|
36
|
+
const { knockChannelId, tenant } = input;
|
|
37
|
+
const queryOptions = input.queryOptions || {};
|
|
38
|
+
|
|
39
|
+
const result = await this.instance.client().makeRequest({
|
|
40
|
+
method: "GET",
|
|
41
|
+
url: `/v1/providers/slack/${knockChannelId}/channels`,
|
|
42
|
+
params: {
|
|
43
|
+
access_token_object: {
|
|
44
|
+
object_id: tenant,
|
|
45
|
+
collection: TENANT_COLLECTION,
|
|
46
|
+
},
|
|
47
|
+
channel_id: knockChannelId,
|
|
48
|
+
query_options: {
|
|
49
|
+
cursor: queryOptions.cursor,
|
|
50
|
+
limit: queryOptions.limit,
|
|
51
|
+
exclude_archived: queryOptions.excludeArchived,
|
|
52
|
+
team_id: queryOptions.teamId,
|
|
53
|
+
types: queryOptions.types,
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
return this.handleResponse(result);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async revokeAccessToken({ tenant, knockChannelId }: RevokeAccessTokenInput) {
|
|
62
|
+
const result = await this.instance.client().makeRequest({
|
|
63
|
+
method: "PUT",
|
|
64
|
+
url: `/v1/providers/slack/${knockChannelId}/revoke_access`,
|
|
65
|
+
params: {
|
|
66
|
+
access_token_object: {
|
|
67
|
+
object_id: tenant,
|
|
68
|
+
collection: TENANT_COLLECTION,
|
|
69
|
+
},
|
|
70
|
+
channel_id: knockChannelId,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
return this.handleResponse(result);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private handleResponse(response: ApiResponse) {
|
|
78
|
+
if (response.statusCode === "error") {
|
|
79
|
+
if (response.error?.response?.status < 500) {
|
|
80
|
+
return response.error || response.body;
|
|
81
|
+
}
|
|
82
|
+
throw new Error(response.error || response.body);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return response.body;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export default SlackClient;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type SlackChannelConnection = {
|
|
2
|
+
access_token?: string;
|
|
3
|
+
channel_id?: string;
|
|
4
|
+
incoming_webhook?: string;
|
|
5
|
+
user_id?: null;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type GetSlackChannelsInput = {
|
|
9
|
+
tenant: string;
|
|
10
|
+
knockChannelId: string;
|
|
11
|
+
queryOptions?: {
|
|
12
|
+
limit?: number;
|
|
13
|
+
cursor?: string;
|
|
14
|
+
excludeArchived?: boolean;
|
|
15
|
+
teamId?: string;
|
|
16
|
+
types?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type AuthCheckInput = {
|
|
21
|
+
tenant: string;
|
|
22
|
+
knockChannelId: string;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type RevokeAccessTokenInput = {
|
|
26
|
+
tenant: string;
|
|
27
|
+
knockChannelId: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type SlackChannel = {
|
|
31
|
+
name: string;
|
|
32
|
+
id: string;
|
|
33
|
+
is_private: boolean;
|
|
34
|
+
is_im: boolean;
|
|
35
|
+
context_team_id: boolean;
|
|
36
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { ApiResponse } from "../../api";
|
|
2
|
+
import { ChannelData } from "../../interfaces";
|
|
3
|
+
import Knock from "../../knock";
|
|
4
|
+
import {
|
|
5
|
+
GetPreferencesOptions,
|
|
6
|
+
PreferenceOptions,
|
|
7
|
+
PreferenceSet,
|
|
8
|
+
SetPreferencesProperties,
|
|
9
|
+
} from "../preferences/interfaces";
|
|
10
|
+
import { GetChannelDataInput, SetChannelDataInput } from "./interfaces";
|
|
11
|
+
|
|
12
|
+
const DEFAULT_PREFERENCE_SET_ID = "default";
|
|
13
|
+
|
|
14
|
+
class UserClient {
|
|
15
|
+
private instance: Knock;
|
|
16
|
+
|
|
17
|
+
constructor(instance: Knock) {
|
|
18
|
+
this.instance = instance;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async getAllPreferences() {
|
|
22
|
+
const result = await this.instance.client().makeRequest({
|
|
23
|
+
method: "GET",
|
|
24
|
+
url: `/v1/users/${this.instance.userId}/preferences`,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
return this.handleResponse<PreferenceSet[]>(result);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async getPreferences(
|
|
31
|
+
options: GetPreferencesOptions = {},
|
|
32
|
+
): Promise<PreferenceSet> {
|
|
33
|
+
const preferenceSetId = options.preferenceSet || DEFAULT_PREFERENCE_SET_ID;
|
|
34
|
+
|
|
35
|
+
const result = await this.instance.client().makeRequest({
|
|
36
|
+
method: "GET",
|
|
37
|
+
url: `/v1/users/${this.instance.userId}/preferences/${preferenceSetId}`,
|
|
38
|
+
params: { tenant: options.tenant },
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return this.handleResponse<PreferenceSet>(result);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async setPreferences(
|
|
45
|
+
preferenceSet: SetPreferencesProperties,
|
|
46
|
+
options: PreferenceOptions = {},
|
|
47
|
+
): Promise<PreferenceSet> {
|
|
48
|
+
const preferenceSetId = options.preferenceSet || DEFAULT_PREFERENCE_SET_ID;
|
|
49
|
+
|
|
50
|
+
const result = await this.instance.client().makeRequest({
|
|
51
|
+
method: "PUT",
|
|
52
|
+
url: `/v1/users/${this.instance.userId}/preferences/${preferenceSetId}`,
|
|
53
|
+
data: preferenceSet,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return this.handleResponse<PreferenceSet>(result);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async getChannelData<T = any>(params: GetChannelDataInput) {
|
|
60
|
+
const result = await this.instance.client().makeRequest({
|
|
61
|
+
method: "GET",
|
|
62
|
+
url: `/v1/users/${this.instance.userId}/channel_data/${params.channelId}`,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
return this.handleResponse<ChannelData<T>>(result);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async setChannelData<T = any>({
|
|
69
|
+
channelId,
|
|
70
|
+
channelData,
|
|
71
|
+
}: SetChannelDataInput) {
|
|
72
|
+
const result = await this.instance.client().makeRequest({
|
|
73
|
+
method: "PUT",
|
|
74
|
+
url: `/v1/users/${this.instance.userId}/channel_data/${channelId}`,
|
|
75
|
+
data: { data: channelData },
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
return this.handleResponse<ChannelData<T>>(result);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private handleResponse<T>(response: ApiResponse) {
|
|
82
|
+
if (response.statusCode === "error") {
|
|
83
|
+
throw new Error(response.error || response.body);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return response.body as T;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export default UserClient;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import FeedClient, { Feed } from "./clients/feed";
|
|
2
|
+
import Knock from "./knock";
|
|
3
|
+
|
|
4
|
+
export * from "./interfaces";
|
|
5
|
+
export * from "./clients/feed/types";
|
|
6
|
+
export * from "./clients/feed/interfaces";
|
|
7
|
+
export * from "./clients/objects";
|
|
8
|
+
export * from "./clients/objects/constants";
|
|
9
|
+
export * from "./clients/preferences/interfaces";
|
|
10
|
+
export * from "./clients/slack";
|
|
11
|
+
export * from "./clients/slack/interfaces";
|
|
12
|
+
export * from "./clients/users";
|
|
13
|
+
export * from "./networkStatus";
|
|
14
|
+
|
|
15
|
+
export default Knock;
|
|
16
|
+
export { Feed, FeedClient };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { GenericData } from "@knocklabs/types";
|
|
2
|
+
|
|
3
|
+
export type LogLevel = "debug";
|
|
4
|
+
|
|
5
|
+
export interface KnockOptions {
|
|
6
|
+
host?: string;
|
|
7
|
+
logLevel?: LogLevel;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface KnockObject<T = GenericData> {
|
|
11
|
+
id: string;
|
|
12
|
+
collection: string;
|
|
13
|
+
properties: T;
|
|
14
|
+
updated_at: string;
|
|
15
|
+
created_at: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface User extends GenericData {
|
|
19
|
+
id: string;
|
|
20
|
+
email: string | null;
|
|
21
|
+
name: string | null;
|
|
22
|
+
phone_number: string | null;
|
|
23
|
+
avatar: string | null;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
created_at: string | null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type Recipient = User | KnockObject;
|
|
29
|
+
|
|
30
|
+
export interface Activity<T = GenericData> {
|
|
31
|
+
id: string;
|
|
32
|
+
inserted_at: string;
|
|
33
|
+
updated_at: string;
|
|
34
|
+
recipient: Recipient;
|
|
35
|
+
actor: Recipient | null;
|
|
36
|
+
data: T | null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface ChannelData<T = any> {
|
|
40
|
+
channel_id: string;
|
|
41
|
+
data: T;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type UserTokenExpiringCallback = (
|
|
45
|
+
currentToken: string,
|
|
46
|
+
decodedToken: any,
|
|
47
|
+
) => Promise<string | void>;
|
|
48
|
+
|
|
49
|
+
export interface AuthenticateOptions {
|
|
50
|
+
onUserTokenExpiring?: UserTokenExpiringCallback;
|
|
51
|
+
timeBeforeExpirationInMs?: number;
|
|
52
|
+
}
|
package/src/knock.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { jwtDecode } from "jwt-decode";
|
|
2
|
+
|
|
3
|
+
import ApiClient from "./api";
|
|
4
|
+
import FeedClient from "./clients/feed";
|
|
5
|
+
import ObjectClient from "./clients/objects";
|
|
6
|
+
import Preferences from "./clients/preferences";
|
|
7
|
+
import SlackClient from "./clients/slack";
|
|
8
|
+
import UserClient from "./clients/users";
|
|
9
|
+
import {
|
|
10
|
+
AuthenticateOptions,
|
|
11
|
+
KnockOptions,
|
|
12
|
+
LogLevel,
|
|
13
|
+
UserTokenExpiringCallback,
|
|
14
|
+
} from "./interfaces";
|
|
15
|
+
|
|
16
|
+
const DEFAULT_HOST = "https://api.knock.app";
|
|
17
|
+
|
|
18
|
+
class Knock {
|
|
19
|
+
public host: string;
|
|
20
|
+
private apiClient: ApiClient | null = null;
|
|
21
|
+
public userId: string | undefined;
|
|
22
|
+
public userToken?: string;
|
|
23
|
+
public logLevel?: LogLevel;
|
|
24
|
+
private tokenExpirationTimer: ReturnType<typeof setTimeout> | null = null;
|
|
25
|
+
readonly feeds = new FeedClient(this);
|
|
26
|
+
readonly objects = new ObjectClient(this);
|
|
27
|
+
readonly preferences = new Preferences(this);
|
|
28
|
+
readonly slack = new SlackClient(this);
|
|
29
|
+
readonly user = new UserClient(this);
|
|
30
|
+
|
|
31
|
+
constructor(
|
|
32
|
+
readonly apiKey: string,
|
|
33
|
+
options: KnockOptions = {},
|
|
34
|
+
) {
|
|
35
|
+
this.host = options.host || DEFAULT_HOST;
|
|
36
|
+
this.logLevel = options.logLevel;
|
|
37
|
+
|
|
38
|
+
this.log("Initialized Knock instance");
|
|
39
|
+
|
|
40
|
+
// Fail loudly if we're using the wrong API key
|
|
41
|
+
if (this.apiKey && this.apiKey.startsWith("sk_")) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
"[Knock] You are using your secret API key on the client. Please use the public key.",
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
client() {
|
|
49
|
+
if (!this.userId) {
|
|
50
|
+
console.warn(
|
|
51
|
+
`[Knock] You must call authenticate(userId, userToken) first before trying to make a request.
|
|
52
|
+
Typically you'll see this message when you're creating a feed instance before having called
|
|
53
|
+
authenticate with a user Id and token. That means we won't know who to issue the request
|
|
54
|
+
to Knock on behalf of.
|
|
55
|
+
`,
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Initiate a new API client if we don't have one yet
|
|
60
|
+
if (!this.apiClient) {
|
|
61
|
+
this.apiClient = this.createApiClient();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return this.apiClient;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/*
|
|
68
|
+
Authenticates the current user. In non-sandbox environments
|
|
69
|
+
the userToken must be specified.
|
|
70
|
+
*/
|
|
71
|
+
authenticate(
|
|
72
|
+
userId: string,
|
|
73
|
+
userToken?: string,
|
|
74
|
+
options?: AuthenticateOptions,
|
|
75
|
+
) {
|
|
76
|
+
let reinitializeApi = false;
|
|
77
|
+
const currentApiClient = this.apiClient;
|
|
78
|
+
|
|
79
|
+
// If we've previously been initialized and the values have now changed, then we
|
|
80
|
+
// need to reinitialize any stateful connections we have
|
|
81
|
+
if (
|
|
82
|
+
currentApiClient &&
|
|
83
|
+
(this.userId !== userId || this.userToken !== userToken)
|
|
84
|
+
) {
|
|
85
|
+
this.log("userId or userToken changed; reinitializing connections");
|
|
86
|
+
this.feeds.teardownInstances();
|
|
87
|
+
this.teardown();
|
|
88
|
+
reinitializeApi = true;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.userId = userId;
|
|
92
|
+
this.userToken = userToken;
|
|
93
|
+
|
|
94
|
+
this.log(`Authenticated with userId ${userId}`);
|
|
95
|
+
|
|
96
|
+
if (this.userToken && options?.onUserTokenExpiring instanceof Function) {
|
|
97
|
+
this.maybeScheduleUserTokenExpiration(
|
|
98
|
+
options.onUserTokenExpiring,
|
|
99
|
+
options.timeBeforeExpirationInMs,
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// If we get the signal to reinitialize the api client, then we want to create a new client
|
|
104
|
+
// and the reinitialize any existing feed real-time connections we have so everything continues
|
|
105
|
+
// to work with the new credentials we've been given
|
|
106
|
+
if (reinitializeApi) {
|
|
107
|
+
this.apiClient = this.createApiClient();
|
|
108
|
+
this.feeds.reinitializeInstances();
|
|
109
|
+
this.log("Reinitialized real-time connections");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/*
|
|
116
|
+
Returns whether or this Knock instance is authenticated. Passing `true` will check the presence
|
|
117
|
+
of the userToken as well.
|
|
118
|
+
*/
|
|
119
|
+
isAuthenticated(checkUserToken = false) {
|
|
120
|
+
return checkUserToken ? !!(this.userId && this.userToken) : !!this.userId;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Used to teardown any connected instances
|
|
124
|
+
teardown() {
|
|
125
|
+
if (this.tokenExpirationTimer) {
|
|
126
|
+
clearTimeout(this.tokenExpirationTimer);
|
|
127
|
+
}
|
|
128
|
+
if (this.apiClient?.socket && this.apiClient.socket.isConnected()) {
|
|
129
|
+
this.apiClient.socket.disconnect();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
log(message: string) {
|
|
134
|
+
if (this.logLevel === "debug") {
|
|
135
|
+
console.log(`[Knock] ${message}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Initiates an API client
|
|
141
|
+
*/
|
|
142
|
+
private createApiClient() {
|
|
143
|
+
return new ApiClient({
|
|
144
|
+
apiKey: this.apiKey,
|
|
145
|
+
host: this.host,
|
|
146
|
+
userToken: this.userToken,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private async maybeScheduleUserTokenExpiration(
|
|
151
|
+
callbackFn: UserTokenExpiringCallback,
|
|
152
|
+
timeBeforeExpirationInMs: number = 30_000,
|
|
153
|
+
) {
|
|
154
|
+
if (!this.userToken) return;
|
|
155
|
+
|
|
156
|
+
const decoded = jwtDecode(this.userToken);
|
|
157
|
+
const expiresAtMs = (decoded.exp ?? 0) * 1000;
|
|
158
|
+
const nowMs = Date.now();
|
|
159
|
+
|
|
160
|
+
// Expiration is in the future
|
|
161
|
+
if (expiresAtMs && expiresAtMs > nowMs) {
|
|
162
|
+
// Check how long until the token should be regenerated
|
|
163
|
+
// | ----------------- | ----------------------- |
|
|
164
|
+
// ^ now ^ expiration offset ^ expires at
|
|
165
|
+
const msInFuture = expiresAtMs - timeBeforeExpirationInMs - nowMs;
|
|
166
|
+
|
|
167
|
+
this.tokenExpirationTimer = setTimeout(async () => {
|
|
168
|
+
const newToken = await callbackFn(this.userToken as string, decoded);
|
|
169
|
+
|
|
170
|
+
// Reauthenticate which will handle reinitializing sockets
|
|
171
|
+
if (typeof newToken === "string") {
|
|
172
|
+
this.authenticate(this.userId!, newToken, {
|
|
173
|
+
onUserTokenExpiring: callbackFn,
|
|
174
|
+
timeBeforeExpirationInMs: timeBeforeExpirationInMs,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}, msInFuture);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export default Knock;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export enum NetworkStatus {
|
|
2
|
+
// Performing a top level loading operation
|
|
3
|
+
loading = "loading",
|
|
4
|
+
|
|
5
|
+
// Performing a fetch more on some already loaded data
|
|
6
|
+
fetchMore = "fetchMore",
|
|
7
|
+
|
|
8
|
+
// No operation is currently in progress
|
|
9
|
+
ready = "ready",
|
|
10
|
+
|
|
11
|
+
// The last operation failed with an error
|
|
12
|
+
error = "error",
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function isRequestInFlight(networkStatus: NetworkStatus): boolean {
|
|
16
|
+
return [NetworkStatus.loading, NetworkStatus.fetchMore].includes(
|
|
17
|
+
networkStatus,
|
|
18
|
+
);
|
|
19
|
+
}
|