alp-node 7.0.0 → 9.0.0
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/CHANGELOG.md +39 -0
- package/README.md +7 -7
- package/dist/{AlpNodeApp-node18.mjs → AlpNodeApp-node.mjs} +136 -134
- package/dist/AlpNodeApp-node.mjs.map +1 -0
- package/dist/definitions/AlpNodeApp.d.ts +16 -17
- package/dist/definitions/AlpNodeApp.d.ts.map +1 -1
- package/dist/definitions/config.d.ts +4 -5
- package/dist/definitions/config.d.ts.map +1 -1
- package/dist/definitions/errors.d.ts +1 -2
- package/dist/definitions/errors.d.ts.map +1 -1
- package/dist/definitions/index.d.ts +8 -8
- package/dist/definitions/language.d.ts +1 -1
- package/dist/definitions/language.d.ts.map +1 -1
- package/dist/definitions/listen.d.ts +2 -3
- package/dist/definitions/listen.d.ts.map +1 -1
- package/dist/definitions/params/ParamValid.d.ts +2 -3
- package/dist/definitions/params/ParamValid.d.ts.map +1 -1
- package/dist/definitions/params/ParamValueFromContext.d.ts +3 -4
- package/dist/definitions/params/ParamValueFromContext.d.ts.map +1 -1
- package/dist/definitions/params/ParamValueModelValidator.d.ts +1 -1
- package/dist/definitions/params/ParamValueStringValidator.d.ts +1 -1
- package/dist/definitions/params/ParamValueValidator.d.ts +1 -1
- package/dist/definitions/params/index.d.ts +8 -4
- package/dist/definitions/params/index.d.ts.map +1 -1
- package/dist/definitions/router.d.ts +3 -4
- package/dist/definitions/router.d.ts.map +1 -1
- package/dist/definitions/translate/index.d.ts +1 -1
- package/dist/definitions/translate/load.d.ts +3 -3
- package/dist/definitions/translate/load.d.ts.map +1 -1
- package/dist/definitions/types.d.ts +6 -6
- package/dist/definitions/types.d.ts.map +1 -1
- package/dist/{index-node18.mjs → index-node.mjs} +233 -225
- package/dist/index-node.mjs.map +1 -0
- package/package.json +26 -25
- package/src/AlpNodeApp.ts +52 -49
- package/src/config.ts +43 -48
- package/src/errors.ts +19 -19
- package/src/index.ts +16 -16
- package/src/language.ts +18 -10
- package/src/listen.ts +16 -16
- package/src/params/ParamValid.ts +3 -3
- package/src/params/ParamValidationResult.test.ts +14 -11
- package/src/params/ParamValueFromContext.ts +5 -5
- package/src/params/ParamValueModelValidator.ts +1 -1
- package/src/params/ParamValueStringValidator.ts +3 -3
- package/src/params/ParamValueValidator.ts +1 -1
- package/src/params/index.ts +17 -13
- package/src/router.ts +7 -7
- package/src/translate/index.ts +9 -9
- package/src/translate/load.ts +13 -12
- package/src/types.ts +8 -8
- package/dist/AlpNodeApp-node18.mjs.map +0 -1
- package/dist/index-node18.mjs.map +0 -1
- package/src/.eslintrc.json +0 -31
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type { NodeApplication, NodeConfig, Context as AlpContext, ContextState } from './types';
|
|
1
|
+
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
2
|
+
import Koa from "koa";
|
|
3
|
+
import type { DefaultContext, DefaultState, ParameterizedContext } from "koa";
|
|
4
|
+
import type { Router } from "router-segments";
|
|
5
|
+
import type { Config } from "./config";
|
|
6
|
+
import type { AlpLanguageContext } from "./language";
|
|
7
|
+
import type { AlpParamsContext, AlpParamsRequest } from "./params/index";
|
|
8
|
+
import type { AlpRouteRef, RouterContext as AlpRouterContext, UrlGenerator } from "./router";
|
|
9
|
+
import type { TranslateBaseContext, TranslateContext } from "./translate/index";
|
|
10
|
+
import type { Context as AlpContext, ContextState, NodeApplication, NodeConfig } from "./types";
|
|
12
11
|
export interface AlpNodeAppOptions {
|
|
13
12
|
appDirname: string;
|
|
14
13
|
packageDirname: string;
|
|
@@ -16,7 +15,7 @@ export interface AlpNodeAppOptions {
|
|
|
16
15
|
certPath?: string;
|
|
17
16
|
publicPath?: string;
|
|
18
17
|
}
|
|
19
|
-
declare module
|
|
18
|
+
declare module "koa" {
|
|
20
19
|
interface DefaultState extends ContextState {
|
|
21
20
|
}
|
|
22
21
|
interface DefaultContext extends AlpContext, AlpParamsContext, AlpRouterContext, AlpLanguageContext, TranslateContext {
|
|
@@ -28,7 +27,7 @@ declare module 'koa' {
|
|
|
28
27
|
interface BaseRequest extends AlpParamsRequest {
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
|
-
export declare class AlpNodeApp extends Koa<
|
|
30
|
+
export declare class AlpNodeApp extends Koa<DefaultState, DefaultContext> implements NodeApplication {
|
|
32
31
|
dirname: string;
|
|
33
32
|
certPath: string;
|
|
34
33
|
publicPath: string;
|
|
@@ -41,8 +40,8 @@ export declare class AlpNodeApp extends Koa<ContextState> implements NodeApplica
|
|
|
41
40
|
* @param {string} [options.publicPath] directory of public files
|
|
42
41
|
*/
|
|
43
42
|
constructor({ appDirname, packageDirname, config, certPath, publicPath, }: AlpNodeAppOptions);
|
|
44
|
-
existsConfigSync(name: string): ReturnType<Config[
|
|
45
|
-
loadConfigSync(name: string): ReturnType<Config[
|
|
43
|
+
existsConfigSync(name: string): ReturnType<Config["existsConfigSync"]>;
|
|
44
|
+
loadConfigSync(name: string): ReturnType<Config["loadConfigSync"]>;
|
|
46
45
|
createContext<StateT = DefaultState>(req: IncomingMessage, res: ServerResponse): ParameterizedContext<StateT>;
|
|
47
46
|
servePublic(): void;
|
|
48
47
|
catchErrors(): void;
|
|
@@ -53,6 +52,6 @@ export declare class AlpNodeApp extends Koa<ContextState> implements NodeApplica
|
|
|
53
52
|
close(): void;
|
|
54
53
|
start(fn: () => Promise<void> | void): Promise<Server>;
|
|
55
54
|
}
|
|
56
|
-
export type { Context } from
|
|
57
|
-
export { type NodeApplication } from
|
|
55
|
+
export type { Context } from "koa";
|
|
56
|
+
export { type NodeApplication } from "./types";
|
|
58
57
|
//# sourceMappingURL=AlpNodeApp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlpNodeApp.d.ts","sourceRoot":"","sources":["../../src/AlpNodeApp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AlpNodeApp.d.ts","sourceRoot":"","sources":["../../src/AlpNodeApp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,eAAe,EAEf,MAAM,EACN,cAAc,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,KAAK,CAAC;AAI9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEzE,OAAO,KAAK,EACV,WAAW,EACX,aAAa,IAAI,gBAAgB,EACjC,YAAY,EACb,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,OAAO,KAAK,EACV,OAAO,IAAI,UAAU,EAErB,YAAY,EACZ,eAAe,EACf,UAAU,EACX,MAAM,SAAS,CAAC;AAIjB,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,OAAO,QAAQ,KAAK,CAAC;IAEnB,UAAU,YAAa,SAAQ,YAAY;KAAG;IAE9C,UAAU,cACR,SAAQ,UAAU,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAk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AY,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NodeConfig, PackageConfig } from "./types";
|
|
2
2
|
export interface ConfigOptions {
|
|
3
3
|
argv?: string[];
|
|
4
4
|
packageConfig?: PackageConfig;
|
|
@@ -6,13 +6,12 @@ export interface ConfigOptions {
|
|
|
6
6
|
}
|
|
7
7
|
export declare class Config {
|
|
8
8
|
packageConfig?: PackageConfig;
|
|
9
|
-
private
|
|
9
|
+
private _record;
|
|
10
10
|
private readonly _dirname;
|
|
11
11
|
constructor(dirname: string, options?: ConfigOptions);
|
|
12
12
|
loadSync(options?: ConfigOptions): Config & NodeConfig;
|
|
13
|
-
get<T>(key: string): T
|
|
13
|
+
get<T>(key: string): Readonly<T>;
|
|
14
14
|
existsConfigSync(name: string): boolean;
|
|
15
|
-
loadConfigSync(name: string):
|
|
15
|
+
loadConfigSync(name: string): Readonly<Record<string, unknown>>;
|
|
16
16
|
}
|
|
17
|
-
export default function getConfig(app: NodeApplication, config: Config & NodeConfig): Config & NodeConfig;
|
|
18
17
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAgBzD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,MAAM;IACjB,aAAa,CAAC,EAAE,aAAa,CAAC;IAE9B,OAAO,CAAC,OAAO,CAA0B;IAEzC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAQpD,QAAQ,CAAC,OAAO,GAAE,aAAkB,GAAG,MAAM,GAAG,UAAU;IAgE1D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC;IAIhC,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIvC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAGhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAQ5C,wBAA8B,aAAa,CACzC,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,GAC/B,OAAO,CAAC,IAAI,CAAC,CAuDf"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type { AlpNodeAppOptions } from
|
|
2
|
-
import { AlpNodeApp } from
|
|
3
|
-
import { Config } from
|
|
4
|
-
export type { BaseContext, NodeApplication, NodeConfig, ContextState, ContextSanitizedState, } from
|
|
5
|
-
export type { Context } from
|
|
1
|
+
import type { AlpNodeAppOptions } from "./AlpNodeApp";
|
|
2
|
+
import { AlpNodeApp } from "./AlpNodeApp";
|
|
3
|
+
import { Config } from "./config";
|
|
4
|
+
export type { BaseContext, NodeApplication, NodeConfig, ContextState, ContextSanitizedState, } from "./types";
|
|
5
|
+
export type { Context } from "./AlpNodeApp";
|
|
6
6
|
export declare const appDirname: string;
|
|
7
7
|
export declare const packageDirname: string;
|
|
8
8
|
export declare const packageConfig: Record<string, unknown>;
|
|
9
9
|
export declare const config: Config & import("./types").NodeConfig;
|
|
10
|
-
export type AppOptions = Omit<AlpNodeAppOptions,
|
|
10
|
+
export type AppOptions = Omit<AlpNodeAppOptions, "appDirname" | "config" | "packageDirname">;
|
|
11
11
|
export default class App extends AlpNodeApp {
|
|
12
12
|
constructor(options?: AppOptions);
|
|
13
13
|
}
|
|
14
|
-
export { Config } from
|
|
15
|
-
export { default as router, createAlpRouterBuilder, type AlpRouteRef, type AlpRouter, } from
|
|
14
|
+
export { Config } from "./config";
|
|
15
|
+
export { default as router, createAlpRouterBuilder, type AlpRouteRef, type AlpRouter, } from "./router";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/language.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AACD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../src/language.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AACD,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CA0BzD"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { Config } from './config';
|
|
1
|
+
import type { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
2
|
+
import type { Config } from "./config";
|
|
4
3
|
type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
|
5
4
|
export default function alpListen(config: Config, callback: RequestListener, dirname?: string): Promise<Server>;
|
|
6
5
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../src/listen.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"listen.d.ts","sourceRoot":"","sources":["../../src/listen.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGzE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIvC,KAAK,eAAe,GAAG,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,KAAK,IAAI,CAAC;AAwB3E,MAAM,CAAC,OAAO,UAAU,SAAS,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,eAAe,EACzB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { ParamValidationResult } from './ParamValidationResult';
|
|
1
|
+
import type { Context } from "../AlpNodeApp";
|
|
2
|
+
import { ParamValidationResult } from "./ParamValidationResult";
|
|
4
3
|
export default class ParamValid extends ParamValidationResult {
|
|
5
4
|
context: Context;
|
|
6
5
|
constructor(context: Context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParamValid.d.ts","sourceRoot":"","sources":["../../../src/params/ParamValid.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParamValid.d.ts","sourceRoot":"","sources":["../../../src/params/ParamValid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,qBAAqB;IAC3D,OAAO,EAAE,OAAO,CAAC;gBAEL,OAAO,EAAE,OAAO;IAKnB,MAAM,IAAI,IAAI;CAGxB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
4
|
-
import ParamValueStringValidator from './ParamValueStringValidator';
|
|
1
|
+
import type { Context } from "../AlpNodeApp";
|
|
2
|
+
import type { ParamValidationResult } from "./ParamValidationResult";
|
|
3
|
+
import ParamValueStringValidator from "./ParamValueStringValidator";
|
|
5
4
|
export declare class ParamValueFromContext {
|
|
6
5
|
readonly validationResult: ParamValidationResult;
|
|
7
6
|
readonly context: Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParamValueFromContext.d.ts","sourceRoot":"","sources":["../../../src/params/ParamValueFromContext.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ParamValueFromContext.d.ts","sourceRoot":"","sources":["../../../src/params/ParamValueFromContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AAEpE,qBAAa,qBAAqB;IAChC,QAAQ,CAAC,gBAAgB,EAAE,qBAAqB,CAAC;IAEjD,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,qBAAqB;IAKrE,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB;IAQnD,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,yBAAyB;IAQvD,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,yBAAyB;CAWpD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ParamValueValidator from
|
|
1
|
+
import ParamValueValidator from "./ParamValueValidator";
|
|
2
2
|
export default class ParamValueStringValidator<T extends string = string> extends ParamValueValidator<T | null | undefined> {
|
|
3
3
|
notEmpty(): ParamValueValidator<T>;
|
|
4
4
|
}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import type { AlpNodeApp } from
|
|
2
|
-
import { ParamValueFromContext } from
|
|
1
|
+
import type { AlpNodeApp } from "../AlpNodeApp";
|
|
2
|
+
import { ParamValueFromContext } from "./ParamValueFromContext";
|
|
3
3
|
export interface AlpParamsContext {
|
|
4
4
|
params: ParamValueFromContext;
|
|
5
5
|
validParams: ParamValueFromContext;
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
namedRouteParam: (name: string) => string | undefined;
|
|
7
|
+
otherRouteParam: (position: number) => string | undefined;
|
|
8
|
+
/** @deprecated use namedRouteParam */
|
|
9
|
+
namedParam: never;
|
|
10
|
+
/** @deprecated use otherRouteParam */
|
|
11
|
+
otherParam: never;
|
|
8
12
|
queryParam: (name: string) => string | undefined;
|
|
9
13
|
bodyParam: <T>(name: string) => T | undefined;
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/params/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,qBAAqB,CAAC;IACnC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/params/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,EAAE,qBAAqB,CAAC;IACnC,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACtD,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC1D,sCAAsC;IACtC,UAAU,EAAE,KAAK,CAAC;IAClB,sCAAsC;IACtC,UAAU,EAAE,KAAK,CAAC;IAClB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACjD,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,CAAC;CAC/C;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,CA8CvD"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type { AlpNodeApp, Context } from './AlpNodeApp';
|
|
1
|
+
import type { LocaleType, RouteMatch, Router, RouterBuilder } from "router-segments";
|
|
2
|
+
import type { AlpNodeApp, Context } from "./AlpNodeApp";
|
|
4
3
|
export type AlpRouter<Locales extends LocaleType> = Router<Locales, AlpRouteRef>;
|
|
5
4
|
export type AlpRouteRef = (ctx: Context) => Promise<void> | void;
|
|
6
5
|
type ReturnType = (app: AlpNodeApp) => AlpRouteRef;
|
|
7
6
|
export interface RouterContext {
|
|
8
7
|
route: RouteMatch<any, AlpRouteRef>;
|
|
9
8
|
}
|
|
10
|
-
export declare const createAlpRouterBuilder: <Locales extends
|
|
9
|
+
export declare const createAlpRouterBuilder: <Locales extends LocaleType>() => RouterBuilder<Locales, AlpRouteRef>;
|
|
11
10
|
export type UrlGenerator = <P extends Record<string, unknown> | undefined>(routeKey: string, params?: P) => string;
|
|
12
11
|
export default function alpRouter<Locales extends string>(router: Router<Locales, AlpRouteRef>): ReturnType;
|
|
13
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,MAAM,EACN,aAAa,EACd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAExD,MAAM,MAAM,SAAS,CAAC,OAAO,SAAS,UAAU,IAAI,MAAM,CACxD,OAAO,EACP,WAAW,CACZ,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjE,KAAK,UAAU,GAAG,CAAC,GAAG,EAAE,UAAU,KAAK,WAAW,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;CACrC;AACD,eAAO,MAAM,sBAAsB,GACjC,OAAO,SAAS,UAAU,OACvB,aAAa,CAAC,OAAO,EAAE,WAAW,CACM,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EACvE,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,CAAC,KACP,MAAM,CAAC;AAEZ,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,OAAO,SAAS,MAAM,EACtD,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,GACnC,UAAU,CAgCZ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import IntlMessageFormatDefault from
|
|
2
|
-
export type Translations =
|
|
3
|
-
export default function load(translations:
|
|
1
|
+
import IntlMessageFormatDefault from "intl-messageformat";
|
|
2
|
+
export type Translations = Readonly<Record<string, IntlMessageFormatDefault>>;
|
|
3
|
+
export default function load(translations: Readonly<Record<string, unknown>>, language: string): Translations;
|
|
4
4
|
//# sourceMappingURL=load.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/translate/load.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,oBAAoB,CAAC;AAO1D,MAAM,MAAM,YAAY,GAAG,
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/translate/load.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,MAAM,oBAAoB,CAAC;AAO1D,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAE9E,MAAM,CAAC,OAAO,UAAU,IAAI,CAC1B,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAC/C,QAAQ,EAAE,MAAM,GACf,YAAY,CAkBd"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
type
|
|
1
|
+
type RawRecordConfig = Readonly<Record<string, unknown>>;
|
|
2
2
|
export interface Config {
|
|
3
3
|
get: <T>(key: string) => T;
|
|
4
4
|
}
|
|
5
5
|
export type PackageConfig = Record<string, any>;
|
|
6
6
|
export interface NodeConfig extends Config {
|
|
7
|
-
loadConfigSync: (name: string) =>
|
|
7
|
+
loadConfigSync: (name: string) => RawRecordConfig;
|
|
8
8
|
readonly packageConfig: PackageConfig;
|
|
9
9
|
}
|
|
10
10
|
export interface ContextState {
|
|
@@ -30,20 +30,20 @@ export interface Application extends ApplicationInCreation {
|
|
|
30
30
|
config: Config;
|
|
31
31
|
}
|
|
32
32
|
export interface NodeApplicationInCreation extends ApplicationInCreation {
|
|
33
|
-
loadConfigSync: (name: string) =>
|
|
33
|
+
loadConfigSync: (name: string) => RawRecordConfig;
|
|
34
34
|
}
|
|
35
35
|
export interface BrowserApplicationInCreation extends ApplicationInCreation {
|
|
36
36
|
appVersion: string;
|
|
37
37
|
existsConfig: (name: string) => Promise<boolean> | boolean;
|
|
38
|
-
loadConfig: (name: string) => Promise<
|
|
38
|
+
loadConfig: (name: string) => Promise<RawRecordConfig>;
|
|
39
39
|
createContext: () => Context;
|
|
40
40
|
}
|
|
41
41
|
export interface NodeApplication extends Application, NodeApplicationInCreation {
|
|
42
42
|
config: NodeConfig;
|
|
43
43
|
dirname: string;
|
|
44
|
-
on: (event:
|
|
44
|
+
on: (event: "close", callback: () => void) => void;
|
|
45
45
|
existsConfigSync: (name: string) => boolean;
|
|
46
|
-
loadConfigSync: (name: string) =>
|
|
46
|
+
loadConfigSync: (name: string) => RawRecordConfig;
|
|
47
47
|
}
|
|
48
48
|
export interface HtmlError extends Error {
|
|
49
49
|
status: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,KAAK,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEzD,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC,CAAC;CAC5B;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAEhD,MAAM,WAAW,UAAW,SAAQ,MAAM;IACxC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,eAAe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