Skip to content

Commit ee95be9

Browse files
zeevmoneyclaude
andcommitted
Remove dead retry exports
- Delete NON_RETRYABLE_STATUS_CODES: it was defined and publicly re-exported but never used in any retry logic (the condition uses RETRYABLE_STATUS_CODES). Drop its definition, the index.ts re-export, and the tests that only asserted its value. - Make DEFAULT_RETRY_METHODS module-private; it's only used in-module by DEFAULT_RETRY_CONFIG and imported nowhere. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e12e28b commit ee95be9

3 files changed

Lines changed: 2 additions & 18 deletions

File tree

src/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,7 @@ export { PermitConnectionError, PermitError, PermitPDPStatusError } from './enfo
2727
export { Context, ContextTransform } from './utils/context';
2828
export { ApiContext, PermitContextError, ApiKeyLevel } from './api/context';
2929
export { PermitApiError } from './api/base';
30-
export {
31-
IRetryConfig,
32-
RetryConditionFn,
33-
RETRYABLE_STATUS_CODES,
34-
NON_RETRYABLE_STATUS_CODES,
35-
} from './utils/retry';
30+
export { IRetryConfig, RetryConditionFn, RETRYABLE_STATUS_CODES } from './utils/retry';
3631

3732
export interface IPermitClient extends IEnforcer {
3833
/**

src/tests/unit/retry.spec.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
DEFAULT_RETRY_CONFIG,
77
defaultRetryCondition,
88
IRetryConfig,
9-
NON_RETRYABLE_STATUS_CODES,
109
parseRetryAfter,
1110
resolveRetryConfig,
1211
RETRYABLE_STATUS_CODES,
@@ -40,10 +39,6 @@ test('RETRYABLE_STATUS_CODES contains expected status codes', (t) => {
4039
t.deepEqual(RETRYABLE_STATUS_CODES, [408, 429, 500, 502, 503, 504]);
4140
});
4241

43-
test('NON_RETRYABLE_STATUS_CODES contains expected status codes', (t) => {
44-
t.deepEqual(NON_RETRYABLE_STATUS_CODES, [400, 401, 403, 404, 422]);
45-
});
46-
4742
// ============================================
4843
// Tests for defaultRetryCondition
4944
// ============================================
@@ -335,7 +330,6 @@ test('retry types are exported from SDK', async (t) => {
335330
const sdk = await import('../../index');
336331

337332
t.truthy(sdk.RETRYABLE_STATUS_CODES);
338-
t.truthy(sdk.NON_RETRYABLE_STATUS_CODES);
339333
t.deepEqual(sdk.RETRYABLE_STATUS_CODES, [408, 429, 500, 502, 503, 504]);
340334
});
341335

src/utils/retry.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@ import { AxiosError } from 'axios';
55
*/
66
export const RETRYABLE_STATUS_CODES = [408, 429, 500, 502, 503, 504];
77

8-
/**
9-
* HTTP status codes that should NOT trigger a retry
10-
*/
11-
export const NON_RETRYABLE_STATUS_CODES = [400, 401, 403, 404, 422];
12-
138
/**
149
* Default HTTP methods that are safe to retry
1510
*/
16-
export const DEFAULT_RETRY_METHODS = ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE'];
11+
const DEFAULT_RETRY_METHODS = ['GET', 'HEAD', 'OPTIONS', 'PUT', 'DELETE'];
1712

1813
/**
1914
* Function type for custom retry condition evaluation

0 commit comments

Comments
 (0)