@internetarchive/fetch-handler 1.1.0-webdev-7731.2 → 1.1.0-webdev-7731.4

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/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export { DefaultRetryConfiguration } from './src/fetch-retry/configuration/defau
5
5
  export { NoRetryConfiguration } from './src/fetch-retry/configuration/no-retry-configuration';
6
6
  export type { RetryConfiguring } from './src/fetch-retry/configuration/retry-configuring';
7
7
  export type { FetchOptions } from './src/fetch-options';
8
+ export { FetchRetryConfig } from './src/fetch-retry/configuration/configurations';
package/dist/index.js CHANGED
@@ -2,4 +2,5 @@ export { IaFetchHandler } from './src/fetch-handler';
2
2
  export { FetchRetrier, } from './src/fetch-retry/fetch-retrier';
3
3
  export { DefaultRetryConfiguration } from './src/fetch-retry/configuration/default-retry-configuration';
4
4
  export { NoRetryConfiguration } from './src/fetch-retry/configuration/no-retry-configuration';
5
+ export { FetchRetryConfig } from './src/fetch-retry/configuration/configurations';
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACL,YAAY,GAEb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6DAA6D,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC","sourcesContent":["export { IaFetchHandler } from './src/fetch-handler';\nexport { FetchHandlerInterface } from './src/fetch-handler-interface';\nexport {\n FetchRetrier,\n FetchRetrierInterface,\n} from './src/fetch-retry/fetch-retrier';\nexport { DefaultRetryConfiguration } from './src/fetch-retry/configuration/default-retry-configuration';\nexport { NoRetryConfiguration } from './src/fetch-retry/configuration/no-retry-configuration';\nexport type { RetryConfiguring } from './src/fetch-retry/configuration/retry-configuring';\nexport type { FetchOptions } from './src/fetch-options';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACL,YAAY,GAEb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,yBAAyB,EAAE,MAAM,6DAA6D,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,wDAAwD,CAAC;AAG9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC","sourcesContent":["export { IaFetchHandler } from './src/fetch-handler';\nexport { FetchHandlerInterface } from './src/fetch-handler-interface';\nexport {\n FetchRetrier,\n FetchRetrierInterface,\n} from './src/fetch-retry/fetch-retrier';\nexport { DefaultRetryConfiguration } from './src/fetch-retry/configuration/default-retry-configuration';\nexport { NoRetryConfiguration } from './src/fetch-retry/configuration/no-retry-configuration';\nexport type { RetryConfiguring } from './src/fetch-retry/configuration/retry-configuring';\nexport type { FetchOptions } from './src/fetch-options';\nexport { FetchRetryConfig } from './src/fetch-retry/configuration/configurations';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { RetryConfiguring } from './retry-configuring';
2
+ export declare class FetchRetryConfig {
3
+ static readonly default: Readonly<RetryConfiguring>;
4
+ static readonly noRetry: Readonly<RetryConfiguring>;
5
+ }
@@ -0,0 +1,7 @@
1
+ import { DefaultRetryConfiguration } from './default-retry-configuration';
2
+ import { NoRetryConfiguration } from './no-retry-configuration';
3
+ export class FetchRetryConfig {
4
+ }
5
+ FetchRetryConfig.default = DefaultRetryConfiguration.shared;
6
+ FetchRetryConfig.noRetry = NoRetryConfiguration.shared;
7
+ //# sourceMappingURL=configurations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configurations.js","sourceRoot":"","sources":["../../../../src/fetch-retry/configuration/configurations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,OAAO,gBAAgB;;AACX,wBAAO,GACrB,yBAAyB,CAAC,MAAM,CAAC;AAEnB,wBAAO,GACrB,oBAAoB,CAAC,MAAM,CAAC","sourcesContent":["import { DefaultRetryConfiguration } from './default-retry-configuration';\nimport { NoRetryConfiguration } from './no-retry-configuration';\nimport type { RetryConfiguring } from './retry-configuring';\n\nexport class FetchRetryConfig {\n static readonly default: Readonly<RetryConfiguring> =\n DefaultRetryConfiguration.shared;\n\n static readonly noRetry: Readonly<RetryConfiguring> =\n NoRetryConfiguration.shared;\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { RetryConfiguring } from './retry-configuring';
2
2
  import type { Milliseconds } from './milliseconds';
