alepha 0.7.0 → 0.7.2

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 (100) hide show
  1. package/README.md +14 -3
  2. package/assets/logo.png +0 -0
  3. package/cache.cjs +0 -1
  4. package/cache.d.ts +30 -13
  5. package/cache.js +0 -1
  6. package/core.cjs +0 -1
  7. package/core.d.ts +465 -196
  8. package/core.js +0 -1
  9. package/datetime.cjs +0 -1
  10. package/datetime.d.ts +68 -79
  11. package/datetime.js +0 -1
  12. package/lock.cjs +0 -1
  13. package/lock.d.ts +3 -14
  14. package/lock.js +0 -1
  15. package/package.json +54 -53
  16. package/postgres.cjs +0 -1
  17. package/postgres.d.ts +3250 -288
  18. package/postgres.js +0 -1
  19. package/queue.cjs +0 -1
  20. package/queue.d.ts +2 -2
  21. package/queue.js +0 -1
  22. package/react/auth.cjs +0 -1
  23. package/react/auth.d.ts +12 -5
  24. package/react/auth.js +0 -1
  25. package/react.cjs +0 -1
  26. package/react.d.ts +317 -206
  27. package/react.js +0 -1
  28. package/redis.cjs +0 -1
  29. package/redis.d.ts +10 -8
  30. package/redis.js +0 -1
  31. package/retry.cjs +12 -0
  32. package/retry.d.ts +68 -0
  33. package/retry.js +1 -0
  34. package/scheduler.cjs +0 -1
  35. package/scheduler.js +0 -1
  36. package/security.cjs +0 -1
  37. package/security.d.ts +82 -35
  38. package/security.js +0 -1
  39. package/server/cookies.cjs +0 -1
  40. package/server/cookies.d.ts +1 -1
  41. package/server/cookies.js +0 -1
  42. package/server/metrics.cjs +0 -1
  43. package/server/metrics.js +0 -1
  44. package/server/static.cjs +0 -1
  45. package/server/static.d.ts +1 -0
  46. package/server/static.js +0 -1
  47. package/server/swagger.cjs +0 -1
  48. package/server/swagger.js +0 -1
  49. package/server.cjs +0 -1
  50. package/server.d.ts +402 -327
  51. package/server.js +0 -1
  52. package/src/retry.ts +1 -0
  53. package/topic.cjs +0 -1
  54. package/topic.d.ts +3 -20
  55. package/topic.js +0 -1
  56. package/vite.cjs +0 -1
  57. package/vite.d.ts +57 -38
  58. package/vite.js +0 -1
  59. package/cache.cjs.map +0 -1
  60. package/cache.js.map +0 -1
  61. package/core.cjs.map +0 -1
  62. package/core.js.map +0 -1
  63. package/datetime.cjs.map +0 -1
  64. package/datetime.js.map +0 -1
  65. package/lock.cjs.map +0 -1
  66. package/lock.js.map +0 -1
  67. package/postgres.cjs.map +0 -1
  68. package/postgres.js.map +0 -1
  69. package/queue.cjs.map +0 -1
  70. package/queue.js.map +0 -1
  71. package/react/auth.cjs.map +0 -1
  72. package/react/auth.js.map +0 -1
  73. package/react.cjs.map +0 -1
  74. package/react.js.map +0 -1
  75. package/redis.cjs.map +0 -1
  76. package/redis.js.map +0 -1
  77. package/scheduler.cjs.map +0 -1
  78. package/scheduler.js.map +0 -1
  79. package/security.cjs.map +0 -1
  80. package/security.js.map +0 -1
  81. package/server/cookies.cjs.map +0 -1
  82. package/server/cookies.js.map +0 -1
  83. package/server/metrics.cjs.map +0 -1
  84. package/server/metrics.js.map +0 -1
  85. package/server/proxy.cjs +0 -13
  86. package/server/proxy.cjs.map +0 -1
  87. package/server/proxy.d.ts +0 -1
  88. package/server/proxy.js +0 -2
  89. package/server/proxy.js.map +0 -1
  90. package/server/static.cjs.map +0 -1
  91. package/server/static.js.map +0 -1
  92. package/server/swagger.cjs.map +0 -1
  93. package/server/swagger.js.map +0 -1
  94. package/server.cjs.map +0 -1
  95. package/server.js.map +0 -1
  96. package/src/server/proxy.ts +0 -1
  97. package/topic.cjs.map +0 -1
  98. package/topic.js.map +0 -1
  99. package/vite.cjs.map +0 -1
  100. package/vite.js.map +0 -1
