@kuckit/sdk 1.0.2 → 1.0.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.
Files changed (64) hide show
  1. package/dist/config/define-config.d.ts +3 -0
  2. package/dist/config/define-config.js +3 -0
  3. package/dist/config/index.d.ts +5 -0
  4. package/dist/config/index.js +5 -0
  5. package/dist/config/loader.d.ts +3 -0
  6. package/dist/config/loader.js +3 -0
  7. package/dist/config/types.d.ts +2 -0
  8. package/dist/config/types.js +1 -0
  9. package/dist/config-BeiJJZGf.js +1 -0
  10. package/dist/container-D0DK003A.js +50 -0
  11. package/dist/container-D0DK003A.js.map +1 -0
  12. package/dist/container-Ngzcb6LI.d.ts +49 -0
  13. package/dist/core/container.d.ts +3 -0
  14. package/dist/core/container.js +4 -0
  15. package/dist/core/core.module.d.ts +3 -0
  16. package/dist/core/core.module.js +3 -0
  17. package/dist/core.module-Ckt9iPWn.d.ts +22 -0
  18. package/dist/core.module-Ctm2stcL.js +48 -0
  19. package/dist/core.module-Ctm2stcL.js.map +1 -0
  20. package/dist/define-config-GYI_W9K6.js +34 -0
  21. package/dist/define-config-GYI_W9K6.js.map +1 -0
  22. package/dist/define-config-yzb59aTs.d.ts +34 -0
  23. package/dist/define-module-B83hUzJz.js +58 -0
  24. package/dist/define-module-B83hUzJz.js.map +1 -0
  25. package/dist/define-module-Cw7q13EE.d.ts +56 -0
  26. package/dist/index-CDDzqahH.d.ts +1 -0
  27. package/dist/index-Dfcz46Ma.d.ts +2 -0
  28. package/dist/index-Dw5cCt-A.d.ts +1 -0
  29. package/dist/index.d.ts +15 -616
  30. package/dist/index.js +12 -633
  31. package/dist/loader-Ct4ZivZz.js +177 -0
  32. package/dist/loader-Ct4ZivZz.js.map +1 -0
  33. package/dist/loader-DCNm6pZB.d.ts +73 -0
  34. package/dist/loader-YEqdtcKI.d.ts +29 -0
  35. package/dist/loader-lCPWCMYx.js +75 -0
  36. package/dist/loader-lCPWCMYx.js.map +1 -0
  37. package/dist/modules/define-module.d.ts +4 -0
  38. package/dist/modules/define-module.js +3 -0
  39. package/dist/modules/index.d.ts +7 -0
  40. package/dist/modules/index.js +8 -0
  41. package/dist/modules/loader.d.ts +4 -0
  42. package/dist/modules/loader.js +6 -0
  43. package/dist/modules/registry.d.ts +4 -0
  44. package/dist/modules/registry.js +3 -0
  45. package/dist/modules/types.d.ts +3 -0
  46. package/dist/modules/types.js +1 -0
  47. package/dist/modules-BDQBjAbp.js +1 -0
  48. package/dist/registry-BPYpBtYx.js +83 -0
  49. package/dist/registry-BPYpBtYx.js.map +1 -0
  50. package/dist/registry-CL_5erME.js +132 -0
  51. package/dist/registry-CL_5erME.js.map +1 -0
  52. package/dist/registry-CfpVCPcW.d.ts +68 -0
  53. package/dist/registry-DrTkgmtH.d.ts +90 -0
  54. package/dist/schema/index.d.ts +3 -0
  55. package/dist/schema/index.js +4 -0
  56. package/dist/schema/registry.d.ts +2 -0
  57. package/dist/schema/registry.js +3 -0
  58. package/dist/schema-BuA2HF_H.js +1 -0
  59. package/dist/types-ByO301S-.d.ts +112 -0
  60. package/dist/types-DKCy16X1.d.ts +51 -0
  61. package/dist/types-DxaDmkQo.d.ts +87 -0
  62. package/dist/types.d.ts +2 -0
  63. package/dist/types.js +1 -0
  64. package/package.json +8 -8
