alepha 0.11.2 → 0.11.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.
Files changed (50) hide show
  1. package/api/files.d.ts +1 -439
  2. package/api/jobs.d.ts +1 -218
  3. package/api/notifications.d.ts +1 -264
  4. package/api/users.d.ts +1 -924
  5. package/batch.d.ts +1 -585
  6. package/bucket.d.ts +1 -507
  7. package/cache/redis.d.ts +1 -40
  8. package/cache.d.ts +1 -288
  9. package/command.d.ts +1 -238
  10. package/core.d.ts +1 -1563
  11. package/datetime.d.ts +5 -3
  12. package/devtools.d.ts +1 -368
  13. package/email.d.ts +1 -144
  14. package/fake.cjs +8 -0
  15. package/fake.d.ts +1 -0
  16. package/fake.js +1 -0
  17. package/file.d.ts +1 -53
  18. package/lock/redis.d.ts +1 -24
  19. package/lock.d.ts +1 -552
  20. package/logger.d.ts +1 -284
  21. package/package.json +57 -50
  22. package/postgres.d.ts +1 -1931
  23. package/queue/redis.d.ts +1 -29
  24. package/queue.d.ts +1 -760
  25. package/react/auth.d.ts +1 -499
  26. package/react/form.d.ts +1 -188
  27. package/react/head.d.ts +1 -120
  28. package/react/i18n.d.ts +1 -118
  29. package/react.d.ts +1 -929
  30. package/redis.d.ts +1 -82
  31. package/scheduler.d.ts +1 -145
  32. package/security.d.ts +1 -586
  33. package/server/cache.d.ts +1 -163
  34. package/server/compress.d.ts +1 -32
  35. package/server/cookies.d.ts +1 -144
  36. package/server/cors.d.ts +1 -27
  37. package/server/health.d.ts +1 -59
  38. package/server/helmet.d.ts +1 -69
  39. package/server/links.d.ts +1 -316
  40. package/server/metrics.d.ts +1 -35
  41. package/server/multipart.d.ts +1 -42
  42. package/server/proxy.d.ts +1 -234
  43. package/server/security.d.ts +1 -87
  44. package/server/static.d.ts +1 -119
  45. package/server/swagger.d.ts +1 -148
  46. package/server.d.ts +1 -849
  47. package/topic/redis.d.ts +1 -42
  48. package/topic.d.ts +1 -819
  49. package/ui.d.ts +1 -619
  50. package/vite.d.ts +1 -197