package/core.js CHANGED
@@ -1,2 +1 @@
1
1
  export * from '@alepha/core';
2
- //# sourceMappingURL=core.js.map
package/datetime.cjs CHANGED
@@ -10,4 +10,3 @@ Object.keys(datetime).forEach(function (k) {
10
10
  get: function () { return datetime[k]; }
11
11
  });
12
12
  });
13
- //# sourceMappingURL=datetime.cjs.map
package/datetime.d.ts CHANGED
@@ -1,35 +1,29 @@
1
1
  import * as _alepha_core from '@alepha/core';
2
2
  import { Async } from '@alepha/core';
3
- import { DurationLike as DurationLike$1, DateTime as DateTime$1, Duration as Duration$1, DurationLikeObject } from 'luxon';
3
+ import dayjs, { ManipulateType, Dayjs } from 'dayjs';
4
+ import dayjsDuration from 'dayjs/plugin/duration';
4
5
 
5
- interface IntervalDescriptorOptions {
6
+ declare class Interval {
7
+ private timer;
8
+ private readonly run;
9
+ private duration;
10
+ private options;
11
+ constructor(duration: number, options: IntervalDescriptorOptions);
6
12
  /**
7
- * Whether to start the interval immediately.
8
- *
9
- * @default false
13
+ * Start the interval.
10
14
  */
11
- run?: boolean;
15
+ start(): Promise<void>;
12
16
  /**
13
- * Whether to attach the interval to the context.
14
- *
15
- * Attached intervals are automatically started when the context starts and stopped when the context stops.
17
+ * Add time to the interval.
16
18
  *
17
- * @default true
18
- */
19
- attach?: boolean;
20
- /**
21
- * The interval handler.
19
+ * @param amountMs
22
20
  */
23
- handler: () => Async<void>;
21
+ add(amountMs: number): Promise<void>;
24
22
  /**
25
- * The interval duration.
23
+ * Clear the interval.
26
24
  */
27
- duration: DurationLike$1;
25
+ clear(): void;
28
26
  }
29
- /**
30
- * Registers a new interval.
31
- */
32
- declare const $interval: (options: IntervalDescriptorOptions) => Interval;
33
27
 
34
28
  declare class Timeout {
35
29
  private timer;
@@ -53,51 +47,31 @@ declare class Timeout {
53
47
  private start;
54
48
  }
55
49
 
56
- declare class Interval {
57
- private timer;
58
- private readonly run;
59
- private duration;
60
- private options;
61
- constructor(duration: number, options: IntervalDescriptorOptions);
62
- /**
63
- * Start the interval.
64
- */
65
- start(): Promise<void>;
66
- /**
67
- * Add time to the interval.
68
- *
69
- * @param amountMs
70
- */
71
- add(amountMs: number): Promise<void>;
72
- /**
73
- * Clear the interval.
74
- */
75
- clear(): void;
76
- }
77
-
50
+ type DateTime = dayjs.Dayjs;
51
+ type Duration = dayjsDuration.Duration;
52
+ type DurationLike = number | dayjsDuration.Duration | [number, ManipulateType];
78
53
  declare class DateTimeProvider {
79
54
  protected log: _alepha_core.Logger;
80
- protected ref: DateTime$1 | null;
55
+ protected ref: DateTime | null;
81
56
  protected readonly timeouts: Timeout[];
82
57
  protected readonly intervals: Interval[];
58
+ constructor();
83
59
  protected readonly start: _alepha_core.HookDescriptor<"start">;
84
60
  protected readonly stop: _alepha_core.HookDescriptor<"stop">;
85
61
  /**
86
62
  * Create a new DateTime instance.
87
- *
88
- * @param date
89
63
  */
90
- of(date: Date | string | DateTime$1): DateTime$1<true>;
64
+ of(date: string | number | Date | Dayjs | null | undefined): DateTime;
91
65
  /**
92
66
  * Get the current date.
93
67
  */
94
- now(): DateTime$1<true>;
68
+ now(): DateTime;
95
69
  /**
96
70
  * Get the current date as a string.
97
71
  *
98
72
  * @param date
99
73
  */
100
- toISOString(date?: Date | string | DateTime$1): string;
74
+ toISOString(date?: Date | string | DateTime): string;
101
75
  /**
102
76
  * Get the current date as a string.
103
77
  */
@@ -107,61 +81,76 @@ declare class DateTimeProvider {
107
81
  *
108
82
  * @protected
109
83
  */
110
- protected getCurrentDate(): DateTime$1<true>;
84
+ protected getCurrentDate(): DateTime;
111
85
  /**
112
86
  * Create a new Duration instance.
113
- *
114
- * @param duration
115
- */
116
- duration(duration: DurationLike$1 | string): Duration$1;
117
- /**
118
- * Add time to the current date.
119
87
  */
120
- add(duration: DurationLikeObject): Promise<void>;
88
+ duration: (duration: DurationLike, unit?: ManipulateType) => Duration;
89
+ isDurationLike(value: unknown): value is DurationLike;
121
90
  /**
122
91
  * Return a promise that resolves after a next tick.
123
92
  * It uses `setTimeout` with 0ms delay.
124
93
  */
125
94
  tick(): Promise<void>;
95
+ /**
96
+ * Wait for a certain duration.
97
+ */
98
+ wait(duration: DurationLike, signal?: AbortSignal): Promise<void>;
99
+ /**
100
+ * Run a callback after a certain duration.
101
+ */
102
+ timeout(callback: () => void, duration: DurationLike): Timeout;
103
+ /**
104
+ * Create an interval.
105
+ *
106
+ * @param args
107
+ */
108
+ interval(args: IntervalDescriptorOptions): Interval;
109
+ /**
110
+ * Run a function with a deadline.
111
+ */
112
+ deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike): Promise<T>;
113
+ /**
114
+ * Add time to the current date.
115
+ */
116
+ travel(duration: DurationLike): Promise<void>;
126
117
  /**
127
118
  * Stop the time.
128
119
  */
129
- pause(): DateTime$1<boolean>;
120
+ pause(): dayjs.Dayjs;
130
121
  /**
131
122
  * Reset the reference date.
132
123
  */
133
124
  reset(): void;
125
+ }
126
+
127
+ interface IntervalDescriptorOptions {
134
128
  /**
135
- * Wait for a certain duration.
129
+ * Whether to start the interval immediately.
136
130
  *
137
- * @param duration
138
- * @param signal
131
+ * @default false
139
132
  */
140
- wait(duration: DurationLike$1, signal?: AbortSignal): Promise<void>;
133
+ run?: boolean;
141
134
  /**
142
- * Run a callback after a certain duration.
135
+ * Whether to attach the interval to the context.
136
+ *
137
+ * Attached intervals are automatically started when the context starts and stopped when the context stops.
143
138
  *
144
- * @param callback
145
- * @param duration
139
+ * @default true
146
140
  */
147
- timeout(callback: () => void, duration: DurationLike$1): Timeout;
141
+ attach?: boolean;
148
142
  /**
149
- * Create an interval.
150
- *
151
- * @param args
143
+ * The interval handler.
152
144
  */
153
- interval(args: IntervalDescriptorOptions): Interval;
145
+ handler: () => Async<void>;
154
146
  /**
155
- * Run a function with a deadline.
156
- *
157
- * @param fn
158
- * @param duration
147
+ * The interval duration.
159
148
  */
160
- deadline<T>(fn: (signal: AbortSignal) => Promise<T>, duration: DurationLike$1): Promise<T>;
149
+ duration: DurationLike;
161
150
  }
162
-
163
- type DurationLike = DurationLike$1;
164
- type DateTime = DateTime$1;
165
- type Duration = Duration$1;
151
+ /**
152
+ * Registers a new interval.
153
+ */
154
+ declare const $interval: (options: IntervalDescriptorOptions) => Interval;
166
155
 
167
156
  export { $interval, type DateTime, DateTimeProvider, type Duration, type DurationLike, Interval, type IntervalDescriptorOptions, Timeout };
package/datetime.js CHANGED
@@ -1,2 +1 @@
1
1
  export * from '@alepha/datetime';
2
- //# sourceMappingURL=datetime.js.map
package/lock.cjs CHANGED
@@ -10,4 +10,3 @@ Object.keys(lock).forEach(function (k) {
10
10
  get: function () { return lock[k]; }
11
11
  });
12
12
  });
