lifecycleion 0.0.19 → 0.0.21

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.
Files changed (74) hide show
  1. package/README.md +39 -36
  2. package/dist/lib/event-emitter.cjs +195 -9
  3. package/dist/lib/event-emitter.cjs.map +1 -1
  4. package/dist/lib/event-emitter.js +195 -9
  5. package/dist/lib/event-emitter.js.map +1 -1
  6. package/dist/lib/global-event-target.cjs +217 -0
  7. package/dist/lib/global-event-target.cjs.map +1 -0
  8. package/dist/lib/global-event-target.d.cts +70 -0
  9. package/dist/lib/global-event-target.d.ts +70 -0
  10. package/dist/lib/global-event-target.js +189 -0
  11. package/dist/lib/global-event-target.js.map +1 -0
  12. package/dist/lib/http-client/index.cjs +554 -193
  13. package/dist/lib/http-client/index.cjs.map +1 -1
  14. package/dist/lib/http-client/index.d.cts +9 -3
  15. package/dist/lib/http-client/index.d.ts +9 -3
  16. package/dist/lib/http-client/index.js +554 -193
  17. package/dist/lib/http-client/index.js.map +1 -1
  18. package/dist/lib/http-client-mock/index.cjs +71 -24
  19. package/dist/lib/http-client-mock/index.cjs.map +1 -1
  20. package/dist/lib/http-client-mock/index.d.cts +50 -2
  21. package/dist/lib/http-client-mock/index.d.ts +50 -2
  22. package/dist/lib/http-client-mock/index.js +71 -24
  23. package/dist/lib/http-client-mock/index.js.map +1 -1
  24. package/dist/lib/http-client-node/index.cjs +135 -33
  25. package/dist/lib/http-client-node/index.cjs.map +1 -1
  26. package/dist/lib/http-client-node/index.d.cts +33 -2
  27. package/dist/lib/http-client-node/index.d.ts +33 -2
  28. package/dist/lib/http-client-node/index.js +135 -33
  29. package/dist/lib/http-client-node/index.js.map +1 -1
  30. package/dist/lib/http-client-xhr/index.cjs +0 -14
  31. package/dist/lib/http-client-xhr/index.cjs.map +1 -1
  32. package/dist/lib/http-client-xhr/index.d.cts +3 -2
  33. package/dist/lib/http-client-xhr/index.d.ts +3 -2
  34. package/dist/lib/http-client-xhr/index.js +0 -14
  35. package/dist/lib/http-client-xhr/index.js.map +1 -1
  36. package/dist/lib/lifecycle-manager/index.cjs +199 -13
  37. package/dist/lib/lifecycle-manager/index.cjs.map +1 -1
  38. package/dist/lib/lifecycle-manager/index.js +199 -13
  39. package/dist/lib/lifecycle-manager/index.js.map +1 -1
  40. package/dist/lib/logger/index.cjs +203 -21
  41. package/dist/lib/logger/index.cjs.map +1 -1
  42. package/dist/lib/logger/index.d.cts +5 -1
  43. package/dist/lib/logger/index.d.ts +5 -1
  44. package/dist/lib/logger/index.js +203 -21
  45. package/dist/lib/logger/index.js.map +1 -1
  46. package/dist/lib/lru-cache/index.cjs +195 -9
  47. package/dist/lib/lru-cache/index.cjs.map +1 -1
  48. package/dist/lib/lru-cache/index.js +195 -9
  49. package/dist/lib/lru-cache/index.js.map +1 -1
  50. package/dist/lib/process-signal-manager.cjs +199 -13
  51. package/dist/lib/process-signal-manager.cjs.map +1 -1
  52. package/dist/lib/process-signal-manager.js +199 -13
  53. package/dist/lib/process-signal-manager.js.map +1 -1
  54. package/dist/lib/promise-protected-resolver.cjs +195 -9
  55. package/dist/lib/promise-protected-resolver.cjs.map +1 -1
  56. package/dist/lib/promise-protected-resolver.js +195 -9
  57. package/dist/lib/promise-protected-resolver.js.map +1 -1
  58. package/dist/lib/retry-utils/index.cjs +195 -9
  59. package/dist/lib/retry-utils/index.cjs.map +1 -1
  60. package/dist/lib/retry-utils/index.js +195 -9
  61. package/dist/lib/retry-utils/index.js.map +1 -1
  62. package/dist/lib/safe-handle-callback.cjs +196 -18
  63. package/dist/lib/safe-handle-callback.cjs.map +1 -1
  64. package/dist/lib/safe-handle-callback.d.cts +14 -4
  65. package/dist/lib/safe-handle-callback.d.ts +14 -4
  66. package/dist/lib/safe-handle-callback.js +196 -18
  67. package/dist/lib/safe-handle-callback.js.map +1 -1
  68. package/dist/lib/single-event-observer.cjs +195 -9
  69. package/dist/lib/single-event-observer.cjs.map +1 -1
  70. package/dist/lib/single-event-observer.js +195 -9
  71. package/dist/lib/single-event-observer.js.map +1 -1
  72. package/dist/{types-CWw885iO.d.cts → types-BFvpJPMt.d.cts} +72 -11
  73. package/dist/{types-Mso0dYOS.d.ts → types-BONtIhQ5.d.ts} +72 -11
  74. package/package.json +31 -12
