Skip to content

Commit

Permalink
Added email specific option for sendanor/project-sendanor.fi#251
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaakko Heusala committed Sep 5, 2024
1 parent ad68c86 commit 7b6cce5
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 7 deletions.
42 changes: 42 additions & 0 deletions store/types/product/features/EmailOption.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright (c) 2024. Heusala Group Oy <info@heusalagroup.fi>. All rights reserved.

import {
explainEnum,
isEnum,
parseEnum,
stringifyEnum,
} from "../../../../types/Enum";
import {
explainNot,
explainOk,
explainOr,
} from "../../../../types/explain";
import { isUndefined } from "../../../../types/undefined";

export enum EmailOption {
ADMIN_CONFIGURABLE = "ADMIN_CONFIGURABLE",
}

export function isEmailOption (value: unknown) : value is EmailOption {
return isEnum(EmailOption, value);
}

export function explainEmailOption (value : unknown) : string {
return explainEnum("EmailOption", EmailOption, isEmailOption, value);
}

export function stringifyEmailOption (value : EmailOption) : string {
return stringifyEnum(EmailOption, value);
}

export function parseEmailOption (value: any) : EmailOption | undefined {
return parseEnum(EmailOption, value) as EmailOption | undefined;
}

export function isEmailOptionOrUndefined (value: unknown): value is EmailOption | undefined {
return isUndefined(value) || isEmailOption(value);
}

export function explainEmailOptionOrUndefined (value: unknown): string {
return isEmailOptionOrUndefined(value) ? explainOk() : explainNot(explainOr(['EmailOption', 'undefined']));
}
15 changes: 8 additions & 7 deletions store/types/product/features/ProductFeatureId.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,8 @@ export enum ProductFeatureId {
IMAP_SUPPORT = "IMAP_SUPPORT",
POP_SUPPORT = "POP_SUPPORT",
SMTP_AUTH_SUPPORT = "SMTP_AUTH_SUPPORT",
API_SUPPORT = "API_SUPPORT",
ADMIN_USER_COUNT = "ADMIN_USER_COUNT",
TOTP_2FA_SUPPORT = "TOTP_2FA_SUPPORT",
OAUTH2_SUPPORT = "OAUTH2_SUPPORT",
SPAM_FILTERING = "SPAM_FILTERING",
CLAMAV_SUPPORT = "CLAMAV_SUPPORT",
QUOTA_SUPPORT = "QUOTA_SUPPORT",
STATISTICS_SUPPORT = "STATISTICS_SUPPORT",
MONITORING_SUPPORT = "MONITORING_SUPPORT",
DKIM_SUPPORT = "DKIM_SUPPORT",
SPF_SUPPORT = "SPF_SUPPORT",
SIEVE_FILTERING_SUPPORT = "SIEVE_FILTERING_SUPPORT",
Expand All @@ -99,6 +92,14 @@ export enum ProductFeatureId {
PASSWORD_RECOVERY_TOTP_THROTTLE_RATE = "PASSWORD_RECOVERY_TOTP_THROTTLE_RATE",
PASSWORD_RECOVERY_APPLY_THROTTLE_RATE = "PASSWORD_RECOVERY_APPLY_THROTTLE_RATE",

API_SUPPORT = "API_SUPPORT",
ADMIN_USER_COUNT = "ADMIN_USER_COUNT",
TOTP_2FA_SUPPORT = "TOTP_2FA_SUPPORT",
OAUTH2_SUPPORT = "OAUTH2_SUPPORT",
QUOTA_SUPPORT = "QUOTA_SUPPORT",
STATISTICS_SUPPORT = "STATISTICS_SUPPORT",
MONITORING_SUPPORT = "MONITORING_SUPPORT",

}

export function isProductFeatureId (value: unknown) : value is ProductFeatureId {
Expand Down

0 comments on commit 7b6cce5

Please sign in to comment.