package/react/head.d.ts CHANGED
@@ -1,120 +1 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { Descriptor, KIND } from "alepha";
3
- import { PageConfigSchema, PageRoute, ReactRouterState, TPropsDefault, TPropsParentDefault } from "alepha/react";
4
- import { ServerTimingProvider } from "alepha/server";
5
-
6
- //#region src/interfaces/Head.d.ts
7
- interface Head extends SimpleHead {
8
- description?: string;
9
- keywords?: string[];
10
- author?: string;
11
- robots?: string;
12
- themeColor?: string;
13
- viewport?: string | {
14
- width?: string;
15
- height?: string;
16
- initialScale?: string;
17
- maximumScale?: string;
18
- userScalable?: "no" | "yes" | "0" | "1";
19
- interactiveWidget?: "resizes-visual" | "resizes-content" | "overlays-content";
20
- };
21
- og?: {
22
- title?: string;
23
- description?: string;
24
- image?: string;
25
- url?: string;
26
- type?: string;
27
- };
28
- twitter?: {
29
- card?: string;
30
- title?: string;
31
- description?: string;
32
- image?: string;
33
- site?: string;
34
- };
35
- }
36
- interface SimpleHead {
37
- title?: string;
38
- titleSeparator?: string;
39
- htmlAttributes?: Record<string, string>;
40
- bodyAttributes?: Record<string, string>;
41
- meta?: Array<{
42
- name: string;
43
- content: string;
44
- }>;
45
- }
46
- //#endregion
47
- //#region src/providers/HeadProvider.d.ts
48
- declare class HeadProvider {
49
- global?: Head | (() => Head);
50
- protected getGlobalHead(): Head | undefined;
51
- fillHead(state: ReactRouterState): void;
52
- protected fillHeadByPage(page: PageRoute, state: ReactRouterState, props: Record<string, any>): void;
53
- }
54
- //#endregion
55
- //#region src/descriptors/$head.d.ts
56
- /**
57
- * Set global `<head>` options for the application.
58
- */
59
- declare const $head: {
60
- (options: HeadDescriptorOptions): HeadDescriptor;
61
- [KIND]: typeof HeadDescriptor;
62
- };
63
- type HeadDescriptorOptions = Head | (() => Head);
64
- declare class HeadDescriptor extends Descriptor<HeadDescriptorOptions> {
65
- protected readonly provider: HeadProvider;
66
- protected onInit(): void;
67
- }
68
- //#endregion
69
- //#region src/hooks/useHead.d.ts
70
- /**
71
- * ```tsx
72
- * const App = () => {
73
- * const [head, setHead] = useHead({
74
- * // will set the document title on the first render
75
- * title: "My App",
76
- * });
77
- *
78
- * return (
79
- * // This will update the document title when the button is clicked
80
- * <button onClick={() => setHead({ title: "Change Title" })}>
81
- * Change Title {head.title}
82
- * </button>
83
- * );
84
- * }
85
- * ```
86
- */
87
- declare const useHead: (options?: UseHeadOptions) => UseHeadReturn;
88
- type UseHeadOptions = Head | ((previous?: Head) => Head);
89
- type UseHeadReturn = [Head, (head?: Head | ((previous?: Head) => Head)) => void];
90
- //#endregion
91
- //#region src/providers/ServerHeadProvider.d.ts
92
- declare class ServerHeadProvider {
93
- protected readonly headProvider: HeadProvider;
94
- protected readonly serverTimingProvider: ServerTimingProvider;
95
- protected readonly onServerRenderEnd: _alepha_core1.HookDescriptor<"react:server:render:end">;
96
- renderHead(template: string, head: SimpleHead): string;
97
- protected mergeAttributes(existing: string, attrs: Record<string, string>): string;
98
- protected parseAttributes(attrStr: string): Record<string, string>;
99
- protected escapeHtml(str: string): string;
100
- }
101
- //#endregion
102
- //#region src/index.d.ts
103
- declare module "alepha/react" {
104
- interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
105
- head?: Head | ((props: TProps, previous?: Head) => Head);
106
- }
107
- interface ReactRouterState {
108
- head: Head;
109
- }
110
- }
111
- /**
112
- * Fill `<head>` server & client side.
113
- *
114
- * @see {@link ServerHeadProvider}
115
- * @module alepha.react.head
116
- */
117
- declare const AlephaReactHead: _alepha_core1.Service<_alepha_core1.Module<{}>>;
118
- //#endregion
119
- export { $head, AlephaReactHead, Head, HeadDescriptor, HeadDescriptorOptions, ServerHeadProvider, SimpleHead, UseHeadOptions, UseHeadReturn, useHead };
120
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/react-head';
package/react/i18n.d.ts CHANGED
@@ -1,118 +1 @@
1
- import * as _alepha_core1 from "alepha";
2
- import { Alepha, Descriptor, KIND } from "alepha";
3
- import * as _alepha_logger0 from "alepha/logger";
4
- import * as _alepha_server_cookies0 from "alepha/server/cookies";
5
- import * as typebox0 from "typebox";
6
-
7
- //#region src/hooks/useI18n.d.ts
8
- /**
9
- * Hook to access the i18n service.
10
- */
11
- declare const useI18n: <S extends object, K$1 extends keyof ServiceDictionary<S>>() => I18nProvider<S, K$1> & {
12
- tr(key: keyof ServiceDictionary<S>[K$1] | string, options?: {
13
- args?: string[];
14
- default?: string;
15
- }): string;
16
- };
17
- type ServiceDictionary<T extends object> = { [K in keyof T]: T[K] extends DictionaryDescriptor<infer U> ? U : never };
18
- //#endregion
19
- //#region src/providers/I18nProvider.d.ts
20
- declare class I18nProvider<S extends object, K$1 extends keyof ServiceDictionary<S>> {
21
- protected logger: _alepha_logger0.Logger;
22
- protected alepha: Alepha;
23
- protected cookie: _alepha_server_cookies0.AbstractCookieDescriptor<typebox0.TString>;
24
- readonly registry: Array<{
25
- name: string;
26
- lang: string;
27
- loader: () => Promise<Record<string, string>>;
28
- translations: Record<string, string>;
29
- }>;
30
- options: {
31
- fallbackLang: string;
32
- };
33
- dateFormat: {
34
- format: (value: Date) => string;
35
- };
36
- numberFormat: {
37
- format: (value: number) => string;
38
- };
39
- get languages(): string[];
40
- protected readonly onRender: _alepha_core1.HookDescriptor<"server:onRequest">;
41
- protected readonly onStart: _alepha_core1.HookDescriptor<"start">;
42
- protected createFormatters(): void;
43
- setLang: (lang: string) => Promise<void>;
44
- protected readonly mutate: _alepha_core1.HookDescriptor<"state:mutate">;
45
- get lang(): string;
46
- translate: (key: string, args?: string[]) => string;
47
- readonly tr: (key: keyof ServiceDictionary<S>[K$1] | string, options?: {
48
- args?: string[];
49
- default?: string;
50
- }) => string;
51
- protected render(item: string, args: string[]): string;
52
- }
53
- //#endregion
54
- //#region src/descriptors/$dictionary.d.ts
55
- /**
56
- * Register a dictionary entry for translations.
57
- *
58
- * It allows you to define a set of translations for a specific language.
59
- * Entry can be lazy-loaded, which is useful for large dictionaries or when translations are not needed immediately.
60
- *
61
- * @example
62
- * ```ts
63
- * import { $dictionary } from "alepha/react-i18n";
64
- *
65
- * const Example = () => {
66
- * const { tr } = useI18n<App, "en">();
67
- * return <div>{tr("hello")}</div>; //
68
- * }
69
- *
70
- * class App {
71
- *
72
- * en = $dictionary({
73
- * // { default: { hello: "Hey" } }
74
- * lazy: () => import("./translations/en.ts"),
75
- * });
76
- *
77
- * home = $page({
78
- * path: "/",
79
- * component: Example,
80
- * })
81
- * }
82
- *
83
- * run(App);
84
- * ```
85
- */
86
- declare const $dictionary: {
87
- <T extends Record<string, string>>(options: DictionaryDescriptorOptions<T>): DictionaryDescriptor<T>;
88
- [KIND]: typeof DictionaryDescriptor;
89
- };
90
- interface DictionaryDescriptorOptions<T extends Record<string, string>> {
91
- lang?: string;
92
- name?: string;
93
- lazy: () => Promise<{
94
- default: T;
95
- }>;
96
- }
97
- declare class DictionaryDescriptor<T extends Record<string, string>> extends Descriptor<DictionaryDescriptorOptions<T>> {
98
- protected provider: I18nProvider<object, never>;
99
- protected onInit(): void;
100
- }
101
- //#endregion
102
- //#region src/index.d.ts
103
- declare module "alepha" {
104
- interface State {
105
- "react.i18n.lang"?: string;
106
- }
107
- }
108
- /**
109
- * Add i18n support to your Alepha React application. SSR and CSR compatible.
110
- *
111
- * It supports lazy loading of translations and provides a context to access the current language.
112
- *
113
- * @module alepha.react.i18n
114
- */
115
- declare const AlephaReactI18n: _alepha_core1.Service<_alepha_core1.Module<{}>>;
116
- //#endregion
117
- export { $dictionary, AlephaReactI18n, DictionaryDescriptor, DictionaryDescriptorOptions, I18nProvider, ServiceDictionary, useI18n };
118
- //# sourceMappingURL=index.d.ts.map
1
+ export * from '@alepha/react-i18n';