alepha 0.7.4 → 0.7.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.
Files changed (99) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +44 -21
  3. package/cache/redis.cjs +4 -8
  4. package/cache/redis.d.ts +30 -91
  5. package/cache/redis.js +1 -1
  6. package/cache.cjs +4 -8
  7. package/cache.d.ts +190 -259
  8. package/cache.js +1 -1
  9. package/core.cjs +4 -8
  10. package/core.d.ts +950 -925
  11. package/core.js +1 -1
  12. package/datetime.cjs +4 -8
  13. package/datetime.d.ts +151 -140
  14. package/datetime.js +1 -1
  15. package/lock/redis.cjs +7 -49
  16. package/lock/redis.d.ts +17 -14
  17. package/lock/redis.js +1 -47
  18. package/lock.cjs +4 -8
  19. package/lock.d.ts +117 -170
  20. package/lock.js +1 -1
  21. package/package.json +70 -40
  22. package/postgres.cjs +4 -8
  23. package/postgres.d.ts +1314 -4400
  24. package/postgres.js +1 -1
  25. package/queue/redis.cjs +8 -0
  26. package/queue/redis.d.ts +31 -0
  27. package/queue/redis.js +1 -0
  28. package/queue.cjs +4 -8
  29. package/queue.d.ts +162 -205
  30. package/queue.js +1 -1
  31. package/react/auth.cjs +4 -8
  32. package/react/auth.d.ts +167 -280
  33. package/react/auth.js +1 -1
  34. package/react.cjs +4 -8
  35. package/react.d.ts +530 -570
  36. package/react.js +1 -1
  37. package/redis.cjs +4 -8
  38. package/redis.d.ts +59 -132
  39. package/redis.js +1 -1
  40. package/retry.cjs +4 -8
  41. package/retry.d.ts +34 -31
  42. package/retry.js +1 -1
  43. package/scheduler.cjs +4 -8
  44. package/scheduler.d.ts +128 -155
  45. package/scheduler.js +1 -1
  46. package/security.cjs +4 -8
  47. package/security.d.ts +472 -595
  48. package/security.js +1 -1
  49. package/server/cache.cjs +4 -8
  50. package/server/cache.d.ts +73 -39
  51. package/server/cache.js +1 -1
  52. package/server/cookies.cjs +4 -8
  53. package/server/cookies.d.ts +46 -41
  54. package/server/cookies.js +1 -1
  55. package/server/static.cjs +4 -8
  56. package/server/static.d.ts +98 -95
  57. package/server/static.js +1 -1
  58. package/server/swagger.cjs +4 -8
  59. package/server/swagger.d.ts +106 -92
  60. package/server/swagger.js +1 -1
  61. package/server.cjs +4 -8
  62. package/server.d.ts +754 -1025
  63. package/server.js +1 -1
  64. package/testing.cjs +8 -0
  65. package/testing.d.ts +1 -0
  66. package/testing.js +1 -0
  67. package/topic/redis.cjs +8 -0
  68. package/topic/redis.d.ts +45 -0
  69. package/topic/redis.js +1 -0
  70. package/topic.cjs +4 -8
  71. package/topic.d.ts +171 -163
  72. package/topic.js +1 -1
  73. package/vite.cjs +4 -8
  74. package/vite.d.ts +91 -84
  75. package/vite.js +1 -1
  76. package/assets/logo.png +0 -0
  77. package/src/cache/redis.ts +0 -1
  78. package/src/cache.ts +0 -1
  79. package/src/core.ts +0 -1
  80. package/src/datetime.ts +0 -1
  81. package/src/lock/redis.ts +0 -1
  82. package/src/lock.ts +0 -1
  83. package/src/postgres.ts +0 -1
  84. package/src/queue/redis.ts +0 -1
  85. package/src/queue.ts +0 -1
  86. package/src/react/auth.ts +0 -1
  87. package/src/react.ts +0 -1
  88. package/src/redis.ts +0 -1
  89. package/src/retry.ts +0 -1
  90. package/src/scheduler.ts +0 -1
  91. package/src/security.ts +0 -1
  92. package/src/server/cache.ts +0 -1
  93. package/src/server/cookies.ts +0 -1
  94. package/src/server/static.ts +0 -1
  95. package/src/server/swagger.ts +0 -1
  96. package/src/server.ts +0 -1
  97. package/src/topic/redis.ts +0 -1
  98. package/src/topic.ts +0 -1
  99. package/src/vite.ts +0 -1
