alepha 0.7.5 → 0.7.7

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 (111) hide show
  1. package/cache/redis.cjs +4 -8
  2. package/cache/redis.d.ts +28 -89
  3. package/cache/redis.js +1 -1
  4. package/cache.cjs +4 -8
  5. package/cache.d.ts +189 -265
  6. package/cache.js +1 -1
  7. package/core.cjs +4 -8
  8. package/core.d.ts +951 -929
  9. package/core.js +1 -1
  10. package/datetime.cjs +4 -8
  11. package/datetime.d.ts +151 -146
  12. package/datetime.js +1 -1
  13. package/lock/redis.cjs +7 -49
  14. package/lock/redis.d.ts +15 -12
  15. package/lock/redis.js +1 -47
  16. package/lock.cjs +4 -8
  17. package/lock.d.ts +117 -170
  18. package/lock.js +1 -1
  19. package/package.json +105 -39
  20. package/postgres.cjs +4 -8
  21. package/postgres.d.ts +1410 -4433
  22. package/postgres.js +1 -1
  23. package/queue/redis.cjs +8 -0
  24. package/queue/redis.d.ts +31 -0
  25. package/queue/redis.js +1 -0
  26. package/queue.cjs +4 -8
  27. package/queue.d.ts +162 -205
  28. package/queue.js +1 -1
  29. package/react/auth.cjs +4 -8
  30. package/react/auth.d.ts +161 -282
  31. package/react/auth.js +1 -1
  32. package/react/head.cjs +8 -0
  33. package/react/head.d.ts +86 -0
  34. package/react/head.js +1 -0
  35. package/react.cjs +4 -8
  36. package/react.d.ts +468 -559
  37. package/react.js +1 -1
  38. package/redis.cjs +4 -8
  39. package/redis.d.ts +59 -132
  40. package/redis.js +1 -1
  41. package/retry.cjs +4 -8
  42. package/retry.d.ts +34 -31
  43. package/retry.js +1 -1
  44. package/scheduler.cjs +4 -8
  45. package/scheduler.d.ts +124 -182
  46. package/scheduler.js +1 -1
  47. package/security.cjs +4 -8
  48. package/security.d.ts +459 -595
  49. package/security.js +1 -1
  50. package/server/cache.cjs +4 -8
  51. package/server/cache.d.ts +43 -40
  52. package/server/cache.js +1 -1
  53. package/server/cookies.cjs +4 -8
  54. package/server/cookies.d.ts +49 -41
  55. package/server/cookies.js +1 -1
  56. package/server/cors.cjs +8 -0
  57. package/server/cors.d.ts +25 -0
  58. package/server/cors.js +1 -0
  59. package/server/health.cjs +8 -0
  60. package/server/health.d.ts +42 -0
  61. package/server/health.js +1 -0
  62. package/server/links.cjs +8 -0
  63. package/server/links.d.ts +188 -0
  64. package/server/links.js +1 -0
  65. package/server/proxy.cjs +8 -0
  66. package/server/proxy.d.ts +41 -0
  67. package/server/proxy.js +1 -0
  68. package/server/static.cjs +4 -8
  69. package/server/static.d.ts +98 -95
  70. package/server/static.js +1 -1
  71. package/server/swagger.cjs +4 -8
  72. package/server/swagger.d.ts +96 -92
  73. package/server/swagger.js +1 -1
  74. package/server.cjs +4 -8
  75. package/server.d.ts +602 -1087
  76. package/server.js +1 -1
  77. package/testing.cjs +8 -0
  78. package/testing.d.ts +1 -0
  79. package/testing.js +1 -0
  80. package/topic/redis.cjs +8 -0
  81. package/topic/redis.d.ts +45 -0
  82. package/topic/redis.js +1 -0
  83. package/topic.cjs +4 -8
  84. package/topic.d.ts +161 -169
  85. package/topic.js +1 -1
  86. package/vite.cjs +4 -8
  87. package/vite.d.ts +89 -82
  88. package/vite.js +1 -1
  89. package/src/cache/redis.ts +0 -1
  90. package/src/cache.ts +0 -1
  91. package/src/core.ts +0 -1
  92. package/src/datetime.ts +0 -1
  93. package/src/lock/redis.ts +0 -1
  94. package/src/lock.ts +0 -1
  95. package/src/postgres.ts +0 -1
  96. package/src/queue/redis.ts +0 -1
  97. package/src/queue.ts +0 -1
  98. package/src/react/auth.ts +0 -1
  99. package/src/react.ts +0 -1
  100. package/src/redis.ts +0 -1
  101. package/src/retry.ts +0 -1
  102. package/src/scheduler.ts +0 -1
  103. package/src/security.ts +0 -1
  104. package/src/server/cache.ts +0 -1
  105. package/src/server/cookies.ts +0 -1
  106. package/src/server/static.ts +0 -1
  107. package/src/server/swagger.ts +0 -1
  108. package/src/server.ts +0 -1
  109. package/src/topic/redis.ts +0 -1
  110. package/src/topic.ts +0 -1
  111. 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,84 @@
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
- /**
70
- *
71
- */
72
72
  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>;
73
+ topic: TopicDescriptor<T>;
74
+ handler: (message: {
75
+ payload: Static<T["payload"]>;
76
+ }) => Promise<void>;
84
77
  }
