@arkstack/contract 0.12.6 → 0.12.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 (2) hide show
  1. package/dist/index.d.ts +68 -0
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -7,6 +7,10 @@ interface ArkstackMiddlewareConfig<TMiddleware> {
7
7
  }
8
8
  //#endregion
9
9
  //#region src/kits.d.ts
10
+ /**
11
+ * The ArkstackKitDriver class defines the contract for a driver
12
+ * that can be used with the ArkstackKitContract.
13
+ */
10
14
  declare abstract class ArkstackKitDriver<TApp, TMiddleware> {
11
15
  abstract readonly name: string;
12
16
  abstract createApp(): TApp;
@@ -17,6 +21,10 @@ declare abstract class ArkstackKitDriver<TApp, TMiddleware> {
17
21
  registerErrorHandler(_app: TApp): PromiseOrValue<void>;
18
22
  abstract start(app: TApp, port: number): PromiseOrValue<void>;
19
23
  }
24
+ /**
25
+ * The ArkstackKitContract class defines the contract for an
26
+ * application that uses the ArkstackKitDriver.
27
+ */
20
28
  declare abstract class ArkstackKitContract<TApp, TMiddleware> {
21
29
  abstract app: TApp;
22
30
  abstract driver: ArkstackKitDriver<TApp, TMiddleware>;
@@ -44,16 +52,76 @@ declare abstract class Arkstack<TApp, TRoutes = unknown, THandler = unknown> {
44
52
  protected app: TApp;
45
53
  protected driver: ArkstackKitDriver<TApp, THandler>;
46
54
  abstract getRouter(): ArkstackRouterContract<TApp, TRoutes>;
55
+ /**
56
+ * Boots the application by mounting public assets, binding the
57
+ * router, applying middleware, and starting the server.
58
+ *
59
+ * @param port The numeric port to run the server on
60
+ * @param defer Set to true to skip server startup
61
+ */
47
62
  abstract boot(port: number, defer?: boolean): Promise<void>;
63
+ /**
64
+ * Gets the driver application instance.
65
+ *
66
+ * @returns
67
+ */
48
68
  getAppInstance(): TApp;
69
+ /**
70
+ * Gets the static driver application instance.
71
+ *
72
+ * @returns
73
+ */
49
74
  static getAppInstance<TApp = unknown>(): TApp;
75
+ /**
76
+ * Gets the ArkstackKitDriver instance used by the application.
77
+ *
78
+ * @returns
79
+ */
50
80
  getDriver(): ArkstackKitDriver<TApp, THandler>;
81
+ /**
82
+ * Boostrap the app and start up the server
83
+ *
84
+ * @param defaultPort start the server with this port if none is APP_PORT env variable is not set
85
+ * @param defer Set to true to skip server startup
86
+ */
51
87
  startup(defaultPort?: number, defer?: boolean): Promise<void>;
88
+ /**
89
+ * Shuts down the application by disconnecting from the database and exiting the process.
90
+ */
52
91
  shutdown(): Promise<void>;
92
+ /**
93
+ * Get the current app root directory
94
+ *
95
+ * @alias getRootDir()
96
+ * @returns
97
+ */
53
98
  static rootDir(): string;
99
+ /**
100
+ * Get the current app root directory
101
+ *
102
+ * @alias getRootDir()
103
+ * @returns
104
+ */
54
105
  rootDir(): string;
106
+ /**
107
+ * Get the current app root directory
108
+ *
109
+ * @returns
110
+ */
55
111
  static getRootDir(): string;
112
+ /**
113
+ * Set the current app root directory
114
+ *
115
+ * @param dir The prefered app root directory
116
+ * @returns
117
+ */
56
118
  setRootDir(dir: string): void;
119
+ /**
120
+ * Set the current app root directory
121
+ *
122
+ * @param dir The prefered app root directory
123
+ * @returns
124
+ */
57
125
  static setRootDir(dir: string): void;
58
126
  }
59
127
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/contract",
3
- "version": "0.12.6",
3
+ "version": "0.12.7",
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",
@@ -28,7 +28,7 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@arkstack/foundry": "^0.12.6"
31
+ "@arkstack/foundry": "^0.12.7"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsdown --config-loader unrun",