package/server.js CHANGED
@@ -1 +1 @@
1
- export * from '@alepha/server';
1
+ export * from '@alepha/server'
package/testing.cjs ADDED
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/testing');
3
+ Object.keys(m).forEach(function (k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function () { return m[k]; }
7
+ });
8
+ });
package/testing.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@faker-js/faker";
package/testing.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@alepha/testing'
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+ var m = require('@alepha/topic-redis');
3
+ Object.keys(m).forEach(function (k) {
4
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
5
+ enumerable: true,
6
+ get: function () { return m[k]; }
7
+ });
8
+ });
@@ -0,0 +1,45 @@
1
+ import { SubscribeCallback, TopicProvider, UnSubscribeFn } from "@alepha/topic";
2
+ import * as _alepha_core0 from "@alepha/core";
3
+ import { Alepha } from "@alepha/core";
4
+ import { RedisProvider, RedisSubscriberProvider } from "@alepha/redis";
5
+
6
+ //#region src/providers/RedisTopicProvider.d.ts
7
+ declare class RedisTopicProvider implements TopicProvider {
8
+ protected readonly env: {
9
+ REDIS_TOPIC_PREFIX: string;
10
+ };
11
+ protected readonly redisProvider: RedisProvider;
12
+ protected readonly redisSubscriberProvider: RedisSubscriberProvider;
13
+ protected readonly log: _alepha_core0.Logger;
14
+ protected readonly stop: _alepha_core0.HookDescriptor<"stop">;
15
+ prefix(queue: string): string;
16
+ /**
17
+ * Publish a message to a topic.
18
+ */
19
+ publish(topic: string, message: string): Promise<void>;
20
+ /**
21
+ * Subscribe to a topic.
22
+ */
23
+ subscribe(name: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
24
+ /**
25
+ * Unsubscribe from a topic.
26
+ */
27
+ unsubscribe(name: string, callback?: SubscribeCallback): Promise<void>;
28
+ }
29
+ //#endregion
30
+ //#region src/index.d.ts
31
+ /**
32
+ * Alepha Topic Redis Module.
33
+ *
34
+ * Plugin for Alepha Topic that provides Redis pub/sub capabilities.
35
+ *
36
+ * @see {@link RedisTopicProvider}
37
+ * @module alepha.topic.redis
38
+ */
39
+ declare class AlephaTopicRedis {
40
+ readonly name = "alepha.topic.redis";
41
+ readonly $services: (alepha: Alepha) => Alepha;
42
+ }
43
+ //#endregion
44
+ export { AlephaTopicRedis, RedisTopicProvider };
45
+ //# sourceMappingURL=index.d.ts.map
package/topic/redis.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@alepha/topic-redis'
package/topic.cjs CHANGED
@@ -1,12 +1,8 @@
1
1
  'use strict';
2
-
3
- var topic = require('@alepha/topic');
4
-
5
-
6
-
7
- Object.keys(topic).forEach(function (k) {
2
+ var m = require('@alepha/topic');
3
+ Object.keys(m).forEach(function (k) {
8
4
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
5
  enumerable: true,
10
- get: function () { return topic[k]; }
6
+ get: function () { return m[k]; }
11
7
  });
12
- });
8
+ });
package/topic.d.ts CHANGED
@@ -1,97 +1,100 @@
1
- import * as _alepha_core from '@alepha/core';
2
- import { TSchema, KIND, OPTIONS, Static, Alepha, Module } from '@alepha/core';
3
- import { DurationLike, DateTimeProvider } from '@alepha/datetime';
1
+ import * as _alepha_core0 from "@alepha/core";
2
+ import { Alepha, KIND, Module, OPTIONS, Static, TSchema } from "@alepha/core";
3
+ import { DateTimeProvider, DurationLike } from "@alepha/datetime";
4
4
 
