alepha 0.7.1 → 0.7.3
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/datetime.d.ts +54 -66
- package/lock.d.ts +1 -12
- package/package.json +26 -33
- package/postgres.d.ts +454 -455
- package/react.d.ts +6 -50
- package/redis.d.ts +10 -8
- package/scheduler.d.ts +2 -2
- package/server/{proxy.cjs → cache.cjs} +3 -3
- package/server/cache.d.ts +51 -0
- package/server/cache.js +1 -0
- package/server.d.ts +3 -20
- package/src/server/cache.ts +1 -0
- package/topic.d.ts +0 -17
- package/vite.d.ts +45 -21
- package/server/metrics.cjs +0 -12
- package/server/metrics.d.ts +0 -14
- package/server/metrics.js +0 -1
- package/server/proxy.d.ts +0 -1
- package/server/proxy.js +0 -1
- package/src/server/metrics.ts +0 -1
- package/src/server/proxy.ts +0 -1
package/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
2
|
import { TSchema as TSchema$1, KIND, OPTIONS, Static as Static$1, Async, Alepha, Service, TObject as TObject$1 } from '@alepha/core';
|
|
3
|
-
import { ServerRoute, ApiLinksResponse, HttpClient, ClientScope, HttpVirtualClient, ServerRouterProvider, ServerTimingProvider, ServerHandler
|
|
3
|
+
import { ServerRoute, ServerRequest, ApiLinksResponse, HttpClient, ClientScope, HttpVirtualClient, ServerRouterProvider, ServerTimingProvider, ServerHandler } from '@alepha/server';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import React__default, { PropsWithChildren, ReactNode, FC, ErrorInfo, AnchorHTMLAttributes } from 'react';
|
|
6
6
|
import { Root } from 'react-dom/client';
|
|
@@ -227,6 +227,7 @@ interface PageDescriptorOptions<TConfig extends PageConfigSchema = PageConfigSch
|
|
|
227
227
|
* If true, the page will be rendered on the client-side.
|
|
228
228
|
*/
|
|
229
229
|
client?: boolean | ClientOnlyProps;
|
|
230
|
+
afterHandler?: (request: ServerRequest) => any;
|
|
230
231
|
}
|
|
231
232
|
interface PageDescriptor<TConfig extends PageConfigSchema = PageConfigSchema, TProps extends object = TPropsDefault, TPropsParent extends object = TPropsParentDefault> {
|
|
232
233
|
[KIND]: typeof KEY;
|
|
@@ -296,11 +297,11 @@ interface PageRequestConfig<TConfig extends PageConfigSchema = PageConfigSchema>
|
|
|
296
297
|
}
|
|
297
298
|
type PageResolve<TConfig extends PageConfigSchema = PageConfigSchema, TPropsParent extends object = TPropsParentDefault> = PageRequestConfig<TConfig> & TPropsParent & PageReactContext;
|
|
298
299
|
|
|
299
|
-
declare const envSchema$
|
|
300
|
+
declare const envSchema$1: _alepha_core.TObject<{
|
|
300
301
|
REACT_STRICT_MODE: TBoolean;
|
|
301
302
|
}>;
|
|
302
303
|
declare module "alepha" {
|
|
303
|
-
interface Env extends Partial<Static$1<typeof envSchema$
|
|
304
|
+
interface Env extends Partial<Static$1<typeof envSchema$1>> {
|
|
304
305
|
}
|
|
305
306
|
}
|
|
306
307
|
declare class PageDescriptorProvider {
|
|
@@ -445,22 +446,12 @@ declare class BrowserRouterProvider extends RouterProvider<BrowserRoute> {
|
|
|
445
446
|
root(state: RouterState, context: PageReactContext): ReactNode;
|
|
446
447
|
}
|
|
447
448
|
|
|
448
|
-
declare const envSchema$1: _alepha_core.TObject<{
|
|
449
|
-
REACT_ROOT_ID: TString;
|
|
450
|
-
}>;
|
|
451
|
-
declare module "alepha/core" {
|
|
452
|
-
interface Env extends Partial<Static$1<typeof envSchema$1>> {
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
449
|
declare class ReactBrowserProvider {
|
|
456
450
|
protected readonly log: _alepha_core.Logger;
|
|
457
451
|
protected readonly client: HttpClient;
|
|
458
452
|
protected readonly alepha: Alepha;
|
|
459
453
|
protected readonly router: BrowserRouterProvider;
|
|
460
454
|
protected readonly headProvider: BrowserHeadProvider;
|
|
461
|
-
protected readonly env: {
|
|
462
|
-
REACT_ROOT_ID: string;
|
|
463
|
-
};
|
|
464
455
|
protected root: Root;
|
|
465
456
|
transitioning?: {
|
|
466
457
|
to: string;
|
|
@@ -470,11 +461,6 @@ declare class ReactBrowserProvider {
|
|
|
470
461
|
get history(): History;
|
|
471
462
|
get url(): string;
|
|
472
463
|
invalidate(props?: Record<string, any>): Promise<void>;
|
|
473
|
-
/**
|
|
474
|
-
*
|
|
475
|
-
* @param url
|
|
476
|
-
* @param options
|
|
477
|
-
*/
|
|
478
464
|
go(url: string, options?: RouterGoOptions): Promise<void>;
|
|
479
465
|
protected render(options?: {
|
|
480
466
|
url?: string;
|
|
@@ -482,19 +468,8 @@ declare class ReactBrowserProvider {
|
|
|
482
468
|
}): Promise<RouterRenderResult>;
|
|
483
469
|
/**
|
|
484
470
|
* Get embedded layers from the server.
|
|
485
|
-
*
|
|
486
|
-
* @protected
|
|
487
471
|
*/
|
|
488
472
|
protected getHydrationState(): ReactHydrationState | undefined;
|
|
489
|
-
/**
|
|
490
|
-
*
|
|
491
|
-
* @protected
|
|
492
|
-
*/
|
|
493
|
-
protected getRootElement(): HTMLElement;
|
|
494
|
-
/**
|
|
495
|
-
*
|
|
496
|
-
* @protected
|
|
497
|
-
*/
|
|
498
473
|
readonly ready: _alepha_core.HookDescriptor<"ready">;
|
|
499
474
|
readonly onTransitionEnd: _alepha_core.HookDescriptor<"react:transition:end">;
|
|
500
475
|
}
|
|
@@ -542,30 +517,11 @@ declare class RouterHookApi {
|
|
|
542
517
|
constructor(pages: PageRoute[], state: RouterState, layer: {
|
|
543
518
|
path: string;
|
|
544
519
|
}, browser?: ReactBrowserProvider | undefined);
|
|
545
|
-
/**
|
|
546
|
-
*
|
|
547
|
-
*/
|
|
548
520
|
get current(): RouterState;
|
|
549
|
-
/**
|
|
550
|
-
*
|
|
551
|
-
*/
|
|
552
521
|
get pathname(): string;
|
|
553
|
-
/**
|
|
554
|
-
*
|
|
555
|
-
*/
|
|
556
522
|
get query(): Record<string, string>;
|
|
557
|
-
/**
|
|
558
|
-
*
|
|
559
|
-
*/
|
|
560
523
|
back(): Promise<void>;
|
|
561
|
-
/**
|
|
562
|
-
*
|
|
563
|
-
*/
|
|
564
524
|
forward(): Promise<void>;
|
|
565
|
-
/**
|
|
566
|
-
*
|
|
567
|
-
* @param props
|
|
568
|
-
*/
|
|
569
525
|
invalidate(props?: Record<string, any>): Promise<void>;
|
|
570
526
|
/**
|
|
571
527
|
* Create a valid href for the given pathname.
|
|
@@ -716,7 +672,7 @@ declare const envSchema: TObject<{
|
|
|
716
672
|
REACT_SSR_ENABLED: TOptional<TBoolean>;
|
|
717
673
|
REACT_ROOT_ID: TString;
|
|
718
674
|
}>;
|
|
719
|
-
declare module "
|
|
675
|
+
declare module "alepha/core" {
|
|
720
676
|
interface Env extends Partial<Static$1<typeof envSchema>> {
|
|
721
677
|
}
|
|
722
678
|
interface State {
|
|
@@ -734,9 +690,9 @@ declare class ReactServerProvider {
|
|
|
734
690
|
protected readonly serverTimingProvider: ServerTimingProvider;
|
|
735
691
|
protected readonly env: {
|
|
736
692
|
REACT_SSR_ENABLED?: boolean | undefined;
|
|
737
|
-
REACT_ROOT_ID: string;
|
|
738
693
|
REACT_SERVER_DIST: string;
|
|
739
694
|
REACT_SERVER_PREFIX: string;
|
|
695
|
+
REACT_ROOT_ID: string;
|
|
740
696
|
};
|
|
741
697
|
protected readonly ROOT_DIV_REGEX: RegExp;
|
|
742
698
|
readonly onConfigure: _alepha_core.HookDescriptor<"configure">;
|
package/redis.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import * as _redis_client from '@redis/client';
|
|
2
|
+
import { createClient, SetOptions } from '@redis/client';
|
|
1
3
|
import * as _alepha_core from '@alepha/core';
|
|
2
4
|
import { Static, Alepha } from '@alepha/core';
|
|
3
|
-
import * as Redis from 'ioredis';
|
|
4
|
-
import Redis__default, { RedisOptions } from 'ioredis';
|
|
5
5
|
|
|
6
6
|
/** Symbol key applied to readonly types */
|
|
7
7
|
declare const ReadonlyKind: unique symbol;
|
|
@@ -89,7 +89,9 @@ declare module "alepha" {
|
|
|
89
89
|
interface Env extends Partial<Static<typeof envSchema>> {
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
type RedisClient =
|
|
92
|
+
type RedisClient = ReturnType<typeof createClient>;
|
|
93
|
+
type RedisClientOptions = Parameters<typeof createClient>[0];
|
|
94
|
+
type RedisSetOptions = SetOptions;
|
|
93
95
|
declare class RedisProvider {
|
|
94
96
|
protected readonly log: _alepha_core.Logger;
|
|
95
97
|
protected readonly alepha: Alepha;
|
|
@@ -98,7 +100,7 @@ declare class RedisProvider {
|
|
|
98
100
|
REDIS_PORT: number;
|
|
99
101
|
REDIS_HOST: string;
|
|
100
102
|
};
|
|
101
|
-
protected readonly client:
|
|
103
|
+
protected readonly client: _redis_client.RedisClientType<_redis_client.RedisModules, _redis_client.RedisFunctions, _redis_client.RedisScripts, _redis_client.RespVersions, _redis_client.TypeMapping>;
|
|
102
104
|
get publisher(): RedisClient;
|
|
103
105
|
protected readonly start: _alepha_core.HookDescriptor<"start">;
|
|
104
106
|
protected readonly stop: _alepha_core.HookDescriptor<"stop">;
|
|
@@ -110,7 +112,7 @@ declare class RedisProvider {
|
|
|
110
112
|
* Close the connection to the Redis server.
|
|
111
113
|
*/
|
|
112
114
|
close(): Promise<void>;
|
|
113
|
-
duplicate(options?: Partial<
|
|
115
|
+
duplicate(options?: Partial<RedisClientOptions>): RedisClient;
|
|
114
116
|
/**
|
|
115
117
|
* Redis subscriber client factory method.
|
|
116
118
|
*/
|
|
@@ -121,16 +123,16 @@ declare class RedisSubscriberProvider {
|
|
|
121
123
|
protected readonly log: _alepha_core.Logger;
|
|
122
124
|
protected readonly alepha: Alepha;
|
|
123
125
|
protected readonly redisProvider: RedisProvider;
|
|
124
|
-
protected readonly client:
|
|
126
|
+
protected readonly client: _redis_client.RedisClientType<_redis_client.RedisModules, _redis_client.RedisFunctions, _redis_client.RedisScripts, _redis_client.RespVersions, _redis_client.TypeMapping>;
|
|
125
127
|
get subscriber(): RedisClient;
|
|
126
128
|
protected readonly start: _alepha_core.HookDescriptor<"start">;
|
|
127
129
|
protected readonly stop: _alepha_core.HookDescriptor<"stop">;
|
|
128
130
|
connect(): Promise<void>;
|
|
129
|
-
close(): void
|
|
131
|
+
close(): Promise<void>;
|
|
130
132
|
/**
|
|
131
133
|
* Redis subscriber client factory method.
|
|
132
134
|
*/
|
|
133
135
|
protected createClient(): RedisClient;
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
export { type RedisClient, RedisProvider, RedisSubscriberProvider };
|
|
138
|
+
export { type RedisClient, type RedisClientOptions, RedisProvider, type RedisSetOptions, RedisSubscriberProvider };
|
package/scheduler.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as _alepha_core from '@alepha/core';
|
|
|
2
2
|
import { Async, KIND, OPTIONS, Static, Alepha } from '@alepha/core';
|
|
3
3
|
import { DurationLike, DateTimeProvider, Interval } from '@alepha/datetime';
|
|
4
4
|
import * as _alepha_lock from '@alepha/lock';
|
|
5
|
-
import {
|
|
5
|
+
import { ScheduledTask } from 'node-cron';
|
|
6
6
|
|
|
7
7
|
declare const KEY = "SCHEDULER";
|
|
8
8
|
type SchedulerDescriptorOptions = {
|
|
@@ -173,7 +173,7 @@ interface Scheduler {
|
|
|
173
173
|
name: string;
|
|
174
174
|
options: SchedulerDescriptorOptions;
|
|
175
175
|
trigger: () => Promise<void>;
|
|
176
|
-
|
|
176
|
+
cron?: ScheduledTask;
|
|
177
177
|
interval?: Interval;
|
|
178
178
|
}
|
|
179
179
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var serverCache = require('@alepha/server-cache');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
Object.keys(
|
|
7
|
+
Object.keys(serverCache).forEach(function (k) {
|
|
8
8
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return serverCache[k]; }
|
|
11
11
|
});
|
|
12
12
|
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as _alepha_core from '@alepha/core';
|
|
2
|
+
import { Alepha, OPTIONS } from '@alepha/core';
|
|
3
|
+
import { CacheDescriptorOptions, CacheDescriptorProvider, Cache } from '@alepha/cache';
|
|
4
|
+
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
5
|
+
import { ServerHandler, ServerRequestConfig } from '@alepha/server';
|
|
6
|
+
|
|
7
|
+
declare module "alepha/server" {
|
|
8
|
+
interface ServerRoute {
|
|
9
|
+
cache?: ServiceRouteCache;
|
|
10
|
+
}
|
|
11
|
+
interface ActionDescriptor {
|
|
12
|
+
invalidate: () => Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
declare class ServerCacheProvider {
|
|
16
|
+
protected readonly log: _alepha_core.Logger;
|
|
17
|
+
protected readonly alepha: Alepha;
|
|
18
|
+
protected readonly cacheProvider: CacheDescriptorProvider;
|
|
19
|
+
protected readonly time: DateTimeProvider;
|
|
20
|
+
protected readonly caches: Map<ServerHandler, RouteCache>;
|
|
21
|
+
readonly onConfigure: _alepha_core.HookDescriptor<"configure">;
|
|
22
|
+
readonly onRoute: _alepha_core.HookDescriptor<"server:onRoute">;
|
|
23
|
+
readonly onRequest: _alepha_core.HookDescriptor<"server:onRequest">;
|
|
24
|
+
readonly onSend: _alepha_core.HookDescriptor<"server:onResponse">;
|
|
25
|
+
generateETag(content: string): string;
|
|
26
|
+
invalidate(route: RouteLike): Promise<void>;
|
|
27
|
+
protected getCacheByRoute(route: RouteLike): RouteCache | undefined;
|
|
28
|
+
protected createCacheKey(args: ServerRequestConfig): string;
|
|
29
|
+
}
|
|
30
|
+
type ServiceRouteCache = boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|
|
31
|
+
type RouteCache = Cache<{
|
|
32
|
+
contentType?: string;
|
|
33
|
+
body: string;
|
|
34
|
+
status?: number;
|
|
35
|
+
lastModified: string;
|
|
36
|
+
hash: string;
|
|
37
|
+
}>;
|
|
38
|
+
type RouteLike = {
|
|
39
|
+
[OPTIONS]: {
|
|
40
|
+
handler?: ServerHandler;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
handler?: ServerHandler;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
declare class ServerCacheModule {
|
|
47
|
+
protected readonly alepha: Alepha;
|
|
48
|
+
constructor();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { ServerCacheModule, ServerCacheProvider, type ServiceRouteCache };
|
package/server/cache.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@alepha/server-cache';
|
package/server.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import * as _alepha_core from '@alepha/core';
|
|
2
2
|
import { Static as Static$1, TObject as TObject$1, TSchema as TSchema$2, Async, StreamLike, Alepha, FileLike, OPTIONS, KIND, Service } from '@alepha/core';
|
|
3
3
|
export { KIND } from '@alepha/core';
|
|
4
|
-
import * as _alepha_cache from '@alepha/cache';
|
|
5
|
-
import { CacheDescriptorOptions } from '@alepha/cache';
|
|
6
|
-
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
7
4
|
import { UserAccountToken, Permission, ServiceAccountDescriptor as ServiceAccountDescriptor$1, SecurityProvider, JwtProvider } from '@alepha/security';
|
|
8
5
|
import { IncomingMessage, ServerResponse as ServerResponse$1 } from 'node:http';
|
|
9
6
|
import { Readable } from 'node:stream';
|
|
10
7
|
import { ReadableStream } from 'node:stream/web';
|
|
11
8
|
import { Route, RouterProvider } from '@alepha/router';
|
|
9
|
+
import * as _alepha_cache from '@alepha/cache';
|
|
10
|
+
import { DurationLike, DateTimeProvider } from '@alepha/datetime';
|
|
12
11
|
import * as _alepha_retry from '@alepha/retry';
|
|
13
12
|
import { BusboyConfig } from '@fastify/busboy';
|
|
14
13
|
import * as http from 'http';
|
|
@@ -210,8 +209,6 @@ interface TSchema$1 extends TKind$1, SchemaOptions$1 {
|
|
|
210
209
|
declare const routeMethods: readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "CONNECT", "TRACE"];
|
|
211
210
|
type RouteMethod = (typeof routeMethods)[number];
|
|
212
211
|
|
|
213
|
-
type ServiceRouteCache = boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|
|
214
|
-
|
|
215
212
|
declare const envSchema$4: TObject$1<{
|
|
216
213
|
SERVER_ALS_ENABLED: TBoolean;
|
|
217
214
|
}>;
|
|
@@ -289,10 +286,6 @@ interface ServerRoute<TConfig extends RequestConfigSchema = RequestConfigSchema>
|
|
|
289
286
|
* @see ServerSecurityProvider
|
|
290
287
|
*/
|
|
291
288
|
secure?: ServerRouteSecure;
|
|
292
|
-
/**
|
|
293
|
-
* @see ServerCacheProvider
|
|
294
|
-
*/
|
|
295
|
-
cache?: ServiceRouteCache;
|
|
296
289
|
}
|
|
297
290
|
type ServerResponseBody<TConfig extends RequestConfigSchema = RequestConfigSchema> = TConfig["response"] extends TSchema$2 ? Static$1<TConfig["response"]> : ResponseBodyType;
|
|
298
291
|
type ResponseType = "json" | "text" | "void" | "file" | "any";
|
|
@@ -537,11 +530,6 @@ interface ActionDescriptorOptions<TConfig extends RequestConfigSchema = RequestC
|
|
|
537
530
|
* Main route handler. This is where the route logic is implemented.
|
|
538
531
|
*/
|
|
539
532
|
handler?: ServerHandler<TConfig>;
|
|
540
|
-
/**
|
|
541
|
-
* If true, the route will be cached.
|
|
542
|
-
* - Number as seconds or boolean to enable cache.
|
|
543
|
-
*/
|
|
544
|
-
cache?: boolean | DurationLike | Omit<CacheDescriptorOptions<any>, "handler" | "key">;
|
|
545
533
|
}
|
|
546
534
|
interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSchema> {
|
|
547
535
|
[KIND]: typeof KEY$2;
|
|
@@ -558,11 +546,6 @@ interface ActionDescriptor<TConfig extends RequestConfigSchema = RequestConfigSc
|
|
|
558
546
|
* Name of the permission required to access this route.
|
|
559
547
|
*/
|
|
560
548
|
permission: () => string;
|
|
561
|
-
/**
|
|
562
|
-
* Invalidate the cache for this action.
|
|
563
|
-
* This is only available if the action has cache enabled.
|
|
564
|
-
*/
|
|
565
|
-
invalidate: () => Promise<void>;
|
|
566
549
|
}
|
|
567
550
|
declare const $action: {
|
|
568
551
|
<TConfig extends RequestConfigSchema>(options: ActionDescriptorOptions<TConfig>): ActionDescriptor<TConfig>;
|
|
@@ -982,8 +965,8 @@ declare class RemoteDescriptorProvider {
|
|
|
982
965
|
}) => Promise<{
|
|
983
966
|
prefix?: string | undefined;
|
|
984
967
|
links: {
|
|
985
|
-
group?: string | undefined;
|
|
986
968
|
method?: string | undefined;
|
|
969
|
+
group?: string | undefined;
|
|
987
970
|
requestBodyType?: string | undefined;
|
|
988
971
|
service?: string | undefined;
|
|
989
972
|
path: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@alepha/server-cache";
|
package/topic.d.ts
CHANGED
|
@@ -184,38 +184,21 @@ declare class RedisTopicProvider implements TopicProvider {
|
|
|
184
184
|
};
|
|
185
185
|
protected readonly redisProvider: RedisProvider;
|
|
186
186
|
protected readonly redisSubscriberProvider: RedisSubscriberProvider;
|
|
187
|
-
protected readonly subscriptions: Record<string, SubscribeCallback[]>;
|
|
188
187
|
protected readonly log: _alepha_core.Logger;
|
|
189
|
-
protected readonly start: _alepha_core.HookDescriptor<"start">;
|
|
190
188
|
protected readonly stop: _alepha_core.HookDescriptor<"stop">;
|
|
191
189
|
prefix(queue: string): string;
|
|
192
190
|
/**
|
|
193
191
|
* Publish a message to a topic.
|
|
194
|
-
*
|
|
195
|
-
* @param topic
|
|
196
|
-
* @param message
|
|
197
192
|
*/
|
|
198
193
|
publish(topic: string, message: string): Promise<void>;
|
|
199
194
|
/**
|
|
200
195
|
* Subscribe to a topic.
|
|
201
|
-
*
|
|
202
|
-
* @param name
|
|
203
|
-
* @param callback
|
|
204
196
|
*/
|
|
205
197
|
subscribe(name: string, callback: SubscribeCallback): Promise<UnSubscribeFn>;
|
|
206
198
|
/**
|
|
207
199
|
* Unsubscribe from a topic.
|
|
208
|
-
*
|
|
209
|
-
* @param name
|
|
210
|
-
* @param callback
|
|
211
200
|
*/
|
|
212
201
|
unsubscribe(name: string, callback?: SubscribeCallback): Promise<void>;
|
|
213
|
-
/**
|
|
214
|
-
* Listen for messages.
|
|
215
|
-
*
|
|
216
|
-
* @protected
|
|
217
|
-
*/
|
|
218
|
-
protected listen(): void;
|
|
219
202
|
}
|
|
220
203
|
|
|
221
204
|
declare class TopicDescriptorProvider {
|
package/vite.d.ts
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { Alepha } from '@alepha/core';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { Plugin } from 'vite';
|
|
3
|
+
import { BrotliOptions, ZlibOptions } from 'node:zlib';
|
|
4
4
|
|
|
5
5
|
interface ViteAlephaBuildOptions {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
7
|
+
* Path to the entry file for the server build.
|
|
8
|
+
* If empty, SSR build will be skipped.
|
|
9
|
+
*/
|
|
10
|
+
serverEntry?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Set false to skip the client build.
|
|
13
|
+
* This is useful if you only want to build the server-side application.
|
|
10
14
|
*/
|
|
11
|
-
|
|
15
|
+
client?: false;
|
|
12
16
|
/**
|
|
13
17
|
* If true, the build will be optimized for Vercel deployment.
|
|
14
18
|
*
|
|
@@ -17,24 +21,15 @@ interface ViteAlephaBuildOptions {
|
|
|
17
21
|
* @default false
|
|
18
22
|
*/
|
|
19
23
|
vercel?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Vite server options to override the default server configuration.
|
|
22
|
-
*/
|
|
23
|
-
server?: false | UserConfig;
|
|
24
|
-
/**
|
|
25
|
-
* If true, all compatible pages will be pre-rendered.
|
|
26
|
-
*/
|
|
27
|
-
prerender?: boolean;
|
|
28
24
|
}
|
|
29
25
|
declare function viteAlephaBuild(options?: ViteAlephaBuildOptions): Promise<Plugin>;
|
|
30
26
|
|
|
31
27
|
interface ViteAlephaDevOptions {
|
|
32
28
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* @default 'src/index.server.ts'
|
|
29
|
+
* Path to the entry file for the server build.
|
|
30
|
+
* If empty, plugin will be disabled.
|
|
36
31
|
*/
|
|
37
|
-
|
|
32
|
+
serverEntry?: string;
|
|
38
33
|
/**
|
|
39
34
|
* Enable or disable debug mode
|
|
40
35
|
*
|
|
@@ -43,7 +38,7 @@ interface ViteAlephaDevOptions {
|
|
|
43
38
|
debug?: boolean;
|
|
44
39
|
}
|
|
45
40
|
/**
|
|
46
|
-
*
|
|
41
|
+
* Plug Alepha into Vite development server.
|
|
47
42
|
*/
|
|
48
43
|
declare function viteAlephaDev(options?: ViteAlephaDevOptions): Promise<Plugin>;
|
|
49
44
|
|
|
@@ -70,10 +65,39 @@ declare function viteAlephaBuildVercel(opts?: ViteAlephaBuildVercelOptions): {
|
|
|
70
65
|
writeBundle(): void;
|
|
71
66
|
};
|
|
72
67
|
|
|
73
|
-
|
|
68
|
+
interface ViteCompressOptions {
|
|
69
|
+
/**
|
|
70
|
+
* If true, the plugin will not compress the files.
|
|
71
|
+
*
|
|
72
|
+
* @default false
|
|
73
|
+
*/
|
|
74
|
+
disabled?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* If true, the plugin will compress the files using brotli.
|
|
77
|
+
* Can also be an object with brotli options.
|
|
78
|
+
*
|
|
79
|
+
* @default true
|
|
80
|
+
*/
|
|
81
|
+
brotli?: boolean | BrotliOptions;
|
|
82
|
+
/**
|
|
83
|
+
* If true, the plugin will compress the files using gzip.
|
|
84
|
+
* Can also be an object with gzip options.
|
|
85
|
+
*
|
|
86
|
+
* @default true
|
|
87
|
+
*/
|
|
88
|
+
gzip?: boolean | ZlibOptions;
|
|
89
|
+
/**
|
|
90
|
+
* A filter to determine which files to compress.
|
|
91
|
+
* Can be a RegExp or a function that returns true for files to compress.
|
|
92
|
+
*
|
|
93
|
+
* @default /\.(js|mjs|cjs|css|wasm|svg)$/
|
|
94
|
+
*/
|
|
95
|
+
filter?: RegExp | ((fileName: string) => boolean);
|
|
96
|
+
}
|
|
97
|
+
declare function viteCompress(options?: ViteCompressOptions): Plugin;
|
|
74
98
|
|
|
75
99
|
declare global {
|
|
76
100
|
var __alepha: Alepha;
|
|
77
101
|
}
|
|
78
102
|
|
|
79
|
-
export { type ViteAlephaBuildOptions, type ViteAlephaBuildVercelOptions, type ViteAlephaDevOptions, type ViteAlephaOptions, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev,
|
|
103
|
+
export { type ViteAlephaBuildOptions, type ViteAlephaBuildVercelOptions, type ViteAlephaDevOptions, type ViteAlephaOptions, type ViteCompressOptions, viteAlepha, viteAlephaBuild, viteAlephaBuildVercel, viteAlephaDev, viteCompress };
|
package/server/metrics.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var serverMetrics = require('@alepha/server-metrics');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Object.keys(serverMetrics).forEach(function (k) {
|
|
8
|
-
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return serverMetrics[k]; }
|
|
11
|
-
});
|
|
12
|
-
});
|
package/server/metrics.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as _alepha_server from '@alepha/server';
|
|
2
|
-
|
|
3
|
-
declare class ServerMetricsProvider {
|
|
4
|
-
private readonly register;
|
|
5
|
-
private cpuUsage;
|
|
6
|
-
private memoryUsage;
|
|
7
|
-
private gcDuration;
|
|
8
|
-
private heapUsage;
|
|
9
|
-
readonly metrics: _alepha_server.ActionDescriptor<_alepha_server.RequestConfigSchema>;
|
|
10
|
-
constructor();
|
|
11
|
-
private collectMetrics;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { ServerMetricsProvider };
|
package/server/metrics.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-metrics';
|
package/server/proxy.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-proxy';
|
package/server/proxy.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '@alepha/server-proxy';
|
package/src/server/metrics.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@alepha/server-metrics";
|
package/src/server/proxy.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "@alepha/server-proxy";
|