@emmvish/stable-request 1.0.7 → 1.0.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"stable-api-gateway.d.ts","sourceRoot":"","sources":["../../src/core/stable-api-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EAGtB,MAAM,mBAAmB,CAAC;AAM3B,wBAAsB,gBAAgB,CAAC,eAAe,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,EAChF,QAAQ,GAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAAO,EACvE,OAAO,GAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAM,iFAkCvE"}
1
+ {"version":3,"file":"stable-api-gateway.d.ts","sourceRoot":"","sources":["../../src/core/stable-api-gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EAGtB,MAAM,mBAAmB,CAAC;AAO3B,wBAAsB,gBAAgB,CAAC,eAAe,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,EAChF,QAAQ,GAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAAO,EACvE,OAAO,GAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAM,iFAqBvE"}
@@ -1,4 +1,4 @@
1
- import { executeConcurrently, executeSequentially } from '../utilities/index.js';
1
+ import { executeConcurrently, executeSequentially, extractCommonRequestConfigOptions as extractCommonOptions } from '../utilities/index.js';
2
2
  export async function stableApiGateway(requests = [], options = {}) {
3
3
  const { concurrentExecution = true, stopOnFirstError = false, } = options;
4
4
  if (!Array.isArray(requests) || requests.length === 0) {
@@ -6,20 +6,7 @@ export async function stableApiGateway(requests = [], options = {}) {
6
6
  }
7
7
  const requestExecutionOptions = {
8
8
  stopOnFirstError,
9
- ...(options.hasOwnProperty('commonRequestData') && { commonRequestData: options.commonRequestData }),
10
- ...(options.hasOwnProperty('commonResponseAnalyzer') && { commonResponseAnalyzer: options.commonResponseAnalyzer }),
11
- ...(options.hasOwnProperty('commonHandleErrors') && { commonHandleErrors: options.commonHandleErrors }),
12
- ...(options.hasOwnProperty('commonHandleSuccessfulAttemptData') && { commonHandleSuccessfulAttemptData: options.commonHandleSuccessfulAttemptData }),
13
- ...(options.hasOwnProperty('commonFinalErrorAnalyzer') && { commonFinalErrorAnalyzer: options.commonFinalErrorAnalyzer }),
14
- ...(options.hasOwnProperty('commonResReq') && { commonResReq: options.commonResReq }),
15
- ...(options.hasOwnProperty('commonAttempts') && { commonAttempts: options.commonAttempts }),
16
- ...(options.hasOwnProperty('commonPerformAllAttempts') && { commonPerformAllAttempts: options.commonPerformAllAttempts }),
17
- ...(options.hasOwnProperty('commonWait') && { commonWait: options.commonWait }),
18
- ...(options.hasOwnProperty('commonRetryStrategy') && { commonRetryStrategy: options.commonRetryStrategy }),
19
- ...(options.hasOwnProperty('commonLogAllErrors') && { commonLogAllErrors: options.commonLogAllErrors }),
20
- ...(options.hasOwnProperty('commonLogAllSuccessfulAttempts') && { commonLogAllSuccessfulAttempts: options.commonLogAllSuccessfulAttempts }),
21
- ...(options.hasOwnProperty('commonMaxSerializableChars') && { commonMaxSerializableChars: options.commonMaxSerializableChars }),
22
- ...(options.hasOwnProperty('commonTrialMode') && { commonTrialMode: options.commonTrialMode }),
9
+ ...extractCommonOptions(options)
23
10
  };
24
11
  if (concurrentExecution) {
25
12
  return executeConcurrently(requests, { ...requestExecutionOptions, stopOnFirstError: undefined });
@@ -1 +1 @@
1
- {"version":3,"file":"stable-api-gateway.js","sourceRoot":"","sources":["../../src/core/stable-api-gateway.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAClC,WAAqE,EAAE,EACvE,UAAkE,EAAE;IAEpE,MAAM,EACF,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IAEZ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,uBAAuB,GAAgF;QACzG,gBAAgB;QAChB,GAAG,oBAAoB,CAAoC,OAAO,CAAC;KACtE,CAAA;IAED,IAAI,mBAAmB,EAAE,CAAC;QACtB,OAAO,mBAAmB,CAAoC,QAAQ,EAAG,EAAE,GAAG,uBAAuB,EAAE,gBAAgB,EAAE,SAAS,EAA6E,CAAC,CAAC;IACrN,CAAC;SAAM,CAAC;QACJ,OAAO,mBAAmB,CAAoC,QAAQ,EAAE,uBAAkG,CAAC,CAAC;IAChL,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { stableRequest, stableApiGateway } from './core/index.js';
2
2
  export { INVALID_AXIOS_RESPONSES, REQUEST_METHODS, RESPONSE_ERRORS, RETRY_STRATEGIES, VALID_REQUEST_PROTOCOLS } from './enums/index.js';
3
3
  export type { API_GATEWAY_OPTIONS, API_GATEWAY_REQUEST, API_GATEWAY_REQUEST_OPTIONS_TYPE, API_GATEWAY_RESPONSE, CONCURRENT_REQUEST_EXECUTION_OPTIONS, ERROR_LOG, ReqFnResponse, REQUEST_DATA, REQUEST_METHOD_TYPES, RETRY_STRATEGY_TYPES, SEQUENTIAL_REQUEST_EXECUTION_OPTIONS, STABLE_REQUEST, SUCCESSFUL_ATTEMPT_DATA, VALID_REQUEST_PROTOCOL_TYPES, TRIAL_MODE_OPTIONS } from './types/index.js';
4
- export { delay, executeConcurrently, executeSequentially, generateAxiosRequestConfig, getNewDelayTime, isRetryableError, prepareApiRequestOptions, reqFn, safelyExecuteUnknownFunction, safelyStringify, validateTrialModeProbabilities } from './utilities/index.js';
4
+ export { delay, executeConcurrently, executeSequentially, extractCommonRequestConfigOptions, generateAxiosRequestConfig, getNewDelayTime, isRetryableError, prepareApiRequestOptions, reqFn, safelyExecuteUnknownFunction, safelyStringify, validateTrialModeProbabilities } from './utilities/index.js';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,gBAAgB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,oBAAoB,EACpB,oCAAoC,EACpC,SAAS,EACT,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,oCAAoC,EACpC,cAAc,EACd,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACH,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,EACL,4BAA4B,EAC5B,eAAe,EACf,8BAA8B,EACjC,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,gBAAgB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EAC1B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,oBAAoB,EACpB,oCAAoC,EACpC,SAAS,EACT,aAAa,EACb,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,oCAAoC,EACpC,cAAc,EACd,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EACrB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EACH,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iCAAiC,EACjC,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,EACL,4BAA4B,EAC5B,eAAe,EACf,8BAA8B,EACjC,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { stableRequest, stableApiGateway } from './core/index.js';
2
2
  export { INVALID_AXIOS_RESPONSES, REQUEST_METHODS, RESPONSE_ERRORS, RETRY_STRATEGIES, VALID_REQUEST_PROTOCOLS } from './enums/index.js';
3
- export { delay, executeConcurrently, executeSequentially, generateAxiosRequestConfig, getNewDelayTime, isRetryableError, prepareApiRequestOptions, reqFn, safelyExecuteUnknownFunction, safelyStringify, validateTrialModeProbabilities } from './utilities/index.js';
3
+ export { delay, executeConcurrently, executeSequentially, extractCommonRequestConfigOptions, generateAxiosRequestConfig, getNewDelayTime, isRetryableError, prepareApiRequestOptions, reqFn, safelyExecuteUnknownFunction, safelyStringify, validateTrialModeProbabilities } from './utilities/index.js';
4
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,gBAAgB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EAC1B,MAAM,kBAAkB,CAAC;AAoB1B,OAAO,EACH,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,EACL,4BAA4B,EAC5B,eAAe,EACf,8BAA8B,EACjC,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,gBAAgB,EACnB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EAC1B,MAAM,kBAAkB,CAAC;AAoB1B,OAAO,EACH,KAAK,EACL,mBAAmB,EACnB,mBAAmB,EACnB,iCAAiC,EACjC,0BAA0B,EAC1B,eAAe,EACf,gBAAgB,EAChB,wBAAwB,EACxB,KAAK,EACL,4BAA4B,EAC5B,eAAe,EACf,8BAA8B,EACjC,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { API_GATEWAY_OPTIONS } from '../types/index.js';
2
+ export declare function extractCommonOptions<RequestDataType = any, ResponseDataType = any>(options: API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType>): Record<string, any>;
3
+ //# sourceMappingURL=extract-common-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-common-options.d.ts","sourceRoot":"","sources":["../../src/utilities/extract-common-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAgB,oBAAoB,CAAC,eAAe,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,EAC9E,OAAO,EAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAC,uBA4BlE"}
@@ -0,0 +1,26 @@
1
+ export function extractCommonOptions(options) {
2
+ const commonOptionKeys = [
3
+ 'commonRequestData',
4
+ 'commonResponseAnalyzer',
5
+ 'commonHandleErrors',
6
+ 'commonHandleSuccessfulAttemptData',
7
+ 'commonFinalErrorAnalyzer',
8
+ 'commonResReq',
9
+ 'commonAttempts',
10
+ 'commonPerformAllAttempts',
11
+ 'commonWait',
12
+ 'commonRetryStrategy',
13
+ 'commonLogAllErrors',
14
+ 'commonLogAllSuccessfulAttempts',
15
+ 'commonMaxSerializableChars',
16
+ 'commonTrialMode'
17
+ ];
18
+ const extracted = {};
19
+ for (const key of commonOptionKeys) {
20
+ if (options.hasOwnProperty(key)) {
21
+ extracted[key] = options[key];
22
+ }
23
+ }
24
+ return extracted;
25
+ }
26
+ //# sourceMappingURL=extract-common-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-common-options.js","sourceRoot":"","sources":["../../src/utilities/extract-common-options.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAChC,OAA+D;IAE/D,MAAM,gBAAgB,GAAqE;QACvF,mBAAmB;QACnB,wBAAwB;QACxB,oBAAoB;QACpB,mCAAmC;QACnC,0BAA0B;QAC1B,cAAc;QACd,gBAAgB;QAChB,0BAA0B;QAC1B,YAAY;QACZ,qBAAqB;QACrB,oBAAoB;QACpB,gCAAgC;QAChC,4BAA4B;QAC5B,iBAAiB;KACpB,CAAC;IAEF,MAAM,SAAS,GAAwB,EAAE,CAAC;IAE1C,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACjC,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { API_GATEWAY_OPTIONS } from '../types/index.js';
2
+ export declare function extractCommonRequestConfigOptions<RequestDataType = any, ResponseDataType = any>(options: API_GATEWAY_OPTIONS<RequestDataType, ResponseDataType>): Record<string, any>;
3
+ //# sourceMappingURL=extract-common-request-config-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-common-request-config-options.d.ts","sourceRoot":"","sources":["../../src/utilities/extract-common-request-config-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,wBAAgB,iCAAiC,CAAC,eAAe,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,EAC3F,OAAO,EAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAC,uBA4BlE"}
@@ -0,0 +1,26 @@
1
+ export function extractCommonRequestConfigOptions(options) {
2
+ const commonOptionKeys = [
3
+ 'commonRequestData',
4
+ 'commonResponseAnalyzer',
5
+ 'commonHandleErrors',
6
+ 'commonHandleSuccessfulAttemptData',
7
+ 'commonFinalErrorAnalyzer',
8
+ 'commonResReq',
9
+ 'commonAttempts',
10
+ 'commonPerformAllAttempts',
11
+ 'commonWait',
12
+ 'commonRetryStrategy',
13
+ 'commonLogAllErrors',
14
+ 'commonLogAllSuccessfulAttempts',
15
+ 'commonMaxSerializableChars',
16
+ 'commonTrialMode'
17
+ ];
18
+ const extracted = {};
19
+ for (const key of commonOptionKeys) {
20
+ if (options.hasOwnProperty(key)) {
21
+ extracted[key] = options[key];
22
+ }
23
+ }
24
+ return extracted;
25
+ }
26
+ //# sourceMappingURL=extract-common-request-config-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-common-request-config-options.js","sourceRoot":"","sources":["../../src/utilities/extract-common-request-config-options.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iCAAiC,CAC7C,OAA+D;IAE/D,MAAM,gBAAgB,GAAqE;QACvF,mBAAmB;QACnB,wBAAwB;QACxB,oBAAoB;QACpB,mCAAmC;QACnC,0BAA0B;QAC1B,cAAc;QACd,gBAAgB;QAChB,0BAA0B;QAC1B,YAAY;QACZ,qBAAqB;QACrB,oBAAoB;QACpB,gCAAgC;QAChC,4BAA4B;QAC5B,iBAAiB;KACpB,CAAC;IAEF,MAAM,SAAS,GAAwB,EAAE,CAAC;IAE1C,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACjC,IAAI,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;YAC9B,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { delay } from './delay.js';
2
2
  export { executeConcurrently } from './execute-concurrently.js';
3
3
  export { executeSequentially } from './execute-sequentially.js';
4
+ export { extractCommonRequestConfigOptions } from './extract-common-request-config-options.js';
4
5
  export { generateAxiosRequestConfig } from './generate-axios-request-config.js';
5
6
  export { getNewDelayTime } from './get-new-delay-time.js';
6
7
  export { isRetryableError } from './is-retryable-error.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  export { delay } from './delay.js';
2
2
  export { executeConcurrently } from './execute-concurrently.js';
3
3
  export { executeSequentially } from './execute-sequentially.js';
4
+ export { extractCommonRequestConfigOptions } from './extract-common-request-config-options.js';
4
5
  export { generateAxiosRequestConfig } from './generate-axios-request-config.js';
5
6
  export { getNewDelayTime } from './get-new-delay-time.js';
6
7
  export { isRetryableError } from './is-retryable-error.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,iCAAiC,EAAE,MAAM,4CAA4C,CAAC;AAC/F,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,8BAA8B,EAAE,MAAM,wCAAwC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-api-request-options.d.ts","sourceRoot":"","sources":["../../src/utilities/prepare-api-request-options.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,oCAAoC,EACpC,oCAAoC,EACpC,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,wBAAwB,CAAC,eAAe,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,EAClF,OAAO,EAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAC/D,6BAA6B,EAAE,oCAAoC,CAAC,eAAe,EAAE,gBAAgB,CAAC,GAC1E,oCAAoC,CAAC,eAAe,EAAE,gBAAgB,CAAC,GACpG,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAAE,SAAS,CAAC,CAkBpE"}
1
+ {"version":3,"file":"prepare-api-request-options.d.ts","sourceRoot":"","sources":["../../src/utilities/prepare-api-request-options.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,mBAAmB,EACnB,oCAAoC,EACpC,oCAAoC,EACpC,cAAc,EACjB,MAAM,mBAAmB,CAAC;AAwB3B,wBAAgB,wBAAwB,CAAC,eAAe,GAAG,GAAG,EAAE,gBAAgB,GAAG,GAAG,EAClF,OAAO,EAAE,mBAAmB,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAC/D,6BAA6B,EAAE,oCAAoC,CAAC,eAAe,EAAE,gBAAgB,CAAC,GAC1E,oCAAoC,CAAC,eAAe,EAAE,gBAAgB,CAAC,GACpG,IAAI,CAAC,cAAc,CAAC,eAAe,EAAE,gBAAgB,CAAC,EAAE,SAAS,CAAC,CAapE"}
@@ -1,19 +1,29 @@
1
+ const OPTION_MAPPINGS = [
2
+ { localKey: 'resReq', commonKey: 'commonResReq', targetKey: 'resReq' },
3
+ { localKey: 'attempts', commonKey: 'commonAttempts', targetKey: 'attempts' },
4
+ { localKey: 'performAllAttempts', commonKey: 'commonPerformAllAttempts', targetKey: 'performAllAttempts' },
5
+ { localKey: 'wait', commonKey: 'commonWait', targetKey: 'wait' },
6
+ { localKey: 'retryStrategy', commonKey: 'commonRetryStrategy', targetKey: 'retryStrategy' },
7
+ { localKey: 'logAllErrors', commonKey: 'commonLogAllErrors', targetKey: 'logAllErrors' },
8
+ { localKey: 'logAllSuccessfulAttempts', commonKey: 'commonLogAllSuccessfulAttempts', targetKey: 'logAllSuccessfulAttempts' },
9
+ { localKey: 'maxSerializableChars', commonKey: 'commonMaxSerializableChars', targetKey: 'maxSerializableChars' },
10
+ { localKey: 'trialMode', commonKey: 'commonTrialMode', targetKey: 'trialMode' },
11
+ { localKey: 'responseAnalyzer', commonKey: 'commonResponseAnalyzer', targetKey: 'responseAnalyzer' },
12
+ { localKey: 'handleErrors', commonKey: 'commonHandleErrors', targetKey: 'handleErrors' },
13
+ { localKey: 'handleSuccessfulAttemptData', commonKey: 'commonHandleSuccessfulAttemptData', targetKey: 'handleSuccessfulAttemptData' },
14
+ { localKey: 'finalErrorAnalyzer', commonKey: 'commonFinalErrorAnalyzer', targetKey: 'finalErrorAnalyzer' },
15
+ ];
1
16
  export function prepareApiRequestOptions(request, commonRequestExecutionOptions) {
2
17
  const { requestOptions: localOptions } = request;
3
- return {
4
- ...(localOptions.hasOwnProperty('resReq') ? { resReq: localOptions.resReq } : { resReq: commonRequestExecutionOptions.commonResReq }),
5
- ...(localOptions.hasOwnProperty('attempts') ? { attempts: localOptions.attempts } : { attempts: commonRequestExecutionOptions.commonAttempts }),
6
- ...(localOptions.hasOwnProperty('performAllAttempts') ? { performAllAttempts: localOptions.performAllAttempts } : { performAllAttempts: commonRequestExecutionOptions.commonPerformAllAttempts }),
7
- ...(localOptions.hasOwnProperty('wait') ? { wait: localOptions.wait } : { wait: commonRequestExecutionOptions.commonWait }),
8
- ...(localOptions.hasOwnProperty('retryStrategy') ? { retryStrategy: localOptions.retryStrategy } : { retryStrategy: commonRequestExecutionOptions.commonRetryStrategy }),
9
- ...(localOptions.hasOwnProperty('logAllErrors') ? { logAllErrors: localOptions.logAllErrors } : { logAllErrors: commonRequestExecutionOptions.commonLogAllErrors }),
10
- ...(localOptions.hasOwnProperty('logAllSuccessfulAttempts') ? { logAllSuccessfulAttempts: localOptions.logAllSuccessfulAttempts } : { logAllSuccessfulAttempts: commonRequestExecutionOptions.commonLogAllSuccessfulAttempts }),
11
- ...(localOptions.hasOwnProperty('maxSerializableChars') ? { maxSerializableChars: localOptions.maxSerializableChars } : { maxSerializableChars: commonRequestExecutionOptions.commonMaxSerializableChars }),
12
- ...(localOptions.hasOwnProperty('trialMode') ? { trialMode: localOptions.trialMode } : { trialMode: commonRequestExecutionOptions.commonTrialMode }),
13
- ...(localOptions.hasOwnProperty('responseAnalyzer') ? { responseAnalyzer: localOptions.responseAnalyzer } : { responseAnalyzer: commonRequestExecutionOptions.commonResponseAnalyzer }),
14
- ...(localOptions.hasOwnProperty('handleErrors') ? { handleErrors: localOptions.handleErrors } : { handleErrors: commonRequestExecutionOptions.commonHandleErrors }),
15
- ...(localOptions.hasOwnProperty('handleSuccessfulAttemptData') ? { handleSuccessfulAttemptData: localOptions.handleSuccessfulAttemptData } : { handleSuccessfulAttemptData: commonRequestExecutionOptions.commonHandleSuccessfulAttemptData }),
16
- ...(localOptions.hasOwnProperty('finalErrorAnalyzer') ? { finalErrorAnalyzer: localOptions.finalErrorAnalyzer } : { finalErrorAnalyzer: commonRequestExecutionOptions.commonFinalErrorAnalyzer }),
17
- };
18
+ const result = {};
19
+ for (const mapping of OPTION_MAPPINGS) {
20
+ if (localOptions.hasOwnProperty(mapping.localKey)) {
21
+ result[mapping.targetKey] = localOptions[mapping.localKey];
22
+ }
23
+ else if (commonRequestExecutionOptions.hasOwnProperty(mapping.commonKey)) {
24
+ result[mapping.targetKey] = commonRequestExecutionOptions[mapping.commonKey];
25
+ }
26
+ }
27
+ return result;
18
28
  }
19
29
  //# sourceMappingURL=prepare-api-request-options.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prepare-api-request-options.js","sourceRoot":"","sources":["../../src/utilities/prepare-api-request-options.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,wBAAwB,CACpC,OAA+D,EAC/D,6BACmG;IAEnG,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAEjD,OAAO;QACH,GAAG,CAAC,YAAY,CA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AAE,SAAS,EAAE,0BAA0B,EAAE,SAAS,EAAE,oBAAoB,EAAE;CAC7G,CAAC;AAEF,MAAM,UAAU,wBAAwB,CACpC,OAA+D,EAC/D,6BACmG;IAEnG,MAAM,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IACjD,MAAM,MAAM,GAAwB,EAAE,CAAC;IAEvC,KAAK,MAAM,OAAO,IAAI,eAAe,EAAE,CAAC;QACpC,IAAI,YAAY,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YAChD,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAI,YAAoB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACxE,CAAC;aAAM,IAAI,6BAA6B,CAAC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACzE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,GAAI,6BAAqC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC1F,CAAC;IACL,CAAC;IAED,OAAO,MAA4E,CAAC;AACxF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emmvish/stable-request",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "stable-request is a TypeScript-first HTTP reliability framework that goes beyond status-code retries by validating response content, handling eventual consistency, coordinating batch workflows, and providing deep observability into every request attempt. It is designed for real-world distributed systems where HTTP success does not guarantee business success.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",