5
+ //#region src/providers/TopicProvider.d.ts
5
6
  declare class TopicProvider {
6
- constructor();
7
- /**
8
- * Publish a message to a topic.
9
- *
10
- * @param topic - The topic to publish to.
11
- * @param message - The message to publish.
12
- */
13
- publish(_topic: string, _message: string): Promise<void>;
14
- /**
15
- * Subscribe to a topic.
16
- *
17
- * @param topic - The topic to subscribe to.
18
- * @param callback - The callback to call when a message is received.
19
- */
20
- subscribe(_topic: string, _callback: SubscribeCallback): Promise<UnSubscribeFn>;
21
- /**
22
- * Unsubscribe from a topic.
23
- *
24
- * @param topic - The topic to unsubscribe from.
25
- */
26
- unsubscribe(_topic: string): Promise<void>;
7
+ constructor();
8
+ /**
9
+ * Publish a message to a topic.
10
+ *
11
+ * @param topic - The topic to publish to.
12
+ * @param message - The message to publish.
13
+ */
14
+ publish(_topic: string, _message: string): Promise<void>;
15
+ /**
16
+ * Subscribe to a topic.
17
+ *
18
+ * @param topic - The topic to subscribe to.
19
+ * @param callback - The callback to call when a message is received.
20
+ */
21
+ subscribe(_topic: string, _callback: SubscribeCallback): Promise<UnSubscribeFn>;
22
+ /**
23
+ * Unsubscribe from a topic.
24
+ *
25
+ * @param topic - The topic to unsubscribe from.
26
+ */
27
+ unsubscribe(_topic: string): Promise<void>;
27
28
  }
28
29
  type SubscribeCallback = (message: string) => Promise<void> | void;
29
30
  type UnSubscribeFn = () => Promise<void>;
30
-
31
+ //#endregion
32
+ //#region src/descriptors/$topic.d.ts
31
33
  declare const KEY$1 = "TOPIC";
32
34
  interface TopicMessageSchema {
33
- headers?: TSchema;
34
- payload: TSchema;
35
+ headers?: TSchema;
36
+ payload: TSchema;
35
37
  }
36
38
  interface TopicDescriptorOptions<T extends TopicMessageSchema = TopicMessageSchema> {
37
- name?: string;
38
- description?: string;
39
- provider?: "memory" | (() => TopicProvider);
40
- schema: T;
41
- handler?: (message: {
42
- payload: Static<T["payload"]>;
43
- }) => Promise<void>;
39
+ name?: string;
40
+ description?: string;
41
+ provider?: "memory" | (() => TopicProvider);
42
+ schema: T;
43
+ handler?: (message: {
44
+ payload: Static<T["payload"]>;
45
+ }) => Promise<void>;
44
46
  }
45
47
  interface TopicDescriptor<T extends TopicMessageSchema = TopicMessageSchema> {
46
- [KIND]: typeof KEY$1;
47
- [OPTIONS]: TopicDescriptorOptions<T>;
48
- name(): string;
49
- provider(): TopicProvider;
50
- publish(payload: Static<T["payload"]>): Promise<void>;
51
- subscribe(fn: (message: TopicMessage<T>) => void): Promise<UnSubscribeFn>;
52
- wait(options?: TopicWaitOptions<T>): Promise<Static<T["payload"]>>;
48
+ [KIND]: typeof KEY$1;
49
+ [OPTIONS]: TopicDescriptorOptions<T>;
50
+ name(): string;
51
+ provider(): TopicProvider;
52
+ publish(payload: Static<T["payload"]>): Promise<void>;
53
+ subscribe(fn: (message: TopicMessage<T>) => void): Promise<UnSubscribeFn>;
54
+ wait(options?: TopicWaitOptions<T>): Promise<Static<T["payload"]>>;
53
55
  }
