@qlover/fe-corekit 3.0.1 → 3.1.1

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
@@ -6848,6 +6848,16 @@ type RequestAdapterContext = ExecutorContextInterface<RequestAdapterConfig, unkn
6848
6848
  * ```
6849
6849
  */
6850
6850
  type RequestPluginConfig = HeaderInjectorConfig & {
6851
+ /**
6852
+ * Allow empty URL
6853
+ *
6854
+ * If set to `false`, an error will be thrown when both `url` and `baseURL` are empty.
6855
+ * If set to `true` (default), the URL builder will attempt to build the URL even if they are empty.
6856
+ *
6857
+ * @since 3.1.0
6858
+ * @default `true`
6859
+ */
6860
+ allowEmptyUrl?: boolean;
6851
6861
  requestDataSerializer?: (data: unknown, config: RequestAdapterConfig & Omit<RequestPluginConfig, 'requestDataSerializer'>) => unknown;
6852
6862
  };
6853
6863
  interface RequestPluginInnerConfig {
@@ -6947,6 +6957,16 @@ declare class RequestPlugin implements LifecyclePluginInterface<RequestAdapterCo
6947
6957
  * @override
6948
6958
  */
6949
6959
  onBefore(ctx: RequestAdapterContext): void;
6960
+ /**
6961
+ * Main request handler
6962
+ *
6963
+ * This is the core of the plugin. It merges default plugin configuration with request context configuration,
6964
+ * processes request data, builds the URL, and injects headers.
6965
+ *
6966
+ * @param config - Request configuration
6967
+ * @returns Merged configuration with processed data, built URL, and injected headers
6968
+ */
6969
+ mergeConfig(config: RequestAdapterConfig & RequestPluginConfig): RequestAdapterConfig & RequestPluginConfig;
6950
6970
  /**
6951
6971
  * Merge default plugin configuration with request context configuration
6952
6972
  *
@@ -6959,7 +6979,7 @@ declare class RequestPlugin implements LifecyclePluginInterface<RequestAdapterCo
6959
6979
  * @param contextConfig - Configuration from request context
6960
6980
  * @returns Merged configuration
6961
6981
  */
6962
- protected mergeConfig(contextConfig: RequestAdapterConfig): RequestAdapterConfig & RequestPluginConfig;
6982
+ protected createConfig(contextConfig: RequestAdapterConfig): RequestAdapterConfig & RequestPluginConfig;
6963
6983
  /**
6964
6984
  * Build the URL from the request configuration
6965
6985
  *
@@ -6967,7 +6987,7 @@ declare class RequestPlugin implements LifecyclePluginInterface<RequestAdapterCo
6967
6987
  * @returns The built URL
6968
6988
  * @throws {Error} If the built URL is empty or invalid
6969
6989
  */
6970
- protected buildUrl(config: RequestAdapterConfig): string;
6990
+ protected buildUrl(config: RequestAdapterConfig & RequestPluginConfig): string;
6971
6991
  /**
6972
6992
  * Inject default headers into request configuration
6973
6993
  *
@@ -7263,6 +7283,7 @@ declare class ResponsePlugin implements LifecyclePluginInterface<ResponsePluginC
7263
7283
  * ```
7264
7284
  */
7265
7285
  onSuccess(context: ResponsePluginContext): Promise<void>;
7286
+ handleResponse(returnValue: unknown, config: ResponsePluginConfig & RequestAdapterConfig<unknown>): Promise<RequestAdapterResponse> | undefined;
7266
7287
  /**
7267
7288
  * Validate response status
7268
7289
  *