odac 0.9.0 → 1.0.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.
Files changed (208) hide show
  1. package/.github/workflows/auto-pr-description.yml +0 -2
  2. package/.github/workflows/codeql.yml +46 -0
  3. package/.github/workflows/release.yml +13 -6
  4. package/.github/workflows/test-coverage.yml +10 -9
  5. package/.releaserc.js +9 -6
  6. package/CHANGELOG.md +62 -150
  7. package/CODE_OF_CONDUCT.md +1 -1
  8. package/CONTRIBUTING.md +8 -8
  9. package/LICENSE +21 -661
  10. package/README.md +12 -12
  11. package/SECURITY.md +4 -4
  12. package/bin/odac.js +101 -0
  13. package/{framework/web/candy.js → client/odac.js} +310 -44
  14. package/docs/backend/01-overview/{01-whats-in-the-candy-box.md → 01-whats-in-the-odac-box.md} +4 -2
  15. package/docs/backend/01-overview/02-super-handy-helper-functions.md +29 -1
  16. package/docs/backend/01-overview/03-development-server.md +11 -11
  17. package/docs/backend/02-structure/01-typical-project-layout.md +4 -4
  18. package/docs/backend/03-config/00-configuration-overview.md +6 -6
  19. package/docs/backend/03-config/01-database-connection.md +1 -1
  20. package/docs/backend/03-config/02-static-route-mapping-optional.md +4 -4
  21. package/docs/backend/03-config/04-environment-variables.md +20 -20
  22. package/docs/backend/03-config/05-early-hints.md +4 -4
  23. package/docs/backend/04-routing/01-basic-page-routes.md +4 -4
  24. package/docs/backend/04-routing/02-controller-less-view-routes.md +5 -5
  25. package/docs/backend/04-routing/03-api-and-data-routes.md +3 -3
  26. package/docs/backend/04-routing/04-authentication-aware-routes.md +5 -5
  27. package/docs/backend/04-routing/05-advanced-routing.md +3 -3
  28. package/docs/backend/04-routing/06-error-pages.md +17 -17
  29. package/docs/backend/04-routing/07-cron-jobs.md +13 -13
  30. package/docs/backend/04-routing/08-middleware.md +214 -0
  31. package/docs/backend/04-routing/09-websocket-auth-middleware.md +292 -0
  32. package/docs/backend/04-routing/09-websocket-examples.md +381 -0
  33. package/docs/backend/04-routing/09-websocket-quick-reference.md +211 -0
  34. package/docs/backend/04-routing/09-websocket.md +298 -0
  35. package/docs/backend/05-controllers/01-how-to-build-a-controller.md +3 -3
  36. package/docs/backend/05-controllers/02-your-trusty-odac-assistant.md +41 -0
  37. package/docs/backend/05-controllers/03-controller-classes.md +19 -19
  38. package/docs/backend/05-forms/01-custom-forms.md +114 -114
  39. package/docs/backend/05-forms/02-automatic-database-insert.md +82 -82
  40. package/docs/backend/06-request-and-response/01-the-request-object-what-is-the-user-asking-for.md +26 -26
  41. package/docs/backend/06-request-and-response/02-sending-a-response-replying-to-the-user.md +10 -10
  42. package/docs/backend/07-views/01-the-view-directory.md +1 -1
  43. package/docs/backend/07-views/02-rendering-a-view.md +22 -22
  44. package/docs/backend/07-views/03-template-syntax.md +52 -52
  45. package/docs/backend/07-views/03-variables.md +84 -84
  46. package/docs/backend/07-views/04-request-data.md +57 -57
  47. package/docs/backend/07-views/05-conditionals.md +78 -78
  48. package/docs/backend/07-views/06-loops.md +114 -114
  49. package/docs/backend/07-views/07-translations.md +66 -66
  50. package/docs/backend/07-views/08-backend-javascript.md +103 -103
  51. package/docs/backend/07-views/09-comments.md +71 -71
  52. package/docs/backend/08-database/01-database-connection.md +8 -8
  53. package/docs/backend/08-database/02-using-mysql.md +49 -49
  54. package/docs/backend/09-validation/01-the-validator-service.md +38 -38
  55. package/docs/backend/10-authentication/01-user-logins-with-authjs.md +15 -15
  56. package/docs/backend/10-authentication/02-foiling-villains-with-csrf-protection.md +10 -10
  57. package/docs/backend/10-authentication/03-register.md +12 -12
  58. package/docs/backend/10-authentication/{04-candy-register-forms.md → 04-odac-register-forms.md} +141 -141
  59. package/docs/backend/10-authentication/05-session-management.md +10 -10
  60. package/docs/backend/10-authentication/{06-candy-login-forms.md → 06-odac-login-forms.md} +125 -125
  61. package/docs/backend/11-mail/01-the-mail-service.md +5 -5
  62. package/docs/backend/12-streaming/01-streaming-overview.md +96 -54
  63. package/docs/backend/13-utilities/{01-candy-var.md → 01-odac-var.md} +109 -109
  64. package/docs/frontend/01-overview/01-introduction.md +30 -30
  65. package/docs/frontend/02-ajax-navigation/01-quick-start.md +45 -45
  66. package/docs/frontend/02-ajax-navigation/02-configuration.md +14 -14
  67. package/docs/frontend/02-ajax-navigation/03-advanced-usage.md +36 -36
  68. package/docs/frontend/03-forms/01-form-handling.md +32 -32
  69. package/docs/frontend/04-api-requests/01-get-post.md +33 -33
  70. package/docs/frontend/05-streaming/01-client-streaming.md +15 -15
  71. package/docs/frontend/06-websocket/00-overview.md +76 -0
  72. package/docs/frontend/06-websocket/01-websocket-client.md +139 -0
  73. package/docs/frontend/06-websocket/02-shared-websocket.md +149 -0
  74. package/docs/index.json +49 -11
  75. package/eslint.config.mjs +6 -6
  76. package/{framework/index.js → index.js} +1 -1
  77. package/package.json +14 -39
  78. package/{framework/src → src}/Auth.js +59 -59
  79. package/{framework/src → src}/Config.js +3 -3
  80. package/{framework/src → src}/Lang.js +7 -7
  81. package/{framework/src → src}/Mail.js +5 -5
  82. package/{framework/src → src}/Mysql.js +42 -42
  83. package/src/Odac.js +112 -0
  84. package/{framework/src → src}/Request.js +38 -36
  85. package/{framework/src → src}/Route/Internal.js +116 -116
  86. package/src/Route/Middleware.js +75 -0
  87. package/src/Route.js +621 -0
  88. package/src/Server.js +22 -0
  89. package/{framework/src → src}/Stream.js +11 -3
  90. package/{framework/src → src}/Validator.js +21 -21
  91. package/{framework/src → src}/Var.js +5 -5
  92. package/{framework/src → src}/View/EarlyHints.js +1 -1
  93. package/{framework/src → src}/View/Form.js +69 -69
  94. package/{framework/src → src}/View.js +78 -81
  95. package/src/WebSocket.js +403 -0
  96. package/template/config.json +5 -0
  97. package/{web → template}/controller/page/about.js +6 -6
  98. package/{web → template}/controller/page/index.js +9 -9
  99. package/{web → template}/package.json +4 -5
  100. package/{web → template}/public/assets/css/style.css +4 -4
  101. package/{web → template}/public/assets/js/app.js +6 -6
  102. package/{web → template}/route/www.js +6 -6
  103. package/{web → template}/skeleton/main.html +1 -1
  104. package/{web → template}/view/content/about.html +5 -5
  105. package/{web → template}/view/content/home.html +12 -12
  106. package/template/view/footer/main.html +11 -0
  107. package/{web → template}/view/head/main.html +1 -1
  108. package/{web → template}/view/header/main.html +2 -2
  109. package/test/core/Candy.test.js +58 -58
  110. package/test/core/Commands.test.js +7 -7
  111. package/test/core/Config.test.js +82 -85
  112. package/test/core/Lang.test.js +2 -2
  113. package/test/core/Process.test.js +6 -6
  114. package/test/framework/Route.test.js +56 -37
  115. package/test/framework/View/EarlyHints.test.js +2 -2
  116. package/test/framework/WebSocket.test.js +100 -0
  117. package/test/framework/middleware.test.js +85 -0
  118. package/test/server/Api.test.js +31 -31
  119. package/test/server/DNS.test.js +11 -11
  120. package/test/server/Hub.test.js +497 -0
  121. package/test/server/Mail.account.test_.js +3 -3
  122. package/test/server/Mail.init.test_.js +10 -10
  123. package/test/server/Mail.test_.js +20 -20
  124. package/test/server/SSL.test_.js +54 -54
  125. package/test/server/Server.test.js +39 -39
  126. package/test/server/Service.test_.js +7 -7
  127. package/test/server/Subdomain.test.js +7 -7
  128. package/test/server/Web/Firewall.test.js +87 -87
  129. package/test/server/Web/Proxy.test.js +397 -0
  130. package/test/server/{Web.test_.js → Web.test.js} +137 -205
  131. package/test/server/__mocks__/fs.js +2 -2
  132. package/test/server/__mocks__/{globalCandy.js → globalOdac.js} +5 -5
  133. package/test/server/__mocks__/index.js +6 -6
  134. package/test/server/__mocks__/testFactories.js +1 -1
  135. package/test/server/__mocks__/testHelpers.js +7 -7
  136. package/.husky/pre-commit +0 -2
  137. package/.kiro/steering/code-style.md +0 -56
  138. package/.kiro/steering/product.md +0 -20
  139. package/.kiro/steering/structure.md +0 -77
  140. package/.kiro/steering/tech.md +0 -87
  141. package/AGENTS.md +0 -84
  142. package/bin/candy +0 -10
  143. package/bin/candypack +0 -10
  144. package/cli/index.js +0 -3
  145. package/cli/src/Cli.js +0 -348
  146. package/cli/src/Connector.js +0 -93
  147. package/cli/src/Monitor.js +0 -416
  148. package/core/Candy.js +0 -87
  149. package/core/Commands.js +0 -239
  150. package/core/Config.js +0 -1094
  151. package/core/Lang.js +0 -52
  152. package/core/Log.js +0 -43
  153. package/core/Process.js +0 -26
  154. package/docs/backend/05-controllers/02-your-trusty-candy-assistant.md +0 -20
  155. package/docs/server/01-installation/01-quick-install.md +0 -19
  156. package/docs/server/01-installation/02-manual-installation-via-npm.md +0 -9
  157. package/docs/server/02-get-started/01-core-concepts.md +0 -7
  158. package/docs/server/02-get-started/02-basic-commands.md +0 -57
  159. package/docs/server/02-get-started/03-cli-reference.md +0 -276
  160. package/docs/server/02-get-started/04-cli-quick-reference.md +0 -102
  161. package/docs/server/03-service/01-start-a-new-service.md +0 -57
  162. package/docs/server/03-service/02-delete-a-service.md +0 -48
  163. package/docs/server/04-web/01-create-a-website.md +0 -36
  164. package/docs/server/04-web/02-list-websites.md +0 -9
  165. package/docs/server/04-web/03-delete-a-website.md +0 -29
  166. package/docs/server/05-subdomain/01-create-a-subdomain.md +0 -32
  167. package/docs/server/05-subdomain/02-list-subdomains.md +0 -33
  168. package/docs/server/05-subdomain/03-delete-a-subdomain.md +0 -41
  169. package/docs/server/06-ssl/01-renew-an-ssl-certificate.md +0 -34
  170. package/docs/server/07-mail/01-create-a-mail-account.md +0 -23
  171. package/docs/server/07-mail/02-delete-a-mail-account.md +0 -20
  172. package/docs/server/07-mail/03-list-mail-accounts.md +0 -20
  173. package/docs/server/07-mail/04-change-account-password.md +0 -23
  174. package/framework/src/Candy.js +0 -81
  175. package/framework/src/Route.js +0 -455
  176. package/framework/src/Server.js +0 -15
  177. package/locale/de-DE.json +0 -80
  178. package/locale/en-US.json +0 -79
  179. package/locale/es-ES.json +0 -80
  180. package/locale/fr-FR.json +0 -80
  181. package/locale/pt-BR.json +0 -80
  182. package/locale/ru-RU.json +0 -80
  183. package/locale/tr-TR.json +0 -85
  184. package/locale/zh-CN.json +0 -80
  185. package/server/index.js +0 -5
  186. package/server/src/Api.js +0 -88
  187. package/server/src/DNS.js +0 -940
  188. package/server/src/Hub.js +0 -535
  189. package/server/src/Mail.js +0 -571
  190. package/server/src/SSL.js +0 -180
  191. package/server/src/Server.js +0 -27
  192. package/server/src/Service.js +0 -248
  193. package/server/src/Subdomain.js +0 -64
  194. package/server/src/Web/Firewall.js +0 -170
  195. package/server/src/Web/Proxy.js +0 -134
  196. package/server/src/Web.js +0 -451
  197. package/server/src/mail/imap.js +0 -1091
  198. package/server/src/mail/server.js +0 -32
  199. package/server/src/mail/smtp.js +0 -786
  200. package/test/server/Client.test.js +0 -338
  201. package/test/server/__mocks__/http-proxy.js +0 -105
  202. package/watchdog/index.js +0 -3
  203. package/watchdog/src/Watchdog.js +0 -156
  204. package/web/config.json +0 -5
  205. package/web/view/footer/main.html +0 -11
  206. /package/{framework/src → src}/Env.js +0 -0
  207. /package/{framework/src → src}/Route/Cron.js +0 -0
  208. /package/{framework/src → src}/Token.js +0 -0
