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.
- package/cache/redis.cjs +4 -8
- package/cache/redis.d.ts +28 -89
- package/cache/redis.js +1 -1
- package/cache.cjs +4 -8
- package/cache.d.ts +189 -265
- package/cache.js +1 -1
- package/core.cjs +4 -8
- package/core.d.ts +951 -929
- package/core.js +1 -1
- package/datetime.cjs +4 -8
- package/datetime.d.ts +151 -146
- package/datetime.js +1 -1
- package/lock/redis.cjs +7 -49
- package/lock/redis.d.ts +15 -12
- package/lock/redis.js +1 -47
- package/lock.cjs +4 -8
- package/lock.d.ts +117 -170
- package/lock.js +1 -1
- package/package.json +105 -39
- package/postgres.cjs +4 -8
- package/postgres.d.ts +1410 -4433
- package/postgres.js +1 -1
- package/queue/redis.cjs +8 -0
- package/queue/redis.d.ts +31 -0
- package/queue/redis.js +1 -0
- package/queue.cjs +4 -8
- package/queue.d.ts +162 -205
- package/queue.js +1 -1
- package/react/auth.cjs +4 -8
- package/react/auth.d.ts +161 -282
- package/react/auth.js +1 -1
- package/react/head.cjs +8 -0
- package/react/head.d.ts +86 -0
- package/react/head.js +1 -0
- package/react.cjs +4 -8
- package/react.d.ts +468 -559
- package/react.js +1 -1
- package/redis.cjs +4 -8
- package/redis.d.ts +59 -132
- package/redis.js +1 -1
- package/retry.cjs +4 -8
- package/retry.d.ts +34 -31
- package/retry.js +1 -1
- package/scheduler.cjs +4 -8
- package/scheduler.d.ts +124 -182
- package/scheduler.js +1 -1
- package/security.cjs +4 -8
- package/security.d.ts +459 -595
- package/security.js +1 -1
- package/server/cache.cjs +4 -8
- package/server/cache.d.ts +43 -40
- package/server/cache.js +1 -1
- package/server/cookies.cjs +4 -8
- package/server/cookies.d.ts +49 -41
- package/server/cookies.js +1 -1
- package/server/cors.cjs +8 -0
- package/server/cors.d.ts +25 -0
- package/server/cors.js +1 -0
- package/server/health.cjs +8 -0
- package/server/health.d.ts +42 -0
- package/server/health.js +1 -0
- package/server/links.cjs +8 -0
- package/server/links.d.ts +188 -0
- package/server/links.js +1 -0
- package/server/proxy.cjs +8 -0
- package/server/proxy.d.ts +41 -0
- package/server/proxy.js +1 -0
- package/server/static.cjs +4 -8
- package/server/static.d.ts +98 -95
- package/server/static.js +1 -1
- package/server/swagger.cjs +4 -8
- package/server/swagger.d.ts +96 -92
- package/server/swagger.js +1 -1
- package/server.cjs +4 -8
- package/server.d.ts +602 -1087
- package/server.js +1 -1
- package/testing.cjs +8 -0
- package/testing.d.ts +1 -0
- package/testing.js +1 -0
- package/topic/redis.cjs +8 -0
- package/topic/redis.d.ts +45 -0
- package/topic/redis.js +1 -0
- package/topic.cjs +4 -8
- package/topic.d.ts +161 -169
- package/topic.js +1 -1
- package/vite.cjs +4 -8
- package/vite.d.ts +89 -82
- package/vite.js +1 -1
- package/src/cache/redis.ts +0 -1
- package/src/cache.ts +0 -1
- package/src/core.ts +0 -1
- package/src/datetime.ts +0 -1
- package/src/lock/redis.ts +0 -1
- package/src/lock.ts +0 -1
- package/src/postgres.ts +0 -1
- package/src/queue/redis.ts +0 -1
- package/src/queue.ts +0 -1
- package/src/react/auth.ts +0 -1
- package/src/react.ts +0 -1
- package/src/redis.ts +0 -1
- package/src/retry.ts +0 -1
- package/src/scheduler.ts +0 -1
- package/src/security.ts +0 -1
- package/src/server/cache.ts +0 -1
- package/src/server/cookies.ts +0 -1
- package/src/server/static.ts +0 -1
- package/src/server/swagger.ts +0 -1
- package/src/server.ts +0 -1
- package/src/topic/redis.ts +0 -1
- package/src/topic.ts +0 -1
- package/src/vite.ts +0 -1
package/scheduler.d.ts
CHANGED
|
@@ -1,206 +1,147 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import * as
|
|
5
|
-
import {
|
|
1
|
+
import * as _alepha_core9 from "@alepha/core";
|
|
2
|
+
import * as _alepha_core2 from "@alepha/core";
|
|
3
|
+
import { Alepha, Async, KIND, OPTIONS, Static } from "@alepha/core";
|
|
4
|
+
import * as _alepha_lock8 from "@alepha/lock";
|
|
5
|
+
import { DateTime, DateTimeProvider, DurationLike, Interval } from "@alepha/datetime";
|
|
6
|
+
import { Cron } from "cron-schedule";
|
|
7
|
+
import * as _sinclair_typebox0 from "@sinclair/typebox";
|
|
8
|
+
import * as dayjs10 from "dayjs";
|
|
6
9
|
|
|
10
|
+
//#region src/descriptors/$scheduler.d.ts
|
|
7
11
|
declare const KEY = "SCHEDULER";
|
|
8
12
|
/**
|
|
9
13
|
* Scheduler descriptor.
|
|
10
14
|
*/
|
|
11
15
|
declare const $scheduler: {
|
|
12
|
-
|
|
13
|
-
|
|
16
|
+
(options: SchedulerDescriptorOptions): SchedulerDescriptor;
|
|
17
|
+
[KIND]: string;
|
|
14
18
|
};
|
|
15
19
|
declare const isScheduler: (value: any) => value is SchedulerDescriptor;
|
|
16
20
|
type SchedulerDescriptorOptions = {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Function to run on schedule.
|
|
23
|
+
*/
|
|
24
|
+
handler: (args: SchedulerHandlerArguments) => Async<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Name of the scheduler. Defaults to the function name.
|
|
27
|
+
*/
|
|
28
|
+
name?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Optional description of the scheduler.
|
|
31
|
+
*/
|
|
32
|
+
description?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Cron expression or interval to run the scheduler.
|
|
35
|
+
*/
|
|
36
|
+
cron?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Cron expression or interval to run the scheduler.
|
|
39
|
+
*/
|
|
40
|
+
interval?: DurationLike;
|
|
41
|
+
/**
|
|
42
|
+
* If true, the scheduler will be locked and only one instance will run at a time.
|
|
43
|
+
* You probably need to import {@link AlephaLockRedis} for distributed locking.
|
|
44
|
+
*
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
lock?: boolean;
|
|
44
48
|
};
|
|
45
49
|
interface SchedulerDescriptor {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
[KIND]: typeof KEY;
|
|
51
|
+
[OPTIONS]: SchedulerDescriptorOptions;
|
|
52
|
+
(): Promise<void>;
|
|
49
53
|
}
|
|
50
54
|
interface SchedulerHandlerArguments {
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Symbol key applied to readonly types */
|
|
55
|
-
declare const ReadonlyKind: unique symbol;
|
|
56
|
-
/** Symbol key applied to optional types */
|
|
57
|
-
declare const OptionalKind: unique symbol;
|
|
58
|
-
/** Symbol key applied to types */
|
|
59
|
-
declare const Hint: unique symbol;
|
|
60
|
-
/** Symbol key applied to types */
|
|
61
|
-
declare const Kind: unique symbol;
|
|
62
|
-
|
|
63
|
-
type StringFormatOption = 'date-time' | 'time' | 'date' | 'email' | 'idn-email' | 'hostname' | 'idn-hostname' | 'ipv4' | 'ipv6' | 'uri' | 'uri-reference' | 'iri' | 'uuid' | 'iri-reference' | 'uri-template' | 'json-pointer' | 'relative-json-pointer' | 'regex' | ({} & string);
|
|
64
|
-
type StringContentEncodingOption = '7bit' | '8bit' | 'binary' | 'quoted-printable' | 'base64' | ({} & string);
|
|
65
|
-
interface StringOptions extends SchemaOptions {
|
|
66
|
-
/** The maximum string length */
|
|
67
|
-
maxLength?: number;
|
|
68
|
-
/** The minimum string length */
|
|
69
|
-
minLength?: number;
|
|
70
|
-
/** A regular expression pattern this string should match */
|
|
71
|
-
pattern?: string;
|
|
72
|
-
/** A format this string should match */
|
|
73
|
-
format?: StringFormatOption;
|
|
74
|
-
/** The content encoding for this string */
|
|
75
|
-
contentEncoding?: StringContentEncodingOption;
|
|
76
|
-
/** The content media type for this string */
|
|
77
|
-
contentMediaType?: string;
|
|
78
|
-
}
|
|
79
|
-
interface TString extends TSchema, StringOptions {
|
|
80
|
-
[Kind]: 'String';
|
|
81
|
-
static: string;
|
|
82
|
-
type: 'string';
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
type TOptional<T extends TSchema> = T & {
|
|
86
|
-
[OptionalKind]: 'Optional';
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
interface SchemaOptions {
|
|
90
|
-
$schema?: string;
|
|
91
|
-
/** Id for this schema */
|
|
92
|
-
$id?: string;
|
|
93
|
-
/** Title of this schema */
|
|
94
|
-
title?: string;
|
|
95
|
-
/** Description of this schema */
|
|
96
|
-
description?: string;
|
|
97
|
-
/** Default value for this schema */
|
|
98
|
-
default?: any;
|
|
99
|
-
/** Example values matching this schema */
|
|
100
|
-
examples?: any;
|
|
101
|
-
/** Optional annotation for readOnly */
|
|
102
|
-
readOnly?: boolean;
|
|
103
|
-
/** Optional annotation for writeOnly */
|
|
104
|
-
writeOnly?: boolean;
|
|
105
|
-
[prop: string]: any;
|
|
106
|
-
}
|
|
107
|
-
interface TKind {
|
|
108
|
-
[Kind]: string;
|
|
55
|
+
now: DateTime;
|
|
109
56
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
[OptionalKind]?: string;
|
|
113
|
-
[Hint]?: string;
|
|
114
|
-
params: unknown[];
|
|
115
|
-
static: unknown;
|
|
116
|
-
}
|
|
117
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
//#region src/providers/CronScheduler.d.ts
|
|
118
59
|
interface CronJob {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
60
|
+
handler: (context: {
|
|
61
|
+
now: DateTime;
|
|
62
|
+
}) => Promise<void>;
|
|
63
|
+
cron: Cron;
|
|
64
|
+
loop: boolean;
|
|
65
|
+
running?: boolean;
|
|
66
|
+
onError?: (error: Error) => void;
|
|
67
|
+
abort: AbortController;
|
|
127
68
|
}
|
|
128
69
|
declare class CronProvider {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
70
|
+
protected readonly dt: DateTimeProvider;
|
|
71
|
+
protected readonly alepha: Alepha;
|
|
72
|
+
protected readonly log: _alepha_core9.Logger;
|
|
73
|
+
start(cron: CronJob): void;
|
|
74
|
+
stop(cron: CronJob): void;
|
|
75
|
+
create(expression: string, handler: (context: {
|
|
76
|
+
now: DateTime;
|
|
77
|
+
}) => Promise<void>): CronJob;
|
|
78
|
+
run(task: CronJob, now?: dayjs10.Dayjs): void;
|
|
138
79
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/providers/SchedulerDescriptorProvider.d.ts
|
|
82
|
+
declare const envSchema: _alepha_core2.TObject<{
|
|
83
|
+
SCHEDULER_PREFIX: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
|
|
142
84
|
}>;
|
|
143
85
|
declare module "alepha" {
|
|
144
|
-
|
|
145
|
-
}
|
|
86
|
+
interface Env extends Partial<Static<typeof envSchema>> {}
|
|
146
87
|
}
|
|
147
88
|
declare class SchedulerDescriptorProvider {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
protected getLockGracePeriod(options: SchedulerDescriptorOptions): number;
|
|
89
|
+
protected readonly log: _alepha_core2.Logger;
|
|
90
|
+
protected readonly env: {
|
|
91
|
+
SCHEDULER_PREFIX?: string | undefined;
|
|
92
|
+
};
|
|
93
|
+
protected readonly alepha: Alepha;
|
|
94
|
+
protected readonly dateTimeProvider: DateTimeProvider;
|
|
95
|
+
protected readonly cronProvider: CronProvider;
|
|
96
|
+
protected readonly schedulers: Scheduler[];
|
|
97
|
+
protected readonly configure: _alepha_core2.HookDescriptor<"configure">;
|
|
98
|
+
protected readonly start: _alepha_core2.HookDescriptor<"start">;
|
|
99
|
+
protected readonly stop: _alepha_core2.HookDescriptor<"stop">;
|
|
100
|
+
/**
|
|
101
|
+
* Get the schedulers.
|
|
102
|
+
*/
|
|
103
|
+
getSchedulers(): Scheduler[];
|
|
104
|
+
/**
|
|
105
|
+
* Process scheduler descriptors.
|
|
106
|
+
*
|
|
107
|
+
* @protected
|
|
108
|
+
*/
|
|
109
|
+
protected processSchedulerDescriptors(): void;
|
|
110
|
+
/**
|
|
111
|
+
* Create a scheduler.
|
|
112
|
+
*
|
|
113
|
+
* @param options - The scheduler options.
|
|
114
|
+
* @param instance - The instance of the scheduler.
|
|
115
|
+
* @param key - Property key name.
|
|
116
|
+
* @protected
|
|
117
|
+
*/
|
|
118
|
+
protected createScheduler(options: SchedulerDescriptorOptions, instance: any, key: string): Scheduler;
|
|
119
|
+
protected createHandler(name: string, options: SchedulerDescriptorOptions): (args: SchedulerHandlerArguments) => Promise<void>;
|
|
120
|
+
trigger(name: string): Promise<void>;
|
|
121
|
+
protected runLock: _alepha_lock8.LockDescriptor<(options: SchedulerDescriptorOptions & {
|
|
122
|
+
name: string;
|
|
123
|
+
args: SchedulerHandlerArguments;
|
|
124
|
+
}) => Promise<void>>;
|
|
125
|
+
/**
|
|
126
|
+
* Prefix the scheduler key.
|
|
127
|
+
*/
|
|
128
|
+
protected prefix(key: string): string;
|
|
129
|
+
/**
|
|
130
|
+
*
|
|
131
|
+
* @param options
|
|
132
|
+
* @protected
|
|
133
|
+
*/
|
|
134
|
+
protected getLockGracePeriod(options: SchedulerDescriptorOptions): number;
|
|
195
135
|
}
|
|
196
136
|
interface Scheduler {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
137
|
+
name: string;
|
|
138
|
+
options: SchedulerDescriptorOptions;
|
|
139
|
+
trigger: (args: SchedulerHandlerArguments) => Promise<void>;
|
|
140
|
+
cron?: CronJob;
|
|
141
|
+
interval?: Interval;
|
|
202
142
|
}
|
|
203
|
-
|
|
143
|
+
//#endregion
|
|
144
|
+
//#region src/index.d.ts
|
|
204
145
|
/**
|
|
205
146
|
* Alepha Scheduler Module
|
|
206
147
|
*
|
|
@@ -210,8 +151,9 @@ interface Scheduler {
|
|
|
210
151
|
* @module alepha.scheduler
|
|
211
152
|
*/
|
|
212
153
|
declare class AlephaScheduler {
|
|
213
|
-
|
|
214
|
-
|
|
154
|
+
readonly name = "alepha.scheduler";
|
|
155
|
+
readonly $services: (alepha: Alepha) => Alepha;
|
|
215
156
|
}
|
|
216
|
-
|
|
217
|
-
export { $scheduler, AlephaScheduler,
|
|
157
|
+
//#endregion
|
|
158
|
+
export { $scheduler, AlephaScheduler, Scheduler, SchedulerDescriptor, SchedulerDescriptorOptions, SchedulerDescriptorProvider, SchedulerHandlerArguments, isScheduler };
|
|
159
|
+
//# sourceMappingURL=index.d.ts.map
|
package/scheduler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '@alepha/scheduler'
|
|
1
|
+
export * from '@alepha/scheduler'
|
package/security.cjs
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(security).forEach(function (k) {
|
|
2
|
+
var m = require('@alepha/security');
|
|
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
|
|
6
|
+
get: function () { return m[k]; }
|
|
11
7
|
});
|
|
12
|
-
});
|
|
8
|
+
});
|