@azure-net/kit 1.2.2 → 1.2.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.
@@ -26,8 +26,8 @@ export const createAsyncHelpers = (opts) => {
26
26
  }
27
27
  catch (err) {
28
28
  const error = errorParser(err);
29
- const { publish } = AppEvents();
30
- publish('OnAsyncHelperError', error);
29
+ const { bus } = AppEvents();
30
+ bus.publish('OnAsyncHelperError', error);
31
31
  const result = { error, response: args?.fallbackResponse, success: false };
32
32
  await args?.onError?.(result);
33
33
  if (args?.reject)
@@ -47,8 +47,8 @@ export const createAsyncHelpers = (opts) => {
47
47
  }
48
48
  catch (err) {
49
49
  const error = errorParser(err);
50
- const { publish } = AppEvents();
51
- publish('OnAsyncHelperError', error);
50
+ const { bus } = AppEvents();
51
+ bus.publish('OnAsyncHelperError', error);
52
52
  await args?.onError?.(error);
53
53
  if (args?.reject)
54
54
  throw error;
@@ -1,4 +1,4 @@
1
+ import { EventBus } from 'azure-net-tools';
1
2
  export declare const AppEvents: () => {
2
- subscribe: <T>(channel: "OnAsyncHelperError", listener: (data: T) => void) => void;
3
- publish: <T>(channel: "OnAsyncHelperError", data: T) => void;
3
+ bus: EventBus<"OnAsyncHelperError">;
4
4
  };
@@ -1,9 +1,8 @@
1
1
  import { EventBus } from 'azure-net-tools';
2
2
  import { createPresenter } from 'edges-svelte';
3
3
  export const AppEvents = createPresenter('GlobalAppEventBus', () => {
4
- const appEventBus = new EventBus();
4
+ const appEventBus = new EventBus({ OnAsyncHelperError: [] });
5
5
  return {
6
- subscribe: appEventBus.subscribe,
7
- publish: appEventBus.publish
6
+ bus: appEventBus
8
7
  };
9
8
  });
@@ -1,7 +1,7 @@
1
1
  import type { RequestErrors } from '../../delivery/schema/index.js';
2
2
  import type { AsyncActionResponse } from '../../index.js';
3
3
  export interface FormConfig<FormData, Response> {
4
- initialData?: FormData;
4
+ initialData?: Partial<FormData>;
5
5
  onSuccess?: (response: Response) => Promise<void> | void;
6
6
  onError?: () => Promise<void> | void;
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-net/kit",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",