@@ -2,15 +2,15 @@
2
2
  <section class="hero">
3
3
  <div class="container">
4
4
  <div class="hero-content">
5
- <h1 class="hero-title">🍭 Your CandyPack Site is Ready!</h1>
6
- <p class="hero-subtitle">You've successfully created a new website with CandyPack</p>
5
+ <h1 class="hero-title">🍭 Your Odac Site is Ready!</h1>
6
+ <p class="hero-subtitle">You've successfully created a new website with Odac</p>
7
7
  <p class="hero-description">
8
8
  This is your starting template. Edit the files in your project directory to customize your site. Everything you need to build a
9
9
  modern web application is already set up and ready to go.
10
10
  </p>
11
11
  <div class="hero-actions">
12
- <a href="https://candypack.dev" target="_blank" class="btn btn-primary" data-navigate="false">Visit CandyPack.dev</a>
13
- <a href="https://docs.candypack.dev" target="_blank" class="btn btn-secondary" data-navigate="false">Read Documentation</a>
12
+ <a href="https://odac.run" target="_blank" class="btn btn-primary" data-navigate="false">Visit odac.run</a>
13
+ <a href="https://docs.odac.run" target="_blank" class="btn btn-secondary" data-navigate="false">Read Documentation</a>
14
14
  </div>
