@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,132 @@
1
+ //#region src/modules/registry.ts
2
+ /**
3
+ * Validates that a capability string matches expected patterns
4
+ */
5
+ const isValidCapability = (cap) => {
6
+ if ([
7
+ "nav.item",
8
+ "settings.page",
9
+ "dashboard.widget",
10
+ "api.webhook",
11
+ "api.public",
12
+ "slot.provider"
13
+ ].includes(cap)) return true;
14
+ if (cap.startsWith("custom.") && cap.length > 7) return true;
15
+ return false;
16
+ };
17
+ /**
18
+ * Registry for loaded Kuckit modules
19
+ *
20
+ * Tracks all loaded modules and their capabilities for querying.
21
+ */
22
+ var ModuleRegistry = class {
23
+ modules = /* @__PURE__ */ new Map();
24
+ frozen = false;
25
+ /**
26
+ * Register a loaded module
27
+ * @throws Error if registry is frozen or module ID already exists
28
+ */
29
+ register(module) {
30
+ if (this.frozen) throw new Error(`ModuleRegistry is frozen. Cannot register module "${module.id}" after finalization.`);
31
+ if (this.modules.has(module.id)) throw new Error(`Module with ID "${module.id}" is already registered.`);
32
+ const capabilities = module.capabilities ?? [];
33
+ for (const cap of capabilities) if (!isValidCapability(cap)) throw new Error(`Invalid capability "${cap}" in module "${module.id}". Capabilities must be built-in (nav.item, settings.page, etc.) or custom.* prefixed.`);
34
+ this.modules.set(module.id, {
35
+ id: module.id,
36
+ displayName: module.displayName,
37
+ description: module.description,
38
+ version: module.version,
39
+ capabilities
40
+ });
41
+ }
42
+ /**
43
+ * Get all registered modules
44
+ */
45
+ getAll() {
46
+ return Array.from(this.modules.values());
47
+ }
48
+ /**
49
+ * Get a module by ID
50
+ */
51
+ getById(id) {
52
+ return this.modules.get(id);
53
+ }
54
+ /**
55
+ * Check if a module is registered
56
+ */
57
+ has(id) {
58
+ return this.modules.has(id);
59
+ }
60
+ /**
61
+ * Get all modules that have a specific capability
62
+ */
63
+ getWithCapability(capability) {
64
+ return this.getAll().filter((mod) => mod.capabilities.includes(capability));
65
+ }
66
+ /**
67
+ * Check if a specific module has a capability
68
+ */
69
+ hasCapability(moduleId, capability) {
70
+ const module = this.modules.get(moduleId);
71
+ return module ? module.capabilities.includes(capability) : false;
72
+ }
73
+ /**
74
+ * Get all unique capabilities across all modules
75
+ */
76
+ getAllCapabilities() {
77
+ const caps = /* @__PURE__ */ new Set();
78
+ for (const mod of this.modules.values()) for (const cap of mod.capabilities) caps.add(cap);
79
+ return Array.from(caps);
80
+ }
81
+ /**
82
+ * Freeze the registry to prevent further modifications
83
+ */
84
+ freeze() {
85
+ this.frozen = true;
86
+ }
87
+ /**
88
+ * Check if registry is frozen
89
+ */
90
+ isFrozen() {
91
+ return this.frozen;
92
+ }
93
+ /**
94
+ * Get the number of registered modules
95
+ */
96
+ get size() {
97
+ return this.modules.size;
98
+ }
99
+ /**
100
+ * Clear all modules (only works if not frozen)
101
+ */
102
+ clear() {
103
+ if (this.frozen) throw new Error("ModuleRegistry is frozen. Cannot clear modules.");
104
+ this.modules.clear();
105
+ }
106
+ };
107
+ let globalRegistry = null;
108
+ /**
109
+ * Get the global module registry
110
+ * Creates one if it doesn't exist
111
+ */
112
+ function getModuleRegistry() {
113
+ if (!globalRegistry) globalRegistry = new ModuleRegistry();
114
+ return globalRegistry;
115
+ }
116
+ /**
117
+ * Get all modules that have a specific capability
118
+ * Convenience function that uses the global registry
119
+ */
120
+ function getModulesWithCapability(capability) {
121
+ return getModuleRegistry().getWithCapability(capability);
122
+ }
123
+ /**
124
+ * Reset the global registry (mainly for testing)
125
+ */
126
+ function resetModuleRegistry() {
127
+ globalRegistry = null;
128
+ }
129
+
130
+ //#endregion
131
+ export { resetModuleRegistry as i, getModuleRegistry as n, getModulesWithCapability as r, ModuleRegistry as t };
132
+ //# sourceMappingURL=registry-CL_5erME.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-CL_5erME.js","names":["globalRegistry: ModuleRegistry | null"],"sources":["../src/modules/registry.ts"],"sourcesContent":["import type { ModuleCapability, KuckitModuleDefinition } from './types'\n\n/**\n * Information about a loaded module\n */\nexport interface LoadedModuleInfo {\n\t/** Module unique identifier */\n\tid: string\n\t/** Human-readable name */\n\tdisplayName?: string\n\t/** Module description */\n\tdescription?: string\n\t/** Module version */\n\tversion?: string\n\t/** Capabilities this module provides */\n\tcapabilities: ModuleCapability[]\n}\n\n/**\n * Validates that a capability string matches expected patterns\n */\nconst isValidCapability = (cap: string): cap is ModuleCapability => {\n\t// Built-in capabilities\n\tconst builtIn = [\n\t\t'nav.item',\n\t\t'settings.page',\n\t\t'dashboard.widget',\n\t\t'api.webhook',\n\t\t'api.public',\n\t\t'slot.provider',\n\t]\n\tif (builtIn.includes(cap)) return true\n\n\t// Custom capabilities must start with 'custom.'\n\tif (cap.startsWith('custom.') && cap.length > 7) return true\n\n\treturn false\n}\n\n/**\n * Registry for loaded Kuckit modules\n *\n * Tracks all loaded modules and their capabilities for querying.\n */\nexport class ModuleRegistry {\n\tprivate modules: Map<string, LoadedModuleInfo> = new Map()\n\tprivate frozen = false\n\n\t/**\n\t * Register a loaded module\n\t * @throws Error if registry is frozen or module ID already exists\n\t */\n\tregister(module: KuckitModuleDefinition): void {\n\t\tif (this.frozen) {\n\t\t\tthrow new Error(\n\t\t\t\t`ModuleRegistry is frozen. Cannot register module \"${module.id}\" after finalization.`\n\t\t\t)\n\t\t}\n\t\tif (this.modules.has(module.id)) {\n\t\t\tthrow new Error(`Module with ID \"${module.id}\" is already registered.`)\n\t\t}\n\n\t\t// Validate capabilities\n\t\tconst capabilities = module.capabilities ?? []\n\t\tfor (const cap of capabilities) {\n\t\t\tif (!isValidCapability(cap)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Invalid capability \"${cap}\" in module \"${module.id}\". ` +\n\t\t\t\t\t\t`Capabilities must be built-in (nav.item, settings.page, etc.) or custom.* prefixed.`\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tthis.modules.set(module.id, {\n\t\t\tid: module.id,\n\t\t\tdisplayName: module.displayName,\n\t\t\tdescription: module.description,\n\t\t\tversion: module.version,\n\t\t\tcapabilities,\n\t\t})\n\t}\n\n\t/**\n\t * Get all registered modules\n\t */\n\tgetAll(): LoadedModuleInfo[] {\n\t\treturn Array.from(this.modules.values())\n\t}\n\n\t/**\n\t * Get a module by ID\n\t */\n\tgetById(id: string): LoadedModuleInfo | undefined {\n\t\treturn this.modules.get(id)\n\t}\n\n\t/**\n\t * Check if a module is registered\n\t */\n\thas(id: string): boolean {\n\t\treturn this.modules.has(id)\n\t}\n\n\t/**\n\t * Get all modules that have a specific capability\n\t */\n\tgetWithCapability(capability: ModuleCapability): LoadedModuleInfo[] {\n\t\treturn this.getAll().filter((mod) => mod.capabilities.includes(capability))\n\t}\n\n\t/**\n\t * Check if a specific module has a capability\n\t */\n\thasCapability(moduleId: string, capability: ModuleCapability): boolean {\n\t\tconst module = this.modules.get(moduleId)\n\t\treturn module ? module.capabilities.includes(capability) : false\n\t}\n\n\t/**\n\t * Get all unique capabilities across all modules\n\t */\n\tgetAllCapabilities(): ModuleCapability[] {\n\t\tconst caps = new Set<ModuleCapability>()\n\t\tfor (const mod of this.modules.values()) {\n\t\t\tfor (const cap of mod.capabilities) {\n\t\t\t\tcaps.add(cap)\n\t\t\t}\n\t\t}\n\t\treturn Array.from(caps)\n\t}\n\n\t/**\n\t * Freeze the registry to prevent further modifications\n\t */\n\tfreeze(): void {\n\t\tthis.frozen = true\n\t}\n\n\t/**\n\t * Check if registry is frozen\n\t */\n\tisFrozen(): boolean {\n\t\treturn this.frozen\n\t}\n\n\t/**\n\t * Get the number of registered modules\n\t */\n\tget size(): number {\n\t\treturn this.modules.size\n\t}\n\n\t/**\n\t * Clear all modules (only works if not frozen)\n\t */\n\tclear(): void {\n\t\tif (this.frozen) {\n\t\t\tthrow new Error('ModuleRegistry is frozen. Cannot clear modules.')\n\t\t}\n\t\tthis.modules.clear()\n\t}\n}\n\n// Global module registry instance\nlet globalRegistry: ModuleRegistry | null = null\n\n/**\n * Get the global module registry\n * Creates one if it doesn't exist\n */\nexport function getModuleRegistry(): ModuleRegistry {\n\tif (!globalRegistry) {\n\t\tglobalRegistry = new ModuleRegistry()\n\t}\n\treturn globalRegistry\n}\n\n/**\n * Get all modules that have a specific capability\n * Convenience function that uses the global registry\n */\nexport function getModulesWithCapability(capability: ModuleCapability): LoadedModuleInfo[] {\n\treturn getModuleRegistry().getWithCapability(capability)\n}\n\n/**\n * Reset the global registry (mainly for testing)\n */\nexport function resetModuleRegistry(): void {\n\tglobalRegistry = null\n}\n"],"mappings":";;;;AAqBA,MAAM,qBAAqB,QAAyC;AAUnE,KARgB;EACf;EACA;EACA;EACA;EACA;EACA;EACA,CACW,SAAS,IAAI,CAAE,QAAO;AAGlC,KAAI,IAAI,WAAW,UAAU,IAAI,IAAI,SAAS,EAAG,QAAO;AAExD,QAAO;;;;;;;AAQR,IAAa,iBAAb,MAA4B;CAC3B,AAAQ,0BAAyC,IAAI,KAAK;CAC1D,AAAQ,SAAS;;;;;CAMjB,SAAS,QAAsC;AAC9C,MAAI,KAAK,OACR,OAAM,IAAI,MACT,qDAAqD,OAAO,GAAG,uBAC/D;AAEF,MAAI,KAAK,QAAQ,IAAI,OAAO,GAAG,CAC9B,OAAM,IAAI,MAAM,mBAAmB,OAAO,GAAG,0BAA0B;EAIxE,MAAM,eAAe,OAAO,gBAAgB,EAAE;AAC9C,OAAK,MAAM,OAAO,aACjB,KAAI,CAAC,kBAAkB,IAAI,CAC1B,OAAM,IAAI,MACT,uBAAuB,IAAI,eAAe,OAAO,GAAG,wFAEpD;AAIH,OAAK,QAAQ,IAAI,OAAO,IAAI;GAC3B,IAAI,OAAO;GACX,aAAa,OAAO;GACpB,aAAa,OAAO;GACpB,SAAS,OAAO;GAChB;GACA,CAAC;;;;;CAMH,SAA6B;AAC5B,SAAO,MAAM,KAAK,KAAK,QAAQ,QAAQ,CAAC;;;;;CAMzC,QAAQ,IAA0C;AACjD,SAAO,KAAK,QAAQ,IAAI,GAAG;;;;;CAM5B,IAAI,IAAqB;AACxB,SAAO,KAAK,QAAQ,IAAI,GAAG;;;;;CAM5B,kBAAkB,YAAkD;AACnE,SAAO,KAAK,QAAQ,CAAC,QAAQ,QAAQ,IAAI,aAAa,SAAS,WAAW,CAAC;;;;;CAM5E,cAAc,UAAkB,YAAuC;EACtE,MAAM,SAAS,KAAK,QAAQ,IAAI,SAAS;AACzC,SAAO,SAAS,OAAO,aAAa,SAAS,WAAW,GAAG;;;;;CAM5D,qBAAyC;EACxC,MAAM,uBAAO,IAAI,KAAuB;AACxC,OAAK,MAAM,OAAO,KAAK,QAAQ,QAAQ,CACtC,MAAK,MAAM,OAAO,IAAI,aACrB,MAAK,IAAI,IAAI;AAGf,SAAO,MAAM,KAAK,KAAK;;;;;CAMxB,SAAe;AACd,OAAK,SAAS;;;;;CAMf,WAAoB;AACnB,SAAO,KAAK;;;;;CAMb,IAAI,OAAe;AAClB,SAAO,KAAK,QAAQ;;;;;CAMrB,QAAc;AACb,MAAI,KAAK,OACR,OAAM,IAAI,MAAM,kDAAkD;AAEnE,OAAK,QAAQ,OAAO;;;AAKtB,IAAIA,iBAAwC;;;;;AAM5C,SAAgB,oBAAoC;AACnD,KAAI,CAAC,eACJ,kBAAiB,IAAI,gBAAgB;AAEtC,QAAO;;;;;;AAOR,SAAgB,yBAAyB,YAAkD;AAC1F,QAAO,mBAAmB,CAAC,kBAAkB,WAAW;;;;;AAMzD,SAAgB,sBAA4B;AAC3C,kBAAiB"}
@@ -0,0 +1,68 @@
1
+ import { PgTable } from "drizzle-orm/pg-core";
2
+
3
+ //#region src/schema/registry.d.ts
4
+
5
+ /**
6
+ * Entry for a registered schema
7
+ */
8
+ interface SchemaEntry {
9
+ /** Module that owns this schema */
10
+ moduleId: string;
11
+ /** Table name identifier */
12
+ tableName: string;
13
+ /** Drizzle table schema */
14
+ schema: PgTable;
15
+ }
16
+ /**
17
+ * Registry for module-owned database schemas
18
+ *
19
+ * Allows modules to register their Drizzle schemas during the register() hook.
20
+ * The CLI uses this registry to aggregate schemas for drizzle-kit operations.
21
+ */
22
+ declare class SchemaRegistry {
23
+ private schemas;
24
+ /**
25
+ * Register a schema from a module
26
+ * @param moduleId - Module identifier (e.g., 'acme.billing')
27
+ * @param tableName - Table name identifier (e.g., 'invoices')
28
+ * @param schema - Drizzle PgTable schema
29
+ */
30
+ register(moduleId: string, tableName: string, schema: PgTable): void;
31
+ /**
32
+ * Get all registered schemas
33
+ */
34
+ getAll(): Map<string, SchemaEntry>;
35
+ /**
36
+ * Get schemas registered by a specific module
37
+ */
38
+ getByModule(moduleId: string): SchemaEntry[];
39
+ /**
40
+ * Get all schemas as a flat object for drizzle-kit
41
+ * Keys are table names, values are PgTable schemas
42
+ */
43
+ getAllSchemas(): Record<string, PgTable>;
44
+ /**
45
+ * Check if any schemas are registered
46
+ */
47
+ hasSchemas(): boolean;
48
+ /**
49
+ * Get the count of registered schemas
50
+ */
51
+ get size(): number;
52
+ /**
53
+ * Clear all schemas (mainly for testing)
54
+ */
55
+ clear(): void;
56
+ }
57
+ /**
58
+ * Get the global schema registry
59
+ * Creates one if it doesn't exist
60
+ */
61
+ declare function getSchemaRegistry(): SchemaRegistry;
62
+ /**
63
+ * Reset the global schema registry (mainly for testing)
64
+ */
65
+ declare function resetSchemaRegistry(): void;
66
+ //#endregion
67
+ export { resetSchemaRegistry as i, SchemaRegistry as n, getSchemaRegistry as r, SchemaEntry as t };
68
+ //# sourceMappingURL=registry-CfpVCPcW.d.ts.map
@@ -0,0 +1,90 @@
1
+ import { c as ModuleCapability, i as KuckitModuleDefinition } from "./types-ByO301S-.js";
2
+
3
+ //#region src/modules/registry.d.ts
4
+
5
+ /**
6
+ * Information about a loaded module
7
+ */
8
+ interface LoadedModuleInfo {
9
+ /** Module unique identifier */
10
+ id: string;
11
+ /** Human-readable name */
12
+ displayName?: string;
13
+ /** Module description */
14
+ description?: string;
15
+ /** Module version */
16
+ version?: string;
17
+ /** Capabilities this module provides */
18
+ capabilities: ModuleCapability[];
19
+ }
20
+ /**
21
+ * Registry for loaded Kuckit modules
22
+ *
23
+ * Tracks all loaded modules and their capabilities for querying.
24
+ */
25
+ declare class ModuleRegistry {
26
+ private modules;
27
+ private frozen;
28
+ /**
29
+ * Register a loaded module
30
+ * @throws Error if registry is frozen or module ID already exists
31
+ */
32
+ register(module: KuckitModuleDefinition): void;
33
+ /**
34
+ * Get all registered modules
35
+ */
36
+ getAll(): LoadedModuleInfo[];
37
+ /**
38
+ * Get a module by ID
39
+ */
40
+ getById(id: string): LoadedModuleInfo | undefined;
41
+ /**
42
+ * Check if a module is registered
43
+ */
44
+ has(id: string): boolean;
45
+ /**
46
+ * Get all modules that have a specific capability
47
+ */
48
+ getWithCapability(capability: ModuleCapability): LoadedModuleInfo[];
49
+ /**
50
+ * Check if a specific module has a capability
51
+ */
52
+ hasCapability(moduleId: string, capability: ModuleCapability): boolean;
53
+ /**
54
+ * Get all unique capabilities across all modules
55
+ */
56
+ getAllCapabilities(): ModuleCapability[];
57
+ /**
58
+ * Freeze the registry to prevent further modifications
59
+ */
60
+ freeze(): void;
61
+ /**
62
+ * Check if registry is frozen
63
+ */
64
+ isFrozen(): boolean;
65
+ /**
66
+ * Get the number of registered modules
67
+ */
68
+ get size(): number;
69
+ /**
70
+ * Clear all modules (only works if not frozen)
71
+ */
72
+ clear(): void;
73
+ }
74
+ /**
75
+ * Get the global module registry
76
+ * Creates one if it doesn't exist
77
+ */
78
+ declare function getModuleRegistry(): ModuleRegistry;
79
+ /**
80
+ * Get all modules that have a specific capability
81
+ * Convenience function that uses the global registry
82
+ */
83
+ declare function getModulesWithCapability(capability: ModuleCapability): LoadedModuleInfo[];
84
+ /**
85
+ * Reset the global registry (mainly for testing)
86
+ */
87
+ declare function resetModuleRegistry(): void;
88
+ //#endregion
89
+ export { resetModuleRegistry as a, getModulesWithCapability as i, ModuleRegistry as n, getModuleRegistry as r, LoadedModuleInfo as t };
90
+ //# sourceMappingURL=registry-DrTkgmtH.d.ts.map
@@ -0,0 +1,3 @@
1
+ import { i as resetSchemaRegistry, n as SchemaRegistry, r as getSchemaRegistry, t as SchemaEntry } from "../registry-CfpVCPcW.js";
2
+ import { t as PgTable } from "../index-Dfcz46Ma.js";
3
+ export { PgTable, SchemaEntry, SchemaRegistry, getSchemaRegistry, resetSchemaRegistry };
@@ -0,0 +1,4 @@
1
+ import { n as getSchemaRegistry, r as resetSchemaRegistry, t as SchemaRegistry } from "../registry-BPYpBtYx.js";
2
+ import "../schema-BuA2HF_H.js";
3
+
4
+ export { SchemaRegistry, getSchemaRegistry, resetSchemaRegistry };
@@ -0,0 +1,2 @@
1
+ import { i as resetSchemaRegistry, n as SchemaRegistry, r as getSchemaRegistry, t as SchemaEntry } from "../registry-CfpVCPcW.js";
2
+ export { SchemaEntry, SchemaRegistry, getSchemaRegistry, resetSchemaRegistry };
@@ -0,0 +1,3 @@
1
+ import { n as getSchemaRegistry, r as resetSchemaRegistry, t as SchemaRegistry } from "../registry-BPYpBtYx.js";
2
+
3
+ export { SchemaRegistry, getSchemaRegistry, resetSchemaRegistry };
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1,112 @@
1
+ import { n as CoreContainer } from "./types-DKCy16X1.js";
2
+ import { PgTable } from "drizzle-orm/pg-core";
3
+
4
+ //#region src/modules/types.d.ts
5
+
6
+ /**
7
+ * Built-in capability types for common module features
8
+ */
9
+ type BuiltInCapability = 'nav.item' | 'settings.page' | 'dashboard.widget' | 'api.webhook' | 'api.public' | 'slot.provider';
10
+ /**
11
+ * Module capability type - built-in or custom
12
+ * Custom capabilities must be prefixed with 'custom.'
13
+ */
14
+ type ModuleCapability = BuiltInCapability | `custom.${string}`;
15
+ /**
16
+ * Module metadata for discovery and documentation
17
+ */
18
+ interface KuckitModuleMeta {
19
+ /** Unique identifier, e.g., 'kuckit.users' or 'acme.billing' */
20
+ id: string;
21
+ /** Human-readable name */
22
+ displayName?: string;
23
+ /** Module description */
24
+ description?: string;
25
+ /** Module version */
26
+ version?: string;
27
+ /** Capabilities this module provides */
28
+ capabilities?: ModuleCapability[];
29
+ }
30
+ /**
31
+ * Context passed to module hooks
32
+ */
33
+ interface KuckitModuleContext<TConfig = unknown> {
34
+ /** DI container for registering services */
35
+ container: CoreContainer;
36
+ /** Environment name (development, production, etc.) */
37
+ env: string;
38
+ /** Module-specific configuration */
39
+ config: TConfig;
40
+ /** Register a Drizzle schema for this module */
41
+ registerSchema: (tableName: string, schema: PgTable) => void;
42
+ }
43
+ /**
44
+ * API registration for oRPC routers or other API handlers
45
+ */
46
+ interface ApiRegistration {
47
+ /** Type of API handler */
48
+ type: 'rpc-router' | 'rest-router' | 'graphql-resolver';
49
+ /** Router/handler name, e.g., 'users' */
50
+ name: string;
51
+ /** The actual router/handler instance */
52
+ router: unknown;
53
+ /** Optional path prefix */
54
+ prefix?: string;
55
+ }
56
+ /**
57
+ * Module lifecycle hooks
58
+ */
59
+ interface KuckitModuleHooks<TConfig = unknown> {
60
+ /**
61
+ * Called early - register DI bindings (repositories, services, use cases)
62
+ * This is where you wire up your module's dependencies
63
+ */
64
+ register?(ctx: KuckitModuleContext<TConfig>): void | Promise<void>;
65
+ /**
66
+ * Called after all modules registered - register API endpoints
67
+ * Use addApiRegistration to contribute routes to the application
68
+ */
69
+ registerApi?(ctx: KuckitModuleContext<TConfig> & {
70
+ addApiRegistration: (reg: ApiRegistration) => void;
71
+ }): void | Promise<void>;
72
+ /**
73
+ * Called after everything is wired - final initialization
74
+ * Good place for startup tasks like cache warming, health checks, etc.
75
+ */
76
+ onBootstrap?(ctx: KuckitModuleContext<TConfig>): void | Promise<void>;
77
+ /**
78
+ * Optional: cleanup on shutdown
79
+ * Close connections, flush buffers, etc.
80
+ */
81
+ onShutdown?(ctx: KuckitModuleContext<TConfig>): void | Promise<void>;
82
+ }
83
+ /**
84
+ * Complete module definition combining metadata and hooks
85
+ */
86
+ interface KuckitModuleDefinition<TConfig = unknown> extends KuckitModuleMeta, KuckitModuleHooks<TConfig> {}
87
+ /**
88
+ * Module specification in application config
89
+ *
90
+ * You can specify a module in two ways:
91
+ * 1. `module`: Direct reference to a module definition (preferred in monorepos)
92
+ * 2. `package`: NPM package name for dynamic import (for published packages)
93
+ */
94
+ interface ModuleSpec<TConfig = unknown> {
95
+ /** Direct module definition (preferred in monorepos for better type safety) */
96
+ module?: KuckitModuleDefinition<TConfig>;
97
+ /** NPM package name or relative path for dynamic import, e.g., '@acme/billing-module' */
98
+ package?: string;
99
+ /** Module-specific configuration */
100
+ config?: TConfig;
101
+ /** Whether to skip this module */
102
+ disabled?: boolean;
103
+ }
104
+ /**
105
+ * Internal type for loaded modules with their config
106
+ */
107
+ interface LoadedModule<TConfig = unknown> extends KuckitModuleDefinition<TConfig> {
108
+ _config?: TConfig;
109
+ }
110
+ //#endregion
111
+ export { KuckitModuleHooks as a, ModuleCapability as c, KuckitModuleDefinition as i, ModuleSpec as l, BuiltInCapability as n, KuckitModuleMeta as o, KuckitModuleContext as r, LoadedModule as s, ApiRegistration as t };
112
+ //# sourceMappingURL=types-ByO301S-.d.ts.map
@@ -0,0 +1,51 @@
1
+ import { AwilixContainer, Resolver } from "awilix";
2
+ import { CacheStore, Clock, EventBus, Logger, RateLimiterStore } from "@kuckit/domain";
3
+ import { auth } from "@kuckit/auth";
4
+
5
+ //#region src/types.d.ts
6
+
7
+ /**
8
+ * Core SDK configuration
9
+ * This is the minimal config needed to bootstrap the SDK
10
+ */
11
+ interface CoreConfig {
12
+ databaseUrl: string;
13
+ enableFileLogging: boolean;
14
+ logDir: string;
15
+ logLevel: 'DEBUG' | 'INFO' | 'WARN' | 'ERROR';
16
+ env: string;
17
+ }
18
+ /**
19
+ * Core cradle interface - the stable contract for all SDK consumers
20
+ * This defines the services available in the DI container after core registration
21
+ *
22
+ * Keep this minimal and stable; breaking changes require major version bumps
23
+ */
24
+ interface CoreCradle {
25
+ config: CoreConfig;
26
+ dbPool: unknown;
27
+ db: unknown;
28
+ clock: Clock;
29
+ logger: Logger;
30
+ errorHandler: unknown;
31
+ auth: typeof auth;
32
+ aiProvider: unknown;
33
+ eventBus: EventBus;
34
+ cacheStore: CacheStore;
35
+ rateLimiterStore: RateLimiterStore;
36
+ requestId?: string;
37
+ session?: {
38
+ user?: {
39
+ id?: string;
40
+ };
41
+ } | null;
42
+ requestLogger?: Logger;
43
+ [key: string]: Resolver<any> | any;
44
+ }
45
+ /**
46
+ * Core container type with CoreCradle
47
+ */
48
+ type CoreContainer = AwilixContainer<CoreCradle>;
49
+ //#endregion
50
+ export { CoreContainer as n, CoreCradle as r, CoreConfig as t };
51
+ //# sourceMappingURL=types-DKCy16X1.d.ts.map
@@ -0,0 +1,87 @@
1
+ //#region src/config/types.d.ts
2
+ /**
3
+ * Configuration for a single Kuckit module
4
+ */
5
+ interface KuckitModuleConfig<TConfig = unknown> {
6
+ /** NPM package name, e.g., '@kuckit/users-module' or '@acme/billing-module' */
7
+ package: string;
8
+ /** Module-specific configuration */
9
+ config?: TConfig;
10
+ /** Whether this module is enabled (default: true). Can use environment variables. */
11
+ enabled?: boolean;
12
+ }
13
+ /**
14
+ * Discovery configuration for auto-detecting modules
15
+ */
16
+ interface KuckitDiscoveryConfig {
17
+ /** Enable auto-discovery of modules in node_modules (default: false) */
18
+ enabled?: boolean;
19
+ /** Glob patterns for module detection (default: ['@star/kuckit-star-module']) */
20
+ patterns?: string[];
21
+ }
22
+ /**
23
+ * Client-specific configuration
24
+ */
25
+ interface KuckitClientConfig {
26
+ /** Component registry mode: 'global' or 'context' (default: 'context') */
27
+ componentRegistry?: 'global' | 'context';
28
+ /** Enable automatic route injection (default: true) */
29
+ routeInjection?: boolean;
30
+ }
31
+ /**
32
+ * Server-specific configuration
33
+ */
34
+ interface KuckitServerConfig {
35
+ /** API route prefix (default: '/api') */
36
+ apiPrefix?: string;
37
+ }
38
+ /**
39
+ * Unified Kuckit configuration
40
+ *
41
+ * This is the single source of truth for both server and client module configuration.
42
+ * Place this in `kuckit.config.ts` at your project root.
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * import { defineConfig } from '@kuckit/sdk'
47
+ *
48
+ * export default defineConfig({
49
+ * modules: [
50
+ * { package: '@kuckit/users-module' },
51
+ * { package: '@acme/billing-module', config: { currency: 'USD' } },
52
+ * {
53
+ * package: '@acme/analytics-module',
54
+ * enabled: process.env.NODE_ENV === 'production',
55
+ * },
56
+ * ],
57
+ *
58
+ * server: {
59
+ * apiPrefix: '/api',
60
+ * },
61
+ *
62
+ * client: {
63
+ * routeInjection: true,
64
+ * },
65
+ * })
66
+ * ```
67
+ */
68
+ interface KuckitConfig {
69
+ /** List of modules to load */
70
+ modules: KuckitModuleConfig[];
71
+ /** Auto-discovery settings (Phase 3.2) */
72
+ discovery?: KuckitDiscoveryConfig;
73
+ /** Client-specific settings */
74
+ client?: KuckitClientConfig;
75
+ /** Server-specific settings */
76
+ server?: KuckitServerConfig;
77
+ }
78
+ /**
79
+ * Result of loading a Kuckit config file
80
+ */
81
+ interface LoadedKuckitConfig extends KuckitConfig {
82
+ /** Path to the config file that was loaded */
83
+ _configPath: string;
84
+ }
85
+ //#endregion
86
+ export { KuckitServerConfig as a, KuckitModuleConfig as i, KuckitConfig as n, LoadedKuckitConfig as o, KuckitDiscoveryConfig as r, KuckitClientConfig as t };
87
+ //# sourceMappingURL=types-DxaDmkQo.d.ts.map
@@ -0,0 +1,2 @@
1
+ import { n as CoreContainer, r as CoreCradle, t as CoreConfig } from "./types-DKCy16X1.js";
2
+ export { CoreConfig, CoreContainer, CoreCradle };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuckit/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -22,13 +22,13 @@
22
22
  "prepublishOnly": "npm run build && node ../../scripts/resolve-workspace-protocols.cjs && node ../../scripts/check-no-workspace-protocol.cjs"
23
23
  },
24
24
  "dependencies": {
25
- "@kuckit/domain": "^1.0.2",
26
- "@kuckit/application": "^1.0.2",
27
- "@kuckit/infrastructure": "^1.0.2",
28
- "@kuckit/api": "^1.0.2",
29
- "@kuckit/contracts": "^1.0.2",
30
- "@kuckit/auth": "^1.0.2",
31
- "@kuckit/db": "^1.0.2",
25
+ "@kuckit/domain": "^1.0.3",
26
+ "@kuckit/application": "^1.0.3",
27
+ "@kuckit/infrastructure": "^1.0.3",
28
+ "@kuckit/api": "^1.0.3",
29
+ "@kuckit/contracts": "^1.0.3",
30
+ "@kuckit/auth": "^1.0.3",
31
+ "@kuckit/db": "^1.0.3",
32
32
  "awilix": "^12.0.5",
33
33
  "jiti": "^2.4.2"
34
34
  },