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!: Remove timeout property on ArcjetRateLimitRule #182

Merged
merged 1 commit into from
Feb 6, 2024
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
chore!: Remove timeout property on ArcjetRateLimitRule
blaine-arcjet committed Feb 5, 2024
commit b8b346f2ece64df57e6afe56b7f787454ed42539
2 changes: 0 additions & 2 deletions arcjet/index.ts
Original file line number Diff line number Diff line change
@@ -377,7 +377,6 @@ export type RateLimitOptions = {
characteristics?: string[];
window: string;
max: number;
timeout: string;
};

/**
@@ -539,7 +538,6 @@ export function rateLimit(
characteristics: opt.characteristics,
window: opt.window,
max: opt.max,
timeout: opt.timeout,
});
}

16 changes: 0 additions & 16 deletions arcjet/test/index.node.test.ts
Original file line number Diff line number Diff line change
@@ -1907,7 +1907,6 @@ describe("Primitive > rateLimit", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
});
expect(rule.type).toEqual("RATE_LIMIT");
expect(rule).toHaveProperty("mode", "DRY_RUN");
@@ -1919,7 +1918,6 @@ describe("Primitive > rateLimit", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
};

const rules = rateLimit(options);
@@ -1930,7 +1928,6 @@ describe("Primitive > rateLimit", () => {
expect(rules[0]).toHaveProperty("characteristics", ["ip.src"]);
expect(rules[0]).toHaveProperty("window", "1h");
expect(rules[0]).toHaveProperty("max", 1);
expect(rules[0]).toHaveProperty("timeout", "10m");
});

test("produces a multiple rules based on multiple `limit` specified", async () => {
@@ -1940,14 +1937,12 @@ describe("Primitive > rateLimit", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
},
{
match: "/test-double",
characteristics: ["ip.src"],
window: "2h",
max: 2,
timeout: "20m",
},
];

@@ -1961,7 +1956,6 @@ describe("Primitive > rateLimit", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
}),
expect.objectContaining({
type: "RATE_LIMIT",
@@ -1970,7 +1964,6 @@ describe("Primitive > rateLimit", () => {
characteristics: ["ip.src"],
window: "2h",
max: 2,
timeout: "20m",
}),
]);
});
@@ -1979,7 +1972,6 @@ describe("Primitive > rateLimit", () => {
const options = {
window: "1h",
max: 1,
timeout: "10m",
};

const [rule] = rateLimit(options);
@@ -1993,12 +1985,10 @@ describe("Primitive > rateLimit", () => {
{
window: "1h",
max: 1,
timeout: "10m",
},
{
window: "2h",
max: 2,
timeout: "20m",
},
];

@@ -2011,7 +2001,6 @@ describe("Primitive > rateLimit", () => {
characteristics: undefined,
window: "1h",
max: 1,
timeout: "10m",
}),
expect.objectContaining({
type: "RATE_LIMIT",
@@ -2020,7 +2009,6 @@ describe("Primitive > rateLimit", () => {
characteristics: undefined,
window: "2h",
max: 2,
timeout: "20m",
}),
]);
});
@@ -2360,7 +2348,6 @@ describe("Products > protectSignup", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
},
bots: {
mode: ArcjetMode.DRY_RUN,
@@ -2381,14 +2368,12 @@ describe("Products > protectSignup", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
},
{
match: "/test",
characteristics: ["ip.src"],
window: "2h",
max: 2,
timeout: "20m",
},
],
});
@@ -3440,7 +3425,6 @@ describe("Arcjet: Env = Serverless Node runtime on Vercel", () => {
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
};
const fingerprint =
"fp_1_ac8547705f1f45c5050f1424700dfa3f6f2f681b550ca4f3c19571585aea7a2c";
1 change: 0 additions & 1 deletion examples/nextjs-13-pages-wrap/pages/api/arcjet-edge.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ const aj = arcjet({
//characteristics: ["ip.src"],
window: "1m",
max: 1,
timeout: "10m",
}),
],
});
1 change: 0 additions & 1 deletion examples/nextjs-13-pages-wrap/pages/api/arcjet.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ const aj = arcjet({
//characteristics: ["ip.src"],
window: "1m",
max: 1,
timeout: "10m",
}),
],
});
1 change: 0 additions & 1 deletion examples/nextjs-14-app-dir-rl/app/api/arcjet/route.ts
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@ const aj = arcjet({
characteristics: ["ip.src"],
window: "1h",
max: 1,
timeout: "10m",
}),
],
});
1 change: 0 additions & 1 deletion examples/nextjs-14-openai/app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ const aj = arcjet({
characteristics: ["ip.src"],
window: "1m",
max: 60,
timeout: "10m",
}),
],
});
1 change: 0 additions & 1 deletion examples/nextjs-14-pages-wrap/pages/api/arcjet-edge.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ const aj = arcjet({
//characteristics: ["ip.src"],
window: "1m",
max: 1,
timeout: "10m",
}),
],
});
1 change: 0 additions & 1 deletion examples/nextjs-14-pages-wrap/pages/api/arcjet.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ const aj = arcjet({
//characteristics: ["ip.src"],
window: "1m",
max: 1,
timeout: "10m",
}),
],
});
1 change: 0 additions & 1 deletion protocol/convert.ts
Original file line number Diff line number Diff line change
@@ -487,7 +487,6 @@ export function ArcjetRuleToProtocol<Props extends { [key: string]: unknown }>(
characteristics: rule.characteristics,
window: rule.window,
max: rule.max,
timeout: rule.timeout,
},
},
});
1 change: 0 additions & 1 deletion protocol/index.ts
Original file line number Diff line number Diff line change
@@ -404,7 +404,6 @@ export interface ArcjetRateLimitRule<Props extends {}>
characteristics?: string[];
window: string;
max: number;
timeout: string;
}

export interface ArcjetEmailRule<Props extends { email: string }>