@@ -0,0 +1,3 @@
1
+ import "../types-DxaDmkQo.js";
2
+ import { t as defineConfig } from "../define-config-yzb59aTs.js";
3
+ export { defineConfig };
@@ -0,0 +1,3 @@
1
+ import { t as defineConfig } from "../define-config-GYI_W9K6.js";
2
+
3
+ export { defineConfig };
@@ -0,0 +1,5 @@
1
+ import { a as KuckitServerConfig, i as KuckitModuleConfig, n as KuckitConfig, o as LoadedKuckitConfig, r as KuckitDiscoveryConfig, t as KuckitClientConfig } from "../types-DxaDmkQo.js";
2
+ import { t as defineConfig } from "../define-config-yzb59aTs.js";
3
+ import { i as tryLoadKuckitConfig, n as hasUnifiedConfig, r as loadKuckitConfig, t as findConfigFile } from "../loader-YEqdtcKI.js";
4
+ import "../index-CDDzqahH.js";
5
+ export { KuckitClientConfig, KuckitConfig, KuckitDiscoveryConfig, KuckitModuleConfig, KuckitServerConfig, LoadedKuckitConfig, defineConfig, findConfigFile, hasUnifiedConfig, loadKuckitConfig, tryLoadKuckitConfig };
@@ -0,0 +1,5 @@
1
+ import { t as defineConfig } from "../define-config-GYI_W9K6.js";
2
+ import { i as tryLoadKuckitConfig, n as hasUnifiedConfig, r as loadKuckitConfig, t as findConfigFile } from "../loader-lCPWCMYx.js";
3
+ import "../config-BeiJJZGf.js";
4
+
5
+ export { defineConfig, findConfigFile, hasUnifiedConfig, loadKuckitConfig, tryLoadKuckitConfig };
@@ -0,0 +1,3 @@
1
+ import "../types-DxaDmkQo.js";
2
+ import { i as tryLoadKuckitConfig, n as hasUnifiedConfig, r as loadKuckitConfig, t as findConfigFile } from "../loader-YEqdtcKI.js";
3
+ export { findConfigFile, hasUnifiedConfig, loadKuckitConfig, tryLoadKuckitConfig };
@@ -0,0 +1,3 @@
1
+ import { i as tryLoadKuckitConfig, n as hasUnifiedConfig, r as loadKuckitConfig, t as findConfigFile } from "../loader-lCPWCMYx.js";
2
+
3
+ export { findConfigFile, hasUnifiedConfig, loadKuckitConfig, tryLoadKuckitConfig };
@@ -0,0 +1,2 @@
1
+ import { a as KuckitServerConfig, i as KuckitModuleConfig, n as KuckitConfig, o as LoadedKuckitConfig, r as KuckitDiscoveryConfig, t as KuckitClientConfig } from "../types-DxaDmkQo.js";
2
+ export { KuckitClientConfig, KuckitConfig, KuckitDiscoveryConfig, KuckitModuleConfig, KuckitServerConfig, LoadedKuckitConfig };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,50 @@
1
+ import { t as registerCoreModule } from "./core.module-Ctm2stcL.js";
2
+ import { InjectionMode, asValue, createContainer } from "awilix";
3
+
4
+ //#region src/core/container.ts
5
+ /**
6
+ * Factory function to create a Kuckit DI container
7
+ *
8
+ * This is the primary entry point for applications using the SDK.
9
+ * It creates an Awilix container with core infrastructure services pre-registered.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const container = await createKuckitContainer({
14
+ * config: {
15
+ * databaseUrl: process.env.DATABASE_URL!,
16
+ * enableFileLogging: true,
17
+ * logDir: './logs',
18
+ * logLevel: 'INFO',
19
+ * env: 'production',
20
+ * },
21
+ * extraRegistrations: (container) => {
22
+ * // Register your custom services
23
+ * container.register({
24
+ * myService: asClass(MyService).singleton(),
25
+ * })
26
+ * },
27
+ * })
28
+ * ```
29
+ */
30
+ const createKuckitContainer = async (opts) => {
31
+ const container = createContainer({ injectionMode: InjectionMode.PROXY });
32
+ container.register({ config: asValue(opts.config) });
33
+ registerCoreModule(container);
34
+ if (opts.extraRegistrations) await opts.extraRegistrations(container);
35
+ return container;
36
+ };
37
+ /**
38
+ * Cleanup container resources gracefully
39
+ *
40
+ * Call this when shutting down your application to close database connections
41
+ * and other resources.
42
+ */
43
+ const disposeContainer = async (container) => {
44
+ const { dbPool } = container.cradle;
45
+ if (dbPool && typeof dbPool === "object" && "end" in dbPool && typeof dbPool.end === "function") await dbPool.end();
46
+ };
47
+
48
+ //#endregion
49
+ export { disposeContainer as n, createKuckitContainer as t };
50
+ //# sourceMappingURL=container-D0DK003A.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container-D0DK003A.js","names":[],"sources":["../src/core/container.ts"],"sourcesContent":["import { createContainer, asValue, InjectionMode } from 'awilix'\nimport type { CoreContainer, CoreCradle, CoreConfig } from '../types'\nimport { registerCoreModule } from './core.module'\n\nexport interface CreateKuckitOptions {\n\t/**\n\t * Core configuration for the SDK\n\t */\n\tconfig: CoreConfig\n\n\t/**\n\t * Optional callback to register additional services after core registration\n\t */\n\textraRegistrations?: (container: CoreContainer) => void | Promise<void>\n}\n\n/**\n * Factory function to create a Kuckit DI container\n *\n * This is the primary entry point for applications using the SDK.\n * It creates an Awilix container with core infrastructure services pre-registered.\n *\n * @example\n * ```ts\n * const container = await createKuckitContainer({\n * config: {\n * databaseUrl: process.env.DATABASE_URL!,\n * enableFileLogging: true,\n * logDir: './logs',\n * logLevel: 'INFO',\n * env: 'production',\n * },\n * extraRegistrations: (container) => {\n * // Register your custom services\n * container.register({\n * myService: asClass(MyService).singleton(),\n * })\n * },\n * })\n * ```\n */\nexport const createKuckitContainer = async (opts: CreateKuckitOptions): Promise<CoreContainer> => {\n\tconst container = createContainer<CoreCradle>({\n\t\tinjectionMode: InjectionMode.PROXY,\n\t})\n\n\t// Register config first (required by other registrations)\n\tcontainer.register({\n\t\tconfig: asValue(opts.config),\n\t})\n\n\t// Register core infrastructure\n\tregisterCoreModule(container)\n\n\t// Allow custom registrations\n\tif (opts.extraRegistrations) {\n\t\tawait opts.extraRegistrations(container)\n\t}\n\n\treturn container\n}\n\n/**\n * Cleanup container resources gracefully\n *\n * Call this when shutting down your application to close database connections\n * and other resources.\n */\nexport const disposeContainer = async (container: CoreContainer): Promise<void> => {\n\tconst { dbPool } = container.cradle\n\t// Handle unknown dbPool type - check for end method\n\tif (\n\t\tdbPool &&\n\t\ttypeof dbPool === 'object' &&\n\t\t'end' in dbPool &&\n\t\ttypeof (dbPool as { end: unknown }).end === 'function'\n\t) {\n\t\tawait (dbPool as { end: () => Promise<void> }).end()\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAa,wBAAwB,OAAO,SAAsD;CACjG,MAAM,YAAY,gBAA4B,EAC7C,eAAe,cAAc,OAC7B,CAAC;AAGF,WAAU,SAAS,EAClB,QAAQ,QAAQ,KAAK,OAAO,EAC5B,CAAC;AAGF,oBAAmB,UAAU;AAG7B,KAAI,KAAK,mBACR,OAAM,KAAK,mBAAmB,UAAU;AAGzC,QAAO;;;;;;;;AASR,MAAa,mBAAmB,OAAO,cAA4C;CAClF,MAAM,EAAE,WAAW,UAAU;AAE7B,KACC,UACA,OAAO,WAAW,YAClB,SAAS,UACT,OAAQ,OAA4B,QAAQ,WAE5C,OAAO,OAAwC,KAAK"}
@@ -0,0 +1,49 @@
1
+ import { n as CoreContainer, t as CoreConfig } from "./types-DKCy16X1.js";
2
+
3
+ //#region src/core/container.d.ts
4
+ interface CreateKuckitOptions {
5
+ /**
6
+ * Core configuration for the SDK
7
+ */
8
+ config: CoreConfig;
9
+ /**
10
+ * Optional callback to register additional services after core registration
11
+ */
12
+ extraRegistrations?: (container: CoreContainer) => void | Promise<void>;
13
+ }
14
+ /**
15
+ * Factory function to create a Kuckit DI container
16
+ *
17
+ * This is the primary entry point for applications using the SDK.
18
+ * It creates an Awilix container with core infrastructure services pre-registered.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const container = await createKuckitContainer({
23
+ * config: {
24
+ * databaseUrl: process.env.DATABASE_URL!,
25
+ * enableFileLogging: true,
26
+ * logDir: './logs',
27
+ * logLevel: 'INFO',
28
+ * env: 'production',
29
+ * },
30
+ * extraRegistrations: (container) => {
31
+ * // Register your custom services
32
+ * container.register({
33
+ * myService: asClass(MyService).singleton(),
34
+ * })
35
+ * },
36
+ * })
37
+ * ```
38
+ */
39
+ declare const createKuckitContainer: (opts: CreateKuckitOptions) => Promise<CoreContainer>;
40
+ /**
41
+ * Cleanup container resources gracefully
42
+ *
43
+ * Call this when shutting down your application to close database connections
44
+ * and other resources.
45
+ */
46
+ declare const disposeContainer: (container: CoreContainer) => Promise<void>;
47
+ //#endregion
48
+ export { createKuckitContainer as n, disposeContainer as r, CreateKuckitOptions as t };
49
+ //# sourceMappingURL=container-Ngzcb6LI.d.ts.map
@@ -0,0 +1,3 @@
1
+ import "../types-DKCy16X1.js";
2
+ import { n as createKuckitContainer, r as disposeContainer, t as CreateKuckitOptions } from "../container-Ngzcb6LI.js";
3
+ export { CreateKuckitOptions, createKuckitContainer, disposeContainer };
@@ -0,0 +1,4 @@
1
+ import "../core.module-Ctm2stcL.js";
2
+ import { n as disposeContainer, t as createKuckitContainer } from "../container-D0DK003A.js";
3
+
4
+ export { createKuckitContainer, disposeContainer };
@@ -0,0 +1,3 @@
1
+ import "../types-DKCy16X1.js";
2
+ import { t as registerCoreModule } from "../core.module-Ckt9iPWn.js";
3
+ export { registerCoreModule };
@@ -0,0 +1,3 @@
1
+ import { t as registerCoreModule } from "../core.module-Ctm2stcL.js";
2
+
3
+ export { registerCoreModule };
@@ -0,0 +1,22 @@
1
+ import { n as CoreContainer } from "./types-DKCy16X1.js";
2
+
3
+ //#region src/core/core.module.d.ts
4
+
5
+ /**
6
+ * Register core infrastructure services into the container
7
+ *
8
+ * This registers:
9
+ * - Database pool and connection
10
+ * - Clock
11
+ * - Logger (structured, Loki/Prometheus compatible)
12
+ * - AI provider
13
+ * - Auth
14
+ * - Event bus
15
+ * - Cache store
16
+ * - Rate limiter store
17
+ * - Request-scoped logger
18
+ */
19
+ declare const registerCoreModule: (container: CoreContainer) => void;
20
+ //#endregion
21
+ export { registerCoreModule as t };
22
+ //# sourceMappingURL=core.module-Ckt9iPWn.d.ts.map
@@ -0,0 +1,48 @@
1
+ import { asClass, asFunction, asValue } from "awilix";
2
+ import { SystemClock } from "@kuckit/domain";
3
+ import { google } from "@ai-sdk/google";
4
+ import { auth } from "@kuckit/auth";
5
+ import { InMemoryCacheStore, InMemoryEventBus, InMemoryRateLimiterStore, createDb, createDbPool, makeErrorHandler, makeRequestLogger, makeStructuredLogger } from "@kuckit/infrastructure";
6
+
7
+ //#region src/core/core.module.ts
8
+ /**
9
+ * Register core infrastructure services into the container
10
+ *
11
+ * This registers:
12
+ * - Database pool and connection
13
+ * - Clock
14
+ * - Logger (structured, Loki/Prometheus compatible)
15
+ * - AI provider
16
+ * - Auth
17
+ * - Event bus
18
+ * - Cache store
19
+ * - Rate limiter store
20
+ * - Request-scoped logger
21
+ */
22
+ const registerCoreModule = (container) => {
23
+ container.register({
24
+ dbPool: asFunction(({ config }) => createDbPool(config.databaseUrl)).singleton(),
25
+ db: asFunction(({ dbPool }) => createDb(dbPool)).singleton(),
26
+ clock: asValue(new SystemClock()),
27
+ logger: asFunction(({ config }) => makeStructuredLogger({
28
+ enableFile: config.enableFileLogging,
29
+ logDir: config.logDir,
30
+ minLevel: config.logLevel
31
+ })).singleton(),
32
+ errorHandler: asFunction(({ logger }) => makeErrorHandler(logger)).singleton(),
33
+ auth: asValue(auth),
34
+ aiProvider: asFunction(() => google("gemini-2.5-flash")).singleton(),
35
+ eventBus: asFunction(({ logger }) => new InMemoryEventBus(logger)).singleton(),
36
+ cacheStore: asClass(InMemoryCacheStore).singleton(),
37
+ rateLimiterStore: asClass(InMemoryRateLimiterStore).singleton(),
38
+ requestLogger: asFunction(({ logger, requestId, session }) => makeRequestLogger({
39
+ requestId,
40
+ userId: session?.user?.id,
41
+ baseLogger: logger
42
+ })).scoped()
43
+ });
44
+ };
45
+
46
+ //#endregion
47
+ export { registerCoreModule as t };
48
+ //# sourceMappingURL=core.module-Ctm2stcL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.module-Ctm2stcL.js","names":[],"sources":["../src/core/core.module.ts"],"sourcesContent":["import { asClass, asFunction, asValue } from 'awilix'\nimport { SystemClock } from '@kuckit/domain'\nimport { google } from '@ai-sdk/google'\nimport { auth } from '@kuckit/auth'\nimport {\n\tcreateDbPool,\n\tcreateDb,\n\tmakeStructuredLogger,\n\tmakeRequestLogger,\n\tmakeErrorHandler,\n\tInMemoryEventBus,\n\tInMemoryCacheStore,\n\tInMemoryRateLimiterStore,\n} from '@kuckit/infrastructure'\nimport type { CoreContainer } from '../types'\n\n/**\n * Register core infrastructure services into the container\n *\n * This registers:\n * - Database pool and connection\n * - Clock\n * - Logger (structured, Loki/Prometheus compatible)\n * - AI provider\n * - Auth\n * - Event bus\n * - Cache store\n * - Rate limiter store\n * - Request-scoped logger\n */\nexport const registerCoreModule = (container: CoreContainer): void => {\n\tcontainer.register({\n\t\t// Database\n\t\tdbPool: asFunction(({ config }) => createDbPool(config.databaseUrl)).singleton(),\n\t\tdb: asFunction(({ dbPool }) => createDb(dbPool)).singleton(),\n\n\t\t// Core services\n\t\tclock: asValue(new SystemClock()),\n\n\t\tlogger: asFunction(({ config }) =>\n\t\t\tmakeStructuredLogger({\n\t\t\t\tenableFile: config.enableFileLogging,\n\t\t\t\tlogDir: config.logDir,\n\t\t\t\tminLevel: config.logLevel,\n\t\t\t})\n\t\t).singleton(),\n\n\t\terrorHandler: asFunction(({ logger }) => makeErrorHandler(logger)).singleton(),\n\n\t\t// External integrations\n\t\tauth: asValue(auth),\n\t\taiProvider: asFunction(() => google('gemini-2.5-flash')).singleton(),\n\n\t\t// Event bus\n\t\teventBus: asFunction(({ logger }) => new InMemoryEventBus(logger)).singleton(),\n\n\t\t// Stores\n\t\tcacheStore: asClass(InMemoryCacheStore).singleton(),\n\t\trateLimiterStore: asClass(InMemoryRateLimiterStore).singleton(),\n\n\t\t// Request-scoped logger (enriched with requestId and userId)\n\t\trequestLogger: asFunction(({ logger, requestId, session }) =>\n\t\t\tmakeRequestLogger({\n\t\t\t\trequestId,\n\t\t\t\tuserId: session?.user?.id,\n\t\t\t\tbaseLogger: logger,\n\t\t\t})\n\t\t).scoped(),\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,sBAAsB,cAAmC;AACrE,WAAU,SAAS;EAElB,QAAQ,YAAY,EAAE,aAAa,aAAa,OAAO,YAAY,CAAC,CAAC,WAAW;EAChF,IAAI,YAAY,EAAE,aAAa,SAAS,OAAO,CAAC,CAAC,WAAW;EAG5D,OAAO,QAAQ,IAAI,aAAa,CAAC;EAEjC,QAAQ,YAAY,EAAE,aACrB,qBAAqB;GACpB,YAAY,OAAO;GACnB,QAAQ,OAAO;GACf,UAAU,OAAO;GACjB,CAAC,CACF,CAAC,WAAW;EAEb,cAAc,YAAY,EAAE,aAAa,iBAAiB,OAAO,CAAC,CAAC,WAAW;EAG9E,MAAM,QAAQ,KAAK;EACnB,YAAY,iBAAiB,OAAO,mBAAmB,CAAC,CAAC,WAAW;EAGpE,UAAU,YAAY,EAAE,aAAa,IAAI,iBAAiB,OAAO,CAAC,CAAC,WAAW;EAG9E,YAAY,QAAQ,mBAAmB,CAAC,WAAW;EACnD,kBAAkB,QAAQ,yBAAyB,CAAC,WAAW;EAG/D,eAAe,YAAY,EAAE,QAAQ,WAAW,cAC/C,kBAAkB;GACjB;GACA,QAAQ,SAAS,MAAM;GACvB,YAAY;GACZ,CAAC,CACF,CAAC,QAAQ;EACV,CAAC"}
@@ -0,0 +1,34 @@
1
+ //#region src/config/define-config.ts
2
+ /**
3
+ * Define a Kuckit configuration with full type safety.
4
+ *
5
+ * This helper provides IntelliSense support and type checking for your configuration.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * // kuckit.config.ts
10
+ * import { defineConfig } from '@kuckit/sdk'
11
+ *
12
+ * export default defineConfig({
13
+ * modules: [
14
+ * { package: '@kuckit/users-module' },
15
+ * { package: '@acme/billing-module', config: { currency: 'USD' } },
16
+ * ],
17
+ *
18
+ * server: {
19
+ * apiPrefix: '/api',
20
+ * },
21
+ *
22
+ * client: {
23
+ * routeInjection: true,
24
+ * },
25
+ * })
26
+ * ```
27
+ */
28
+ function defineConfig(config) {
29
+ return config;
30
+ }
31
+
32
+ //#endregion
33
+ export { defineConfig as t };
34
+ //# sourceMappingURL=define-config-GYI_W9K6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-config-GYI_W9K6.js","names":[],"sources":["../src/config/define-config.ts"],"sourcesContent":["import type { KuckitConfig } from './types'\n\n/**\n * Define a Kuckit configuration with full type safety.\n *\n * This helper provides IntelliSense support and type checking for your configuration.\n *\n * @example\n * ```typescript\n * // kuckit.config.ts\n * import { defineConfig } from '@kuckit/sdk'\n *\n * export default defineConfig({\n * modules: [\n * { package: '@kuckit/users-module' },\n * { package: '@acme/billing-module', config: { currency: 'USD' } },\n * ],\n *\n * server: {\n * apiPrefix: '/api',\n * },\n *\n * client: {\n * routeInjection: true,\n * },\n * })\n * ```\n */\nexport function defineConfig(config: KuckitConfig): KuckitConfig {\n\treturn config\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,aAAa,QAAoC;AAChE,QAAO"}
@@ -0,0 +1,34 @@
1
+ import { n as KuckitConfig } from "./types-DxaDmkQo.js";
2
+
3
+ //#region src/config/define-config.d.ts
4
+
5
+ /**
6
+ * Define a Kuckit configuration with full type safety.
7
+ *
8
+ * This helper provides IntelliSense support and type checking for your configuration.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // kuckit.config.ts
13
+ * import { defineConfig } from '@kuckit/sdk'
14
+ *
15
+ * export default defineConfig({
16
+ * modules: [
17
+ * { package: '@kuckit/users-module' },
18
+ * { package: '@acme/billing-module', config: { currency: 'USD' } },
19
+ * ],
20
+ *
21
+ * server: {
22
+ * apiPrefix: '/api',
23
+ * },
24
+ *
25
+ * client: {
26
+ * routeInjection: true,
27
+ * },
28
+ * })
29
+ * ```
30
+ */
31
+ declare function defineConfig(config: KuckitConfig): KuckitConfig;
32
+ //#endregion
33
+ export { defineConfig as t };
34
+ //# sourceMappingURL=define-config-yzb59aTs.d.ts.map
@@ -0,0 +1,58 @@
1
+ //#region src/modules/define-module.ts
2
+ /**
3
+ * Helper to define a Kuckit module with type safety
4
+ *
5
+ * This is the primary way to create a module for the Kuckit SDK.
6
+ * It provides type inference for the configuration and validates
7
+ * the module structure at compile time.
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * // In your module's main file (e.g., src/module.ts)
12
+ * import { defineKuckitModule, asClass, asFunction } from '@kuckit/sdk'
13
+ *
14
+ * interface BillingModuleConfig {
15
+ * currency: string
16
+ * taxRate: number
17
+ * }
18
+ *
19
+ * export const kuckitModule = defineKuckitModule<BillingModuleConfig>({
20
+ * id: 'acme.billing',
21
+ * displayName: 'Billing',
22
+ * description: 'Invoice and payment processing',
23
+ * version: '1.0.0',
24
+ *
25
+ * register(ctx) {
26
+ * ctx.container.register({
27
+ * invoiceRepository: asClass(DrizzleInvoiceRepository).scoped(),
28
+ * paymentService: asFunction(makePaymentService).singleton(),
29
+ * })
30
+ * },
31
+ *
32
+ * registerApi(ctx) {
33
+ * ctx.addApiRegistration({
34
+ * type: 'rpc-router',
35
+ * name: 'billing',
36
+ * router: createBillingRouter(ctx.container),
37
+ * })
38
+ * },
39
+ *
40
+ * onBootstrap(ctx) {
41
+ * const logger = ctx.container.resolve('logger')
42
+ * logger.info(`Billing module initialized with currency: ${ctx.config.currency}`)
43
+ * },
44
+ * })
45
+ * ```
46
+ *
47
+ * @param mod - The module definition object
48
+ * @returns The same module definition (for type inference)
49
+ */
50
+ const defineKuckitModule = (mod) => {
51
+ if (!mod.id) throw new Error("Module must have an id");
52
+ if (typeof mod.id !== "string" || mod.id.trim() === "") throw new Error("Module id must be a non-empty string");
53
+ return mod;
54
+ };
55
+
56
+ //#endregion
57
+ export { defineKuckitModule as t };
58
+ //# sourceMappingURL=define-module-B83hUzJz.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define-module-B83hUzJz.js","names":[],"sources":["../src/modules/define-module.ts"],"sourcesContent":["import type { KuckitModuleDefinition } from './types'\n\n/**\n * Helper to define a Kuckit module with type safety\n *\n * This is the primary way to create a module for the Kuckit SDK.\n * It provides type inference for the configuration and validates\n * the module structure at compile time.\n *\n * @example\n * ```ts\n * // In your module's main file (e.g., src/module.ts)\n * import { defineKuckitModule, asClass, asFunction } from '@kuckit/sdk'\n *\n * interface BillingModuleConfig {\n * currency: string\n * taxRate: number\n * }\n *\n * export const kuckitModule = defineKuckitModule<BillingModuleConfig>({\n * id: 'acme.billing',\n * displayName: 'Billing',\n * description: 'Invoice and payment processing',\n * version: '1.0.0',\n *\n * register(ctx) {\n * ctx.container.register({\n * invoiceRepository: asClass(DrizzleInvoiceRepository).scoped(),\n * paymentService: asFunction(makePaymentService).singleton(),\n * })\n * },\n *\n * registerApi(ctx) {\n * ctx.addApiRegistration({\n * type: 'rpc-router',\n * name: 'billing',\n * router: createBillingRouter(ctx.container),\n * })\n * },\n *\n * onBootstrap(ctx) {\n * const logger = ctx.container.resolve('logger')\n * logger.info(`Billing module initialized with currency: ${ctx.config.currency}`)\n * },\n * })\n * ```\n *\n * @param mod - The module definition object\n * @returns The same module definition (for type inference)\n */\nexport const defineKuckitModule = <TConfig = unknown>(\n\tmod: KuckitModuleDefinition<TConfig>\n): KuckitModuleDefinition<TConfig> => {\n\t// Validate required fields\n\tif (!mod.id) {\n\t\tthrow new Error('Module must have an id')\n\t}\n\n\tif (typeof mod.id !== 'string' || mod.id.trim() === '') {\n\t\tthrow new Error('Module id must be a non-empty string')\n\t}\n\n\treturn mod\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAa,sBACZ,QACqC;AAErC,KAAI,CAAC,IAAI,GACR,OAAM,IAAI,MAAM,yBAAyB;AAG1C,KAAI,OAAO,IAAI,OAAO,YAAY,IAAI,GAAG,MAAM,KAAK,GACnD,OAAM,IAAI,MAAM,uCAAuC;AAGxD,QAAO"}
@@ -0,0 +1,56 @@
1
+ import { i as KuckitModuleDefinition } from "./types-ByO301S-.js";
2
+
3
+ //#region src/modules/define-module.d.ts
4
+
5
+ /**
6
+ * Helper to define a Kuckit module with type safety
7
+ *
8
+ * This is the primary way to create a module for the Kuckit SDK.
9
+ * It provides type inference for the configuration and validates
10
+ * the module structure at compile time.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * // In your module's main file (e.g., src/module.ts)
15
+ * import { defineKuckitModule, asClass, asFunction } from '@kuckit/sdk'
16
+ *
17
+ * interface BillingModuleConfig {
18
+ * currency: string
19
+ * taxRate: number
20
+ * }
21
+ *
22
+ * export const kuckitModule = defineKuckitModule<BillingModuleConfig>({
23
+ * id: 'acme.billing',
24
+ * displayName: 'Billing',
25
+ * description: 'Invoice and payment processing',
26
+ * version: '1.0.0',
27
+ *
28
+ * register(ctx) {
29
+ * ctx.container.register({
30
+ * invoiceRepository: asClass(DrizzleInvoiceRepository).scoped(),
31
+ * paymentService: asFunction(makePaymentService).singleton(),
32
+ * })
33
+ * },
34
+ *
35
+ * registerApi(ctx) {
36
+ * ctx.addApiRegistration({
37
+ * type: 'rpc-router',
38
+ * name: 'billing',
39
+ * router: createBillingRouter(ctx.container),
40
+ * })
41
+ * },
42
+ *
43
+ * onBootstrap(ctx) {
44
+ * const logger = ctx.container.resolve('logger')
45
+ * logger.info(`Billing module initialized with currency: ${ctx.config.currency}`)
46
+ * },
47
+ * })
48
+ * ```
49
+ *
50
+ * @param mod - The module definition object
51
+ * @returns The same module definition (for type inference)
52
+ */
53
+ declare const defineKuckitModule: <TConfig = unknown>(mod: KuckitModuleDefinition<TConfig>) => KuckitModuleDefinition<TConfig>;
54
+ //#endregion
55
+ export { defineKuckitModule as t };
56
+ //# sourceMappingURL=define-module-Cw7q13EE.d.ts.map
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,2 @@
1
+ import { PgTable as PgTable$1 } from "drizzle-orm/pg-core";
2
+ export { PgTable$1 as t };
@@ -0,0 +1 @@
1
+ export { };