@lylajs/core
Advanced tools
+15
-11
@@ -9,3 +9,3 @@ import { defineLylaError, isLylaError as _isLylaError, LYLA_ERROR } from './error'; | ||
| const mergedLylaOptions = mergeOptions(lylaOptions, ...overrides); | ||
| async function request(options) { | ||
| async function request(options, onContextReady) { | ||
| var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
@@ -20,2 +20,3 @@ const resolvedContext = options.context === undefined | ||
| }); | ||
| onContextReady === null || onContextReady === void 0 ? void 0 : onContextReady(optionsWithContext.context); | ||
| async function handleNonResponseError(error, shouldRejectOriginalRequest) { | ||
@@ -504,3 +505,3 @@ var _a, _b; | ||
| let retryOptionsResolver = undefined; | ||
| const makeBrokenRetryError = (error) => defineLylaError({ | ||
| const makeBrokenRetryError = (error, context) => defineLylaError({ | ||
| type: LYLA_ERROR.BROKEN_RETRY, | ||
@@ -511,7 +512,7 @@ error: error, | ||
| response: undefined, | ||
| context: undefined, | ||
| context, | ||
| isRetryError: true, | ||
| requestOptions: options | ||
| }, undefined); | ||
| const makeRetryRejectedError = (error) => defineLylaError({ | ||
| const makeRetryRejectedError = (error, context) => defineLylaError({ | ||
| type: LYLA_ERROR.RETRY_REJECTED_BY_NON_LYLA_ERROR, | ||
@@ -522,3 +523,3 @@ error: error, | ||
| response: undefined, | ||
| context: undefined, | ||
| context, | ||
| isRetryError: true, | ||
@@ -537,6 +538,7 @@ requestOptions: options | ||
| catch (e) { | ||
| throw makeBrokenRetryError(e); | ||
| throw makeBrokenRetryError(e, undefined); | ||
| } | ||
| let context = undefined; | ||
| try { | ||
| response = await request(finalOptions); | ||
| response = await request(finalOptions, v => context = v); | ||
| } | ||
@@ -549,2 +551,3 @@ catch (e) { | ||
| options: finalOptions, | ||
| context: context, | ||
| state, | ||
@@ -558,3 +561,3 @@ lyla, | ||
| catch (e) { | ||
| throw makeBrokenRetryError(e); | ||
| throw makeBrokenRetryError(e, context); | ||
| } | ||
@@ -568,3 +571,3 @@ // expected error | ||
| else { | ||
| throw makeRetryRejectedError(rejected.value); | ||
| throw makeRetryRejectedError(rejected.value, context); | ||
| } | ||
@@ -580,2 +583,3 @@ case 'retry': | ||
| options: finalOptions, | ||
| context: context, | ||
| response, | ||
@@ -586,3 +590,3 @@ state | ||
| catch (e) { | ||
| throw makeBrokenRetryError(e); | ||
| throw makeBrokenRetryError(e, context); | ||
| } | ||
@@ -598,3 +602,3 @@ // expected error | ||
| else { | ||
| throw makeRetryRejectedError(resolved.value); | ||
| throw makeRetryRejectedError(resolved.value, context); | ||
| } | ||
@@ -601,0 +605,0 @@ case 'retry': |
+5
-5
@@ -1,2 +0,2 @@ | ||
| import type { LylaAdapterMeta, LylaRequestOptionsWithContext, LylaResponse } from './types'; | ||
| import type { LylaAdapterMeta, LylaRequestOptionsWithContext, LylaRequestOptions, LylaResponse } from './types'; | ||
| export declare enum LYLA_ERROR { | ||
@@ -124,4 +124,4 @@ /** | ||
| response: undefined; | ||
| context: undefined; | ||
| requestOptions: LylaRequestOptionsWithContext<C, M>; | ||
| context: C | undefined; | ||
| requestOptions: LylaRequestOptions<C, M>; | ||
| isRetryError: true; | ||
@@ -135,4 +135,4 @@ spread: () => Omit<LylaBrokenRetryError<C, M>, 'spread'>; | ||
| response: undefined; | ||
| context: undefined; | ||
| requestOptions: LylaRequestOptionsWithContext<C, M>; | ||
| context: C; | ||
| requestOptions: LylaRequestOptions<C, M>; | ||
| isRetryError: true; | ||
@@ -139,0 +139,0 @@ spread: () => Omit<LylaRetryRejectedByNonLylaErrorError<C, M>, 'spread'>; |
+4
-2
@@ -164,3 +164,4 @@ import type { LylaError, LylaNonResponseError, LylaResponseError } from './error'; | ||
| state: S; | ||
| options: LylaRequestOptionsWithContext<C, M>; | ||
| options: LylaRequestOptions<C, M>; | ||
| context: C; | ||
| response: LylaResponse<any, C, M>; | ||
@@ -170,3 +171,4 @@ }) => Promise<LylaRetryOnResolvedCommand<any, C, M>>; | ||
| state: S; | ||
| options: LylaRequestOptionsWithContext<C, M>; | ||
| options: LylaRequestOptions<C, M>; | ||
| context: C; | ||
| lyla: Lyla<C, M>; | ||
@@ -173,0 +175,0 @@ error: unknown; |
+15
-11
@@ -12,3 +12,3 @@ "use strict"; | ||
| const mergedLylaOptions = (0, utils_1.mergeOptions)(lylaOptions, ...overrides); | ||
| async function request(options) { | ||
| async function request(options, onContextReady) { | ||
| var _a, _b, _c, _d, _e, _f, _g, _h, _j; | ||
@@ -23,2 +23,3 @@ const resolvedContext = options.context === undefined | ||
| }); | ||
| onContextReady === null || onContextReady === void 0 ? void 0 : onContextReady(optionsWithContext.context); | ||
| async function handleNonResponseError(error, shouldRejectOriginalRequest) { | ||
@@ -507,3 +508,3 @@ var _a, _b; | ||
| let retryOptionsResolver = undefined; | ||
| const makeBrokenRetryError = (error) => (0, error_1.defineLylaError)({ | ||
| const makeBrokenRetryError = (error, context) => (0, error_1.defineLylaError)({ | ||
| type: error_1.LYLA_ERROR.BROKEN_RETRY, | ||
@@ -514,7 +515,7 @@ error: error, | ||
| response: undefined, | ||
| context: undefined, | ||
| context, | ||
| isRetryError: true, | ||
| requestOptions: options | ||
| }, undefined); | ||
| const makeRetryRejectedError = (error) => (0, error_1.defineLylaError)({ | ||
| const makeRetryRejectedError = (error, context) => (0, error_1.defineLylaError)({ | ||
| type: error_1.LYLA_ERROR.RETRY_REJECTED_BY_NON_LYLA_ERROR, | ||
@@ -525,3 +526,3 @@ error: error, | ||
| response: undefined, | ||
| context: undefined, | ||
| context, | ||
| isRetryError: true, | ||
@@ -540,6 +541,7 @@ requestOptions: options | ||
| catch (e) { | ||
| throw makeBrokenRetryError(e); | ||
| throw makeBrokenRetryError(e, undefined); | ||
| } | ||
| let context = undefined; | ||
| try { | ||
| response = await request(finalOptions); | ||
| response = await request(finalOptions, v => context = v); | ||
| } | ||
@@ -552,2 +554,3 @@ catch (e) { | ||
| options: finalOptions, | ||
| context: context, | ||
| state, | ||
@@ -561,3 +564,3 @@ lyla, | ||
| catch (e) { | ||
| throw makeBrokenRetryError(e); | ||
| throw makeBrokenRetryError(e, context); | ||
| } | ||
@@ -571,3 +574,3 @@ // expected error | ||
| else { | ||
| throw makeRetryRejectedError(rejected.value); | ||
| throw makeRetryRejectedError(rejected.value, context); | ||
| } | ||
@@ -583,2 +586,3 @@ case 'retry': | ||
| options: finalOptions, | ||
| context: context, | ||
| response, | ||
@@ -589,3 +593,3 @@ state | ||
| catch (e) { | ||
| throw makeBrokenRetryError(e); | ||
| throw makeBrokenRetryError(e, context); | ||
| } | ||
@@ -601,3 +605,3 @@ // expected error | ||
| else { | ||
| throw makeRetryRejectedError(resolved.value); | ||
| throw makeRetryRejectedError(resolved.value, context); | ||
| } | ||
@@ -604,0 +608,0 @@ case 'retry': |
+5
-5
@@ -1,2 +0,2 @@ | ||
| import type { LylaAdapterMeta, LylaRequestOptionsWithContext, LylaResponse } from './types'; | ||
| import type { LylaAdapterMeta, LylaRequestOptionsWithContext, LylaRequestOptions, LylaResponse } from './types'; | ||
| export declare enum LYLA_ERROR { | ||
@@ -124,4 +124,4 @@ /** | ||
| response: undefined; | ||
| context: undefined; | ||
| requestOptions: LylaRequestOptionsWithContext<C, M>; | ||
| context: C | undefined; | ||
| requestOptions: LylaRequestOptions<C, M>; | ||
| isRetryError: true; | ||
@@ -135,4 +135,4 @@ spread: () => Omit<LylaBrokenRetryError<C, M>, 'spread'>; | ||
| response: undefined; | ||
| context: undefined; | ||
| requestOptions: LylaRequestOptionsWithContext<C, M>; | ||
| context: C; | ||
| requestOptions: LylaRequestOptions<C, M>; | ||
| isRetryError: true; | ||
@@ -139,0 +139,0 @@ spread: () => Omit<LylaRetryRejectedByNonLylaErrorError<C, M>, 'spread'>; |
+4
-2
@@ -164,3 +164,4 @@ import type { LylaError, LylaNonResponseError, LylaResponseError } from './error'; | ||
| state: S; | ||
| options: LylaRequestOptionsWithContext<C, M>; | ||
| options: LylaRequestOptions<C, M>; | ||
| context: C; | ||
| response: LylaResponse<any, C, M>; | ||
@@ -170,3 +171,4 @@ }) => Promise<LylaRetryOnResolvedCommand<any, C, M>>; | ||
| state: S; | ||
| options: LylaRequestOptionsWithContext<C, M>; | ||
| options: LylaRequestOptions<C, M>; | ||
| context: C; | ||
| lyla: Lyla<C, M>; | ||
@@ -173,0 +175,0 @@ error: unknown; |
+1
-1
| { | ||
| "name": "@lylajs/core", | ||
| "version": "2.1.0", | ||
| "version": "2.1.1", | ||
| "keywords": [ | ||
@@ -5,0 +5,0 @@ "http-request", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
149925
0.54%2781
0.43%0
-100%