15
15
  </div>
16
16
  </div>
@@ -86,16 +86,16 @@
86
86
  <div class="step-number">2</div>
87
87
  <h3 class="step-title">Add Routes</h3>
88
88
  <p class="step-description">Define new pages in <code>route/www.js</code>. Map URLs to controllers:</p>
89
- <pre class="code-snippet"><code>Candy.Route.page('/my-page', 'page.mypage')</code></pre>
89
+ <pre class="code-snippet"><code>Odac.Route.page('/my-page', 'page.mypage')</code></pre>
90
90
  </div>
91
91
 
92
92
  <div class="quickstart-step">
93
93
  <div class="step-number">3</div>
94
94
  <h3 class="step-title">Create Controllers</h3>
95
95
  <p class="step-description">Add logic in <code>controller/page/mypage.js</code>:</p>
96
- <pre class="code-snippet"><code>module.exports = function(Candy) {
97
- Candy.View.skeleton('main')
98
- Candy.View.set({
96
+ <pre class="code-snippet"><code>module.exports = function(Odac) {
97
+ Odac.View.skeleton('main')
98
+ Odac.View.set({
99
99
  header: 'main',
100
100
  content: 'mypage',
101
101
  footer: 'main'
@@ -177,19 +177,19 @@
177
177
  <h2 class="section-title">📚 Learn More</h2>
178
178
 
179
179
  <div class="resources-grid">
180
- <a href="https://candypack.dev" target="_blank" class="resource-card" data-navigate="false">
180
+ <a href="https://odac.run" target="_blank" class="resource-card" data-navigate="false">
181
181
  <div class="resource-icon">🌐</div>
182
- <h3>CandyPack.dev</h3>
182
+ <h3>odac.run</h3>
183
183
  <p>Official website with guides, tutorials, and community resources</p>
184
184
  </a>
185
185
 
186
- <a href="https://docs.candypack.dev" target="_blank" class="resource-card" data-navigate="false">
186
+ <a href="https://docs.odac.run" target="_blank" class="resource-card" data-navigate="false">
187
187
  <div class="resource-icon">📖</div>
188
188
  <h3>Documentation</h3>
189
189
  <p>Complete API reference, examples, and best practices</p>
190
190
  </a>
191
191
 
192
- <a href="https://github.com/candypack" target="_blank" class="resource-card" data-navigate="false">
192
+ <a href="https://github.com/odac-run/odac" target="_blank" class="resource-card" data-navigate="false">
193
193
  <div class="resource-icon">💻</div>
194
194
  <h3>GitHub</h3>
195
195
  <p>Source code, issues, and contribution guidelines</p>
@@ -0,0 +1,11 @@
1
+ <!-- Footer -->
2
+ <div class="footer">
3
+ <div class="container">
4
+ <p>Powered by <strong>Odac</strong> - A next-generation server and framework toolkit</p>
5
+ <p class="footer-links">
6
+ <a href="https://github.com/odac-run/odac" target="_blank" data-navigate="false">GitHub</a> •
7
+ <a href="https://docs.odac.run" target="_blank" data-navigate="false">Documentation</a> •
8
+ <a href="https://odac.run" target="_blank" data-navigate="false">Official Site</a>
9
+ </p>
10
+ </div>
11
+ </div>
@@ -1,5 +1,5 @@
1
1
  <meta charset="UTF-8" />
2
2
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
3
- <title>CandyPack</title>
3
+ <title>Odac</title>
4
4
  <meta name="description" content="A next-generation server and framework toolkit for modern web development" />
5
5
  <link rel="stylesheet" href="/assets/css/style.css" />
@@ -3,12 +3,12 @@
3
3
  <div class="container">
4
4
  <div class="nav-brand">
5
5
  <span class="brand-icon">🍭</span>
6
- <span class="brand-name">CandyPack</span>
6
+ <span class="brand-name">Odac</span>
7
7
  </div>
8
8
  <div class="nav-links">
9
9
  <a href="/" class="nav-link active">Getting Started</a>
10
10
  <a href="/about" class="nav-link">About</a>
11
- <a href="https://docs.candypack.dev" class="nav-link" target="_blank" data-navigate="false">Docs ↗</a>
11
+ <a href="https://docs.odac.run" class="nav-link" target="_blank" data-navigate="false">Docs ↗</a>
12
12
  </div>
13
13
  </div>
14
14
  </nav>
@@ -10,17 +10,17 @@ jest.mock('fs', () => ({
10
10
  }))
11
11
 
12
12
  // Mock process.mainModule to avoid Config initialization issues
13
- process.mainModule = {path: '/mock/node_modules/candypack/bin'}
13
+ process.mainModule = {path: '/mock/node_modules/odac/bin'}
14
14
 
15
15
  // Import the module to ensure global setup
16
- require('../../core/Candy.js')
16
+ require('../../core/Odac.js')
17
17
 
18
- describe('CandyPack', () => {
18
+ describe('Odac', () => {
19
19
  describe('global setup', () => {
20
- it('should have global Candy instance', () => {
21
- expect(global.Candy).toBeDefined()
22
- expect(global.Candy._registry).toBeInstanceOf(Map)
23
- expect(global.Candy._singletons).toBeInstanceOf(Map)
20
+ it('should have global Odac instance', () => {
21
+ expect(global.Odac).toBeDefined()
22
+ expect(global.Odac._registry).toBeInstanceOf(Map)
23
+ expect(global.Odac._singletons).toBeInstanceOf(Map)
24
24
  })
25
25
 
26
26
  it('should have global __ function', () => {
@@ -34,83 +34,83 @@ describe('CandyPack', () => {
34
34
  })
35
35
 
36
36
  it('should not recreate global if already exists', () => {
37
- const existingCandy = global.Candy
37
+ const existingCandy = global.Odac
38
38
 
39
39
  // Clear module cache and re-require
40
- delete require.cache[require.resolve('../../core/Candy.js')]
41
- require('../../core/Candy.js')
40
+ delete require.cache[require.resolve('../../core/Odac.js')]
41
+ require('../../core/Odac.js')
42
42
 
43
- expect(global.Candy).toBe(existingCandy)
43
+ expect(global.Odac).toBe(existingCandy)
44
44
  })
45
45
  })
46
46
 
47
- describe('CandyPack instance methods', () => {
47
+ describe('Odac instance methods', () => {
48
48
  it('should have core method', () => {
49
- expect(typeof global.Candy.core).toBe('function')
49
+ expect(typeof global.Odac.core).toBe('function')
50
50
  })
51
51
 
52
52
  it('should have cli method', () => {
53
- expect(typeof global.Candy.cli).toBe('function')
53
+ expect(typeof global.Odac.cli).toBe('function')
54
54
  })
55
55
 
56
56
  it('should have server method', () => {
57
- expect(typeof global.Candy.server).toBe('function')
57
+ expect(typeof global.Odac.server).toBe('function')
58
58
  })
59
59
 
60
60
  it('should have watchdog method', () => {
61
- expect(typeof global.Candy.watchdog).toBe('function')
61
+ expect(typeof global.Odac.watchdog).toBe('function')
62
62
  })
63
63
  })
64
64
 
65
65
  describe('module loading functionality', () => {
66
66
  it('should load core modules', () => {
67
- const lang = global.Candy.core('Lang')
67
+ const lang = global.Odac.core('Lang')
68
68
  expect(lang).toBeDefined()
69
- expect(global.Candy._registry.has('core:Lang')).toBe(true)
69
+ expect(global.Odac._registry.has('core:Lang')).toBe(true)
70
70
  })
71
71
 
72
72
  it('should return singleton instances by default', () => {
73
- const lang1 = global.Candy.core('Lang')
74
- const lang2 = global.Candy.core('Lang')
73
+ const lang1 = global.Odac.core('Lang')
74
+ const lang2 = global.Odac.core('Lang')
75
75
  expect(lang1).toBe(lang2)
76
76
  })
77
77
 
78
78
  it('should cache singleton instances', () => {
79
- const lang1 = global.Candy.core('Lang')
80
- const lang2 = global.Candy.core('Lang')
79
+ const lang1 = global.Odac.core('Lang')
80
+ const lang2 = global.Odac.core('Lang')
81
81
 
82
82
  expect(lang1).toBe(lang2)
83
- expect(global.Candy._singletons.has('core:Lang')).toBe(true)
83
+ expect(global.Odac._singletons.has('core:Lang')).toBe(true)
84
84
  })
85
85
 
86
86
  it('should return new instances when singleton is false', () => {
87
87
  // Clear any existing Lang registration first to test non-singleton behavior
88
- global.Candy._registry.delete('core:Lang')
89
- global.Candy._singletons.delete('core:Lang')
88
+ global.Odac._registry.delete('core:Lang')
89
+ global.Odac._singletons.delete('core:Lang')
90
90
 
91
- const lang1 = global.Candy.core('Lang', false)
92
- const lang2 = global.Candy.core('Lang', false)
91
+ const lang1 = global.Odac.core('Lang', false)
92
+ const lang2 = global.Odac.core('Lang', false)
93
93
  expect(lang1).not.toBe(lang2)
94
94
  })
95
95
 
96
96
  it('should call init method if module has one', () => {
97
97
  // Test with Config module which has init method
98
- const config = global.Candy.core('Config')
98
+ const config = global.Odac.core('Config')
99
99
  expect(config).toBeDefined()
100
100
  })
101
101
 
102
102
  it('should retrieve Config module as singleton', () => {
103
103
  // Get Config instance twice
104
- const config1 = global.Candy.core('Config')
105
- const config2 = global.Candy.core('Config')
104
+ const config1 = global.Odac.core('Config')
105
+ const config2 = global.Odac.core('Config')
106
106
 
107
107
  // Should be the same instance (singleton behavior)
108
108
  expect(config1).toBe(config2)
109
109
  expect(config1).toBeInstanceOf(Object)
110
110
 
111
111
  // Should be registered in singleton cache
112
- expect(global.Candy._singletons.has('core:Config')).toBe(true)
113
- expect(global.Candy._singletons.get('core:Config')).toBe(config1)
112
+ expect(global.Odac._singletons.has('core:Config')).toBe(true)
113
+ expect(global.Odac._singletons.get('core:Config')).toBe(config1)
114
114
 
115
115
  // Should have Config class properties
116
116
  expect(config1.config).toBeDefined()
@@ -120,7 +120,7 @@ describe('CandyPack', () => {
120
120
 
121
121
  it('should handle modules without init method', () => {
122
122
  // Test with Process module which doesn't have init method
123
- const process = global.Candy.core('Process')
123
+ const process = global.Odac.core('Process')
124
124
  expect(process).toBeDefined()
125
125
  })
126
126
  })
@@ -129,21 +129,21 @@ describe('CandyPack', () => {
129
129
  it('should load cli modules with correct path prefix', () => {
130
130
  // This will fail but we can test the path construction
131
131
  expect(() => {
132
- global.Candy.cli('NonExistentCli')
132
+ global.Odac.cli('NonExistentCli')
133
133
  }).toThrow()
134
134
  })
135
135
 
136
136
  it('should load server modules with correct path prefix', () => {
137
137
  // This will fail but we can test the path construction
138
138
  expect(() => {
139
- global.Candy.server('NonExistentServer')
139
+ global.Odac.server('NonExistentServer')
140
140
  }).toThrow()
141
141
  })
142
142
 
143
143
  it('should load watchdog modules with correct path prefix', () => {
144
144
  // This will fail but we can test the path construction
145
145
  expect(() => {
146
- global.Candy.watchdog('NonExistentWatchdog')
146
+ global.Odac.watchdog('NonExistentWatchdog')
147
147
  }).toThrow()
148
148
  })
149
149
  })
@@ -151,16 +151,16 @@ describe('CandyPack', () => {
151
151
  describe('registry functionality', () => {
152
152
  it('should maintain separate registries for different module types', () => {
153
153
  // Load a core module
154
- global.Candy.core('Lang')
154
+ global.Odac.core('Lang')
155
155
 
156
- expect(global.Candy._registry.has('core:Lang')).toBe(true)
157
- expect(global.Candy._registry.size).toBeGreaterThan(0)
156
+ expect(global.Odac._registry.has('core:Lang')).toBe(true)
157
+ expect(global.Odac._registry.size).toBeGreaterThan(0)
158
158
  })
159
159
 
160
160
  it('should store registry entries with correct structure', () => {
161
- global.Candy.core('Lang')
161
+ global.Odac.core('Lang')
162
162
 
163
- const entry = global.Candy._registry.get('core:Lang')
163
+ const entry = global.Odac._registry.get('core:Lang')
164
164
  expect(entry).toBeDefined()
165
165
  expect(entry).toHaveProperty('value')
166
166
  expect(entry).toHaveProperty('singleton')
@@ -168,24 +168,24 @@ describe('CandyPack', () => {
168
168
 
169
169
  it('should handle non-singleton registry entries', () => {
170
170
  // Clear existing registration
171
- global.Candy._registry.delete('core:Lang')
172
- global.Candy._singletons.delete('core:Lang')
171
+ global.Odac._registry.delete('core:Lang')
172
+ global.Odac._singletons.delete('core:Lang')
173
173
 
174
- global.Candy.core('Lang', false)
174
+ global.Odac.core('Lang', false)
175
175
 
176
- const entry = global.Candy._registry.get('core:Lang')
176
+ const entry = global.Odac._registry.get('core:Lang')
177
177
  expect(entry.singleton).toBe(false)
178
178
  })
179
179
  })
180
180
 
181
181
  describe('instantiation behavior', () => {
182
182
  it('should instantiate function modules', () => {
183
- const lang = global.Candy.core('Lang')
183
+ const lang = global.Odac.core('Lang')
184
184
  expect(lang).toBeInstanceOf(Object)
185
185
  })
186
186
 
187
187
  it('should handle non-function modules', () => {
188
- const config = global.Candy.core('Config')
188
+ const config = global.Odac.core('Config')
189
189
  expect(config).toBeDefined()
190
190
  })
191
191
  })
@@ -193,14 +193,14 @@ describe('CandyPack', () => {
193
193
  describe('error handling', () => {
194
194
  it('should handle module loading errors gracefully', () => {
195
195
  expect(() => {
196
- global.Candy.core('NonExistentModule')
196
+ global.Odac.core('NonExistentModule')
197
197
  }).toThrow()
198
198
  })
199
199
 
200
200
  it('should throw specific error for non-existent registry entries', () => {
201
- // Create a new CandyPack instance to test private methods
202
- const CandyPackClass = global.Candy.constructor
203
- const testInstance = new CandyPackClass()
201
+ // Create a new Odac instance to test private methods
202
+ const OdacClass = global.Odac.constructor
203
+ const testInstance = new OdacClass()
204
204
 
205
205
  expect(() => {
206
206
  // This should trigger the resolve error
@@ -212,23 +212,23 @@ describe('CandyPack', () => {
212
212
  describe('module caching', () => {
213
213
  beforeEach(() => {
214
214
  // Clear any existing registrations for clean tests
215
- global.Candy._registry.clear()
216
- global.Candy._singletons.clear()
215
+ global.Odac._registry.clear()
216
+ global.Odac._singletons.clear()
217
217
  })
218
218
 
219
219
  it('should not re-register already registered modules', () => {
220
220
  // Load Lang module twice
221
- const lang1 = global.Candy.core('Lang')
222
- const lang2 = global.Candy.core('Lang')
221
+ const lang1 = global.Odac.core('Lang')
222
+ const lang2 = global.Odac.core('Lang')
223
223
 
224
224
  expect(lang1).toBe(lang2)
225
225
  })
226
226
 
227
227
  it('should maintain singleton cache correctly', () => {
228
- const lang = global.Candy.core('Lang')
228
+ const lang = global.Odac.core('Lang')
229
229
 
230
- expect(global.Candy._singletons.has('core:Lang')).toBe(true)
231
- expect(global.Candy._singletons.get('core:Lang')).toBe(lang)
230
+ expect(global.Odac._singletons.has('core:Lang')).toBe(true)
231
+ expect(global.Odac._singletons.get('core:Lang')).toBe(lang)
232
232
  })
233
233
  })
234
234
  })
@@ -1,5 +1,5 @@
1
- // Mock the Candy global before requiring Commands
2
- global.Candy = {
1
+ // Mock the Odac global before requiring Commands
2
+ global.Odac = {
3
3
  cli: jest.fn(),
4
4
  core: jest.fn()
5
5
  }
@@ -29,7 +29,7 @@ describe('Commands', () => {
29
29
  monit: jest.fn()
30
30
  }
31
31
 
32
- global.Candy.cli.mockImplementation(name => {
32
+ global.Odac.cli.mockImplementation(name => {
33
33
  switch (name) {
34
34
  case 'Cli':
35
35
  return mockCli
@@ -42,7 +42,7 @@ describe('Commands', () => {
42
42
  }
43
43
  })
44
44
 
45
- global.Candy.core.mockImplementation(name => {
45
+ global.Odac.core.mockImplementation(name => {
46
46
  if (name === 'Lang') {
47
47
  return {get: key => key}
48
48
  }
@@ -68,11 +68,11 @@ describe('Commands', () => {
68
68
  })
69
69
 
70
70
  it('should have correct command descriptions', () => {
71
- expect(Commands.auth.description).toBe('Define your server to your CandyPack account')
72
- expect(Commands.debug.description).toBe('Debug CandyPack Server')
71
+ expect(Commands.auth.description).toBe('Define your server to your Odac account')
72
+ expect(Commands.debug.description).toBe('Debug Odac Server')
73
73
  expect(Commands.help.description).toBe('List all available commands')
74
74
  expect(Commands.monit.description).toBe('Monitor Website or Service')
75
- expect(Commands.restart.description).toBe('Restart CandyPack Server')
75
+ expect(Commands.restart.description).toBe('Restart Odac Server')
76
76
  expect(Commands.run.description).toBe('Add a new Service')
77
77
  })
78
78
  })