13
- //# sourceMappingURL=lock.cjs.map
package/lock.d.ts CHANGED
@@ -82,18 +82,9 @@ interface LockDescriptorOptions<TFunc extends AsyncFn> {
82
82
  * @default false
83
83
  */
84
84
  wait?: boolean;
85
- /**
86
- *
87
- */
88
85
  key?: string | ((...args: Parameters<TFunc>) => string);
89
- /**
90
- *
91
- */
92
86
  maxDuration?: DurationLike;
93
- /**
94
- *
95
- */
96
- gracePeriod?: DurationLike | ((...args: Parameters<TFunc>) => DurationLike | undefined);
87
+ gracePeriod?: (...args: Parameters<TFunc>) => DurationLike | undefined;
97
88
  }
98
89
  interface LockDescriptor<TFunc extends AsyncFn> {
99
90
  [KIND]: typeof KEY;
@@ -132,13 +123,13 @@ declare class LockProvider {
132
123
  * @param nx If set to true, the key will only be set if it does not already exist.
133
124
  * @param px Set the specified expire time, in milliseconds.
134
125
  */
135
- set(key: string, value: string, nx?: boolean, px?: number): Promise<string>;
126
+ set(_key: string, _value: string, _nx?: boolean, _px?: number): Promise<string>;
136
127
  /**
137
128
  * Remove the specified keys.
138
129
  *
139
130
  * @param keys The keys to delete.
140
131
  */
141
- del(...keys: string[]): Promise<void>;
132
+ del(..._keys: string[]): Promise<void>;
142
133
  }
143
134
 
144
135
  declare class LockTopicProvider extends TopicProvider {
@@ -257,8 +248,6 @@ declare class RedisLockProvider implements LockProvider {
257
248
  set(key: string, value: string, nx?: boolean, px?: number): Promise<string>;
258
249
  /**
259
250
  * Remove the specified keys.
260
- *
261
- * @param keys The keys to delete.
262
251
  */
263
252
  del(...keys: string[]): Promise<void>;
264
253
  }
package/lock.js CHANGED
@@ -1,2 +1 @@
1
1
  export * from '@alepha/lock';
2
- //# sourceMappingURL=lock.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alepha",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "TypeScript framework for building full-stack apps with strict conventions, custom schemas, and React-based SPA or SSR without filesystem-based routing.",
@@ -12,26 +12,26 @@
12
12
  "main": "./core.js",
13
13
  "types": "./core.d.ts",
14
14
  "dependencies": {
15
- "@alepha/cache": "0.7.0",
16
- "@alepha/core": "0.7.0",
17
- "@alepha/datetime": "0.7.0",
18
- "@alepha/lock": "0.7.0",
19
- "@alepha/postgres": "0.7.0",
20
- "@alepha/queue": "0.7.0",
21
- "@alepha/react": "0.7.0",
22
- "@alepha/react-auth": "0.7.0",
23
- "@alepha/redis": "0.7.0",
24
- "@alepha/scheduler": "0.7.0",
25
- "@alepha/security": "0.7.0",
26
- "@alepha/server": "0.7.0",
27
- "@alepha/server-cookies": "0.7.0",
28
- "@alepha/server-metrics": "0.7.0",
29
- "@alepha/server-proxy": "0.6.10",
30
- "@alepha/server-static": "0.7.0",
31
- "@alepha/server-swagger": "0.7.0",
32
- "@alepha/testing": "0.7.0",
33
- "@alepha/topic": "0.7.0",
34
- "@alepha/vite": "0.7.0"
15
+ "@alepha/cache": "0.7.2",
16
+ "@alepha/core": "0.7.2",
17
+ "@alepha/datetime": "0.7.2",
18
+ "@alepha/lock": "0.7.2",
19
+ "@alepha/postgres": "0.7.2",
20
+ "@alepha/queue": "0.7.2",
21
+ "@alepha/react": "0.7.2",
22
+ "@alepha/react-auth": "0.7.2",
23
+ "@alepha/redis": "0.7.2",
24
+ "@alepha/retry": "0.7.2",
25
+ "@alepha/scheduler": "0.7.2",
26
+ "@alepha/security": "0.7.2",
27
+ "@alepha/server": "0.7.2",
28
+ "@alepha/server-cookies": "0.7.2",
29
+ "@alepha/server-metrics": "0.7.2",
30
+ "@alepha/server-static": "0.7.2",
31
+ "@alepha/server-swagger": "0.7.2",
32
+ "@alepha/testing": "0.7.2",
33
+ "@alepha/topic": "0.7.2",
34
+ "@alepha/vite": "0.7.2"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@types/react": "^19",
@@ -50,15 +50,16 @@
50
50
  }
51
51
  },
52
52
  "devDependencies": {
53
- "@types/react": "^19.1.4",
54
- "pkgroll": "^2.12.2",
53
+ "@types/react": "^19.1.8",
54
+ "pkgroll": "^2.13.1",
55
55
  "react": "^19.1.0"
56
56
  },
57
57
  "scripts": {
58
- "build": "pkgroll --sourcemap --dist ./"
58
+ "build": "pkgroll --dist ./"
59
59
  },
60
60
  "files": [
61
61
  "src",
62
+ "assets",
62
63
  "**/*.js",
63
64
  "**/*.cjs",
64
65
  "**/*.d.ts",
@@ -70,21 +71,31 @@
70
71
  "require": "./core.cjs",
71
72
  "types": "./core.d.ts"
72
73
  },
74
+ "./cache": {
75
+ "import": "./cache.js",
76
+ "require": "./cache.cjs",
77
+ "types": "./cache.d.ts"
78
+ },
73
79
  "./core": {
74
80
  "import": "./core.js",
75
81
  "require": "./core.cjs",
76
82
  "types": "./core.d.ts"
77
83
  },
78
- "./vite": {
79
- "import": "./vite.js",
80
- "require": "./vite.cjs",
81
- "types": "./vite.d.ts"
82
- },
83
84
  "./datetime": {
84
85
  "import": "./datetime.js",
85
86
  "require": "./datetime.cjs",
86
87
  "types": "./datetime.d.ts"
87
88
  },
89
+ "./lock": {
90
+ "import": "./lock.js",
91
+ "require": "./lock.cjs",
92
+ "types": "./lock.d.ts"
93
+ },
94
+ "./postgres": {
95
+ "import": "./postgres.js",
96
+ "require": "./postgres.cjs",
97
+ "types": "./postgres.d.ts"
98
+ },
88
99
  "./react": {
89
100
  "import": "./react.js",
90
101
  "require": "./react.cjs",
@@ -95,30 +106,15 @@
95
106
  "require": "./react/auth.cjs",
96
107
  "types": "./react/auth.d.ts"
97
108
  },
98
- "./cache": {
99
- "import": "./cache.js",
100
- "require": "./cache.cjs",
101
- "types": "./cache.d.ts"
102
- },
103
- "./postgres": {
104
- "import": "./postgres.js",
105
- "require": "./postgres.cjs",
106
- "types": "./postgres.d.ts"
107
- },
108
109
  "./redis": {
109
110
  "import": "./redis.js",
110
111
  "require": "./redis.cjs",
111
112
  "types": "./redis.d.ts"
112
113
  },
113
- "./lock": {
114
- "import": "./lock.js",
115
- "require": "./lock.cjs",
116
- "types": "./lock.d.ts"
117
- },
118
- "./topic": {
119
- "import": "./topic.js",
120
- "require": "./topic.cjs",
121
- "types": "./topic.d.ts"
114
+ "./retry": {
115
+ "import": "./retry.js",
116
+ "require": "./retry.cjs",
117
+ "types": "./retry.d.ts"
122
118
  },
123
119
  "./queue": {
124
120
  "import": "./queue.js",
@@ -150,11 +146,6 @@
150
146
  "require": "./server/metrics.cjs",
151
147
  "types": "./server/metrics.d.ts"
152
148
  },
153
- "./server/proxy": {
154
- "import": "./server/proxy.js",
155
- "require": "./server/proxy.cjs",
156
- "types": "./server/proxy.d.ts"
157
- },
158
149
  "./server/static": {
159
150
  "import": "./server/static.js",
160
151
  "require": "./server/static.cjs",
@@ -164,6 +155,16 @@
164
155
  "import": "./server/swagger.js",
165
156
  "require": "./server/swagger.cjs",
166
157
  "types": "./server/swagger.d.ts"
158
+ },
159
+ "./topic": {
160
+ "import": "./topic.js",
161
+ "require": "./topic.cjs",
162
+ "types": "./topic.d.ts"
163
+ },
164
+ "./vite": {
165
+ "import": "./vite.js",
166
+ "require": "./vite.cjs",
167
+ "types": "./vite.d.ts"
167
168
  }
168
169
  },
169
170
  "keywords": [
package/postgres.cjs CHANGED
@@ -10,4 +10,3 @@ Object.keys(postgres).forEach(function (k) {
10
10
  get: function () { return postgres[k]; }
11
11
  });
12
12
  });
13
- //# sourceMappingURL=postgres.cjs.map