54
56
  interface TopicMessage<T extends TopicMessageSchema = TopicMessageSchema> {
55
- payload: Static<T["payload"]>;
57
+ payload: Static<T["payload"]>;
56
58
  }
57
59
  interface TopicWaitOptions<T extends TopicMessageSchema> {
58
- timeout?: DurationLike;
59
- filter?: (message: {
60
- payload: Static<T["payload"]>;
61
- }) => boolean;
60
+ timeout?: DurationLike;
61
+ filter?: (message: {
62
+ payload: Static<T["payload"]>;
63
+ }) => boolean;
62
64
  }
63
65
  declare const $topic: {
64
- <T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
65
- [KIND]: string;
66
+ <T extends TopicMessageSchema>(options: TopicDescriptorOptions<T>): TopicDescriptor<T>;
67
+ [KIND]: string;
66
68
  };
67
-
69
+ //#endregion
70
+ //#region src/descriptors/$subscriber.d.ts
68
71
  declare const KEY = "SUBSCRIBER";
69
72
  /**
70
73
  *
71
74
  */
72
75
  interface SubscriberDescriptorOptions<T extends TopicMessageSchema = TopicMessageSchema> {
73
- /**
74
- *
75
- */
76
- topic: TopicDescriptor<T>;
77
- /**
78
- *
79
- * @param message
80
- */
81
- handler: (message: {
82
- payload: Static<T["payload"]>;
83
- }) => Promise<void>;
76
+ /**
77
+ *
78
+ */
79
+ topic: TopicDescriptor<T>;
80
+ /**
81
+ *
82
+ * @param message
83
+ */
84
+ handler: (message: {
85
+ payload: Static<T["payload"]>;
86
+ }) => Promise<void>;
84
87
  }
85
88
  /**
86
89
  *
87
90
  */
88
91
  interface SubscriberDescriptor<T extends TopicMessageSchema = TopicMessageSchema> {
89
- [KIND]: typeof KEY;
90
- [OPTIONS]: SubscriberDescriptorOptions<T>;
91
- /**
92
- *
93
- */
94
- topic: () => TopicDescriptor<T>;
92
+ [KIND]: typeof KEY;
93
+ [OPTIONS]: SubscriberDescriptorOptions<T>;
94
+ /**
95
+ *
96
+ */
97
+ topic: () => TopicDescriptor<T>;
95
98
  }
96
99
  /**
97
100
  * Subscriber descriptor.
@@ -100,106 +103,110 @@ interface SubscriberDescriptor<T extends TopicMessageSchema = TopicMessageSchema
100
103
  * @returns The descriptor value.
101
104
  */
102
105
  declare const $subscriber: {
103
- <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
104
- [KIND]: string;
106
+ <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
107
+ [KIND]: string;
105
108
  };
106
-
109
+ //#endregion
110
+ //#region src/errors/TopicTimeoutError.d.ts
107
111
  declare class TopicTimeoutError extends Error {
108
- readonly topic: string;
109
- readonly timeout: number;
110
- constructor(topic: string, timeout: number);
112
+ readonly topic: string;
113
+ readonly timeout: number;
114
+ constructor(topic: string, timeout: number);
111
115
  }
