@arkstack/contract 0.7.20 → 0.9.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/dist/index.d.ts +20 -13
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
/// <reference path="./global.d.ts" />
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/core.d.ts
|
|
3
3
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
4
|
+
type ENV = 'development' | 'production' | 'stagging' | 'testing';
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/http.d.ts
|
|
4
7
|
interface ArkstackMiddlewareConfig<TMiddleware> {
|
|
5
8
|
global: TMiddleware[];
|
|
6
9
|
before: TMiddleware[];
|
|
7
10
|
after: TMiddleware[];
|
|
8
11
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
interface ArkstackRouterContract<TApp, TRoutes = unknown> {
|
|
13
|
-
bind(app: TApp): PromiseOrValue<unknown>;
|
|
14
|
-
list(options?: ArkstackRouteListOptions, app?: TApp): PromiseOrValue<TRoutes>;
|
|
15
|
-
}
|
|
16
|
-
interface ArkstackRouterAwareCore<TApp, TRoutes = unknown> {
|
|
17
|
-
getAppInstance(): TApp;
|
|
18
|
-
getRouter(): ArkstackRouterContract<TApp, TRoutes>;
|
|
19
|
-
}
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/kits.d.ts
|
|
20
14
|
declare abstract class ArkstackKitDriver<TApp, TMiddleware> {
|
|
21
15
|
abstract readonly name: string;
|
|
22
16
|
abstract createApp(): TApp;
|
|
@@ -35,5 +29,18 @@ declare abstract class ArkstackKitContract<TApp, TMiddleware> {
|
|
|
35
29
|
abstract shutdown(): Promise<void>;
|
|
36
30
|
}
|
|
37
31
|
//#endregion
|
|
38
|
-
|
|
32
|
+
//#region src/routing.d.ts
|
|
33
|
+
interface ArkstackRouteListOptions {
|
|
34
|
+
path?: string;
|
|
35
|
+
}
|
|
36
|
+
interface ArkstackRouterContract<TApp, TRoutes = unknown> {
|
|
37
|
+
bind(app: TApp): PromiseOrValue<unknown>;
|
|
38
|
+
list(options?: ArkstackRouteListOptions, app?: TApp): PromiseOrValue<TRoutes>;
|
|
39
|
+
}
|
|
40
|
+
interface ArkstackRouterAwareCore<TApp, TRoutes = unknown> {
|
|
41
|
+
getAppInstance(): TApp;
|
|
42
|
+
getRouter(): ArkstackRouterContract<TApp, TRoutes>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { ArkstackKitContract, ArkstackKitDriver, ArkstackMiddlewareConfig, ArkstackRouteListOptions, ArkstackRouterAwareCore, ArkstackRouterContract, ENV, PromiseOrValue };
|
|
39
46
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/kits.ts"],"sourcesContent":["import { ArkstackMiddlewareConfig } from './http'\nimport { PromiseOrValue } from './core'\n\n/**\n * The ArkstackKitDriver class defines the contract for a driver \n * that can be used with the ArkstackKitContract. \n */\nexport abstract class ArkstackKitDriver<TApp, TMiddleware> {\n abstract readonly name: string;\n abstract createApp (): TApp;\n abstract mountPublicAssets (app: TApp, publicPath: string): PromiseOrValue<void>;\n abstract bindRouter (app: TApp): PromiseOrValue<void>;\n abstract applyMiddleware (app: TApp, middleware: ArkstackMiddlewareConfig<TMiddleware>): PromiseOrValue<void>;\n abstract applyMiddleware (app: TApp, middleware: TMiddleware): PromiseOrValue<void>;\n registerErrorHandler (_app: TApp): PromiseOrValue<void> {\n return\n }\n abstract start (app: TApp, port: number): PromiseOrValue<void>;\n}\n\n/**\n * The ArkstackKitContract class defines the contract for an \n * application that uses the ArkstackKitDriver.\n */\nexport abstract class ArkstackKitContract<TApp, TMiddleware> {\n abstract app: TApp;\n abstract driver: ArkstackKitDriver<TApp, TMiddleware>;\n abstract middleware: ArkstackMiddlewareConfig<TMiddleware>;\n abstract boot (port: number): Promise<void>;\n abstract shutdown (): Promise<void>;\n}"],"mappings":";;;;;AAOA,IAAsB,oBAAtB,MAA2D;CAOvD,qBAAsB,MAAkC;;;;;;AAU5D,IAAsB,sBAAtB,MAA6D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/contract",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Contract module for Arkstack, providing shared interfaces and type contracts used across the framework.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net",
|