alepha 0.11.5 → 0.11.6

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/queue/redis.d.ts CHANGED
@@ -23,7 +23,7 @@ declare class RedisQueueProvider implements QueueProvider {
23
23
  * @see {@link RedisQueueProvider}
24
24
  * @module alepha.queue.redis
25
25
  */
26
- declare const AlephaQueueRedis: _alepha_core0.Service<_alepha_core0.Module<{}>>;
26
+ declare const AlephaQueueRedis: _alepha_core0.Service<_alepha_core0.Module>;
27
27
  //#endregion
28
28
  export { AlephaQueueRedis, RedisQueueProvider };
29
29
  //# sourceMappingURL=index.d.ts.map
package/queue.d.ts CHANGED
@@ -754,7 +754,7 @@ declare class ConsumerDescriptor<T extends TSchema> extends Descriptor<ConsumerD
754
754
  * @see {@link $consumer}
755
755
  * @module alepha.queue
756
756
  */
757
- declare const AlephaQueue: _alepha_core1.Service<_alepha_core1.Module<{}>>;
757
+ declare const AlephaQueue: _alepha_core1.Service<_alepha_core1.Module>;
758
758
  //#endregion
759
759
  export { $consumer, $queue, AlephaQueue, ConsumerDescriptor, ConsumerDescriptorOptions, MemoryQueueProvider, QueueDescriptor, QueueDescriptorOptions, QueueMessage, QueueMessageSchema, QueueProvider };
760
760
  //# sourceMappingURL=index.d.ts.map
package/react/auth.d.ts CHANGED
@@ -479,7 +479,12 @@ declare const useAuth: <T extends object = any>() => {
479
479
  //#region src/index.d.ts
480
480
  declare module "alepha" {
481
481
  interface State {
482
- user?: UserAccount;
482
+ /**
483
+ * The authenticated user account attached to the server request state.
484
+ *
485
+ * @internal
486
+ */
487
+ "alepha.server.request.user"?: UserAccount;
483
488
  }
484
489
  }
485
490
  declare module "alepha/react" {
@@ -493,7 +498,7 @@ declare module "alepha/react" {
493
498
  * @see {@link ReactAuthProvider}
494
499
  * @module alepha.react.auth
495
500
  */
496
- declare const AlephaReactAuth: _alepha_core4.Service<_alepha_core4.Module<{}>>;
501
+ declare const AlephaReactAuth: _alepha_core4.Service<_alepha_core4.Module>;
497
502
  //#endregion
498
503
  export { $auth, AccessToken, AlephaReactAuth, AuthDescriptor, AuthDescriptorOptions, AuthExternal, AuthInternal, CredentialsOptions, OAuth2Options, OAuth2Profile, OidcOptions, ReactAuth, ReactAuthProvider, SessionExpiredError, useAuth };
499
504
  //# sourceMappingURL=index.d.ts.map
package/react/form.d.ts CHANGED
@@ -4,6 +4,15 @@ import { InputHTMLAttributes, ReactNode } from "react";
4
4
  import * as _alepha_logger0 from "alepha/logger";
5
5
 
6
6
  //#region src/services/FormModel.d.ts
7
+
8
+ /**
9
+ * FormModel is a dynamic form handler that generates form inputs based on a provided TypeBox schema.
10
+ * It manages form state, handles input changes, and processes form submissions with validation.
11
+ *
12
+ * It means to be injected and used within React components to provide a structured way to create and manage forms.
13
+ *
14
+ * @see {@link useForm}
15
+ */
7
16
  declare class FormModel<T extends TObject> {
8
17
  readonly id: string;
9
18
  readonly options: FormCtrlOptions<T>;
@@ -12,16 +21,26 @@ declare class FormModel<T extends TObject> {
12
21
  protected readonly values: Record<string, any>;
13
22
  input: SchemaToInput<T>;
14
23
  constructor(id: string, options: FormCtrlOptions<T>);
24
+ get element(): HTMLFormElement;
15
25
  get currentValues(): Record<string, any>;
16
26
  get props(): {
27
+ id: string;
17
28
  noValidate: boolean;
18
- onSubmit: (values: FormEventLike) => Promise<void>;
29
+ onSubmit: (ev?: FormEventLike) => void;
19
30
  onReset: (event: FormEventLike) => Promise<void>;
20
31
  };
21
- protected readonly reset: (event: FormEventLike) => Promise<void>;
22
- protected readonly submit: (event: FormEventLike) => Promise<void>;
23
- protected parseValuesFromFormElement<T extends TObject>(options: FormCtrlOptions<T>, store: Record<string, any>): Record<string, any>;
24
- protected getValueFromInputObject<T extends TObject>(options: FormCtrlOptions<T>, values: Record<string, any>, key: string, value: FormDataEntryValue): void;
32
+ readonly reset: (event: FormEventLike) => Promise<void>;
33
+ readonly submit: () => Promise<void>;
34
+ /**
35
+ * Restructures flat keys like "address.city" into nested objects like { address: { city: ... } }
36
+ * Values are already typed from onChange, so no conversion is needed.
37
+ */
38
+ protected restructureValues(store: Record<string, any>): Record<string, any>;
39
+ /**
40
+ * Helper to restructure a flat key like "address.city" into nested object structure.
41
+ * The value is already typed, so we just assign it to the nested path.
42
+ */
43
+ protected restructureNestedValue(values: Record<string, any>, key: string, value: any): void;
25
44
  protected createProxyFromSchema<T extends TObject>(options: FormCtrlOptions<T>, schema: TSchema, context: {
26
45
  parent: string;
27
46
  store: Record<string, any>;
@@ -31,16 +50,16 @@ declare class FormModel<T extends TObject> {
31
50
  store: Record<string, any>;
32
51
  }): InputField;
33
52
  /**
34
- * Convert an input value from HTML to the correct type based on the schema.
53
+ * Convert an input value to the correct type based on the schema.
54
+ * Handles raw DOM values (strings, booleans from checkboxes, Files, etc.)
35
55
  */
36
- protected getValueFromInput(input: FormDataEntryValue, schema: TSchema): any;
56
+ protected getValueFromInput(input: any, schema: TSchema): any;
37
57
  protected valueToInputEntry(value: any): string | number | boolean;
38
58
  }
39
59
  type SchemaToInput<T extends TObject> = { [K in keyof T["properties"]]: T["properties"][K] extends TObject ? SchemaToInput<T["properties"][K]> : InputField };
40
60
  interface FormEventLike {
41
- currentTarget: any;
42
- preventDefault: () => void;
43
- stopPropagation: () => void;
61
+ preventDefault?: () => void;
62
+ stopPropagation?: () => void;
44
63
  }
45
64
  interface InputField {
46
65
  path: string;
@@ -90,6 +109,7 @@ type FormCtrlOptions<T extends TObject> = {
90
109
  form: HTMLFormElement;
91
110
  }) => void;
92
111
  onChange?: (key: string, value: any, store: Record<string, any>) => void;
112
+ onReset?: () => void;
93
113
  };
94
114
  //#endregion
95
115
  //#region src/components/FormState.d.ts
@@ -122,15 +142,15 @@ declare const FormState: <T extends TObject>(props: {
122
142
  * });
123
143
  *
124
144
  * return (
125
- * <form onSubmit={form.onSubmit}>
126
- * <input {...form.input("username")} />
127
- * <input {...form.input("password")} />
145
+ * <form {...form.props}>
146
+ * <input {...form.input.username.props} />
147
+ * <input {...form.input.password.props} />
128
148
  * <button type="submit">Submit</button>
129
149
  * </form>
130
150
  * );
131
151
  * ```
132
152
  */
133
- declare const useForm: <T extends TObject>(options: FormCtrlOptions<T>) => FormModel<T>;
153
+ declare const useForm: <T extends TObject>(options: FormCtrlOptions<T>, deps?: any[]) => FormModel<T>;
134
154
  //#endregion
135
155
  //#region src/hooks/useFormState.d.ts
136
156
  interface UseFormStateReturn {
@@ -182,7 +202,7 @@ declare module "alepha" {
182
202
  * @see {@link useForm}
183
203
  * @module alepha.react.form
184
204
  */
185
- declare const AlephaReactForm: _alepha_core0.Service<_alepha_core0.Module<{}>>;
205
+ declare const AlephaReactForm: _alepha_core0.Service<_alepha_core0.Module>;
186
206
  //#endregion
187
207
  export { AlephaReactForm, FormCtrlOptions, FormEventLike, FormModel, FormState, InputField, InputHTMLAttributesLike, SchemaToInput, UseFormStateReturn, useForm, useFormState };
188
208
  //# sourceMappingURL=index.d.ts.map
package/react/head.d.ts CHANGED
@@ -114,7 +114,7 @@ declare module "alepha/react" {
114
114
  * @see {@link ServerHeadProvider}
115
115
  * @module alepha.react.head
116
116
  */
117
- declare const AlephaReactHead: _alepha_core1.Service<_alepha_core1.Module<{}>>;
117
+ declare const AlephaReactHead: _alepha_core1.Service<_alepha_core1.Module>;
118
118
  //#endregion
119
119
  export { $head, AlephaReactHead, Head, HeadDescriptor, HeadDescriptorOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
120
120
  //# sourceMappingURL=index.d.ts.map
package/react/i18n.d.ts CHANGED
@@ -152,7 +152,7 @@ declare class DictionaryDescriptor<T extends Record<string, string>> extends Des
152
152
  //#region src/index.d.ts
153
153
  declare module "alepha" {
154
154
  interface State {
155
- "react.i18n.lang"?: string;
155
+ "alepha.react.i18n.lang"?: string;
156
156
  }
157
157
  }
158
158
  /**
@@ -162,7 +162,7 @@ declare module "alepha" {
162
162
  *
163
163
  * @module alepha.react.i18n
164
164
  */
165
- declare const AlephaReactI18n: _alepha_core1.Service<_alepha_core1.Module<{}>>;
165
+ declare const AlephaReactI18n: _alepha_core1.Service<_alepha_core1.Module>;
166
166
  //#endregion
167
167
  export { $dictionary, AlephaReactI18n, DictionaryDescriptor, DictionaryDescriptorOptions, I18nLocalizeOptions, I18nLocalizeType, I18nProvider, Localize, type LocalizeProps, ServiceDictionary, useI18n };
168
168
  //# sourceMappingURL=index.d.ts.map
package/react.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import * as _alepha_core10 from "alepha";
2
- import { Alepha, Async, Configurable, Descriptor, Hook, Hooks, KIND, Service, State, Static, TObject, TSchema } from "alepha";
1
+ import * as _alepha_core14 from "alepha";
2
+ import { Alepha, Async, Descriptor, Hook, Hooks, KIND, Service, State, Static, TObject, TSchema } from "alepha";
3
3
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
4
4
  import { RequestConfigSchema, ServerHandler, ServerProvider, ServerRequest, ServerRouterProvider, ServerTimingProvider } from "alepha/server";
5
5
  import { ServerRouteCache } from "alepha/server/cache";
@@ -8,8 +8,9 @@ import * as _alepha_logger0 from "alepha/logger";
8
8
  import * as react0 from "react";
9
9
  import React, { AnchorHTMLAttributes, CSSProperties, DependencyList, ErrorInfo, FC, PropsWithChildren, ReactNode } from "react";
10
10
  import * as react_jsx_runtime0 from "react/jsx-runtime";
11
- import { ServeDescriptorOptions, ServerStaticProvider } from "alepha/server/static";
11
+ import { ServerStaticProvider } from "alepha/server/static";
12
12
  import { Route, RouterProvider } from "alepha/router";
13
+ import * as typebox0 from "typebox";
13
14
 
14
15
  //#region src/components/ClientOnly.d.ts
15
16
  interface ClientOnlyProps {
@@ -40,8 +41,8 @@ declare class Redirection extends Error {
40
41
  }
41
42
  //#endregion
42
43
  //#region src/providers/ReactPageProvider.d.ts
43
- declare const envSchema$2: _alepha_core10.TObject<{
44
- REACT_STRICT_MODE: _alepha_core10.TBoolean;
44
+ declare const envSchema$2: _alepha_core14.TObject<{
45
+ REACT_STRICT_MODE: _alepha_core14.TBoolean;
45
46
  }>;
46
47
  declare module "alepha" {
47
48
  interface Env extends Partial<Static<typeof envSchema$2>> {}
@@ -84,7 +85,7 @@ declare class ReactPageProvider {
84
85
  }, params?: Record<string, any>): string;
85
86
  compile(path: string, params?: Record<string, string>): string;
86
87
  protected renderView(index: number, path: string, view: ReactNode | undefined, page: PageRoute): ReactNode;
87
- protected readonly configure: _alepha_core10.HookDescriptor<"configure">;
88
+ protected readonly configure: _alepha_core14.HookDescriptor<"configure">;
88
89
  protected map(pages: Array<PageDescriptor>, target: PageDescriptor): PageRouteEntry;
89
90
  add(entry: PageRouteEntry): void;
90
91
  protected createMatch(page: PageRoute): string;
@@ -502,20 +503,29 @@ declare class ReactBrowserRouterProvider extends RouterProvider<BrowserRoute> {
502
503
  protected readonly alepha: Alepha;
503
504
  protected readonly pageApi: ReactPageProvider;
504
505
  add(entry: PageRouteEntry): void;
505
- protected readonly configure: _alepha_core10.HookDescriptor<"configure">;
506
+ protected readonly configure: _alepha_core14.HookDescriptor<"configure">;
506
507
  transition(url: URL, previous?: PreviousLayerData[], meta?: {}): Promise<string | void>;
507
508
  root(state: ReactRouterState): ReactNode;
508
509
  }
509
510
  //#endregion
510
511
  //#region src/providers/ReactBrowserProvider.d.ts
511
- declare const envSchema$1: _alepha_core10.TObject<{
512
- REACT_ROOT_ID: _alepha_core10.TString;
512
+ declare const envSchema$1: _alepha_core14.TObject<{
513
+ REACT_ROOT_ID: _alepha_core14.TString;
513
514
  }>;
514
515
  declare module "alepha" {
515
516
  interface Env extends Partial<Static<typeof envSchema$1>> {}
516
517
  }
517
- interface ReactBrowserRendererOptions {
518
- scrollRestoration?: "top" | "manual";
518
+ /**
519
+ * React browser renderer configuration atom
520
+ */
521
+ declare const reactBrowserOptions: _alepha_core14.Atom<_alepha_core14.TObject<{
522
+ scrollRestoration: typebox0.TUnsafe<"top" | "manual">;
523
+ }>, "alepha.react.browser.options">;
524
+ type ReactBrowserRendererOptions = Static<typeof reactBrowserOptions.schema>;
525
+ declare module "alepha" {
526
+ interface State {
527
+ [reactBrowserOptions.key]: ReactBrowserRendererOptions;
528
+ }
519
529
  }
520
530
  declare class ReactBrowserProvider {
521
531
  protected readonly env: {
@@ -526,7 +536,9 @@ declare class ReactBrowserProvider {
526
536
  protected readonly alepha: Alepha;
527
537
  protected readonly router: ReactBrowserRouterProvider;
528
538
  protected readonly dateTimeProvider: DateTimeProvider;
529
- options: ReactBrowserRendererOptions;
539
+ protected readonly options: Readonly<{
540
+ scrollRestoration: "top" | "manual";
541
+ }>;
530
542
  protected getRootElement(): HTMLElement;
531
543
  transitioning?: {
532
544
  to: string;
@@ -555,8 +567,8 @@ declare class ReactBrowserProvider {
555
567
  * Get embedded layers from the server.
556
568
  */
557
569
  protected getHydrationState(): ReactHydrationState | undefined;
558
- protected readonly onTransitionEnd: _alepha_core10.HookDescriptor<"react:transition:end">;
559
- readonly ready: _alepha_core10.HookDescriptor<"ready">;
570
+ protected readonly onTransitionEnd: _alepha_core14.HookDescriptor<"react:transition:end">;
571
+ readonly ready: _alepha_core14.HookDescriptor<"ready">;
560
572
  }
561
573
  interface RouterGoOptions {
562
574
  replace?: boolean;
@@ -1055,34 +1067,39 @@ declare const ssrSchemaLoading: (alepha: Alepha, name: string) => RequestConfigS
1055
1067
  declare const useStore: <Key extends keyof State>(key: Key, defaultValue?: State[Key]) => [State[Key], (value: State[Key]) => void];
1056
1068
  //#endregion
1057
1069
  //#region src/providers/ReactServerProvider.d.ts
1058
- declare const envSchema: _alepha_core10.TObject<{
1059
- REACT_SERVER_DIST: _alepha_core10.TString;
1060
- REACT_SERVER_PREFIX: _alepha_core10.TString;
1061
- REACT_SSR_ENABLED: _alepha_core10.TOptional<_alepha_core10.TBoolean>;
1062
- REACT_ROOT_ID: _alepha_core10.TString;
1063
- REACT_SERVER_TEMPLATE: _alepha_core10.TOptional<_alepha_core10.TString>;
1070
+ declare const envSchema: _alepha_core14.TObject<{
1071
+ REACT_SSR_ENABLED: _alepha_core14.TOptional<_alepha_core14.TBoolean>;
1072
+ REACT_ROOT_ID: _alepha_core14.TString;
1073
+ REACT_SERVER_TEMPLATE: _alepha_core14.TOptional<_alepha_core14.TString>;
1064
1074
  }>;
1065
1075
  declare module "alepha" {
1066
1076
  interface Env extends Partial<Static<typeof envSchema>> {}
1067
1077
  interface State {
1068
- "react.server.ssr"?: boolean;
1078
+ "alepha.react.server.ssr"?: boolean;
1069
1079
  }
1070
1080
  }
1071
- interface ReactServerProviderOptions {
1072
- /**
1073
- * Override default options for the static file server.
1074
- * > Static file server is only created in non-serverless production mode.
1075
- */
1076
- static?: Partial<Omit<ServeDescriptorOptions, "root">>;
1081
+ /**
1082
+ * React server provider configuration atom
1083
+ */
1084
+ declare const reactServerOptions: _alepha_core14.Atom<_alepha_core14.TObject<{
1085
+ publicDir: _alepha_core14.TString;
1086
+ staticServer: _alepha_core14.TObject<{
1087
+ disabled: _alepha_core14.TBoolean;
1088
+ path: _alepha_core14.TString;
1089
+ }>;
1090
+ }>, "alepha.react.server.options">;
1091
+ type ReactServerProviderOptions = Static<typeof reactServerOptions.schema>;
1092
+ declare module "alepha" {
1093
+ interface State {
1094
+ [reactServerOptions.key]: ReactServerProviderOptions;
1095
+ }
1077
1096
  }
1078
- declare class ReactServerProvider implements Configurable {
1097
+ declare class ReactServerProvider {
1079
1098
  protected readonly log: _alepha_logger0.Logger;
1080
1099
  protected readonly alepha: Alepha;
1081
1100
  protected readonly env: {
1082
1101
  REACT_SSR_ENABLED?: boolean | undefined;
1083
1102
  REACT_SERVER_TEMPLATE?: string | undefined;
1084
- REACT_SERVER_DIST: string;
1085
- REACT_SERVER_PREFIX: string;
1086
1103
  REACT_ROOT_ID: string;
1087
1104
  };
1088
1105
  protected readonly pageApi: ReactPageProvider;
@@ -1092,11 +1109,17 @@ declare class ReactServerProvider implements Configurable {
1092
1109
  protected readonly serverTimingProvider: ServerTimingProvider;
1093
1110
  readonly ROOT_DIV_REGEX: RegExp;
1094
1111
  protected preprocessedTemplate: PreprocessedTemplate | null;
1095
- options: ReactServerProviderOptions;
1112
+ protected readonly options: Readonly<{
1113
+ publicDir: string;
1114
+ staticServer: {
1115
+ disabled: boolean;
1116
+ path: string;
1117
+ };
1118
+ }>;
1096
1119
  /**
1097
1120
  * Configure the React server provider.
1098
1121
  */
1099
- readonly onConfigure: _alepha_core10.HookDescriptor<"configure">;
1122
+ readonly onConfigure: _alepha_core14.HookDescriptor<"configure">;
1100
1123
  get template(): string;
1101
1124
  protected registerPages(templateLoader: TemplateLoader): Promise<void>;
1102
1125
  /**
@@ -1133,7 +1156,7 @@ interface PreprocessedTemplate {
1133
1156
  //#region src/index.d.ts
1134
1157
  declare module "alepha" {
1135
1158
  interface State {
1136
- "react.router.state"?: ReactRouterState;
1159
+ "alepha.react.router.state"?: ReactRouterState;
1137
1160
  }
1138
1161
  interface Hooks {
1139
1162
  /**
@@ -1232,7 +1255,7 @@ declare module "alepha" {
1232
1255
  * @see {@link $page}
1233
1256
  * @module alepha.react
1234
1257
  */
1235
- declare const AlephaReact: _alepha_core10.Service<_alepha_core10.Module<{}>>;
1258
+ declare const AlephaReact: _alepha_core14.Service<_alepha_core14.Module>;
1236
1259
  //#endregion
1237
- export { $page, ActionContext, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActionOptions, UseActionReturn, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, VirtualRouter, isPageRoute, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
1260
+ export { $page, ActionContext, AlephaContext, AlephaReact, AnchorProps, ClientOnly, CreateLayersResult, ErrorBoundary, ErrorHandler, ErrorViewer, Layer, Link, type LinkProps, _default as NestedView, NotFoundPage as NotFound, PageAnimation, PageConfigSchema, PageDescriptor, PageDescriptorOptions, PageDescriptorRenderOptions, PageDescriptorRenderResult, PageRequestConfig, PageResolve, PageRoute, PageRouteEntry, PreviousLayerData, ReactBrowserProvider, ReactBrowserRendererOptions, ReactHydrationState, ReactPageProvider, ReactRouter, ReactRouterState, ReactServerProvider, ReactServerProviderOptions, Redirection, RouterGoOptions, RouterLayerContext, RouterLayerContextValue, RouterRenderOptions, RouterStackItem, TPropsDefault, TPropsParentDefault, TransitionOptions, UseActionOptions, UseActionReturn, UseActiveHook, UseActiveOptions, UseQueryParamsHookOptions, UseSchemaReturn, VirtualRouter, isPageRoute, reactBrowserOptions, reactServerOptions, ssrSchemaLoading, useAction, useActive, useAlepha, useClient, useEvents, useInject, useQueryParams, useRouter, useRouterState, useSchema, useStore };
1238
1261
  //# sourceMappingURL=index.d.ts.map
package/redis.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import * as _alepha_core3 from "alepha";
1
+ import * as _alepha_core1 from "alepha";
2
2
  import { Alepha, Static } from "alepha";
3
3
  import * as _alepha_logger0 from "alepha/logger";
4
4
  import { RedisClientType, SetOptions, createClient } from "@redis/client";
5
5
 
6
6
  //#region src/providers/RedisProvider.d.ts
7
- declare const envSchema: _alepha_core3.TObject<{
8
- REDIS_PORT: _alepha_core3.TInteger;
9
- REDIS_HOST: _alepha_core3.TString;
10
- REDIS_PASSWORD: _alepha_core3.TOptional<_alepha_core3.TString>;
7
+ declare const envSchema: _alepha_core1.TObject<{
8
+ REDIS_PORT: _alepha_core1.TInteger;
9
+ REDIS_HOST: _alepha_core1.TString;
10
+ REDIS_PASSWORD: _alepha_core1.TOptional<_alepha_core1.TString>;
11
11
  }>;
12
12
  declare module "alepha" {
13
13
  interface Env extends Partial<Static<typeof envSchema>> {}
@@ -30,8 +30,8 @@ declare class RedisProvider {
30
30
  };
31
31
  protected readonly client: RedisClient;
32
32
  get publisher(): RedisClient;
33
- protected readonly start: _alepha_core3.HookDescriptor<"start">;
34
- protected readonly stop: _alepha_core3.HookDescriptor<"stop">;
33
+ protected readonly start: _alepha_core1.HookDescriptor<"start">;
34
+ protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
35
35
  /**
36
36
  * Connect to the Redis server.
37
37
  */
@@ -59,8 +59,8 @@ declare class RedisSubscriberProvider {
59
59
  protected readonly redisProvider: RedisProvider;
60
60
  protected readonly client: RedisClient;
61
61
  get subscriber(): RedisClient;
62
- protected readonly start: _alepha_core3.HookDescriptor<"start">;
63
- protected readonly stop: _alepha_core3.HookDescriptor<"stop">;
62
+ protected readonly start: _alepha_core1.HookDescriptor<"start">;
63
+ protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
64
64
  connect(): Promise<void>;
65
65
  close(): Promise<void>;
66
66
  /**
@@ -76,7 +76,7 @@ declare class RedisSubscriberProvider {
76
76
  * @see {@link RedisProvider}
77
77
  * @module alepha.redis
78
78
  */
79
- declare const AlephaRedis: _alepha_core3.Service<_alepha_core3.Module<{}>>;
79
+ declare const AlephaRedis: _alepha_core1.Service<_alepha_core1.Module>;
80
80
  //#endregion
81
81
  export { AlephaRedis, RedisClient, RedisClientOptions, RedisProvider, RedisSetOptions, RedisSubscriberProvider };
82
82
  //# sourceMappingURL=index.d.ts.map
package/retry.d.ts CHANGED
@@ -1,17 +1,9 @@
1
1
  import { AlephaError, Descriptor, DescriptorArgs, KIND } from "alepha";
2
2
  import { DateTimeProvider, DurationLike } from "alepha/datetime";
3
+ import * as _alepha_logger0 from "alepha/logger";
3
4
 
4
- //#region src/descriptors/$retry.d.ts
5
-
6
- /**
7
- * Creates a function that automatically retries a handler upon failure,
8
- * with support for exponential backoff, max duration, and cancellation.
9
- */
10
- declare const $retry: {
11
- <T extends (...args: any[]) => any>(options: RetryDescriptorOptions<T>): RetryDescriptorFn<T>;
12
- [KIND]: typeof RetryDescriptor;
13
- };
14
- interface RetryDescriptorOptions<T extends (...args: any[]) => any> {
5
+ //#region src/providers/RetryProvider.d.ts
6
+ interface RetryOptions<T extends (...args: any[]) => any> {
15
7
  /**
16
8
  * The function to retry.
17
9
  */
@@ -50,15 +42,11 @@ interface RetryDescriptorOptions<T extends (...args: any[]) => any> {
50
42
  * An AbortSignal to allow for external cancellation of the retry loop.
51
43
  */
52
44
  signal?: AbortSignal;
53
- }
54
- declare class RetryDescriptor<T extends (...args: any[]) => any> extends Descriptor<RetryDescriptorOptions<T>> {
55
- protected readonly dateTimeProvider: DateTimeProvider;
56
- protected appAbortController: AbortController;
57
- constructor(args: DescriptorArgs<RetryDescriptorOptions<T>>);
58
- run(...args: Parameters<T>): Promise<ReturnType<T>>;
59
- }
60
- interface RetryDescriptorFn<T extends (...args: any[]) => any> extends RetryDescriptor<T> {
61
- (...args: Parameters<T>): Promise<ReturnType<T>>;
45
+ /**
46
+ * An additional AbortSignal to combine with the provided signal.
47
+ * Used internally by $retry to handle app lifecycle.
48
+ */
49
+ additionalSignal?: AbortSignal;
62
50
  }
63
51
  interface RetryBackoffOptions {
64
52
  /**
@@ -84,6 +72,81 @@ interface RetryBackoffOptions {
84
72
  */
85
73
  jitter?: boolean;
86
74
  }
75
+ /**
76
+ * Service for executing functions with automatic retry logic.
77
+ * Supports exponential backoff, max duration, conditional retries, and cancellation.
78
+ */
79
+ declare class RetryProvider {
80
+ protected readonly log: _alepha_logger0.Logger;
81
+ protected readonly dateTime: DateTimeProvider;
82
+ /**
83
+ * Execute a function with automatic retry logic.
84
+ */
85
+ retry<T extends (...args: any[]) => any>(options: RetryOptions<T>, ...args: Parameters<T>): Promise<ReturnType<T>>;
86
+ /**
87
+ * Calculate the backoff delay for a given attempt.
88
+ */
89
+ protected calculateBackoff(attempt: number, options?: number | RetryBackoffOptions): number;
90
+ }
91
+ //#endregion
92
+ //#region src/descriptors/$retry.d.ts
93
+ /**
94
+ * Creates a function that automatically retries a handler upon failure,
95
+ * with support for exponential backoff, max duration, and cancellation.
96
+ */
97
+ declare const $retry: {
98
+ <T extends (...args: any[]) => any>(options: RetryDescriptorOptions<T>): RetryDescriptorFn<T>;
99
+ [KIND]: typeof RetryDescriptor;
100
+ };
101
+ interface RetryDescriptorOptions<T extends (...args: any[]) => any> {
102
+ /**
103
+ * The function to retry.
104
+ */
105
+ handler: T;
106
+ /**
107
+ * The maximum number of attempts.
108
+ *
109
+ * @default 3
110
+ */
111
+ max?: number;
112
+ /**
113
+ * The backoff strategy for delays between retries.
114
+ * Can be a fixed number (in ms) or a configuration object for exponential backoff.
115
+ *
116
+ * @default { initial: 200, factor: 2, jitter: true }
117
+ */
118
+ backoff?: number | RetryBackoffOptions;
119
+ /**
120
+ * An overall time limit for all retry attempts combined.
121
+ *
122
+ * e.g., `[5, 'seconds']`
123
+ */
124
+ maxDuration?: DurationLike;
125
+ /**
126
+ * A function that determines if a retry should be attempted based on the error.
127
+ *
128
+ * @default (error) => true (retries on any error)
129
+ */
130
+ when?: (error: Error) => boolean;
131
+ /**
132
+ * A custom callback for when a retry attempt fails.
133
+ * This is called before the delay.
134
+ */
135
+ onError?: (error: Error, attempt: number, ...args: Parameters<T>) => void;
136
+ /**
137
+ * An AbortSignal to allow for external cancellation of the retry loop.
138
+ */
139
+ signal?: AbortSignal;
140
+ }
141
+ declare class RetryDescriptor<T extends (...args: any[]) => any> extends Descriptor<RetryDescriptorOptions<T>> {
142
+ protected readonly retryProvider: RetryProvider;
143
+ protected appAbortController: AbortController;
144
+ constructor(args: DescriptorArgs<RetryDescriptorOptions<T>>);
145
+ run(...args: Parameters<T>): Promise<ReturnType<T>>;
146
+ }
147
+ interface RetryDescriptorFn<T extends (...args: any[]) => any> extends RetryDescriptor<T> {
148
+ (...args: Parameters<T>): Promise<ReturnType<T>>;
149
+ }
87
150
  //#endregion
88
151
  //#region src/errors/RetryCancelError.d.ts
89
152
  declare class RetryCancelError extends AlephaError {
@@ -95,5 +158,5 @@ declare class RetryTimeoutError extends AlephaError {
95
158
  constructor(duration: number);
96
159
  }
97
160
  //#endregion
98
- export { $retry, RetryBackoffOptions, RetryCancelError, RetryDescriptor, RetryDescriptorFn, RetryDescriptorOptions, RetryTimeoutError };
161
+ export { $retry, RetryBackoffOptions, RetryCancelError, RetryDescriptor, RetryDescriptorFn, RetryDescriptorOptions, RetryOptions, RetryProvider, RetryTimeoutError };
99
162
  //# sourceMappingURL=index.d.ts.map
package/scheduler.d.ts CHANGED
@@ -139,7 +139,7 @@ declare module "alepha" {
139
139
  * @see {@link $scheduler}
140
140
  * @module alepha.scheduler
141
141
  */
142
- declare const AlephaScheduler: _alepha_core1.Service<_alepha_core1.Module<{}>>;
142
+ declare const AlephaScheduler: _alepha_core1.Service<_alepha_core1.Module>;
143
143
  //#endregion
144
144
  export { $scheduler, AlephaScheduler, CRON, CronJob, CronProvider, SchedulerDescriptor, SchedulerDescriptorOptions, SchedulerHandlerArguments };
145
145
  //# sourceMappingURL=index.d.ts.map