85
- /**
86
- *
87
- */
88
78
  interface SubscriberDescriptor<T extends TopicMessageSchema = TopicMessageSchema> {
89
- [KIND]: typeof KEY;
90
- [OPTIONS]: SubscriberDescriptorOptions<T>;
91
- /**
92
- *
93
- */
94
- topic: () => TopicDescriptor<T>;
79
+ [KIND]: typeof KEY;
80
+ [OPTIONS]: SubscriberDescriptorOptions<T>;
81
+ topic: () => TopicDescriptor<T>;
95
82
  }
96
83
  /**
97
84
  * Subscriber descriptor.
@@ -100,106 +87,110 @@ interface SubscriberDescriptor<T extends TopicMessageSchema = TopicMessageSchema
100
87
  * @returns The descriptor value.
101
88
  */
102
89
  declare const $subscriber: {
103
- <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
104
- [KIND]: string;
90
+ <T extends TopicMessageSchema>(options: SubscriberDescriptorOptions<T>): SubscriberDescriptor<T>;
91
+ [KIND]: string;
105
92
  };
106
-
93
+ //#endregion
94
+ //#region src/errors/TopicTimeoutError.d.ts
107
95
  declare class TopicTimeoutError extends Error {
108
- readonly topic: string;
109
- readonly timeout: number;
110
- constructor(topic: string, timeout: number);
96
+ readonly topic: string;
97
+ readonly timeout: number;
98
+ constructor(topic: string, timeout: number);
111
99
  }
112
-
100
+ //#endregion
101
+ //#region src/providers/MemoryTopicProvider.d.ts
113
102
  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>;
103
+ protected readonly subscriptions: Record<string, SubscribeCallback[]>;
104
+ /**
105
+ * Publish a message to a topic.
106
+ *
107
+ * @param topic
108
+ * @param message
109
+ */
110
+ publish(topic: string, message: string): Promise<void>;
111
+ /**
112
+ * Subscribe to a topic.
113
+ *
114
+ * @param topic - The topic to subscribe to.
115
+ * @param callback
116
+ */
117
+ subscribe(topic: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
118
+ /**
119
+ * Unsubscribe from a topic.
120
+ *
121
+ * @param topic - The topic to unsubscribe from.
122
+ */
123
+ unsubscribe(topic: string): Promise<void>;
135
124
  }
136
-
125
+ //#endregion
126
+ //#region src/providers/TopicDescriptorProvider.d.ts
137
127
  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
- };
128
+ protected readonly log: _alepha_core0.Logger;
129
+ protected readonly alepha: Alepha;
130
+ protected readonly dateTimeProvider: DateTimeProvider;
131
+ protected readonly topicProvider: TopicProvider;
132
+ protected readonly memoryTopicProvider: MemoryTopicProvider;
133
+ protected readonly topics: TopicDescriptor[];
134
+ protected readonly subscribers: Array<SubscriberDescriptorOptions & {
135
+ unsub?: UnSubscribeFn;
136
+ }>;
137
+ protected readonly configure: _alepha_core0.HookDescriptor<"configure">;
138
+ protected readonly start: _alepha_core0.HookDescriptor<"start">;
139
+ /**
140
+ * Process the descriptors.
141
+ *
142
+ * @protected
143
+ */
144
+ protected processDescriptors(): void;
145
+ /**
146
+ * Process the queue descriptors.
147
+ *
148
+ * @protected
149
+ */
150
+ protected processTopicDescriptors(): void;
151
+ /**
152
+ * Wait for a message on the topic.
153
+ *
154
+ * @param topic
155
+ * @param options
156
+ * @protected
157
+ */
158
+ protected wait(topic: TopicDescriptor, options?: TopicWaitOptions<any>): Promise<unknown>;
159
+ /**
160
+ * Process the consumer descriptors.
161
+ *
162
+ * @protected
163
+ */
164
+ protected processSubscriberDescriptors(): void;
165
+ /**
166
+ * Get the provider for the queue.
167
+ *
168
+ * @param options - The queue options.
169
+ * @protected
170
+ */
171
+ protected provider(options: TopicDescriptorOptions): TopicProvider;
172
+ /**
173
+ * Publish a message to the topic.
174
+ *
175
+ * @param topic
176
+ * @param message
177
+ * @protected
178
+ */
179
+ protected publish<T extends TopicMessageSchema = TopicMessageSchema>(topic: TopicDescriptor<T>, message: TopicMessage<T>): Promise<void>;
180
+ /**
181
+ * Process a message.
182
+ *
183
+ * @param subscriber
184
+ * @param message
185
+ * @protected
186
+ */
187
+ protected processMessage(subscriber: SubscriberDescriptorOptions, message: string): Promise<void>;
188
+ protected parseMessage(schema: any, message: string): {
189
+ payload: any;
190
+ };
201
191
  }
202
-
192
+ //#endregion
193
+ //#region src/index.d.ts
203
194
  /**
204
195
  * Alepha Topic Module
205
196
  *
@@ -212,8 +203,9 @@ declare class TopicDescriptorProvider {
212
203
  * @module alepha.topic
213
204
  */
214
205
  declare class AlephaTopic implements Module {
215
- readonly name = "alepha.topic";
216
- readonly $services: (alepha: Alepha) => Alepha;
206
+ readonly name = "alepha.topic";
207
+ readonly $services: (alepha: Alepha) => Alepha;
217
208
  }
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 };
209
+ //#endregion
210
+ export { $subscriber, $topic, AlephaTopic, MemoryTopicProvider, SubscribeCallback, SubscriberDescriptor, SubscriberDescriptorOptions, TopicDescriptor, TopicDescriptorOptions, TopicDescriptorProvider, TopicMessage, TopicMessageSchema, TopicProvider, TopicTimeoutError, TopicWaitOptions, UnSubscribeFn };
211
+ //# 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
+ });