@protobase/server 0.126.0 → 0.126.2
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/better-auth/auth-settings.d.ts +64 -0
- package/dist/better-auth/create-auth.d.ts +67 -2
- package/dist/better-auth/create-auth.js +10 -3
- package/dist/better-auth/names/modules/index.d.ts +9 -2
- package/dist/better-auth/names/modules/mail-senders.js +7 -2
- package/dist/better-auth/staff-checks.js +2 -0
- package/dist/better-auth/store/steps/index.js +3 -1
- package/dist/better-auth/store/steps/legacy-versions.js +4 -0
- package/dist/better-auth/store/steps/mail-senders/005-sender-sharing.js +24 -0
- package/dist/create-admin.js +10 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/package.js +1 -1
- package/dist/personal-mail/listed-mail-senders.d.ts +3 -1
- package/dist/personal-mail/listed-mail-senders.js +1 -0
- package/dist/personal-mail/mail-sender.d.ts +5 -3
- package/dist/personal-mail/mail-sender.js +22 -5
- package/dist/personal-mail/mail-senders-plugin.js +39 -3
- package/dist/personal-mail/personal-mailer.d.ts +8 -6
- package/dist/personal-mail/personal-mailer.js +25 -4
- package/dist/personal-mail/sender-address-error.d.ts +5 -4
- package/dist/personal-mail/sender-address-error.js +4 -3
- package/dist/personal-mail/sender-store.js +13 -6
- package/dist/personal-mail/shared-sender-store.d.ts +2 -0
- package/dist/personal-mail/shared-sender-store.js +39 -0
- package/dist/personal-mail/shared-senders.d.ts +11 -0
- package/dist/personal-mail/shared-senders.js +22 -0
- package/dist/relay/change-commands.js +34 -4
- package/dist/relay/client-events.d.ts +2 -2
- package/dist/relay/members-sql.js +30 -7
- package/dist/relay/realtime-channels.d.ts +25 -0
- package/dist/relay/realtime-channels.js +39 -0
- package/dist/relay/realtime-members-reads.js +16 -0
- package/dist/relay/realtime-members-schema.js +67 -0
- package/dist/relay/realtime-members-sql.js +120 -0
- package/dist/relay/relay-jobs.js +9 -1
- package/dist/relay/relay-models.js +27 -3
- package/dist/relay/relay-options.d.ts +16 -4
- package/dist/relay/relay-options.js +7 -2
- package/dist/relay/relay-runtime.js +3 -3
- package/dist/relay/relay-schema.d.ts +8 -5
- package/dist/relay/relay-schema.js +17 -5
- package/dist/relay/relay-switch.d.ts +1 -0
- package/dist/relay/relay-switch.js +12 -6
- package/dist/relay/ticket-route.js +2 -1
- package/dist/relay/typing-views.js +1 -1
- package/package.json +6 -6
|
@@ -11,6 +11,7 @@ import { Mailer } from "../mail/mail-message.js";
|
|
|
11
11
|
import { PersonalMailProvider } from "../personal-mail/personal-mail-provider.js";
|
|
12
12
|
import { AddVerifier } from "../personal-mail/verifiers/sender-address-verifier.js";
|
|
13
13
|
import { ListedConnection, ListedMailSender, ListedVerification } from "../personal-mail/listed-mail-senders.js";
|
|
14
|
+
import { SharedSender } from "../personal-mail/shared-senders.js";
|
|
14
15
|
import { RoleDefinitions } from "./organizations/role-definitions.js";
|
|
15
16
|
import { ConnectedApp } from "./mcp/connected-apps.js";
|
|
16
17
|
import { OperatorClient } from "./openid-provider/operator-clients.js";
|
|
@@ -6414,6 +6415,7 @@ export declare const buildAppAuth: (settings: AuthSettings, input: AppAuthInput)
|
|
|
6414
6415
|
};
|
|
6415
6416
|
}>>[];
|
|
6416
6417
|
}, {
|
|
6418
|
+
shared: SharedSender[];
|
|
6417
6419
|
verifiers: boolean;
|
|
6418
6420
|
senders: ListedMailSender[];
|
|
6419
6421
|
connections: ListedConnection[];
|
|
@@ -6546,6 +6548,68 @@ export declare const buildAppAuth: (settings: AuthSettings, input: AppAuthInput)
|
|
|
6546
6548
|
}, {
|
|
6547
6549
|
connections: ConnectionListing[];
|
|
6548
6550
|
}>;
|
|
6551
|
+
shareMailSender: import("better-call").StrictEndpoint<string, {
|
|
6552
|
+
method: "POST";
|
|
6553
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
6554
|
+
session: {
|
|
6555
|
+
session: Record<string, any> & {
|
|
6556
|
+
id: string;
|
|
6557
|
+
createdAt: Date;
|
|
6558
|
+
updatedAt: Date;
|
|
6559
|
+
userId: string;
|
|
6560
|
+
expiresAt: Date;
|
|
6561
|
+
token: string;
|
|
6562
|
+
ipAddress?: string | null | undefined;
|
|
6563
|
+
userAgent?: string | null | undefined;
|
|
6564
|
+
};
|
|
6565
|
+
user: Record<string, any> & {
|
|
6566
|
+
id: string;
|
|
6567
|
+
createdAt: Date;
|
|
6568
|
+
updatedAt: Date;
|
|
6569
|
+
email: string;
|
|
6570
|
+
emailVerified: boolean;
|
|
6571
|
+
name: string;
|
|
6572
|
+
image?: string | null | undefined;
|
|
6573
|
+
};
|
|
6574
|
+
};
|
|
6575
|
+
}>>[];
|
|
6576
|
+
body: import("zod").ZodObject<{
|
|
6577
|
+
id: import("zod").ZodString;
|
|
6578
|
+
}, import("zod/v4/core").$strip>;
|
|
6579
|
+
}, {
|
|
6580
|
+
sender: ListedMailSender;
|
|
6581
|
+
}>;
|
|
6582
|
+
unshareMailSender: import("better-call").StrictEndpoint<string, {
|
|
6583
|
+
method: "POST";
|
|
6584
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
6585
|
+
session: {
|
|
6586
|
+
session: Record<string, any> & {
|
|
6587
|
+
id: string;
|
|
6588
|
+
createdAt: Date;
|
|
6589
|
+
updatedAt: Date;
|
|
6590
|
+
userId: string;
|
|
6591
|
+
expiresAt: Date;
|
|
6592
|
+
token: string;
|
|
6593
|
+
ipAddress?: string | null | undefined;
|
|
6594
|
+
userAgent?: string | null | undefined;
|
|
6595
|
+
};
|
|
6596
|
+
user: Record<string, any> & {
|
|
6597
|
+
id: string;
|
|
6598
|
+
createdAt: Date;
|
|
6599
|
+
updatedAt: Date;
|
|
6600
|
+
email: string;
|
|
6601
|
+
emailVerified: boolean;
|
|
6602
|
+
name: string;
|
|
6603
|
+
image?: string | null | undefined;
|
|
6604
|
+
};
|
|
6605
|
+
};
|
|
6606
|
+
}>>[];
|
|
6607
|
+
body: import("zod").ZodObject<{
|
|
6608
|
+
id: import("zod").ZodString;
|
|
6609
|
+
}, import("zod/v4/core").$strip>;
|
|
6610
|
+
}, {
|
|
6611
|
+
sender: ListedMailSender;
|
|
6612
|
+
}>;
|
|
6549
6613
|
};
|
|
6550
6614
|
} | {
|
|
6551
6615
|
id: "protobase-mcp-signed-query-guard";
|
|
@@ -11,6 +11,8 @@ import { Mailer } from "../mail/mail-message.js";
|
|
|
11
11
|
import { PersonalMailProvider } from "../personal-mail/personal-mail-provider.js";
|
|
12
12
|
import { SenderAddressVerifier } from "../personal-mail/verifiers/sender-address-verifier.js";
|
|
13
13
|
import { ListedConnection, ListedMailSender, ListedVerification } from "../personal-mail/listed-mail-senders.js";
|
|
14
|
+
import "../personal-mail/shared-sender-store.js";
|
|
15
|
+
import { SharedSender } from "../personal-mail/shared-senders.js";
|
|
14
16
|
import { RoleDefinitions, RolesInput } from "./organizations/role-definitions.js";
|
|
15
17
|
import { ConnectedApp } from "./mcp/connected-apps.js";
|
|
16
18
|
import { OperatorClient } from "./openid-provider/operator-clients.js";
|
|
@@ -6601,6 +6603,7 @@ export declare const createAuth: (options: CreateAuthOptions, plugins?: AuthPlug
|
|
|
6601
6603
|
};
|
|
6602
6604
|
}>>[];
|
|
6603
6605
|
}, {
|
|
6606
|
+
shared: SharedSender[];
|
|
6604
6607
|
verifiers: boolean;
|
|
6605
6608
|
senders: ListedMailSender[];
|
|
6606
6609
|
connections: ListedConnection[];
|
|
@@ -6733,6 +6736,68 @@ export declare const createAuth: (options: CreateAuthOptions, plugins?: AuthPlug
|
|
|
6733
6736
|
}, {
|
|
6734
6737
|
connections: ConnectionListing[];
|
|
6735
6738
|
}>;
|
|
6739
|
+
shareMailSender: import("better-call").StrictEndpoint<string, {
|
|
6740
|
+
method: "POST";
|
|
6741
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
6742
|
+
session: {
|
|
6743
|
+
session: Record<string, any> & {
|
|
6744
|
+
id: string;
|
|
6745
|
+
createdAt: Date;
|
|
6746
|
+
updatedAt: Date;
|
|
6747
|
+
userId: string;
|
|
6748
|
+
expiresAt: Date;
|
|
6749
|
+
token: string;
|
|
6750
|
+
ipAddress?: string | null | undefined;
|
|
6751
|
+
userAgent?: string | null | undefined;
|
|
6752
|
+
};
|
|
6753
|
+
user: Record<string, any> & {
|
|
6754
|
+
id: string;
|
|
6755
|
+
createdAt: Date;
|
|
6756
|
+
updatedAt: Date;
|
|
6757
|
+
email: string;
|
|
6758
|
+
emailVerified: boolean;
|
|
6759
|
+
name: string;
|
|
6760
|
+
image?: string | null | undefined;
|
|
6761
|
+
};
|
|
6762
|
+
};
|
|
6763
|
+
}>>[];
|
|
6764
|
+
body: import("zod").ZodObject<{
|
|
6765
|
+
id: import("zod").ZodString;
|
|
6766
|
+
}, import("zod/v4/core").$strip>;
|
|
6767
|
+
}, {
|
|
6768
|
+
sender: ListedMailSender;
|
|
6769
|
+
}>;
|
|
6770
|
+
unshareMailSender: import("better-call").StrictEndpoint<string, {
|
|
6771
|
+
method: "POST";
|
|
6772
|
+
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
6773
|
+
session: {
|
|
6774
|
+
session: Record<string, any> & {
|
|
6775
|
+
id: string;
|
|
6776
|
+
createdAt: Date;
|
|
6777
|
+
updatedAt: Date;
|
|
6778
|
+
userId: string;
|
|
6779
|
+
expiresAt: Date;
|
|
6780
|
+
token: string;
|
|
6781
|
+
ipAddress?: string | null | undefined;
|
|
6782
|
+
userAgent?: string | null | undefined;
|
|
6783
|
+
};
|
|
6784
|
+
user: Record<string, any> & {
|
|
6785
|
+
id: string;
|
|
6786
|
+
createdAt: Date;
|
|
6787
|
+
updatedAt: Date;
|
|
6788
|
+
email: string;
|
|
6789
|
+
emailVerified: boolean;
|
|
6790
|
+
name: string;
|
|
6791
|
+
image?: string | null | undefined;
|
|
6792
|
+
};
|
|
6793
|
+
};
|
|
6794
|
+
}>>[];
|
|
6795
|
+
body: import("zod").ZodObject<{
|
|
6796
|
+
id: import("zod").ZodString;
|
|
6797
|
+
}, import("zod/v4/core").$strip>;
|
|
6798
|
+
}, {
|
|
6799
|
+
sender: ListedMailSender;
|
|
6800
|
+
}>;
|
|
6736
6801
|
};
|
|
6737
6802
|
} | {
|
|
6738
6803
|
id: "protobase-mcp-signed-query-guard";
|
|
@@ -6840,7 +6905,7 @@ export declare const createAuth: (options: CreateAuthOptions, plugins?: AuthPlug
|
|
|
6840
6905
|
SERVER_ONLY: true;
|
|
6841
6906
|
};
|
|
6842
6907
|
}, {
|
|
6843
|
-
jwks_uri
|
|
6908
|
+
jwks_uri? /** The roles with their labels, for the role switcher. */ : string | undefined;
|
|
6844
6909
|
userinfo_endpoint: string;
|
|
6845
6910
|
acr_values_supported?: string[] | undefined;
|
|
6846
6911
|
subject_types_supported: ("public" | "pairwise")[];
|
|
@@ -9533,7 +9598,7 @@ export declare const createAuth: (options: CreateAuthOptions, plugins?: AuthPlug
|
|
|
9533
9598
|
SERVER_ONLY: true;
|
|
9534
9599
|
};
|
|
9535
9600
|
}, {
|
|
9536
|
-
jwks_uri
|
|
9601
|
+
jwks_uri? /** The roles with their labels, for the role switcher. */ : string | undefined;
|
|
9537
9602
|
userinfo_endpoint: string;
|
|
9538
9603
|
acr_values_supported?: string[] | undefined;
|
|
9539
9604
|
subject_types_supported: ("public" | "pairwise")[];
|
|
@@ -17,6 +17,7 @@ import { mailSendersPlugin } from "../personal-mail/mail-senders-plugin.js";
|
|
|
17
17
|
import { senderVerifications } from "../personal-mail/verifiers/sender-verifications.js";
|
|
18
18
|
import { verificationStore } from "../personal-mail/verifiers/verification-store.js";
|
|
19
19
|
import { mailSenderUseCheck } from "../personal-mail/mail-sender-use-check.js";
|
|
20
|
+
import { sharedSenderReader } from "../personal-mail/shared-sender-store.js";
|
|
20
21
|
import { bothAccountHooks, connectionAccountHooks } from "./connections/connection-account-hooks.js";
|
|
21
22
|
import { connectionEvents } from "./connections/connection-events.js";
|
|
22
23
|
import { listConnections } from "./connections/list-connections.js";
|
|
@@ -160,7 +161,7 @@ const pageLoadReads = [
|
|
|
160
161
|
* The options `createAuth` gives Better Auth, with the roles, default role, mailer, operator provider and platform
|
|
161
162
|
* sign-in provider already resolved.
|
|
162
163
|
*/
|
|
163
|
-
const betterAuthOptions = (options, { origins = [], passkeyDomain, roles, definitions, defaultRole, appName = defaultAppName, mailer, signUpRole, signUpDomains, signUpFields = resolveSignUpFields(void 0), operator, platformSignIn = [], saml = [], organizations, mcp, api, openId, personalAccessTokens, context = noContext, signInPolicy = defaultSignInPolicy, mobile, deletion, mailSenderUse, senderVerifications: verifications, personalMailer: mailOf = noMailer, lockedAccounts = [], connections, names = resolveNames({
|
|
164
|
+
const betterAuthOptions = (options, { origins = [], passkeyDomain, roles, definitions, defaultRole, appName = defaultAppName, mailer, signUpRole, signUpDomains, signUpFields = resolveSignUpFields(void 0), operator, platformSignIn = [], saml = [], organizations, mcp, api, openId, personalAccessTokens, context = noContext, signInPolicy = defaultSignInPolicy, mobile, deletion, mailSenderUse, senderVerifications: verifications, personalMailer: mailOf = noMailer, sharedSenders, lockedAccounts = [], connections, names = resolveNames({
|
|
164
165
|
schema: storeSchema({ options }),
|
|
165
166
|
tables: options.tables
|
|
166
167
|
}), ...plugins }) => {
|
|
@@ -396,7 +397,7 @@ const betterAuthOptions = (options, { origins = [], passkeyDomain, roles, defini
|
|
|
396
397
|
definitions,
|
|
397
398
|
names: named
|
|
398
399
|
})] : [],
|
|
399
|
-
...mailProviders.length > 0 ? [mailSendersPlugin(mailProviders, named, mailOf, mailSenderUse, verifications)] : [],
|
|
400
|
+
...mailProviders.length > 0 ? [mailSendersPlugin(mailProviders, named, mailOf, mailSenderUse, verifications, sharedSenders)] : [],
|
|
400
401
|
...mcp ? loaded(plugins.mcpAuthPlugins, "mcp")({
|
|
401
402
|
mcp,
|
|
402
403
|
...api && { api },
|
|
@@ -571,6 +572,10 @@ const createAuth = (options, plugins = {}) => {
|
|
|
571
572
|
const verifiers = options.senderVerifiers ?? [];
|
|
572
573
|
if (verifiers.length > 0 && personalMail.length === 0) throw new Error("auth.senderVerifiers: verifiers prove From addresses of linked mailboxes; turn on auth.personalMail");
|
|
573
574
|
const verifications = verifiers.length > 0 ? senderVerifications(verifiers, verificationStore(async () => storeSqlOf(await context())), mailboxOf) : void 0;
|
|
575
|
+
const sharedSenders = sharedSenderReader(async () => storeSqlOf(await context()), {
|
|
576
|
+
organizations: Boolean(organizations),
|
|
577
|
+
verifiers: verifications?.ids ?? []
|
|
578
|
+
});
|
|
574
579
|
if (resolvedConnections.length > 0) deletion.set("connections", releaseUserConnections({
|
|
575
580
|
connections: resolvedConnections,
|
|
576
581
|
events,
|
|
@@ -590,6 +595,7 @@ const createAuth = (options, plugins = {}) => {
|
|
|
590
595
|
mailSenderUse: senderUse,
|
|
591
596
|
...verifications && { senderVerifications: verifications },
|
|
592
597
|
personalMailer: mailboxOf,
|
|
598
|
+
sharedSenders,
|
|
593
599
|
lockedAccounts,
|
|
594
600
|
origins,
|
|
595
601
|
passkeyDomain,
|
|
@@ -622,7 +628,8 @@ const createAuth = (options, plugins = {}) => {
|
|
|
622
628
|
instance = auth;
|
|
623
629
|
const senderStore = {
|
|
624
630
|
...sqlSenderStore(async () => storeSqlOf(await context())),
|
|
625
|
-
...verifications && { proofsOf: verifications.proofsOf }
|
|
631
|
+
...verifications && { proofsOf: verifications.proofsOf },
|
|
632
|
+
sharedWith: sharedSenders
|
|
626
633
|
};
|
|
627
634
|
return Object.assign(auth, {
|
|
628
635
|
/**
|
|
@@ -749,7 +749,14 @@ export declare const builtInModules: readonly [{
|
|
|
749
749
|
field: "shared";
|
|
750
750
|
attribute: {
|
|
751
751
|
readonly type: "boolean";
|
|
752
|
-
readonly required:
|
|
752
|
+
readonly required: false;
|
|
753
|
+
};
|
|
754
|
+
};
|
|
755
|
+
readonly shared_at: {
|
|
756
|
+
field: "sharedAt";
|
|
757
|
+
attribute: {
|
|
758
|
+
readonly type: "date";
|
|
759
|
+
readonly required: false;
|
|
753
760
|
};
|
|
754
761
|
};
|
|
755
762
|
readonly signature: {
|
|
@@ -824,7 +831,7 @@ export declare const builtInModules: readonly [{
|
|
|
824
831
|
};
|
|
825
832
|
};
|
|
826
833
|
};
|
|
827
|
-
readonly indexes: ["mail_sender_default_idx", "mail_sender_shared_idx", "mail_sender_connection_address_uidx", "mail_sender_user_address_idx"];
|
|
834
|
+
readonly indexes: ["mail_sender_default_idx", "mail_sender_shared_idx", "mail_sender_connection_address_uidx", "mail_sender_user_address_idx", "mail_sender_shared_at_idx"];
|
|
828
835
|
};
|
|
829
836
|
readonly mail_sender_verification: {
|
|
830
837
|
readonly scope: "global";
|
|
@@ -26,7 +26,11 @@ const mailSenders = {
|
|
|
26
26
|
}),
|
|
27
27
|
shared: own("shared", {
|
|
28
28
|
type: "boolean",
|
|
29
|
-
required:
|
|
29
|
+
required: false
|
|
30
|
+
}),
|
|
31
|
+
shared_at: own("sharedAt", {
|
|
32
|
+
type: "date",
|
|
33
|
+
required: false
|
|
30
34
|
}),
|
|
31
35
|
signature: own("signature", {
|
|
32
36
|
type: "string",
|
|
@@ -74,7 +78,8 @@ const mailSenders = {
|
|
|
74
78
|
"mail_sender_default_idx",
|
|
75
79
|
"mail_sender_shared_idx",
|
|
76
80
|
"mail_sender_connection_address_uidx",
|
|
77
|
-
"mail_sender_user_address_idx"
|
|
81
|
+
"mail_sender_user_address_idx",
|
|
82
|
+
"mail_sender_shared_at_idx"
|
|
78
83
|
]
|
|
79
84
|
},
|
|
80
85
|
mail_sender_verification: {
|
|
@@ -69,6 +69,8 @@ const accountChanges = [
|
|
|
69
69
|
"/account/mail-senders/add",
|
|
70
70
|
"/account/mail-senders/update",
|
|
71
71
|
"/account/mail-senders/remove",
|
|
72
|
+
"/account/mail-senders/share",
|
|
73
|
+
"/account/mail-senders/unshare",
|
|
72
74
|
"/account/mail-senders/verify",
|
|
73
75
|
"/account/mail-senders/refresh"
|
|
74
76
|
];
|
|
@@ -7,6 +7,7 @@ import { mailSenders } from "./mail-senders/001-mail-senders.js";
|
|
|
7
7
|
import { mailSenderNames } from "./mail-senders/002-mail-sender-names.js";
|
|
8
8
|
import { senderAddressEvidence } from "./mail-senders/003-sender-address-evidence.js";
|
|
9
9
|
import { senderVerifications } from "./mail-senders/004-sender-verifications.js";
|
|
10
|
+
import { senderSharing } from "./mail-senders/005-sender-sharing.js";
|
|
10
11
|
import { mcp } from "./mcp/001-mcp.js";
|
|
11
12
|
import { organizations } from "./organizations/001-organizations.js";
|
|
12
13
|
import { organizationIndex } from "./organizations/002-organization-index.js";
|
|
@@ -39,7 +40,8 @@ const moduleSteps = {
|
|
|
39
40
|
mailSenders,
|
|
40
41
|
mailSenderNames,
|
|
41
42
|
senderAddressEvidence,
|
|
42
|
-
senderVerifications
|
|
43
|
+
senderVerifications,
|
|
44
|
+
senderSharing
|
|
43
45
|
],
|
|
44
46
|
platform_devices: [platformDevices]
|
|
45
47
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ddl } from "../../ddl.js";
|
|
2
|
+
//#region src/better-auth/store/steps/mail-senders/005-sender-sharing.ts
|
|
3
|
+
/**
|
|
4
|
+
* When the owner of each From address shared it with the app's other senders, NULL while it is theirs alone. It takes
|
|
5
|
+
* the place of `shared`, which nothing writes from this version on, so it may be NULL; a later step drops it.
|
|
6
|
+
*/
|
|
7
|
+
const senderSharing = {
|
|
8
|
+
step: 5,
|
|
9
|
+
version: 17,
|
|
10
|
+
name: "sender_sharing",
|
|
11
|
+
title: "When the owner of each From address shared it with the app's other senders",
|
|
12
|
+
tables: [],
|
|
13
|
+
statements: ({ table }) => {
|
|
14
|
+
const sender = table("mail_sender");
|
|
15
|
+
const s = sender.columns;
|
|
16
|
+
return [
|
|
17
|
+
ddl`alter table ${sender} add column ${s.shared_at} timestamptz`,
|
|
18
|
+
ddl`alter table ${sender} alter column ${s.shared} drop not null`,
|
|
19
|
+
ddl`create index ${sender.index("mail_sender_shared_at_idx")} on ${sender} (${s.user_id}) where ${s.shared_at} is not null`
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
export { senderSharing };
|
package/dist/create-admin.js
CHANGED
|
@@ -87,7 +87,9 @@ import { pushJob } from "./notifications/push-job.js";
|
|
|
87
87
|
import { onDoNotDisturb } from "./status/do-not-disturb.js";
|
|
88
88
|
import { checkStatusAuth, statusNames } from "./status/options.js";
|
|
89
89
|
import { statusRoutes } from "./status/routes.js";
|
|
90
|
+
import { appRelayChannels } from "./relay/realtime-channels.js";
|
|
90
91
|
import { appRelaySettings } from "./relay/relay-switch.js";
|
|
92
|
+
import { idleRelayJobs } from "./relay/relay-jobs.js";
|
|
91
93
|
import { relayPresencePath } from "./relay/presence-route.js";
|
|
92
94
|
import { relayTicketPath } from "./relay/ticket-route.js";
|
|
93
95
|
import { relayRuntime } from "./relay/relay-runtime.js";
|
|
@@ -343,8 +345,14 @@ const createAdmin = ({ resources: appResources, views: appViews = [], userTables
|
|
|
343
345
|
...statusTables && { doNotDisturb: (ringDb, userIds) => onDoNotDisturb(ringDb, statusTables.statuses, userIds) }
|
|
344
346
|
}) }
|
|
345
347
|
};
|
|
346
|
-
const
|
|
348
|
+
const relayApp = {
|
|
349
|
+
views: viewModels,
|
|
350
|
+
models: appModels,
|
|
351
|
+
signIn: Boolean(auth)
|
|
352
|
+
};
|
|
353
|
+
const relaySettings = appRelaySettings(realtime?.relay, globalThis.process?.env ?? {}, relayApp);
|
|
347
354
|
const relay = relaySettings && relayRuntime(relaySettings, auth, deps);
|
|
355
|
+
const relayJobList = relay ? relay.jobs : appRelayChannels(realtime?.relay, relayApp) ? idleRelayJobs() : [];
|
|
348
356
|
const typingErrors = typingViewErrors(viewModels, relaySettings && new Set(Object.keys(relaySettings.channels)));
|
|
349
357
|
if (typingErrors.length > 0) throw new Error(typingErrors.join("\n"));
|
|
350
358
|
if (auth) auth.mailSenderUse.set(mailSenderUse(db, registry.entries));
|
|
@@ -685,7 +693,7 @@ const createAdmin = ({ resources: appResources, views: appViews = [], userTables
|
|
|
685
693
|
jobs: [
|
|
686
694
|
...webhooks.jobs,
|
|
687
695
|
...auth ? auth.senderVerificationJobs : [],
|
|
688
|
-
...
|
|
696
|
+
...relayJobList,
|
|
689
697
|
...engine ? engine.jobs : [],
|
|
690
698
|
...derived ? derived.jobs : [],
|
|
691
699
|
...withHistory && days !== void 0 ? [pruneHistoryJob(changes, days)] : [],
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MobileConfig, MobileSplash, MobileSplashLook } from "./mobile-config.js";
|
|
2
2
|
import { AppIdentity } from "./app-identity.js";
|
|
3
3
|
import { AppIcons, PngIcon, pngIcons } from "./web-app/app-icons.js";
|
|
4
|
-
import { RealtimeRelayOptions, RealtimeRelaySettings, RelayChannelOptions, RelayClientEvent, RelayMembers, RelayPresence, checkRelayOptions, realtimeVariables, relaySettings } from "./relay/relay-options.js";
|
|
4
|
+
import { RealtimeRelayOptions, RealtimeRelaySettings, RelayChannelOptions, RelayClientEvent, RelayListedMembers, RelayMembers, RelayPresence, checkRelayOptions, realtimeVariables, relaySettings } from "./relay/relay-options.js";
|
|
5
5
|
import { RealtimeOptions, relayed, sqlSends } from "./realtime/relay/realtime-options.js";
|
|
6
6
|
import { StaffSignIn } from "./better-auth/staff-log.js";
|
|
7
7
|
import { OrganizationRole, StoredMember, StoredOrganization } from "./better-auth/organizations/store.js";
|
|
@@ -162,6 +162,7 @@ import { mailFeedbackResource } from "./mail/feedback/mail-feedback-resource.js"
|
|
|
162
162
|
import { mailFeedbackHeaders, mailFeedbackSecret } from "./mail/feedback/feedback-signing.js";
|
|
163
163
|
import { MailFeedback } from "./mail/feedback/feedback-record.js";
|
|
164
164
|
import { onDoNotDisturb } from "./status/do-not-disturb.js";
|
|
165
|
+
import { appRelayChannels, defaultRelayChannels } from "./relay/realtime-channels.js";
|
|
165
166
|
import { readRelaySwitch, realtimeSwitchVariable } from "./relay/relay-switch.js";
|
|
166
167
|
import { relayPresencePath } from "./relay/presence-route.js";
|
|
167
168
|
import { relayClientEvents, typingResources } from "./relay/client-events.js";
|
|
@@ -237,4 +238,4 @@ import { DrainResult, JobsRuntime, StartJobsOptions, startJobs } from "./jobs/ru
|
|
|
237
238
|
import { jobsDrainApp } from "./jobs/drain-route.js";
|
|
238
239
|
import { checkJobsSchema, jobsSchema, jobsSchemaMigration } from "./jobs/schema.js";
|
|
239
240
|
import { ResourceSource, configExports } from "./resource-source.js";
|
|
240
|
-
export { type AddVerifier, type Admin, type AdminAuth, type AdminOptions, type AggregateParams, type ApiFunction, type ApiKeys, type ApiKeysOptions, type ApnsEnvironment, type ApnsOptions, type ApnsSettings, type AppIcons, type AppIdentity, type AppPoolConfig, type ApplyOptions, type ApplyResult, type ApprovalAnswer, type ApprovalRequest, type ArgumentsPayload, type AssistantBackend, type AssistantOptions, type AssistantSettings, type AssistantTool, type AuditEvent, type AuditQueue, type AuthHooks, type AuthSettings, type AuthenticateSettings, type Authenticator, type BaseToolContext, type BatchOperation, type BatchResult, type BetterAuthAuthenticator, type BetterAuthAuthenticatorOptions, type BridgeClosing, type BridgeRule, type BridgeTarget, BulkMailError, type CallBackend, type CallMember, type Caller, type CallerOptions, type CallsAccess, type CallsOptions, type CapturedRow, type CascadingKey, type ChannelBroadcast, type ChannelSender, type ChatMessage, type ChatTextPart, type CheckAiInput, type CleanupEntry, type CleanupReport, type CleanupSchedule, type CoalescedChange, type CommentItem, type CommentToolsInput, type CommentUsers, type Completion, type CompletionOptions, type ConnectionListing, ConnectionsBusy, type Conversation, type ConversationRecord, type ConversationStore, type ConversationsOptions, type CorsOptions, type CorsOrigins, type CreateAdminInput, type CreateAuthOptions, type DecryptField, type DerivedClock, type DerivedCompute, type DerivedContext, type Device, type DeviceColumn, type DeviceKind, type DeviceStore, DeviceStoreError, type DrainResult, type EmailComponent, type EmailOptions, type EmailTemplate, type EncryptionStatus, type EncryptionTools, type EncryptionToolsInput, type EnqueueJob, type EnqueueOptions, type ErrorReporter, type ErrorReportingOptions, type ErrorReportingSettings, type EventData, type EventsOptions, FatalJobError, type FcmOptions, type FcmSettings, type FieldApplied, type FieldDecrypter, type FieldReader, type FieldStatus, type FileCleanupInput, type FileLimits, type FileObject, type FileProvider, type FileProviderSettings, type FileRef, type FileStore, type FileVariantObject, type FilesOptions, type FunctionApp, type FunctionCaller, type FunctionContext, type FunctionEnv, type FunctionHandler, type FunctionOptions, type FunctionRecords, type FunctionSocket, type FunctionSource, type HistoryColumn, type HistoryOptions, type HistoryPosition, type HistoryStore, HistoryStoreError, type HookContext, HttpProblem, type IssueTokenOptions, type JobContext, type JobDeclaration, type JobDefinition, type JobName, type JobOptions, type JobPayload, type JobRun, type JobsRuntime, type JoinedUser, type JsonObject, type JsonValue, type JwtOptions, type JwtVerifyOptions, type KeyFunctionContext, type LinkedAccount, type ListParams, type ListedOrganization, type LiveKitBackend, type LocalFilesOptions, type MailAttachment, type MailFeedback, type MailMessage, type MailSender, MailSenderRefusedError, MailServerTimeoutError, type MailTemplate, type Mailer, type MapLayer, type MapOptions, type MapSettings, type McpApprovals, type McpGateInput, type McpHandlerInput, type McpRoutesInput, type McpServerInput, type McpToolsInput, type McpWrites, type MemberInput, type Membership, MissingCredentials, type MobileConfig, type MobileSplash, type MobileSplashLook, ModelError, type ModelSettings, type NewDevice, type NewNotification, type NewOrganization, type NewUser, type NotificationRecipients, NotificationSendError, type NotificationsOptions, type OperatorProvider, type OrganizationRole, type OrganizationsCursor, type OrganizationsOptions, type OrganizationsPage, type OverSignIn, type PdfComponent, type PdfOptions, type PdfTemplate, type PersonalMail, type PersonalMailEntry, PersonalMailError, type PersonalMailErrorCode, type PersonalMailMessage, type PersonalMailProviderId, type PgModule, type PipelineHook, type PlatformSignIn, type PluginOption, type PluginRef, type PngIcon, type ProtectedFunctionOptions, type PublicFunctionContext, type PublicFunctionEnv, type PublicFunctionHandler, type PublicFunctionOptions, type PushAnswer, type PushMessage, PushMessageError, type PushSender, type QueryOptions, type QueryResult, type ReadableResources, type RealtimeOptions, type RealtimePrune, type RealtimeRelayOptions, type RealtimeRelaySettings, type ReasoningDetail, type ReasoningEffort, type RebindOption, type RecordGroups, type RecordKey, type RecordKeyInput, type RecordPage, type RelayChannelOptions, type RelayClientEvent, type RelayDevice, type RelayMembers, type RelayPresence, type RelayResult, type RelaySendAnswer, type RelaySendRequest, type RelaySettings, type RenderedEmail, type RenderedTemplate, type ResourceChange, type ResourceSource, type RoleDefinition, type RolesInput, type RunContext, type RuntimeOptions, type S3Bucket, type S3FilesOptions, type S3ListPage, type S3Object, type ScanGuardMode, type ScheduledDelete, type SendNotification, SenderAddressError, type SenderAddressErrorCode, SenderAddressNotFoundError, type SenderAddressState, type SenderAddressVerifier, type SentMail, type Session, type SessionOrganization, type Sharp, type SignInPolicy, type SignInRule, type SignatureOptions, type SocketEvents, type SourceOption, type SourceRef, type StaffAccessRule, type StaffSignIn, type StandardSchema, type StandardWebhookOptions, type StartJobsOptions, type StartWorkflowOptions, type StatusOptions, type StoreFileInput, type StoredMember, type StoredNotification, type StoredObject, type StoredOrganization, type StoredUser, type StrayValues, type SubscriptionDefinition, type SubscriptionEvent, type SubscriptionOptions, type TcpBridge, type TcpBridgeOptions, TemplateDataError, type TemplateOptions, type TemplateSchema, type TemplateScope, type TemplateSendOptions, type TemplateText, type TenantValue, type ToolAnnotations, type ToolCall, type ToolComment, type ToolCommentPage, type ToolComments, type ToolContext, type ToolRecord, type ToolRecords, type ToolSpec, type TrustedApp, type TurnOptions, type UnreadableEntry, type UnsubscribeLinks, type Urgency, type User, type UserCreatedHook, type UserTables, type UsersCursor, type UsersPage, type VapidSettings, type VerificationInput, type VerificationMessage, type VerificationOutcome, type VerifyInput, type VerifyTools, type ViewSource, type WebPushFields, type WebPushOptions, type WebhooksOptions, type WidgetOptions, type WorkflowCatalog, type WorkflowTypes, type WorkflowsOptions, type WriteEvent, type WriteOperation, type WriteRecordToolsInput, addAppRoleToOwners, addCommentTool, addEveryUser, addMember, apiKeyCaller, apiKeySettings, apiKeyVariables, apnsKeyIdVariable, apnsKeyVariable, apnsSender, apnsTeamIdVariable, appNameOver, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaDrift, authSchemaMigration, authStoreTables, backgroundSettled, badRequest, batchWriteTool, beforeSignInPluginsVariable, betterAuthTokens, bridgeClosings, callsMigration, capSocketMessages, capturedBy, changesMigration, channelSendsMigration, checkAi, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkJobsSchema, checkMailFeedbackSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkRelayOptions, checkRelaySchema, checkResourcesOutsideAuthStore, checkSourceNames, checkStatusSchema, checkUnsubscribesSchema, checkUserTablesSchema, checkViewQueries, checkWebhooksSchema, checkWorkflowsSchema, coalesce, commentTools, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, countRecordsTool, createAdmin, createConversations, createEncryptionTools, createFileCleanup, createOrganization, createRecordTool, createUser, defaultAppName, defaultHistoryPage, defaultSignInPolicy, defineEmail, defineFunction, defineJob, definePdf, defineTemplate, defineTool, deleteRecordTool, deleteUser, derivedMigration, describeResourceTool, deviceIdParam, deviceStore, devicesPath, enqueueJob, errorReportingSettings, errorReportingVariable, eventMatcher, fcmSender, fcmServiceAccountVariable, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, generateVapidKeys, getRecordTool, gmailSettingsScope, goTruePath, handleDroppedConnections, hasBuckets, hasUsers, historyIdParam, historyIdPattern, historyLimits, historyPath, historyStore, honorSocketMessageCaps, hookPath, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isMailTemplate, isOAuthWellKnownPath, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listCommentsTool, listOrganizations, listRecordsTool, listResourcesTool, listUsers, localFileStore, longQueryTimeoutMs, mailFeedbackHeaders, mailFeedbackMigration, mailFeedbackResource, mailFeedbackSecret, mapSettings, mapStyleUrl, mapStyleVariable, maxDevicesPerUser, maxHistoryPage, maxMessageBytes, maxRecipients, maxRelayDevices, maxTokenTtlSeconds, maxTtlSeconds, maxUnreadCount, maxWidgetPropsBytes, mcpApprovals, mcpGate, mcpHandler, mcpIcons, mcpInstructions, mcpRoutes, mcpServer, mcpToolContext, mcpTools, migrationCommand, newWebhookSecret, normalizeRoles, notFound, notificationSenders, notificationsMigration, oauthWellKnownPaths, objectKey, onDoNotDisturb, organizationsPageSize, overSignIn, ownedDefinitionsMigration, parseColumns, parseRoles, passwordLength, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, poolWaitMs, postgresDeviceStore, postgresHistoryStore, processor, pushMessage, queryRunnerMigration, readApnsSettings, readDbConnections, readDefinitionsVersion, readFcmSettings, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIns, readRecordTools, readRelaySettings, readRelaySwitch, readVapidSettings, readWriteQueryTool, readableResources, realtimeLimits, realtimeRelayMigration, realtimeSwitchVariable, realtimeVariables, recordBlocksOf, recordOf, redactHookKeys, refusalOf, refused, relayClientEvents, relayCredentialVariable, relayHandle, relayMigration, relayPresencePath, relayResults, relaySendAnswer, relaySendPath, relaySendRequest, relaySender, relaySettings, relayUrlVariable, relayed, releaseConnectionsWithUsers, reloadingAdmin, removeDevicesWithUsers, removeHistoryWithUsers, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, seesAssistant, seesRuntime, sendNotification, sessionOf, setMemberRoles, setUserBanned, setUserRole, shownAppName, signInPolicyMethods, socketMessageCapOf, sourceOptions, sourcesFor, sourcesVariable, sqlSends, startErrorReporting, startJobs, startWorkflow, statusMigration, statusNames, storageCleanupSchedule, storageProvider, storeFile, storeUsage, streamChatCompletion, subscription, supabasePath, tcpBridge, thumbHash, typingResources, unauthorized, unsubscribesMigration, updateRecordTool, urgencies, userTableResources, userTablesMigration, usersPageSize, vapidPrivateKeyVariable, vapidPublicKeyVariable, vapidSubjectVariable, variantPath, verifySignature, verifyStandardWebhook, waitUntil, wantsLongQueries, webManifestPath, webPushSender, webauthnPath, webhookIssuePath, webhookParams, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps, workflowInstructions, workflowReadTools, workflowTypes, workflowWriteTools, workflowsMigration, writeRecordTools };
|
|
241
|
+
export { type AddVerifier, type Admin, type AdminAuth, type AdminOptions, type AggregateParams, type ApiFunction, type ApiKeys, type ApiKeysOptions, type ApnsEnvironment, type ApnsOptions, type ApnsSettings, type AppIcons, type AppIdentity, type AppPoolConfig, type ApplyOptions, type ApplyResult, type ApprovalAnswer, type ApprovalRequest, type ArgumentsPayload, type AssistantBackend, type AssistantOptions, type AssistantSettings, type AssistantTool, type AuditEvent, type AuditQueue, type AuthHooks, type AuthSettings, type AuthenticateSettings, type Authenticator, type BaseToolContext, type BatchOperation, type BatchResult, type BetterAuthAuthenticator, type BetterAuthAuthenticatorOptions, type BridgeClosing, type BridgeRule, type BridgeTarget, BulkMailError, type CallBackend, type CallMember, type Caller, type CallerOptions, type CallsAccess, type CallsOptions, type CapturedRow, type CascadingKey, type ChannelBroadcast, type ChannelSender, type ChatMessage, type ChatTextPart, type CheckAiInput, type CleanupEntry, type CleanupReport, type CleanupSchedule, type CoalescedChange, type CommentItem, type CommentToolsInput, type CommentUsers, type Completion, type CompletionOptions, type ConnectionListing, ConnectionsBusy, type Conversation, type ConversationRecord, type ConversationStore, type ConversationsOptions, type CorsOptions, type CorsOrigins, type CreateAdminInput, type CreateAuthOptions, type DecryptField, type DerivedClock, type DerivedCompute, type DerivedContext, type Device, type DeviceColumn, type DeviceKind, type DeviceStore, DeviceStoreError, type DrainResult, type EmailComponent, type EmailOptions, type EmailTemplate, type EncryptionStatus, type EncryptionTools, type EncryptionToolsInput, type EnqueueJob, type EnqueueOptions, type ErrorReporter, type ErrorReportingOptions, type ErrorReportingSettings, type EventData, type EventsOptions, FatalJobError, type FcmOptions, type FcmSettings, type FieldApplied, type FieldDecrypter, type FieldReader, type FieldStatus, type FileCleanupInput, type FileLimits, type FileObject, type FileProvider, type FileProviderSettings, type FileRef, type FileStore, type FileVariantObject, type FilesOptions, type FunctionApp, type FunctionCaller, type FunctionContext, type FunctionEnv, type FunctionHandler, type FunctionOptions, type FunctionRecords, type FunctionSocket, type FunctionSource, type HistoryColumn, type HistoryOptions, type HistoryPosition, type HistoryStore, HistoryStoreError, type HookContext, HttpProblem, type IssueTokenOptions, type JobContext, type JobDeclaration, type JobDefinition, type JobName, type JobOptions, type JobPayload, type JobRun, type JobsRuntime, type JoinedUser, type JsonObject, type JsonValue, type JwtOptions, type JwtVerifyOptions, type KeyFunctionContext, type LinkedAccount, type ListParams, type ListedOrganization, type LiveKitBackend, type LocalFilesOptions, type MailAttachment, type MailFeedback, type MailMessage, type MailSender, MailSenderRefusedError, MailServerTimeoutError, type MailTemplate, type Mailer, type MapLayer, type MapOptions, type MapSettings, type McpApprovals, type McpGateInput, type McpHandlerInput, type McpRoutesInput, type McpServerInput, type McpToolsInput, type McpWrites, type MemberInput, type Membership, MissingCredentials, type MobileConfig, type MobileSplash, type MobileSplashLook, ModelError, type ModelSettings, type NewDevice, type NewNotification, type NewOrganization, type NewUser, type NotificationRecipients, NotificationSendError, type NotificationsOptions, type OperatorProvider, type OrganizationRole, type OrganizationsCursor, type OrganizationsOptions, type OrganizationsPage, type OverSignIn, type PdfComponent, type PdfOptions, type PdfTemplate, type PersonalMail, type PersonalMailEntry, PersonalMailError, type PersonalMailErrorCode, type PersonalMailMessage, type PersonalMailProviderId, type PgModule, type PipelineHook, type PlatformSignIn, type PluginOption, type PluginRef, type PngIcon, type ProtectedFunctionOptions, type PublicFunctionContext, type PublicFunctionEnv, type PublicFunctionHandler, type PublicFunctionOptions, type PushAnswer, type PushMessage, PushMessageError, type PushSender, type QueryOptions, type QueryResult, type ReadableResources, type RealtimeOptions, type RealtimePrune, type RealtimeRelayOptions, type RealtimeRelaySettings, type ReasoningDetail, type ReasoningEffort, type RebindOption, type RecordGroups, type RecordKey, type RecordKeyInput, type RecordPage, type RelayChannelOptions, type RelayClientEvent, type RelayDevice, type RelayListedMembers, type RelayMembers, type RelayPresence, type RelayResult, type RelaySendAnswer, type RelaySendRequest, type RelaySettings, type RenderedEmail, type RenderedTemplate, type ResourceChange, type ResourceSource, type RoleDefinition, type RolesInput, type RunContext, type RuntimeOptions, type S3Bucket, type S3FilesOptions, type S3ListPage, type S3Object, type ScanGuardMode, type ScheduledDelete, type SendNotification, SenderAddressError, type SenderAddressErrorCode, SenderAddressNotFoundError, type SenderAddressState, type SenderAddressVerifier, type SentMail, type Session, type SessionOrganization, type Sharp, type SignInPolicy, type SignInRule, type SignatureOptions, type SocketEvents, type SourceOption, type SourceRef, type StaffAccessRule, type StaffSignIn, type StandardSchema, type StandardWebhookOptions, type StartJobsOptions, type StartWorkflowOptions, type StatusOptions, type StoreFileInput, type StoredMember, type StoredNotification, type StoredObject, type StoredOrganization, type StoredUser, type StrayValues, type SubscriptionDefinition, type SubscriptionEvent, type SubscriptionOptions, type TcpBridge, type TcpBridgeOptions, TemplateDataError, type TemplateOptions, type TemplateSchema, type TemplateScope, type TemplateSendOptions, type TemplateText, type TenantValue, type ToolAnnotations, type ToolCall, type ToolComment, type ToolCommentPage, type ToolComments, type ToolContext, type ToolRecord, type ToolRecords, type ToolSpec, type TrustedApp, type TurnOptions, type UnreadableEntry, type UnsubscribeLinks, type Urgency, type User, type UserCreatedHook, type UserTables, type UsersCursor, type UsersPage, type VapidSettings, type VerificationInput, type VerificationMessage, type VerificationOutcome, type VerifyInput, type VerifyTools, type ViewSource, type WebPushFields, type WebPushOptions, type WebhooksOptions, type WidgetOptions, type WorkflowCatalog, type WorkflowTypes, type WorkflowsOptions, type WriteEvent, type WriteOperation, type WriteRecordToolsInput, addAppRoleToOwners, addCommentTool, addEveryUser, addMember, apiKeyCaller, apiKeySettings, apiKeyVariables, apnsKeyIdVariable, apnsKeyVariable, apnsSender, apnsTeamIdVariable, appNameOver, appRelayChannels, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaDrift, authSchemaMigration, authStoreTables, backgroundSettled, badRequest, batchWriteTool, beforeSignInPluginsVariable, betterAuthTokens, bridgeClosings, callsMigration, capSocketMessages, capturedBy, changesMigration, channelSendsMigration, checkAi, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkJobsSchema, checkMailFeedbackSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkRelayOptions, checkRelaySchema, checkResourcesOutsideAuthStore, checkSourceNames, checkStatusSchema, checkUnsubscribesSchema, checkUserTablesSchema, checkViewQueries, checkWebhooksSchema, checkWorkflowsSchema, coalesce, commentTools, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, countRecordsTool, createAdmin, createConversations, createEncryptionTools, createFileCleanup, createOrganization, createRecordTool, createUser, defaultAppName, defaultHistoryPage, defaultRelayChannels, defaultSignInPolicy, defineEmail, defineFunction, defineJob, definePdf, defineTemplate, defineTool, deleteRecordTool, deleteUser, derivedMigration, describeResourceTool, deviceIdParam, deviceStore, devicesPath, enqueueJob, errorReportingSettings, errorReportingVariable, eventMatcher, fcmSender, fcmServiceAccountVariable, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, generateVapidKeys, getRecordTool, gmailSettingsScope, goTruePath, handleDroppedConnections, hasBuckets, hasUsers, historyIdParam, historyIdPattern, historyLimits, historyPath, historyStore, honorSocketMessageCaps, hookPath, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isMailTemplate, isOAuthWellKnownPath, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listCommentsTool, listOrganizations, listRecordsTool, listResourcesTool, listUsers, localFileStore, longQueryTimeoutMs, mailFeedbackHeaders, mailFeedbackMigration, mailFeedbackResource, mailFeedbackSecret, mapSettings, mapStyleUrl, mapStyleVariable, maxDevicesPerUser, maxHistoryPage, maxMessageBytes, maxRecipients, maxRelayDevices, maxTokenTtlSeconds, maxTtlSeconds, maxUnreadCount, maxWidgetPropsBytes, mcpApprovals, mcpGate, mcpHandler, mcpIcons, mcpInstructions, mcpRoutes, mcpServer, mcpToolContext, mcpTools, migrationCommand, newWebhookSecret, normalizeRoles, notFound, notificationSenders, notificationsMigration, oauthWellKnownPaths, objectKey, onDoNotDisturb, organizationsPageSize, overSignIn, ownedDefinitionsMigration, parseColumns, parseRoles, passwordLength, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, poolWaitMs, postgresDeviceStore, postgresHistoryStore, processor, pushMessage, queryRunnerMigration, readApnsSettings, readDbConnections, readDefinitionsVersion, readFcmSettings, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIns, readRecordTools, readRelaySettings, readRelaySwitch, readVapidSettings, readWriteQueryTool, readableResources, realtimeLimits, realtimeRelayMigration, realtimeSwitchVariable, realtimeVariables, recordBlocksOf, recordOf, redactHookKeys, refusalOf, refused, relayClientEvents, relayCredentialVariable, relayHandle, relayMigration, relayPresencePath, relayResults, relaySendAnswer, relaySendPath, relaySendRequest, relaySender, relaySettings, relayUrlVariable, relayed, releaseConnectionsWithUsers, reloadingAdmin, removeDevicesWithUsers, removeHistoryWithUsers, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, seesAssistant, seesRuntime, sendNotification, sessionOf, setMemberRoles, setUserBanned, setUserRole, shownAppName, signInPolicyMethods, socketMessageCapOf, sourceOptions, sourcesFor, sourcesVariable, sqlSends, startErrorReporting, startJobs, startWorkflow, statusMigration, statusNames, storageCleanupSchedule, storageProvider, storeFile, storeUsage, streamChatCompletion, subscription, supabasePath, tcpBridge, thumbHash, typingResources, unauthorized, unsubscribesMigration, updateRecordTool, urgencies, userTableResources, userTablesMigration, usersPageSize, vapidPrivateKeyVariable, vapidPublicKeyVariable, vapidSubjectVariable, variantPath, verifySignature, verifyStandardWebhook, waitUntil, wantsLongQueries, webManifestPath, webPushSender, webauthnPath, webhookIssuePath, webhookParams, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps, workflowInstructions, workflowReadTools, workflowTypes, workflowWriteTools, workflowsMigration, writeRecordTools };
|
package/dist/index.js
CHANGED
|
@@ -107,6 +107,7 @@ import { webPushSender } from "./notifications/web-push/web-push-sender.js";
|
|
|
107
107
|
import { notificationSenders } from "./notifications/senders-of.js";
|
|
108
108
|
import { onDoNotDisturb } from "./status/do-not-disturb.js";
|
|
109
109
|
import { statusNames } from "./status/options.js";
|
|
110
|
+
import { appRelayChannels, defaultRelayChannels } from "./relay/realtime-channels.js";
|
|
110
111
|
import { checkRelayOptions, realtimeVariables, relaySettings } from "./relay/relay-options.js";
|
|
111
112
|
import { readRelaySwitch, realtimeSwitchVariable } from "./relay/relay-switch.js";
|
|
112
113
|
import { relayPresencePath } from "./relay/presence-route.js";
|
|
@@ -176,4 +177,4 @@ import { defineEmail } from "./mail/define-email.js";
|
|
|
176
177
|
import { definePdf } from "./pdf/define-pdf.js";
|
|
177
178
|
import { startJobs } from "./jobs/runtime.js";
|
|
178
179
|
import { jobsDrainApp } from "./jobs/drain-route.js";
|
|
179
|
-
export { BulkMailError, ConnectionsBusy, DeviceStoreError, FatalJobError, HistoryStoreError, HttpProblem, MailSenderRefusedError, MailServerTimeoutError, MissingCredentials, ModelError, NotificationSendError, PersonalMailError, PushMessageError, SenderAddressError, SenderAddressNotFoundError, TemplateDataError, addAppRoleToOwners, addCommentTool, addEveryUser, addMember, apiKeyCaller, apiKeySettings, apiKeyVariables, apnsKeyIdVariable, apnsKeyVariable, apnsSender, apnsTeamIdVariable, appNameOver, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaDrift, authSchemaMigration, authStoreTables, backgroundSettled, badRequest, batchWriteTool, beforeSignInPluginsVariable, betterAuthTokens, bridgeClosings, callsMigration, capSocketMessages, capturedBy, changesMigration, channelSendsMigration, checkAi, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkJobsSchema, checkMailFeedbackSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkRelayOptions, checkRelaySchema, checkResourcesOutsideAuthStore, checkSourceNames, checkStatusSchema, checkUnsubscribesSchema, checkUserTablesSchema, checkViewQueries, checkWebhooksSchema, checkWorkflowsSchema, coalesce, commentTools, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, countRecordsTool, createAdmin, createConversations, createEncryptionTools, createFileCleanup, createOrganization, createRecordTool, createUser, defaultAppName, defaultHistoryPage, defaultSignInPolicy, defineEmail, defineFunction, defineJob, definePdf, defineTemplate, defineTool, deleteRecordTool, deleteUser, derivedMigration, describeResourceTool, deviceIdParam, deviceStore, devicesPath, enqueueJob, errorReportingSettings, errorReportingVariable, eventMatcher, fcmSender, fcmServiceAccountVariable, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, generateVapidKeys, getRecordTool, gmailSettingsScope, goTruePath, handleDroppedConnections, hasBuckets, hasUsers, historyIdParam, historyIdPattern, historyLimits, historyPath, historyStore, honorSocketMessageCaps, hookPath, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isMailTemplate, isOAuthWellKnownPath, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listCommentsTool, listOrganizations, listRecordsTool, listResourcesTool, listUsers, localFileStore, longQueryTimeoutMs, mailFeedbackHeaders, mailFeedbackMigration, mailFeedbackResource, mailFeedbackSecret, mapSettings, mapStyleUrl, mapStyleVariable, maxDevicesPerUser, maxHistoryPage, maxMessageBytes, maxRecipients, maxRelayDevices, maxTokenTtlSeconds, maxTtlSeconds, maxUnreadCount, maxWidgetPropsBytes, mcpApprovals, mcpGate, mcpHandler, mcpIcons, mcpInstructions, mcpRoutes, mcpServer, mcpToolContext, mcpTools, migrationCommand, newWebhookSecret, normalizeRoles, notFound, notificationSenders, notificationsMigration, oauthWellKnownPaths, objectKey, onDoNotDisturb, organizationsPageSize, overSignIn, ownedDefinitionsMigration, parseColumns, parseRoles, passwordLength, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, poolWaitMs, postgresDeviceStore, postgresHistoryStore, processor, pushMessage, queryRunnerMigration, readApnsSettings, readDbConnections, readDefinitionsVersion, readFcmSettings, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIns, readRecordTools, readRelaySettings, readRelaySwitch, readVapidSettings, readWriteQueryTool, readableResources, realtimeLimits, realtimeRelayMigration, realtimeSwitchVariable, realtimeVariables, recordBlocksOf, recordOf, redactHookKeys, refusalOf, refused, relayClientEvents, relayCredentialVariable, relayHandle, relayMigration, relayPresencePath, relayResults, relaySendAnswer, relaySendPath, relaySendRequest, relaySender, relaySettings, relayUrlVariable, relayed, releaseConnectionsWithUsers, reloadingAdmin, removeDevicesWithUsers, removeHistoryWithUsers, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, seesAssistant, seesRuntime, sendNotification, sessionOf, setMemberRoles, setUserBanned, setUserRole, shownAppName, signInPolicyMethods, socketMessageCapOf, sourceOptions, sourcesFor, sourcesVariable, sqlSends, startErrorReporting, startJobs, startWorkflow, statusMigration, statusNames, storageCleanupSchedule, storageProvider, storeFile, storeUsage, streamChatCompletion, subscription, supabasePath, tcpBridge, thumbHash, typingResources, unauthorized, unsubscribesMigration, updateRecordTool, urgencies, userTableResources, userTablesMigration, usersPageSize, vapidPrivateKeyVariable, vapidPublicKeyVariable, vapidSubjectVariable, variantPath, verifySignature, verifyStandardWebhook, waitUntil, wantsLongQueries, webManifestPath, webPushSender, webauthnPath, webhookIssuePath, webhookParams, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps, workflowInstructions, workflowReadTools, workflowTypes, workflowWriteTools, workflowsMigration, writeRecordTools };
|
|
180
|
+
export { BulkMailError, ConnectionsBusy, DeviceStoreError, FatalJobError, HistoryStoreError, HttpProblem, MailSenderRefusedError, MailServerTimeoutError, MissingCredentials, ModelError, NotificationSendError, PersonalMailError, PushMessageError, SenderAddressError, SenderAddressNotFoundError, TemplateDataError, addAppRoleToOwners, addCommentTool, addEveryUser, addMember, apiKeyCaller, apiKeySettings, apiKeyVariables, apnsKeyIdVariable, apnsKeyVariable, apnsSender, apnsTeamIdVariable, appNameOver, appRelayChannels, aspectRatio, assistantProtocolRoutes, assistantRoles, assistantSettings, assistantVariables, authSchemaDrift, authSchemaMigration, authStoreTables, backgroundSettled, badRequest, batchWriteTool, beforeSignInPluginsVariable, betterAuthTokens, bridgeClosings, callsMigration, capSocketMessages, capturedBy, changesMigration, channelSendsMigration, checkAi, checkAuthSchema, checkCalls, checkChanges, checkChannelSends, checkComments, checkComputed, checkDerived, checkJobsSchema, checkMailFeedbackSchema, checkNotificationsSchema, checkQueryRunner, checkRealtimeRelay, checkRelayOptions, checkRelaySchema, checkResourcesOutsideAuthStore, checkSourceNames, checkStatusSchema, checkUnsubscribesSchema, checkUserTablesSchema, checkViewQueries, checkWebhooksSchema, checkWorkflowsSchema, coalesce, commentTools, commentsMigration, computedMigration, configExports, consoleAuditQueue, conversationKey, countRecordsTool, createAdmin, createConversations, createEncryptionTools, createFileCleanup, createOrganization, createRecordTool, createUser, defaultAppName, defaultHistoryPage, defaultRelayChannels, defaultSignInPolicy, defineEmail, defineFunction, defineJob, definePdf, defineTemplate, defineTool, deleteRecordTool, deleteUser, derivedMigration, describeResourceTool, deviceIdParam, deviceStore, devicesPath, enqueueJob, errorReportingSettings, errorReportingVariable, eventMatcher, fcmSender, fcmServiceAccountVariable, fileConversationStore, fileSize, fileType, forbidden, formatUri, functionApp, generateVapidKeys, getRecordTool, gmailSettingsScope, goTruePath, handleDroppedConnections, hasBuckets, hasUsers, historyIdParam, historyIdPattern, historyLimits, historyPath, historyStore, honorSocketMessageCaps, hookPath, imageSize, isBackgroundWork, isCaptured, isJobDefinition, isMailTemplate, isOAuthWellKnownPath, isSchedule, issueToken, jobDefinitions, jobsDrainApp, jobsSchema, jobsSchemaMigration, jwtAuthenticator, jwtVerifier, limitedFileStore, listCommentsTool, listOrganizations, listRecordsTool, listResourcesTool, listUsers, localFileStore, longQueryTimeoutMs, mailFeedbackHeaders, mailFeedbackMigration, mailFeedbackResource, mailFeedbackSecret, mapSettings, mapStyleUrl, mapStyleVariable, maxDevicesPerUser, maxHistoryPage, maxMessageBytes, maxRecipients, maxRelayDevices, maxTokenTtlSeconds, maxTtlSeconds, maxUnreadCount, maxWidgetPropsBytes, mcpApprovals, mcpGate, mcpHandler, mcpIcons, mcpInstructions, mcpRoutes, mcpServer, mcpToolContext, mcpTools, migrationCommand, newWebhookSecret, normalizeRoles, notFound, notificationSenders, notificationsMigration, oauthWellKnownPaths, objectKey, onDoNotDisturb, organizationsPageSize, overSignIn, ownedDefinitionsMigration, parseColumns, parseRoles, passwordLength, pluginOptions, pluginsBeforeSignIn, pluginsFor, pluginsVariable, pngIcons, poolWaitMs, postgresDeviceStore, postgresHistoryStore, processor, pushMessage, queryRunnerMigration, readApnsSettings, readDbConnections, readDefinitionsVersion, readFcmSettings, readJson, readOnlyQueryTool, readOperatorSettings, readOutbox, readPlatformSignIns, readRecordTools, readRelaySettings, readRelaySwitch, readVapidSettings, readWriteQueryTool, readableResources, realtimeLimits, realtimeRelayMigration, realtimeSwitchVariable, realtimeVariables, recordBlocksOf, recordOf, redactHookKeys, refusalOf, refused, relayClientEvents, relayCredentialVariable, relayHandle, relayMigration, relayPresencePath, relayResults, relaySendAnswer, relaySendPath, relaySendRequest, relaySender, relaySettings, relayUrlVariable, relayed, releaseConnectionsWithUsers, reloadingAdmin, removeDevicesWithUsers, removeHistoryWithUsers, removeMember, renderVariant, requestApproval, requireEnv, resourceChange, roleChoices, runInBackground, runReadOnlyQuery, runReadWriteQuery, runTurn, runtimeUrl, runtimeVariable, s3FileStore, seesAssistant, seesRuntime, sendNotification, sessionOf, setMemberRoles, setUserBanned, setUserRole, shownAppName, signInPolicyMethods, socketMessageCapOf, sourceOptions, sourcesFor, sourcesVariable, sqlSends, startErrorReporting, startJobs, startWorkflow, statusMigration, statusNames, storageCleanupSchedule, storageProvider, storeFile, storeUsage, streamChatCompletion, subscription, supabasePath, tcpBridge, thumbHash, typingResources, unauthorized, unsubscribesMigration, updateRecordTool, urgencies, userTableResources, userTablesMigration, usersPageSize, vapidPrivateKeyVariable, vapidPublicKeyVariable, vapidSubjectVariable, variantPath, verifySignature, verifyStandardWebhook, waitUntil, wantsLongQueries, webManifestPath, webPushSender, webauthnPath, webhookIssuePath, webhookParams, webhooksMigration, widget, withCacheBreakpoints, withTrustedApps, workflowInstructions, workflowReadTools, workflowTypes, workflowWriteTools, workflowsMigration, writeRecordTools };
|
package/dist/package.js
CHANGED
|
@@ -5,7 +5,8 @@ import "./mail-sender.js";
|
|
|
5
5
|
//#region src/personal-mail/listed-mail-senders.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* An address as the account page lists it: its `state`, `detached` for one on no connection they can send through,
|
|
8
|
-
* and its `connection`, none when detached; `listedAt` when the provider's last listing held it
|
|
8
|
+
* and its `connection`, none when detached; `listedAt` when the provider's last listing held it; `sharedAt` when they
|
|
9
|
+
* shared it with the app's other senders.
|
|
9
10
|
*/
|
|
10
11
|
export type ListedMailSender = {
|
|
11
12
|
id: string;
|
|
@@ -16,6 +17,7 @@ export type ListedMailSender = {
|
|
|
16
17
|
state: Exclude<SenderRowState, 'removed'>;
|
|
17
18
|
connection?: string;
|
|
18
19
|
listedAt?: string;
|
|
20
|
+
sharedAt?: string;
|
|
19
21
|
/** The latest verification by each of the app's verifiers, when it has any. */
|
|
20
22
|
verifications?: ListedVerification[];
|
|
21
23
|
};
|
|
@@ -23,6 +23,7 @@ const listedSender = (book, row, verifications) => {
|
|
|
23
23
|
state,
|
|
24
24
|
...state !== "detached" && row.connectionId && { connection: row.connectionId },
|
|
25
25
|
...row.listedAt && { listedAt: new Date(row.listedAt).toISOString() },
|
|
26
|
+
...row.sharedAt && { sharedAt: new Date(row.sharedAt).toISOString() },
|
|
26
27
|
...verifications && { verifications: verifications.filter(({ senderId }) => senderId === row.id).map(listedVerification) }
|
|
27
28
|
};
|
|
28
29
|
};
|
|
@@ -7,14 +7,16 @@ import "./mailbox-connections.js";
|
|
|
7
7
|
* A From address someone may send mail from: `id`, the record a send names (`sender_address_id`), null for the
|
|
8
8
|
* mailbox's own address, which goes out with no From header, so the provider fills in its own; `address`, unknown
|
|
9
9
|
* when it is the mailbox's own and the link does not name it; the display `name` its owner entered, if any; `ownerId`,
|
|
10
|
-
* whose mailbox it goes out through
|
|
11
|
-
* mailbox's own address is `verified`: the provider's sign-in
|
|
10
|
+
* whose mailbox it goes out through, none for an address someone else shared (`shared`); its own `signature`, if it
|
|
11
|
+
* has one; and its `state` (`SenderAddressState`). The mailbox's own address is `verified`: the provider's sign-in
|
|
12
|
+
* vouches for it, as a shared one is only while its owner's evidence says so.
|
|
12
13
|
*/
|
|
13
14
|
export type MailSender = {
|
|
14
15
|
id: string | null;
|
|
15
16
|
address?: string;
|
|
16
17
|
name?: string;
|
|
17
|
-
ownerId
|
|
18
|
+
ownerId?: string;
|
|
19
|
+
shared?: true;
|
|
18
20
|
signature?: string;
|
|
19
21
|
state: SenderAddressState;
|
|
20
22
|
};
|
|
@@ -21,6 +21,14 @@ const senderOf = (row, state) => ({
|
|
|
21
21
|
...row.signature && { signature: row.signature },
|
|
22
22
|
state
|
|
23
23
|
});
|
|
24
|
+
const sharedSender = (row) => ({
|
|
25
|
+
id: row.id,
|
|
26
|
+
address: row.address,
|
|
27
|
+
...row.name && { name: row.name },
|
|
28
|
+
shared: true,
|
|
29
|
+
...row.signature && { signature: row.signature },
|
|
30
|
+
state: "verified"
|
|
31
|
+
});
|
|
24
32
|
const mailboxSender = (book) => ({
|
|
25
33
|
id: null,
|
|
26
34
|
...book.ownAddress && { address: book.ownAddress },
|
|
@@ -30,9 +38,10 @@ const mailboxSender = (book) => ({
|
|
|
30
38
|
const sameAddress = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
31
39
|
/**
|
|
32
40
|
* The sender `book`'s person sends as for `address`, matched without regard to case: one of their usable records;
|
|
33
|
-
* else their mailbox's own address
|
|
34
|
-
* `MailSenderRefusedError` any other address, one someone else
|
|
35
|
-
* one that is a record on more than one of
|
|
41
|
+
* else their mailbox's own address; else one someone else shared with them (`book.shared`). Without `address`, their
|
|
42
|
+
* default record, else their mailbox's own. Refuses with `MailSenderRefusedError` any other address, one someone else
|
|
43
|
+
* entered and did not share included, and with `sender_address_ambiguous` one that is a record on more than one of
|
|
44
|
+
* their connections, or shared by more than one person.
|
|
36
45
|
*/
|
|
37
46
|
const chooseSender = (book, address) => {
|
|
38
47
|
const usable = usableRows(book);
|
|
@@ -44,12 +53,20 @@ const chooseSender = (book, address) => {
|
|
|
44
53
|
if (matching.length > 1) throw new SenderAddressError("sender_address_ambiguous");
|
|
45
54
|
if (matching[0]) return senderOf(matching[0].row, matching[0].state);
|
|
46
55
|
if (book.ownAddress && sameAddress(book.ownAddress, address)) return mailboxSender(book);
|
|
56
|
+
const shared = (book.shared ?? []).filter((row) => sameAddress(row.address, address));
|
|
57
|
+
if (shared.length > 1) throw new SenderAddressError("sender_address_ambiguous");
|
|
58
|
+
if (shared[0]) return sharedSender(shared[0]);
|
|
47
59
|
throw new MailSenderRefusedError(address);
|
|
48
60
|
};
|
|
49
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Every sender the person may choose: their mailbox's own address, when the link names it and no record holds it, then
|
|
63
|
+
* their records, then the addresses others shared with them that none of theirs holds.
|
|
64
|
+
*/
|
|
50
65
|
const usableSenders = (book) => {
|
|
51
66
|
const usable = usableRows(book);
|
|
52
|
-
|
|
67
|
+
const theirs = [...book.ownAddress && !usable.some(({ row }) => sameAddress(row.address, book.ownAddress)) ? [mailboxSender(book)] : [], ...usable.map(({ row, state }) => senderOf(row, state))];
|
|
68
|
+
const shared = (book.shared ?? []).filter((row) => !theirs.some((sender) => sender.address && sameAddress(sender.address, row.address)));
|
|
69
|
+
return [...theirs, ...shared.map(sharedSender)];
|
|
53
70
|
};
|
|
54
71
|
//#endregion
|
|
55
72
|
export { chooseSender, senderOf, stateIn, usableRows, usableSenders };
|