alepha 0.10.7 → 0.11.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/api/files.d.ts +172 -235
- package/api/jobs.d.ts +134 -209
- package/api/notifications.d.ts +112 -225
- package/api/users.d.ts +479 -766
- package/batch.d.ts +8 -8
- package/bucket.d.ts +1 -1
- package/cache.d.ts +12 -12
- package/command.d.ts +15 -15
- package/core.d.ts +312 -221
- package/datetime.d.ts +41 -10
- package/lock.d.ts +8 -8
- package/logger.d.ts +19 -9
- package/package.json +52 -65
- package/postgres.d.ts +488 -1172
- package/queue.d.ts +14 -14
- package/react/auth.d.ts +1 -1
- package/react/form.d.ts +33 -22
- package/react/i18n.d.ts +8 -8
- package/react.d.ts +76 -56
- package/retry.d.ts +8 -8
- package/scheduler.d.ts +7 -7
- package/security.d.ts +2 -1
- package/server/cookies.d.ts +13 -12
- package/server/health.d.ts +31 -8
- package/server/links.d.ts +3 -3
- package/server/multipart.d.ts +2 -2
- package/server/swagger.d.ts +4 -0
- package/server.d.ts +43 -42
- package/topic.d.ts +17 -17
- package/ui.d.ts +365 -46
- package/vite.d.ts +7 -2
package/datetime.d.ts
CHANGED
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
import * as _alepha_core1 from "alepha";
|
|
2
|
-
import { Alepha, Descriptor, KIND } from "alepha";
|
|
2
|
+
import { Alepha, Descriptor, KIND, TStringOptions } from "alepha";
|
|
3
3
|
import "dayjs/plugin/relativeTime.js";
|
|
4
4
|
import dayjsDuration from "dayjs/plugin/duration.js";
|
|
5
|
-
import
|
|
5
|
+
import "dayjs/plugin/utc.js";
|
|
6
|
+
import "dayjs/plugin/timezone.js";
|
|
7
|
+
import "dayjs/plugin/localizedFormat.js";
|
|
8
|
+
import "dayjs/locale/ar.js";
|
|
9
|
+
import "dayjs/locale/fr.js";
|
|
10
|
+
import DayjsApi, { Dayjs, ManipulateType, PluginFunc } from "dayjs";
|
|
11
|
+
import * as typebox0 from "typebox";
|
|
12
|
+
import * as dayjs_plugin_duration0 from "dayjs/plugin/duration";
|
|
6
13
|
|
|
14
|
+
//#region src/providers/DateTimeTypeProvider.d.ts
|
|
15
|
+
declare const datetime: (options?: TStringOptions) => typebox0.TCodec<typebox0.TString, DayjsApi.Dayjs>;
|
|
16
|
+
declare const date: (options?: TStringOptions) => typebox0.TCodec<typebox0.TString, DayjsApi.Dayjs>;
|
|
17
|
+
declare const time: (options?: TStringOptions) => typebox0.TCodec<typebox0.TString, DayjsApi.Dayjs>;
|
|
18
|
+
declare const duration: (options?: TStringOptions) => typebox0.TCodec<typebox0.TString, dayjs_plugin_duration0.Duration>;
|
|
19
|
+
declare const isDateTimeSchema: (schema: unknown) => schema is ReturnType<typeof datetime>;
|
|
20
|
+
declare const isDateSchema: (schema: unknown) => schema is ReturnType<typeof date>;
|
|
21
|
+
declare const isTimeSchema: (schema: unknown) => schema is ReturnType<typeof time>;
|
|
22
|
+
declare const isDurationSchema: (schema: unknown) => schema is ReturnType<typeof duration>;
|
|
23
|
+
//#endregion
|
|
7
24
|
//#region src/providers/DateTimeProvider.d.ts
|
|
8
25
|
type DateTimeApi = typeof dayjs;
|
|
9
|
-
type DateTime =
|
|
26
|
+
type DateTime = DayjsApi.Dayjs;
|
|
10
27
|
type Duration = dayjsDuration.Duration;
|
|
11
28
|
type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
|
|
29
|
+
declare const dayjs: typeof DayjsApi;
|
|
12
30
|
declare class DateTimeProvider {
|
|
31
|
+
static PLUGINS: Array<PluginFunc<any>>;
|
|
13
32
|
protected alepha: Alepha;
|
|
14
33
|
protected ref: DateTime | null;
|
|
15
34
|
protected readonly timeouts: Timeout[];
|
|
16
35
|
protected readonly intervals: Interval[];
|
|
17
36
|
constructor();
|
|
37
|
+
protected readonly onStart: _alepha_core1.HookDescriptor<"start">;
|
|
38
|
+
protected readonly onStop: _alepha_core1.HookDescriptor<"stop">;
|
|
18
39
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* You can override this method to add custom plugins.
|
|
40
|
+
* Create a new UTC DateTime instance.
|
|
22
41
|
*/
|
|
23
|
-
|
|
24
|
-
protected readonly start: _alepha_core1.HookDescriptor<"start">;
|
|
25
|
-
protected readonly stop: _alepha_core1.HookDescriptor<"stop">;
|
|
42
|
+
utc(date: string | number | Date | Dayjs | null | undefined): DateTime;
|
|
26
43
|
/**
|
|
27
44
|
* Create a new DateTime instance.
|
|
28
45
|
*/
|
|
@@ -130,7 +147,21 @@ declare class IntervalDescriptor extends Descriptor<IntervalDescriptorOptions> {
|
|
|
130
147
|
}
|
|
131
148
|
//#endregion
|
|
132
149
|
//#region src/index.d.ts
|
|
150
|
+
declare module "alepha" {
|
|
151
|
+
interface TypeProvider {
|
|
152
|
+
datetime: typeof datetime;
|
|
153
|
+
date: typeof date;
|
|
154
|
+
time: typeof time;
|
|
155
|
+
duration: typeof duration;
|
|
156
|
+
}
|
|
157
|
+
interface TypeGuard {
|
|
158
|
+
isDateTime: typeof isDateTimeSchema;
|
|
159
|
+
isDate: typeof isDateSchema;
|
|
160
|
+
isTime: typeof isTimeSchema;
|
|
161
|
+
isDuration: typeof isDurationSchema;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
133
164
|
declare const AlephaDateTime: _alepha_core1.Service<_alepha_core1.Module<{}>>;
|
|
134
165
|
//#endregion
|
|
135
|
-
export { $interval, AlephaDateTime, DateTime, DateTimeApi, DateTimeProvider, Duration, DurationLike, Interval, IntervalDescriptor, IntervalDescriptorOptions, Timeout };
|
|
166
|
+
export { $interval, AlephaDateTime, DateTime, DateTimeApi, DateTimeProvider, Duration, DurationLike, Interval, IntervalDescriptor, IntervalDescriptorOptions, Timeout, date, datetime, dayjs, duration, isDateSchema, isDateTimeSchema, isDurationSchema, isTimeSchema, time };
|
|
136
167
|
//# sourceMappingURL=index.d.ts.map
|
package/lock.d.ts
CHANGED
|
@@ -273,7 +273,7 @@ declare const $lock: {
|
|
|
273
273
|
<TFunc extends AsyncFn>(options: LockDescriptorOptions<TFunc>): LockDescriptor<TFunc>;
|
|
274
274
|
[KIND]: typeof LockDescriptor;
|
|
275
275
|
};
|
|
276
|
-
interface LockDescriptorOptions<TFunc
|
|
276
|
+
interface LockDescriptorOptions<TFunc extends AsyncFn> {
|
|
277
277
|
/**
|
|
278
278
|
* The function to execute when the lock is successfully acquired.
|
|
279
279
|
*
|
|
@@ -308,7 +308,7 @@ interface LockDescriptorOptions<TFunc$1 extends AsyncFn> {
|
|
|
308
308
|
* }
|
|
309
309
|
* ```
|
|
310
310
|
*/
|
|
311
|
-
handler: TFunc
|
|
311
|
+
handler: TFunc;
|
|
312
312
|
/**
|
|
313
313
|
* Whether the lock should wait for other instances to complete before giving up.
|
|
314
314
|
*
|
|
@@ -388,7 +388,7 @@ interface LockDescriptorOptions<TFunc$1 extends AsyncFn> {
|
|
|
388
388
|
* });
|
|
389
389
|
* ```
|
|
390
390
|
*/
|
|
391
|
-
name?: string | ((...args: Parameters<TFunc
|
|
391
|
+
name?: string | ((...args: Parameters<TFunc>) => string);
|
|
392
392
|
/**
|
|
393
393
|
* Maximum duration the lock can be held before it expires automatically.
|
|
394
394
|
*
|
|
@@ -474,7 +474,7 @@ interface LockDescriptorOptions<TFunc$1 extends AsyncFn> {
|
|
|
474
474
|
* });
|
|
475
475
|
* ```
|
|
476
476
|
*/
|
|
477
|
-
gracePeriod?: ((...args: Parameters<TFunc
|
|
477
|
+
gracePeriod?: ((...args: Parameters<TFunc>) => DurationLike | undefined) | DurationLike;
|
|
478
478
|
}
|
|
479
479
|
declare const envSchema: _alepha_core1.TObject<{
|
|
480
480
|
LOCK_PREFIX_KEY: _alepha_core1.TString;
|
|
@@ -482,7 +482,7 @@ declare const envSchema: _alepha_core1.TObject<{
|
|
|
482
482
|
declare module "alepha" {
|
|
483
483
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
484
484
|
}
|
|
485
|
-
declare class LockDescriptor<TFunc
|
|
485
|
+
declare class LockDescriptor<TFunc extends AsyncFn> extends Descriptor<LockDescriptorOptions<TFunc>> {
|
|
486
486
|
protected readonly log: _alepha_logger0.Logger;
|
|
487
487
|
protected readonly provider: LockProvider;
|
|
488
488
|
protected readonly env: {
|
|
@@ -496,14 +496,14 @@ declare class LockDescriptor<TFunc$1 extends AsyncFn> extends Descriptor<LockDes
|
|
|
496
496
|
name: _alepha_core1.TString;
|
|
497
497
|
}>;
|
|
498
498
|
}>;
|
|
499
|
-
run(...args: Parameters<TFunc
|
|
499
|
+
run(...args: Parameters<TFunc>): Promise<void>;
|
|
500
500
|
/**
|
|
501
501
|
* Set the lock for the given key.
|
|
502
502
|
*/
|
|
503
503
|
protected lock(key: string): Promise<LockResult>;
|
|
504
|
-
protected setGracePeriod(key: string, lock: LockResult, ...args: Parameters<TFunc
|
|
504
|
+
protected setGracePeriod(key: string, lock: LockResult, ...args: Parameters<TFunc>): Promise<void>;
|
|
505
505
|
protected wait(key: string, maxDuration: DurationLike): Promise<void>;
|
|
506
|
-
protected key(...args: Parameters<TFunc
|
|
506
|
+
protected key(...args: Parameters<TFunc>): string;
|
|
507
507
|
protected parse(value: string): LockResult;
|
|
508
508
|
}
|
|
509
509
|
interface LockResult {
|
package/logger.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as _alepha_core0 from "alepha";
|
|
2
2
|
import { Alepha, KIND, LogLevel, LoggerInterface, Static } from "alepha";
|
|
3
|
-
import { DateTimeProvider } from "alepha/datetime";
|
|
3
|
+
import { DateTime, DateTimeProvider } from "alepha/datetime";
|
|
4
4
|
import * as typebox0 from "typebox";
|
|
5
|
+
import * as dayjs0 from "dayjs";
|
|
5
6
|
|
|
6
7
|
//#region src/schemas/logEntrySchema.d.ts
|
|
7
8
|
declare const logEntrySchema: typebox0.TObject<{
|
|
@@ -12,7 +13,7 @@ declare const logEntrySchema: typebox0.TObject<{
|
|
|
12
13
|
context: typebox0.TOptional<typebox0.TString>;
|
|
13
14
|
app: typebox0.TOptional<typebox0.TString>;
|
|
14
15
|
data: typebox0.TOptional<typebox0.TAny>;
|
|
15
|
-
timestamp: typebox0.TString
|
|
16
|
+
timestamp: typebox0.TCodec<typebox0.TString, dayjs0.Dayjs>;
|
|
16
17
|
}>;
|
|
17
18
|
type LogEntry = Static<typeof logEntrySchema>;
|
|
18
19
|
//#endregion
|
|
@@ -84,14 +85,19 @@ interface LoggerDescriptorOptions {
|
|
|
84
85
|
declare class ConsoleColorProvider {
|
|
85
86
|
static readonly COLORS: {
|
|
86
87
|
RESET: string;
|
|
87
|
-
|
|
88
|
+
BLACK: string;
|
|
88
89
|
RED: string;
|
|
89
|
-
ORANGE: string;
|
|
90
90
|
GREEN: string;
|
|
91
|
+
ORANGE: string;
|
|
91
92
|
BLUE: string;
|
|
92
|
-
|
|
93
|
+
PURPLE: string;
|
|
93
94
|
CYAN: string;
|
|
94
|
-
|
|
95
|
+
GREY_LIGHT: string;
|
|
96
|
+
GREY_LIGHT_BOLD: string;
|
|
97
|
+
GREY_DARK: string;
|
|
98
|
+
GREY_DARK_BOLD: string;
|
|
99
|
+
WHITE: string;
|
|
100
|
+
WHITE_BOLD: string;
|
|
95
101
|
SILENT: string;
|
|
96
102
|
ERROR: string;
|
|
97
103
|
WARN: string;
|
|
@@ -138,7 +144,7 @@ declare class MemoryDestinationProvider extends LogDestinationProvider {
|
|
|
138
144
|
message: string;
|
|
139
145
|
service: string;
|
|
140
146
|
module: string;
|
|
141
|
-
timestamp:
|
|
147
|
+
timestamp: dayjs0.Dayjs;
|
|
142
148
|
} & {
|
|
143
149
|
formatted: string;
|
|
144
150
|
})[];
|
|
@@ -150,9 +156,13 @@ declare class SimpleFormatterProvider extends LogFormatterProvider {
|
|
|
150
156
|
protected color: ConsoleColorProvider;
|
|
151
157
|
protected alepha: Alepha;
|
|
152
158
|
format(entry: LogEntry): string;
|
|
153
|
-
formatTimestamp(iso:
|
|
159
|
+
formatTimestamp(iso: DateTime): string;
|
|
154
160
|
protected pad2: (n: number) => string;
|
|
155
161
|
protected pad3: (n: number) => string;
|
|
162
|
+
/**
|
|
163
|
+
* Avoid to display the whole UUID in development mode
|
|
164
|
+
*/
|
|
165
|
+
protected formatContext(context: string): string;
|
|
156
166
|
protected formatError(error: Error): string;
|
|
157
167
|
}
|
|
158
168
|
//#endregion
|
|
@@ -254,7 +264,7 @@ declare const envSchema: _alepha_core0.TObject<{
|
|
|
254
264
|
* - "text" - Simple text format, human-readable, with colors. {@link SimpleFormatterProvider}
|
|
255
265
|
* - "raw" - Raw format, no formatting, just the message. {@link RawFormatterProvider}
|
|
256
266
|
*/
|
|
257
|
-
LOG_FORMAT: _alepha_core0.TOptional<
|
|
267
|
+
LOG_FORMAT: _alepha_core0.TOptional<_alepha_core0.TUnsafe<"json" | "text" | "raw">>;
|
|
258
268
|
}>;
|
|
259
269
|
declare module "alepha" {
|
|
260
270
|
interface Env extends Partial<Static<typeof envSchema>> {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alepha",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22.0.0"
|
|
@@ -15,58 +15,57 @@
|
|
|
15
15
|
"main": "./core.js",
|
|
16
16
|
"types": "./core.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@alepha/api-files": "0.
|
|
19
|
-
"@alepha/api-jobs": "0.
|
|
20
|
-
"@alepha/api-notifications": "0.
|
|
21
|
-
"@alepha/api-users": "0.
|
|
22
|
-
"@alepha/api-verifications": "0.
|
|
23
|
-
"@alepha/batch": "0.
|
|
24
|
-
"@alepha/bucket": "0.
|
|
25
|
-
"@alepha/cache": "0.
|
|
26
|
-
"@alepha/cache-redis": "0.
|
|
27
|
-
"@alepha/command": "0.
|
|
28
|
-
"@alepha/core": "0.
|
|
29
|
-
"@alepha/datetime": "0.
|
|
30
|
-
"@alepha/devtools": "0.
|
|
31
|
-
"@alepha/email": "0.
|
|
32
|
-
"@alepha/file": "0.
|
|
33
|
-
"@alepha/lock": "0.
|
|
34
|
-
"@alepha/lock-redis": "0.
|
|
35
|
-
"@alepha/logger": "0.
|
|
36
|
-
"@alepha/postgres": "0.
|
|
37
|
-
"@alepha/queue": "0.
|
|
38
|
-
"@alepha/queue-redis": "0.
|
|
39
|
-
"@alepha/react": "0.
|
|
40
|
-
"@alepha/react-auth": "0.
|
|
41
|
-
"@alepha/react-form": "0.
|
|
42
|
-
"@alepha/react-head": "0.
|
|
43
|
-
"@alepha/react-i18n": "0.
|
|
44
|
-
"@alepha/redis": "0.
|
|
45
|
-
"@alepha/retry": "0.
|
|
46
|
-
"@alepha/router": "0.
|
|
47
|
-
"@alepha/scheduler": "0.
|
|
48
|
-
"@alepha/security": "0.
|
|
49
|
-
"@alepha/server": "0.
|
|
50
|
-
"@alepha/server-cache": "0.
|
|
51
|
-
"@alepha/server-compress": "0.
|
|
52
|
-
"@alepha/server-cookies": "0.
|
|
53
|
-
"@alepha/server-cors": "0.
|
|
54
|
-
"@alepha/server-health": "0.
|
|
55
|
-
"@alepha/server-helmet": "0.
|
|
56
|
-
"@alepha/server-links": "0.
|
|
57
|
-
"@alepha/server-metrics": "0.
|
|
58
|
-
"@alepha/server-multipart": "0.
|
|
59
|
-
"@alepha/server-proxy": "0.
|
|
60
|
-
"@alepha/server-security": "0.
|
|
61
|
-
"@alepha/server-static": "0.
|
|
62
|
-
"@alepha/server-swagger": "0.
|
|
63
|
-
"@alepha/topic": "0.
|
|
64
|
-
"@alepha/topic-redis": "0.
|
|
65
|
-
"@alepha/ui": "0.
|
|
66
|
-
"@alepha/vite": "0.
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"tsdown": "^0.15.9"
|
|
18
|
+
"@alepha/api-files": "0.11.1",
|
|
19
|
+
"@alepha/api-jobs": "0.11.1",
|
|
20
|
+
"@alepha/api-notifications": "0.11.1",
|
|
21
|
+
"@alepha/api-users": "0.11.1",
|
|
22
|
+
"@alepha/api-verifications": "0.11.1",
|
|
23
|
+
"@alepha/batch": "0.11.1",
|
|
24
|
+
"@alepha/bucket": "0.11.1",
|
|
25
|
+
"@alepha/cache": "0.11.1",
|
|
26
|
+
"@alepha/cache-redis": "0.11.1",
|
|
27
|
+
"@alepha/command": "0.11.1",
|
|
28
|
+
"@alepha/core": "0.11.1",
|
|
29
|
+
"@alepha/datetime": "0.11.1",
|
|
30
|
+
"@alepha/devtools": "0.11.1",
|
|
31
|
+
"@alepha/email": "0.11.1",
|
|
32
|
+
"@alepha/file": "0.11.1",
|
|
33
|
+
"@alepha/lock": "0.11.1",
|
|
34
|
+
"@alepha/lock-redis": "0.11.1",
|
|
35
|
+
"@alepha/logger": "0.11.1",
|
|
36
|
+
"@alepha/postgres": "0.11.1",
|
|
37
|
+
"@alepha/queue": "0.11.1",
|
|
38
|
+
"@alepha/queue-redis": "0.11.1",
|
|
39
|
+
"@alepha/react": "0.11.1",
|
|
40
|
+
"@alepha/react-auth": "0.11.1",
|
|
41
|
+
"@alepha/react-form": "0.11.1",
|
|
42
|
+
"@alepha/react-head": "0.11.1",
|
|
43
|
+
"@alepha/react-i18n": "0.11.1",
|
|
44
|
+
"@alepha/redis": "0.11.1",
|
|
45
|
+
"@alepha/retry": "0.11.1",
|
|
46
|
+
"@alepha/router": "0.11.1",
|
|
47
|
+
"@alepha/scheduler": "0.11.1",
|
|
48
|
+
"@alepha/security": "0.11.1",
|
|
49
|
+
"@alepha/server": "0.11.1",
|
|
50
|
+
"@alepha/server-cache": "0.11.1",
|
|
51
|
+
"@alepha/server-compress": "0.11.1",
|
|
52
|
+
"@alepha/server-cookies": "0.11.1",
|
|
53
|
+
"@alepha/server-cors": "0.11.1",
|
|
54
|
+
"@alepha/server-health": "0.11.1",
|
|
55
|
+
"@alepha/server-helmet": "0.11.1",
|
|
56
|
+
"@alepha/server-links": "0.11.1",
|
|
57
|
+
"@alepha/server-metrics": "0.11.1",
|
|
58
|
+
"@alepha/server-multipart": "0.11.1",
|
|
59
|
+
"@alepha/server-proxy": "0.11.1",
|
|
60
|
+
"@alepha/server-security": "0.11.1",
|
|
61
|
+
"@alepha/server-static": "0.11.1",
|
|
62
|
+
"@alepha/server-swagger": "0.11.1",
|
|
63
|
+
"@alepha/topic": "0.11.1",
|
|
64
|
+
"@alepha/topic-redis": "0.11.1",
|
|
65
|
+
"@alepha/ui": "0.11.1",
|
|
66
|
+
"@alepha/vite": "0.11.1",
|
|
67
|
+
"react": "^19.2.0",
|
|
68
|
+
"react-dom": "^19.2.0"
|
|
70
69
|
},
|
|
71
70
|
"scripts": {
|
|
72
71
|
"build": "node build.ts"
|
|
@@ -76,18 +75,6 @@
|
|
|
76
75
|
"**/*.cjs",
|
|
77
76
|
"**/*.d.ts"
|
|
78
77
|
],
|
|
79
|
-
"peerDependencies": {
|
|
80
|
-
"react": "*",
|
|
81
|
-
"react-dom": "*"
|
|
82
|
-
},
|
|
83
|
-
"peerDependenciesMeta": {
|
|
84
|
-
"react": {
|
|
85
|
-
"optional": true
|
|
86
|
-
},
|
|
87
|
-
"react-dom": {
|
|
88
|
-
"optional": true
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
78
|
"exports": {
|
|
92
79
|
".": {
|
|
93
80
|
"import": "./core.js",
|