3
3
  export declare class DefaultRetryConfiguration implements RetryConfiguring {
4
+ static readonly shared: Readonly<RetryConfiguring>;
4
5
  private readonly maxRetries;
5
6
  constructor(options?: {
6
7
  maxRetries?: number;
@@ -17,4 +17,5 @@ export class DefaultRetryConfiguration {
17
17
  return Math.min(500 * 2 ** retryNumber, 10000);
18
18
  }
19
19
  }
20
+ DefaultRetryConfiguration.shared = new DefaultRetryConfiguration();
20
21
  //# sourceMappingURL=default-retry-configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-retry-configuration.js","sourceRoot":"","sources":["../../../../src/fetch-retry/configuration/default-retry-configuration.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,yBAAyB;IAGpC,YAAY,OAAiC;QAF5B,eAAU,GAAqB,CAAC,CAAC;QAGhD,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,MAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACvC,CAAC;IACH,CAAC;IAED,WAAW,CAAC,QAAyB,EAAE,WAAmB;QACxD,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACpC,IAAI,WAAW,GAAG,IAAI,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QAChD,OAAO,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,WAAmB;QAC5B,uCAAuC;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,WAAW,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;CACF","sourcesContent":["import type { RetryConfiguring } from './retry-configuring';\nimport type { Milliseconds } from './milliseconds';\n\nexport class DefaultRetryConfiguration implements RetryConfiguring {\n private readonly maxRetries: Readonly<number> = 2;\n\n constructor(options?: { maxRetries?: number }) {\n if (options?.maxRetries !== undefined) {\n this.maxRetries = options.maxRetries;\n }\n }\n\n shouldRetry(response: Response | null, retryNumber: number): boolean {\n if (response === null) return false;\n if (retryNumber > this.maxRetries) return false;\n return response.status >= 500 && response.status < 600;\n }\n\n retryDelay(retryNumber: number): Milliseconds {\n // Exponential backoff up to 10 seconds\n return Math.min(500 * 2 ** retryNumber, 10000);\n }\n}\n"]}
1
+ {"version":3,"file":"default-retry-configuration.js","sourceRoot":"","sources":["../../../../src/fetch-retry/configuration/default-retry-configuration.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,yBAAyB;IAMpC,YAAY,OAAiC;QAF5B,eAAU,GAAqB,CAAC,CAAC;QAGhD,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,MAAK,SAAS,EAAE,CAAC;YACtC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACvC,CAAC;IACH,CAAC;IAED,WAAW,CAAC,QAAyB,EAAE,WAAmB;QACxD,IAAI,QAAQ,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QACpC,IAAI,WAAW,GAAG,IAAI,CAAC,UAAU;YAAE,OAAO,KAAK,CAAC;QAChD,OAAO,QAAQ,CAAC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC;IACzD,CAAC;IAED,UAAU,CAAC,WAAmB;QAC5B,uCAAuC;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,IAAI,WAAW,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;;AApBe,gCAAM,GACpB,IAAI,yBAAyB,EAAE,AADX,CACY","sourcesContent":["import type { RetryConfiguring } from './retry-configuring';\nimport type { Milliseconds } from './milliseconds';\n\nexport class DefaultRetryConfiguration implements RetryConfiguring {\n static readonly shared: Readonly<RetryConfiguring> =\n new DefaultRetryConfiguration();\n\n private readonly maxRetries: Readonly<number> = 2;\n\n constructor(options?: { maxRetries?: number }) {\n if (options?.maxRetries !== undefined) {\n this.maxRetries = options.maxRetries;\n }\n }\n\n shouldRetry(response: Response | null, retryNumber: number): boolean {\n if (response === null) return false;\n if (retryNumber > this.maxRetries) return false;\n return response.status >= 500 && response.status < 600;\n }\n\n retryDelay(retryNumber: number): Milliseconds {\n // Exponential backoff up to 10 seconds\n return Math.min(500 * 2 ** retryNumber, 10000);\n }\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { RetryConfiguring } from './retry-configuring';
2
2
  import type { Milliseconds } from './milliseconds';
3
3
  export declare class NoRetryConfiguration implements RetryConfiguring {
4
+ static readonly shared: Readonly<RetryConfiguring>;
4
5
  shouldRetry(): boolean;
5
6
  retryDelay(): Milliseconds;
6
7
  }
@@ -6,4 +6,5 @@ export class NoRetryConfiguration {
6
6
  return 0;
7
7
  }
8
8
  }
9
+ NoRetryConfiguration.shared = new NoRetryConfiguration();
9
10
  //# sourceMappingURL=no-retry-configuration.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"no-retry-configuration.js","sourceRoot":"","sources":["../../../../src/fetch-retry/configuration/no-retry-configuration.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,oBAAoB;IAC/B,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,CAAC,CAAC;IACX,CAAC;CACF","sourcesContent":["import type { RetryConfiguring } from './retry-configuring';\nimport type { Milliseconds } from './milliseconds';\n\nexport class NoRetryConfiguration implements RetryConfiguring {\n shouldRetry(): boolean {\n return false;\n }\n\n retryDelay(): Milliseconds {\n return 0;\n }\n}\n"]}
1
+ {"version":3,"file":"no-retry-configuration.js","sourceRoot":"","sources":["../../../../src/fetch-retry/configuration/no-retry-configuration.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,oBAAoB;IAI/B,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU;QACR,OAAO,CAAC,CAAC;IACX,CAAC;;AATe,2BAAM,GACpB,IAAI,oBAAoB,EAAE,CAAC","sourcesContent":["import type { RetryConfiguring } from './retry-configuring';\nimport type { Milliseconds } from './milliseconds';\n\nexport class NoRetryConfiguration implements RetryConfiguring {\n static readonly shared: Readonly<RetryConfiguring> =\n new NoRetryConfiguration();\n\n shouldRetry(): boolean {\n return false;\n }\n\n retryDelay(): Milliseconds {\n return 0;\n }\n}\n"]}
package/index.ts CHANGED
@@ -8,3 +8,4 @@ export { DefaultRetryConfiguration } from './src/fetch-retry/configuration/defau
8
8
  export { NoRetryConfiguration } from './src/fetch-retry/configuration/no-retry-configuration';
9
9
  export type { RetryConfiguring } from './src/fetch-retry/configuration/retry-configuring';
10
10
  export type { FetchOptions } from './src/fetch-options';
11
+ export { FetchRetryConfig } from './src/fetch-retry/configuration/configurations';
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "AGPL-3.0-only",
9
9
  "author": "Internet Archive",
10
- "version": "1.1.0-webdev-7731.2",
10
+ "version": "1.1.0-webdev-7731.4",
11
11
  "main": "dist/index.js",
12
12
  "module": "dist/index.js",
13
13
  "scripts": {
@@ -0,0 +1,11 @@
1
+ import { DefaultRetryConfiguration } from './default-retry-configuration';
2
+ import { NoRetryConfiguration } from './no-retry-configuration';
3
+ import type { RetryConfiguring } from './retry-configuring';
4
+
5
+ export class FetchRetryConfig {
6
+ static readonly default: Readonly<RetryConfiguring> =
7
+ DefaultRetryConfiguration.shared;
8
+
9
+ static readonly noRetry: Readonly<RetryConfiguring> =
10
+ NoRetryConfiguration.shared;
11
+ }
@@ -2,6 +2,9 @@ import type { RetryConfiguring } from './retry-configuring';
2
2
  import type { Milliseconds } from './milliseconds';
3
3
 
4
4
  export class DefaultRetryConfiguration implements RetryConfiguring {
5
+ static readonly shared: Readonly<RetryConfiguring> =
6
+ new DefaultRetryConfiguration();
7
+
5
8
  private readonly maxRetries: Readonly<number> = 2;
6
9
 
7
10
  constructor(options?: { maxRetries?: number }) {
@@ -2,6 +2,9 @@ import type { RetryConfiguring } from './retry-configuring';
2
2
  import type { Milliseconds } from './milliseconds';
3
3
 
4
4
  export class NoRetryConfiguration implements RetryConfiguring {
5
+ static readonly shared: Readonly<RetryConfiguring> =
6
+ new NoRetryConfiguration();
7
+
5
8
  shouldRetry(): boolean {
6
9
  return false;
7
10
  }