112
-
116
+ //#endregion
117
+ //#region src/providers/MemoryTopicProvider.d.ts
113
118
  declare class MemoryTopicProvider implements TopicProvider {
114
- protected readonly subscriptions: Record<string, SubscribeCallback[]>;
115
- /**
116
- * Publish a message to a topic.
117
- *
118
- * @param topic
119
- * @param message
120
- */
121
- publish(topic: string, message: string): Promise<void>;
122
- /**
123
- * Subscribe to a topic.
124
- *
125
- * @param topic - The topic to subscribe to.
126
- * @param callback
127
- */
128
- subscribe(topic: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
129
- /**
130
- * Unsubscribe from a topic.
131
- *
132
- * @param topic - The topic to unsubscribe from.
133
- */
134
- unsubscribe(topic: string): Promise<void>;
119
+ protected readonly subscriptions: Record<string, SubscribeCallback[]>;
120
+ /**
121
+ * Publish a message to a topic.
122
+ *
123
+ * @param topic
124
+ * @param message
125
+ */
126
+ publish(topic: string, message: string): Promise<void>;
127
+ /**
128
+ * Subscribe to a topic.
129
+ *
130
+ * @param topic - The topic to subscribe to.
131
+ * @param callback
132
+ */
133
+ subscribe(topic: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
134
+ /**
135
+ * Unsubscribe from a topic.
136
+ *
137
+ * @param topic - The topic to unsubscribe from.
138
+ */
139
+ unsubscribe(topic: string): Promise<void>;
135
140
  }
136
-
141
+ //#endregion
142
+ //#region src/providers/TopicDescriptorProvider.d.ts
137
143
  declare class TopicDescriptorProvider {
138
- protected readonly log: _alepha_core.Logger;
139
- protected readonly alepha: Alepha;
140
- protected readonly dateTimeProvider: DateTimeProvider;
141
- protected readonly topicProvider: TopicProvider;
142
- protected readonly memoryTopicProvider: MemoryTopicProvider;
143
- protected readonly topics: TopicDescriptor[];
144
- protected readonly subscribers: Array<SubscriberDescriptorOptions & {
145
- unsub?: UnSubscribeFn;
146
- }>;
147
- protected readonly configure: _alepha_core.HookDescriptor<"configure">;
148
- protected readonly start: _alepha_core.HookDescriptor<"start">;
149
- /**
150
- * Process the descriptors.
151
- *
152
- * @protected
153
- */
154
- protected processDescriptors(): void;
155
- /**
156
- * Process the queue descriptors.
157
- *
158
- * @protected
159
- */
160
- protected processTopicDescriptors(): void;
161
- /**
162
- * Wait for a message on the topic.
163
- *
164
- * @param topic
165
- * @param options
166
- * @protected
167
- */
168
- protected wait(topic: TopicDescriptor, options?: TopicWaitOptions<any>): Promise<unknown>;
169
- /**
170
- * Process the consumer descriptors.
171
- *
172
- * @protected
173
- */
174
- protected processSubscriberDescriptors(): void;
175
- /**
176
- * Get the provider for the queue.
177
- *
178
- * @param options - The queue options.
179
- * @protected
180
- */
181
- protected provider(options: TopicDescriptorOptions): TopicProvider;
182
- /**
183
- * Publish a message to the topic.
184
- *
185
- * @param topic
186
- * @param message
187
- * @protected
188
- */
189
- protected publish<T extends TopicMessageSchema = TopicMessageSchema>(topic: TopicDescriptor<T>, message: TopicMessage<T>): Promise<void>;
190
- /**
191
- * Process a message.
192
- *
193
- * @param subscriber
194
- * @param message
195
- * @protected
196
- */
197
- protected processMessage(subscriber: SubscriberDescriptorOptions, message: string): Promise<void>;
198
- protected parseMessage(schema: any, message: string): {
199
- payload: any;
200
- };
144
+ protected readonly log: _alepha_core0.Logger;
145
+ protected readonly alepha: Alepha;
146
+ protected readonly dateTimeProvider: DateTimeProvider;
147
+ protected readonly topicProvider: TopicProvider;
148
+ protected readonly memoryTopicProvider: MemoryTopicProvider;
149
+ protected readonly topics: TopicDescriptor[];
150
+ protected readonly subscribers: Array<SubscriberDescriptorOptions & {
151
+ unsub?: UnSubscribeFn;
152
+ }>;
153
+ protected readonly configure: _alepha_core0.HookDescriptor<"configure">;
154
+ protected readonly start: _alepha_core0.HookDescriptor<"start">;
155
+ /**
156
+ * Process the descriptors.
157
+ *
158
+ * @protected
159
+ */
160
+ protected processDescriptors(): void;
161
+ /**
162
+ * Process the queue descriptors.
163
+ *
164
+ * @protected
165
+ */
166
+ protected processTopicDescriptors(): void;
167
+ /**
168
+ * Wait for a message on the topic.
169
+ *
170
+ * @param topic
171
+ * @param options
172
+ * @protected
173
+ */
174
+ protected wait(topic: TopicDescriptor, options?: TopicWaitOptions<any>): Promise<unknown>;
175
+ /**
176
+ * Process the consumer descriptors.
177
+ *
178
+ * @protected
179
+ */
180
+ protected processSubscriberDescriptors(): void;
181
+ /**
182
+ * Get the provider for the queue.
183
+ *
184
+ * @param options - The queue options.
185
+ * @protected
186
+ */
187
+ protected provider(options: TopicDescriptorOptions): TopicProvider;
188
+ /**
189
+ * Publish a message to the topic.
190
+ *
191
+ * @param topic
192
+ * @param message
193
+ * @protected
194
+ */
195
+ protected publish<T extends TopicMessageSchema = TopicMessageSchema>(topic: TopicDescriptor<T>, message: TopicMessage<T>): Promise<void>;
196
+ /**
197
+ * Process a message.
198
+ *
199
+ * @param subscriber
200
+ * @param message
201
+ * @protected
202
+ */
203
+ protected processMessage(subscriber: SubscriberDescriptorOptions, message: string): Promise<void>;
204
+ protected parseMessage(schema: any, message: string): {
205
+ payload: any;
206
+ };
201
207
  }
202
-
208
+ //#endregion
209
+ //#region src/index.d.ts
203
210
  /**
204
211
  * Alepha Topic Module
205
212
  *
@@ -212,8 +219,9 @@ declare class TopicDescriptorProvider {
212
219
  * @module alepha.topic
213
220
  */
214
221
  declare class AlephaTopic implements Module {
215
- readonly name = "alepha.topic";
216
- readonly $services: (alepha: Alepha) => Alepha;
222
+ readonly name = "alepha.topic";
223
+ readonly $services: (alepha: Alepha) => Alepha;
217
224
  }
218
-
219
- export { $subscriber, $topic, AlephaTopic, MemoryTopicProvider, type SubscribeCallback, type SubscriberDescriptor, type SubscriberDescriptorOptions, type TopicDescriptor, type TopicDescriptorOptions, TopicDescriptorProvider, type TopicMessage, type TopicMessageSchema, TopicProvider, TopicTimeoutError, type TopicWaitOptions, type UnSubscribeFn };
225
+ //#endregion
226
+ export { $subscriber, $topic, AlephaTopic, MemoryTopicProvider, SubscribeCallback, SubscriberDescriptor, SubscriberDescriptorOptions, TopicDescriptor, TopicDescriptorOptions, TopicDescriptorProvider, TopicMessage, TopicMessageSchema, TopicProvider, TopicTimeoutError, TopicWaitOptions, UnSubscribeFn };
227
+ //# sourceMappingURL=index.d.ts.map
package/topic.js CHANGED
@@ -1 +1 @@
1
- export * from '@alepha/topic';
1
+ export * from '@alepha/topic'
package/vite.cjs CHANGED
@@ -1,12 +1,8 @@
1
1
  'use strict';
2
-
3
- var vite = require('@alepha/vite');
4
-
5
-
6
-
7
- Object.keys(vite).forEach(function (k) {
2
+ var m = require('@alepha/vite');
3
+ Object.keys(m).forEach(function (k) {
8
4
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
5
  enumerable: true,
10
- get: function () { return vite[k]; }
6
+ get: function () { return m[k]; }
11
7
  });
12
- });
8
+ });