@fabriktor/fx 0.0.158 → 0.0.160
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/src/chat/chat.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { type ChatOperator, type UsersOperator, type WSCloseHandler, type WSConn
|
|
|
2
2
|
import { type Chat, type ChatRoom, type ChatRoomMember, type User } from "@fabriktor/schema";
|
|
3
3
|
import { type RequiredSearchOptions, type SearchOptions, type SearchPage, type SearchPaginationOptions } from "../core/search.js";
|
|
4
4
|
import { ChatSendQueue, type ChatSendQueueOptions } from "./send-queue.js";
|
|
5
|
+
export declare function isChatPublicConversationDisabled(error: unknown): boolean;
|
|
5
6
|
type ChatInsertOptions = Parameters<ChatOperator["insertOneChat"]>[0];
|
|
6
7
|
type ChatReplaceOptions = Parameters<ChatOperator["replaceOneChat"]>[0];
|
|
7
8
|
export type CreateChatOptions = ChatInsertOptions;
|
package/dist/src/chat/chat.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
import { queryParam, queryParams, } from "@fabriktor/client";
|
|
7
|
-
import { IDKey, OwnerIDKey, } from "@fabriktor/schema";
|
|
6
|
+
import { isHTTPClientErr, queryParam, queryParams, } from "@fabriktor/client";
|
|
7
|
+
import { ErrCodeChatPublicConversationDisabled, IDKey, OwnerIDKey, } from "@fabriktor/schema";
|
|
8
8
|
import { errRequired, errResolveFailed, errValidation } from "../core/err.js";
|
|
9
9
|
import { requiredOperationID, normalizeIDs } from "../core/id.js";
|
|
10
10
|
import { normalizeSearchPage, normalizeSearchPerPage, normalizeSearchQuery, runSearch, } from "../core/search.js";
|
|
@@ -22,6 +22,11 @@ const msgSearchQueryRequired = "Search query is required.";
|
|
|
22
22
|
const msgChatObjectsUploading = "Cannot react to a chat while objects are still uploading.";
|
|
23
23
|
const msgChatRecipients = "Chat recipients must have a Fabriktor account. External contacts cannot receive messages or forms.";
|
|
24
24
|
const msgParticipantMissing = "Chat room participant could not be resolved.";
|
|
25
|
+
export function isChatPublicConversationDisabled(error) {
|
|
26
|
+
return (isHTTPClientErr(error) &&
|
|
27
|
+
error.status === 403 &&
|
|
28
|
+
error.message === ErrCodeChatPublicConversationDisabled);
|
|
29
|
+
}
|
|
25
30
|
export class ChatFX {
|
|
26
31
|
chat;
|
|
27
32
|
users;
|
package/dist/src/feed/feed.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
import { All, PullTypeBatch, PullTypeSingle, PullTypeResearch, PullTypeReplies, PullTypeReferences, PullTypeReactions, PullTypeProfilePosts, PullTypeProfileReplies, PullTypeProfileMedias, FeedLike, FeedDislike, FeedReport, PullTypeKeepAlive, ZeroID, } from "@fabriktor/schema";
|
|
6
|
+
import { All, PullTypeBatch, PullTypeSingle, PullTypeResearch, PullTypeReplies, PullTypeReferences, PullTypeReactions, PullTypeProfilePosts, PullTypeProfileReplies, PullTypeProfileMedias, PullTypeProfileReferences, FeedLike, FeedDislike, FeedReport, PullTypeKeepAlive, ZeroID, } from "@fabriktor/schema";
|
|
7
7
|
import { isClientErr, queryParams, } from "@fabriktor/client";
|
|
8
8
|
import { errResolveFailed, errValidation, errUnconfirmedMutation, } from "../core/err.js";
|
|
9
9
|
import { requiredOperationID, resolvedID } from "../core/id.js";
|
|
@@ -313,6 +313,7 @@ export class FeedFX {
|
|
|
313
313
|
PullTypeProfilePosts,
|
|
314
314
|
PullTypeProfileReplies,
|
|
315
315
|
PullTypeProfileMedias,
|
|
316
|
+
PullTypeProfileReferences,
|
|
316
317
|
];
|
|
317
318
|
if (!supported.includes(input.pull_type))
|
|
318
319
|
throw errValidation({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type GetByUIDOptions, type OperationResultOf, type TmpPhonesOperator, type TmpUsernamesOperator, type UsernameVerification, type UsersOperator } from "@fabriktor/client";
|
|
2
2
|
import { UserTypeEmployee, UserTypeEmployer, type InAddress, type InUser, type User } from "@fabriktor/schema";
|
|
3
3
|
import { type RunSearchOptions, type SearchPage } from "../core/search.js";
|
|
4
4
|
export type ResolveUsernameOptions = Parameters<UsersOperator["resolveUsername"]>[0];
|
|
@@ -6,6 +6,10 @@ export type VerifyUsernameOptions = Parameters<TmpUsernamesOperator["verify"]>[0
|
|
|
6
6
|
export type GenerateUsernamesOptions = VerifyUsernameOptions;
|
|
7
7
|
export type SearchUsersOptions = GetByUIDOptions & Omit<RunSearchOptions<User>, "search">;
|
|
8
8
|
export type SearchUsersPage = SearchPage<User>;
|
|
9
|
+
export type UsersByIDsOptions = {
|
|
10
|
+
ids: readonly string[];
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
};
|
|
9
13
|
export type ExternalUserInput = Omit<InUser, "account_identity" | "active_mode" | "privacy">;
|
|
10
14
|
export type CreateExternalUserOptions = {
|
|
11
15
|
in: ExternalUserInput;
|
|
@@ -51,6 +55,7 @@ export type UsersFXOptions = {
|
|
|
51
55
|
};
|
|
52
56
|
export interface UsersFXOperator {
|
|
53
57
|
searchUsers(opts: SearchUsersOptions): Promise<SearchUsersPage>;
|
|
58
|
+
usersByIDs(opts: UsersByIDsOptions): Promise<User[]>;
|
|
54
59
|
createExternalUser(opts: CreateExternalUserOptions): Promise<User>;
|
|
55
60
|
updateExternalUser(opts: UpdateExternalUserOptions): Promise<User>;
|
|
56
61
|
searchExternalUsers(opts: SearchExternalUsersOptions): Promise<SearchExternalUsersPage>;
|
|
@@ -70,6 +75,7 @@ export declare class UsersFX implements UsersFXOperator {
|
|
|
70
75
|
private tmp_phones;
|
|
71
76
|
constructor(opts: UsersFXOptions);
|
|
72
77
|
searchUsers(opts: SearchUsersOptions): Promise<SearchUsersPage>;
|
|
78
|
+
usersByIDs(opts: UsersByIDsOptions): Promise<User[]>;
|
|
73
79
|
createExternalUser(opts: CreateExternalUserOptions): Promise<User>;
|
|
74
80
|
updateExternalUser(opts: UpdateExternalUserOptions): Promise<User>;
|
|
75
81
|
searchExternalUsers(opts: SearchExternalUsersOptions): Promise<SearchExternalUsersPage>;
|
package/dist/src/users/users.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
4
4
|
// not use this file except in compliance with the License. You may obtain
|
|
5
5
|
// a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
import { isNotFoundClientErr, } from "@fabriktor/client";
|
|
6
7
|
import { UserTypeClient, UserTypeEmployee, UserTypeEmployer, UserTypeExternal, } from "@fabriktor/schema";
|
|
7
8
|
import { errRequired, errResolveFailed, errValidation, } from "../core/err.js";
|
|
8
|
-
import { requiredOperationID, resolvedID } from "../core/id.js";
|
|
9
|
+
import { normalizeIDs, requiredOperationID, resolvedID } from "../core/id.js";
|
|
9
10
|
import { runSearch, } from "../core/search.js";
|
|
10
11
|
import { normalizePhone, normalizePhoneCode, validatePhone, validatePhoneCode, } from "./phone.js";
|
|
11
12
|
import { normalizeEmail, isValidEmail } from "./email.js";
|
|
@@ -75,6 +76,21 @@ export class UsersFX {
|
|
|
75
76
|
}),
|
|
76
77
|
});
|
|
77
78
|
}
|
|
79
|
+
// Known identities are resolved independently of public search visibility.
|
|
80
|
+
async usersByIDs(opts) {
|
|
81
|
+
const users = await Promise.all(normalizeIDs(opts.ids).map(async (id) => {
|
|
82
|
+
try {
|
|
83
|
+
const out = await this.users.findOneUser({ id, signal: opts.signal });
|
|
84
|
+
return out.value?.id === id ? out.value : undefined;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
if (isNotFoundClientErr(error))
|
|
88
|
+
return undefined;
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
}));
|
|
92
|
+
return users.filter((user) => user !== undefined);
|
|
93
|
+
}
|
|
78
94
|
async createExternalUser(opts) {
|
|
79
95
|
const input = normalizeExternalUserInput(opts.in);
|
|
80
96
|
validateExternalUserInput(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabriktor/fx",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.160",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@fabriktor/client": "0.0.101",
|
|
21
21
|
"@fabriktor/fx": "0.0.94",
|
|
22
|
-
"@fabriktor/schema": "0.0.
|
|
22
|
+
"@fabriktor/schema": "0.0.72",
|
|
23
23
|
"convert": "8.0.2"
|
|
24
24
|
}
|
|
25
25
|
}
|