@@ -1,5 +1,5 @@
1
- import { R as RequestState, c as HTTPMethod, d as HTTPRequestOptions, e as HTTPResponse, f as HTTPClientError, g as HTTPProgressEvent, h as AttemptStartEvent, i as AttemptEndEvent, S as StreamResponseFactory, j as HTTPClientConfig, A as AdapterType, k as RequestInterceptor, l as RequestInterceptorFilter, m as ResponseObserver, n as ResponseObserverFilter, E as ErrorObserver, o as ErrorObserverFilter, p as SubClientConfig, H as HTTPAdapter, a as AdapterRequest, b as AdapterResponse } from '../../types-CWw885iO.cjs';
2
- export { q as AttemptRequest, C as ContentType, r as Cookie, s as CookieInput, t as CookieJar, u as CookieJarJSON, v as ErrorCode, w as ErrorObserverPhase, x as ErrorObserverPhaseName, I as InterceptedRequest, y as InterceptorCancel, z as InterceptorPhase, B as InterceptorPhaseName, Q as QueryObject, D as QueryValue, F as RedirectHopInfo, G as RequestInterceptorContext, J as RequestPhase, K as RequestPhaseName, L as ResponseObserverPhase, M as ResponseObserverPhaseName, N as StreamResponseCancel, O as StreamResponseContext, P as StreamResponseInfo, W as WritableLike } from '../../types-CWw885iO.cjs';
1
+ import { R as RequestState, d as HTTPMethod, h as HTTPRequestOptions, i as HTTPResponse, j as HTTPClientError, k as HTTPProgressEvent, l as AttemptStartEvent, m as AttemptEndEvent, f as StreamResponseFactory, n as HTTPClientConfig, A as AdapterType, o as RequestInterceptor, p as RequestInterceptorFilter, q as ResponseObserver, r as ResponseObserverFilter, E as ErrorObserver, s as ErrorObserverFilter, t as SubClientConfig, H as HTTPAdapter, a as AdapterRequest, b as AdapterResponse } from '../../types-BFvpJPMt.cjs';
2
+ export { u as AttemptRequest, C as ContentType, v as Cookie, w as CookieInput, x as CookieJar, y as CookieJarJSON, z as ErrorCode, B as ErrorObserverPhase, D as ErrorObserverPhaseName, I as InterceptedRequest, F as InterceptorCancel, G as InterceptorPhase, J as InterceptorPhaseName, Q as QueryObject, K as QueryValue, L as RedirectHopInfo, M as RequestInterceptorContext, N as RequestPhase, O as RequestPhaseName, P as ResponseObserverPhase, T as ResponseObserverPhaseName, S as StreamResponseCancel, e as StreamResponseContext, g as StreamResponseInfo, W as WritableLike } from '../../types-BFvpJPMt.cjs';
3
3
  import { R as RetryPolicyOptions } from '../../types-BW0vnSzd.cjs';
4
4
 
