Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Deprecate Arcjet enum-like objects #2684

Merged
merged 2 commits into from
Jan 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions protocol/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type RequiredProps<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
type ArcjetEnum<T extends string> = { readonly [Key in T]: T };

export type ArcjetMode = "LIVE" | "DRY_RUN";
/** @deprecated use equivalent string union type instead */
export const ArcjetMode: ArcjetEnum<ArcjetMode> = Object.freeze({
LIVE: "LIVE",
DRY_RUN: "DRY_RUN",
Expand All @@ -21,6 +22,7 @@ export type ArcjetRateLimitAlgorithm =
| "TOKEN_BUCKET"
| "FIXED_WINDOW"
| "SLIDING_WINDOW";
/** @deprecated use equivalent string union type instead */
export const ArcjetRateLimitAlgorithm: ArcjetEnum<ArcjetRateLimitAlgorithm> =
Object.freeze({
TOKEN_BUCKET: "TOKEN_BUCKET",
Expand All @@ -34,6 +36,7 @@ export type ArcjetEmailType =
| "NO_MX_RECORDS"
| "NO_GRAVATAR"
| "INVALID";
/** @deprecated use equivalent string union type instead */
export const ArcjetEmailType: ArcjetEnum<ArcjetEmailType> = {
DISPOSABLE: "DISPOSABLE",
FREE: "FREE",
Expand All @@ -56,6 +59,7 @@ export type ArcjetStack =
| "DENO"
| "NESTJS"
| "REMIX";
/** @deprecated use equivalent string union type instead */
export const ArcjetStack: ArcjetEnum<ArcjetStack> = {
NODEJS: "NODEJS",
NEXTJS: "NEXTJS",
Expand All @@ -67,6 +71,7 @@ export const ArcjetStack: ArcjetEnum<ArcjetStack> = {
};

export type ArcjetRuleState = "RUN" | "NOT_RUN" | "CACHED" | "DRY_RUN";
/** @deprecated use equivalent string union type instead */
export const ArcjetRuleState: ArcjetEnum<ArcjetRuleState> = Object.freeze({
RUN: "RUN",
NOT_RUN: "NOT_RUN",
Expand All @@ -75,6 +80,7 @@ export const ArcjetRuleState: ArcjetEnum<ArcjetRuleState> = Object.freeze({
});

export type ArcjetConclusion = "ALLOW" | "DENY" | "CHALLENGE" | "ERROR";
/** @deprecated use equivalent string union type instead */
export const ArcjetConclusion: ArcjetEnum<ArcjetConclusion> = Object.freeze({
ALLOW: "ALLOW",
DENY: "DENY",
Expand All @@ -87,6 +93,7 @@ export type ArcjetSensitiveInfoType =
| "PHONE_NUMBER"
| "IP_ADDRESS"
| "CREDIT_CARD_NUMBER";
/** @deprecated use equivalent string union type instead */
export const ArcjetSensitiveInfoType: ArcjetEnum<ArcjetSensitiveInfoType> = {
EMAIL: "EMAIL",
PHONE_NUMBER: "PHONE_NUMBER",
Expand All @@ -95,6 +102,7 @@ export const ArcjetSensitiveInfoType: ArcjetEnum<ArcjetSensitiveInfoType> = {
};

export type ArcjetRuleType = "LOCAL" | "REMOTE";
/** @deprecated use equivalent string union type instead */
export const ArcjetRuleType: ArcjetEnum<ArcjetRuleType> = Object.freeze({
LOCAL: "LOCAL",
REMOTE: "REMOTE",
Expand Down
Loading