@maroonedsoftware/koa 1.7.0 → 1.8.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 CHANGED
@@ -17,4 +17,5 @@ export * from './parsers/form.parser.js';
17
17
  export * from './parsers/multipart.parser.js';
18
18
  export * from './parsers/binary.parser.js';
19
19
  export * from './parsers/serverkit.default.parsers.js';
20
+ export * from './serverkit.module.js';
20
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qDAAqD,CAAC;AACpE,cAAc,kDAAkD,CAAC;AACjE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oDAAoD,CAAC;AACnE,cAAc,qDAAqD,CAAC;AACpE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { Registry, Container } from 'injectkit';
2
+ import { AppConfig } from '@maroonedsoftware/appconfig';
3
+ /**
4
+ * Defines the lifecycle hooks for a ServerKit module.
5
+ *
6
+ * Modules are discrete units of functionality that can register services,
7
+ * respond to application startup/shutdown, and clean up resources. All
8
+ * lifecycle methods are optional — implement only what your module needs.
9
+ *
10
+ * @template ConfigT - The application config type, defaults to `AppConfig`.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const myModule: ServerKitModule<MyConfig> = {
15
+ * async setup(registry, config) {
16
+ * registry.register(MyService, new MyService(config.myService));
17
+ * },
18
+ * async teardown(container) {
19
+ * await container.resolve(MyService).close();
20
+ * },
21
+ * };
22
+ * ```
23
+ */
24
+ export interface ServerKitModule<ConfigT = AppConfig> {
25
+ /**
26
+ * Called during application initialization to register services and
27
+ * bindings into the DI registry before the container is built.
28
+ *
29
+ * @param registry - The InjectKit registry used to register services.
30
+ * @param config - The resolved application configuration.
31
+ */
32
+ setup?: (registry: Registry, config: ConfigT) => Promise<void>;
33
+ /**
34
+ * Called during application shutdown to release resources held by
35
+ * services in the container (e.g. close DB connections, flush buffers).
36
+ *
37
+ * @param container - The built InjectKit container for resolving services.
38
+ */
39
+ teardown?: (container: Container) => Promise<void>;
40
+ /**
41
+ * Called after the application is fully initialized and ready to serve
42
+ * requests. Use this to begin background work (e.g. start polling, open
43
+ * socket connections).
44
+ */
45
+ start?: () => Promise<void>;
46
+ /**
47
+ * Called before the application begins shutting down. Use this to
48
+ * gracefully stop background work started in `start`.
49
+ */
50
+ stop?: () => Promise<void>;
51
+ }
52
+ //# sourceMappingURL=serverkit.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverkit.module.d.ts","sourceRoot":"","sources":["../src/serverkit.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,eAAe,CAAC,OAAO,GAAG,SAAS;IAClD;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/D;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maroonedsoftware/koa",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Koa middleware, body parsing, and utilities for ServerKit",
5
5
  "author": {
6
6
  "name": "Marooned Software",
@@ -37,12 +37,12 @@
37
37
  "qs": "^6.15.0",
38
38
  "rate-limiter-flexible": "^9.1.1",
39
39
  "raw-body": "^3.0.2",
40
- "@maroonedsoftware/logger": "1.0.0",
41
40
  "@maroonedsoftware/errors": "1.3.0",
42
- "@maroonedsoftware/multipart": "1.0.3",
41
+ "@maroonedsoftware/appconfig": "1.3.0",
43
42
  "@maroonedsoftware/utilities": "1.1.0",
44
43
  "@maroonedsoftware/authentication": "0.1.0",
45
- "@maroonedsoftware/appconfig": "1.3.0"
44
+ "@maroonedsoftware/multipart": "1.0.3",
45
+ "@maroonedsoftware/logger": "1.0.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@koa/cors": "^5.0.0",
@@ -58,8 +58,8 @@
58
58
  "@types/koa__cors": "^5.0.1",
59
59
  "@types/qs": "^6.15.0",
60
60
  "koa": "^3.1.2",
61
- "@repo/config-typescript": "0.0.0",
62
- "@repo/config-eslint": "0.1.0"
61
+ "@repo/config-eslint": "0.1.0",
62
+ "@repo/config-typescript": "0.0.0"
63
63
  },
64
64
  "scripts": {
65
65
  "build": "tsup src/index.ts --format esm --sourcemap --dts && tsc --emitDeclarationOnly --declaration",