5
5
  interface TrackedRequest {
@@ -99,6 +99,7 @@ declare class HTTPRequestBuilder<T = unknown> {
99
99
  private _timeout?;
100
100
  private _signal?;
101
101
  private _retryPolicy?;
102
+ private _retryNonIdempotentMethods?;
102
103
  private _label?;
103
104
  private _onUploadProgress?;
104
105
  private _onDownloadProgress?;
@@ -129,6 +130,11 @@ declare class HTTPRequestBuilder<T = unknown> {
129
130
  signal(abortSignal: AbortSignal): this;
130
131
  label(label: string): this;
131
132
  retryPolicy(options: RetryPolicyOptions | null): this;
133
+ /**
134
+ * Allow or forbid retrying this request when its method is not idempotent
135
+ * (`POST`, `PATCH`). Overrides the client config for this request only.
136
+ */
137
+ retryNonIdempotentMethods(allow: boolean): this;
132
138
  onUploadProgress(fn: (event: HTTPProgressEvent) => void): this;
133
139
  onDownloadProgress(fn: (event: HTTPProgressEvent) => void): this;
134
140
  onAttemptStart(fn: (event: AttemptStartEvent) => void): this;
@@ -187,7 +193,7 @@ interface InternalClientState {
187
193
  }
188
194
  declare class BaseHTTPClient {
189
195
  protected _clientID: string;
190
- protected _config: Required<Pick<HTTPClientConfig, 'timeout' | 'includeRequestID' | 'includeAttemptHeader' | 'followRedirects' | 'maxRedirects'>> & HTTPClientConfig;
196
+ protected _config: Required<Pick<HTTPClientConfig, 'timeout' | 'includeRequestID' | 'includeAttemptHeader' | 'followRedirects' | 'maxRedirects' | 'retryNonIdempotentMethods'>> & HTTPClientConfig;
191
197
  protected _adapter: NonNullable<HTTPClientConfig['adapter']>;
192
198
  protected _tracker: RequestTracker;
193
199
  protected _parentClient: BaseHTTPClient | null;
@@ -1,5 +1,5 @@
1
- import { R as RequestState, c as HTTPMethod, d as HTTPRequestOptions, e as HTTPResponse, f as HTTPClientError, g as HTTPProgressEvent, h as AttemptStartEvent, i as AttemptEndEvent, S as StreamResponseFactory, j as HTTPClientConfig, A as AdapterType, k as RequestInterceptor, l as RequestInterceptorFilter, m as ResponseObserver, n as ResponseObserverFilter, E as ErrorObserver, o as ErrorObserverFilter, p as SubClientConfig, H as HTTPAdapter, a as AdapterRequest, b as AdapterResponse } from '../../types-Mso0dYOS.js';
2
- export { q as AttemptRequest, C as ContentType, r as Cookie, s as CookieInput, t as CookieJar, u as CookieJarJSON, v as ErrorCode, w as ErrorObserverPhase, x as ErrorObserverPhaseName, I as InterceptedRequest, y as InterceptorCancel, z as InterceptorPhase, B as InterceptorPhaseName, Q as QueryObject, D as QueryValue, F as RedirectHopInfo, G as RequestInterceptorContext, J as RequestPhase, K as RequestPhaseName, L as ResponseObserverPhase, M as ResponseObserverPhaseName, N as StreamResponseCancel, O as StreamResponseContext, P as StreamResponseInfo, W as WritableLike } from '../../types-Mso0dYOS.js';
1
+ import { R as RequestState, d as HTTPMethod, h as HTTPRequestOptions, i as HTTPResponse, j as HTTPClientError, k as HTTPProgressEvent, l as AttemptStartEvent, m as AttemptEndEvent, f as StreamResponseFactory, n as HTTPClientConfig, A as AdapterType, o as RequestInterceptor, p as RequestInterceptorFilter, q as ResponseObserver, r as ResponseObserverFilter, E as ErrorObserver, s as ErrorObserverFilter, t as SubClientConfig, H as HTTPAdapter, a as AdapterRequest, b as AdapterResponse } from '../../types-BONtIhQ5.js';
2
+ export { u as AttemptRequest, C as ContentType, v as Cookie, w as CookieInput, x as CookieJar, y as CookieJarJSON, z as ErrorCode, B as ErrorObserverPhase, D as ErrorObserverPhaseName, I as InterceptedRequest, F as InterceptorCancel, G as InterceptorPhase, J as InterceptorPhaseName, Q as QueryObject, K as QueryValue, L as RedirectHopInfo, M as RequestInterceptorContext, N as RequestPhase, O as RequestPhaseName, P as ResponseObserverPhase, T as ResponseObserverPhaseName, S as StreamResponseCancel, e as StreamResponseContext, g as StreamResponseInfo, W as WritableLike } from '../../types-BONtIhQ5.js';
3
3
  import { R as RetryPolicyOptions } from '../../types-BW0vnSzd.js';
4
4
 
5
5
  interface TrackedRequest {
@@ -99,6 +99,7 @@ declare class HTTPRequestBuilder<T = unknown> {
99
99
  private _timeout?;
100
100
  private _signal?;
101
101
  private _retryPolicy?;
102
+ private _retryNonIdempotentMethods?;
102
103
  private _label?;
103
104
  private _onUploadProgress?;
104
105
  private _onDownloadProgress?;
@@ -129,6 +130,11 @@ declare class HTTPRequestBuilder<T = unknown> {
129
130
  signal(abortSignal: AbortSignal): this;
130
131
  label(label: string): this;
131
132
  retryPolicy(options: RetryPolicyOptions | null): this;
133
+ /**
134
+ * Allow or forbid retrying this request when its method is not idempotent
135
+ * (`POST`, `PATCH`). Overrides the client config for this request only.
136
+ */
137
+ retryNonIdempotentMethods(allow: boolean): this;
132
138
  onUploadProgress(fn: (event: HTTPProgressEvent) => void): this;
133
139
  onDownloadProgress(fn: (event: HTTPProgressEvent) => void): this;
134
140
  onAttemptStart(fn: (event: AttemptStartEvent) => void): this;
@@ -187,7 +193,7 @@ interface InternalClientState {
187
193
  }
188
194
  declare class BaseHTTPClient {
189
195
  protected _clientID: string;
190
- protected _config: Required<Pick<HTTPClientConfig, 'timeout' | 'includeRequestID' | 'includeAttemptHeader' | 'followRedirects' | 'maxRedirects'>> & HTTPClientConfig;
196
+ protected _config: Required<Pick<HTTPClientConfig, 'timeout' | 'includeRequestID' | 'includeAttemptHeader' | 'followRedirects' | 'maxRedirects' | 'retryNonIdempotentMethods'>> & HTTPClientConfig;
191
197
  protected _adapter: NonNullable<HTTPClientConfig['adapter']>;
192
198
  protected _tracker: RequestTracker;
193
199
  protected _parentClient: BaseHTTPClient | null;