@zintrust/core 0.1.22 → 0.1.24

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 (234) hide show
  1. package/bin/z.d.ts +1 -1
  2. package/bin/z.js +1 -1
  3. package/bin/zin.d.ts +1 -1
  4. package/bin/zin.js +1 -1
  5. package/bin/zintrust-main.d.ts +1 -1
  6. package/bin/zintrust-main.js +2 -2
  7. package/bin/zintrust-microservices.d.ts +1 -1
  8. package/bin/zintrust-microservices.js +1 -1
  9. package/bin/zintrust.d.ts +1 -1
  10. package/bin/zintrust.js +1 -1
  11. package/bin/zt.d.ts +1 -1
  12. package/bin/zt.js +1 -1
  13. package/package.json +2 -3
  14. package/public/index.html +3 -3
  15. package/routes/api.js +1 -1
  16. package/routes/health.d.ts +3 -4
  17. package/routes/health.d.ts.map +1 -1
  18. package/routes/health.js +3 -125
  19. package/src/boot/Application.d.ts.map +1 -1
  20. package/src/boot/Application.js +11 -22
  21. package/src/boot/bootstrap.d.ts +1 -1
  22. package/src/boot/bootstrap.js +48 -7
  23. package/src/builder/BundleOptimizer.d.ts +1 -1
  24. package/src/builder/BundleOptimizer.js +1 -1
  25. package/src/cache/drivers/KVRemoteDriver.d.ts +1 -1
  26. package/src/cache/drivers/KVRemoteDriver.js +1 -1
  27. package/src/cli/CLI.d.ts.map +1 -1
  28. package/src/cli/CLI.js +15 -1
  29. package/src/cli/ErrorHandler.js +3 -3
  30. package/src/cli/commands/AddCommand.d.ts +1 -1
  31. package/src/cli/commands/AddCommand.d.ts.map +1 -1
  32. package/src/cli/commands/AddCommand.js +1 -1
  33. package/src/cli/commands/DbSeedCommand.d.ts.map +1 -1
  34. package/src/cli/commands/DbSeedCommand.js +7 -39
  35. package/src/cli/commands/MakeMailTemplateCommand.js +2 -1
  36. package/src/cli/commands/MakeNotificationTemplateCommand.js +2 -1
  37. package/src/cli/commands/MigrateCommand.d.ts.map +1 -1
  38. package/src/cli/commands/MigrateCommand.js +12 -55
  39. package/src/cli/commands/MigrateWorkerCommand.d.ts +9 -0
  40. package/src/cli/commands/MigrateWorkerCommand.d.ts.map +1 -0
  41. package/src/cli/commands/MigrateWorkerCommand.js +136 -0
  42. package/src/cli/commands/NewCommand.d.ts +1 -1
  43. package/src/cli/commands/NewCommand.d.ts.map +1 -1
  44. package/src/cli/commands/NewCommand.js +9 -7
  45. package/src/cli/commands/PublishCommand.d.ts +5 -0
  46. package/src/cli/commands/PublishCommand.d.ts.map +1 -0
  47. package/src/cli/commands/PublishCommand.js +54 -0
  48. package/src/cli/commands/QACommand.js +4 -4
  49. package/src/cli/commands/ResourceControlCommand.d.ts +6 -0
  50. package/src/cli/commands/ResourceControlCommand.d.ts.map +1 -0
  51. package/src/cli/commands/ResourceControlCommand.js +43 -0
  52. package/src/cli/commands/SimulateCommand.d.ts +1 -1
  53. package/src/cli/commands/SimulateCommand.js +4 -4
  54. package/src/cli/commands/StartCommand.js +7 -7
  55. package/src/cli/commands/UpgradeCommand.d.ts +1 -1
  56. package/src/cli/commands/UpgradeCommand.js +2 -2
  57. package/src/cli/commands/WorkerCommands.d.ts +17 -0
  58. package/src/cli/commands/WorkerCommands.d.ts.map +1 -0
  59. package/src/cli/commands/WorkerCommands.js +264 -0
  60. package/src/cli/commands/index.d.ts +2 -0
  61. package/src/cli/commands/index.d.ts.map +1 -1
  62. package/src/cli/commands/index.js +2 -0
  63. package/src/cli/config/ConfigSchema.d.ts +1 -1
  64. package/src/cli/config/ConfigSchema.d.ts.map +1 -1
  65. package/src/cli/config/ConfigSchema.js +4 -3
  66. package/src/cli/scaffolding/ProjectScaffolder.js +5 -5
  67. package/src/cli/scaffolding/RouteGenerator.d.ts.map +1 -1
  68. package/src/cli/scaffolding/RouteGenerator.js +21 -2
  69. package/src/cli/scaffolding/TemplateEngine.js +1 -1
  70. package/src/cli/utils/DatabaseCliUtils.d.ts +20 -0
  71. package/src/cli/utils/DatabaseCliUtils.d.ts.map +1 -0
  72. package/src/cli/utils/DatabaseCliUtils.js +54 -0
  73. package/src/cli/utils/EnvFileLoader.d.ts.map +1 -1
  74. package/src/common/ExternalServiceUtils.d.ts +63 -0
  75. package/src/common/ExternalServiceUtils.d.ts.map +1 -0
  76. package/src/common/ExternalServiceUtils.js +116 -0
  77. package/src/common/HealthRoutes.d.ts +10 -0
  78. package/src/common/HealthRoutes.d.ts.map +1 -0
  79. package/src/common/HealthRoutes.js +114 -0
  80. package/src/config/SecretsManager.d.ts.map +1 -1
  81. package/src/config/SecretsManager.js +2 -1
  82. package/src/config/app.d.ts +2 -1
  83. package/src/config/app.d.ts.map +1 -1
  84. package/src/config/app.js +98 -52
  85. package/src/config/broadcast.d.ts.map +1 -1
  86. package/src/config/broadcast.js +1 -1
  87. package/src/config/cache.d.ts.map +1 -1
  88. package/src/config/cache.js +2 -2
  89. package/src/config/database.d.ts.map +1 -1
  90. package/src/config/database.js +24 -5
  91. package/src/config/env.d.ts +43 -1
  92. package/src/config/env.d.ts.map +1 -1
  93. package/src/config/env.js +68 -21
  94. package/src/config/index.d.ts +10 -1
  95. package/src/config/index.d.ts.map +1 -1
  96. package/src/config/index.js +1 -0
  97. package/src/config/mail.d.ts.map +1 -1
  98. package/src/config/mail.js +3 -3
  99. package/src/config/middleware.d.ts.map +1 -1
  100. package/src/config/middleware.js +1 -1
  101. package/src/config/notification.d.ts.map +1 -1
  102. package/src/config/notification.js +2 -2
  103. package/src/config/queue.d.ts +14 -0
  104. package/src/config/queue.d.ts.map +1 -1
  105. package/src/config/queue.js +61 -36
  106. package/src/config/security.js +2 -2
  107. package/src/config/storage.d.ts.map +1 -1
  108. package/src/config/storage.js +1 -1
  109. package/src/config/type.d.ts +111 -0
  110. package/src/config/type.d.ts.map +1 -1
  111. package/src/config/workers.d.ts +13 -0
  112. package/src/config/workers.d.ts.map +1 -0
  113. package/src/config/workers.js +173 -0
  114. package/src/database/Paginator.d.ts +37 -0
  115. package/src/database/Paginator.d.ts.map +1 -0
  116. package/src/database/Paginator.js +81 -0
  117. package/src/exceptions/ZintrustError.d.ts +5 -2
  118. package/src/exceptions/ZintrustError.d.ts.map +1 -1
  119. package/src/exceptions/ZintrustError.js +6 -2
  120. package/src/features/Auth.d.ts +1 -1
  121. package/src/features/Auth.d.ts.map +1 -1
  122. package/src/features/Auth.js +3 -2
  123. package/src/features/Queue.d.ts.map +1 -1
  124. package/src/features/Queue.js +0 -2
  125. package/src/index.d.ts +15 -5
  126. package/src/index.d.ts.map +1 -1
  127. package/src/index.js +24 -3
  128. package/src/microservices/MicroserviceBootstrap.d.ts.map +1 -1
  129. package/src/microservices/MicroserviceBootstrap.js +3 -1
  130. package/src/microservices/MicroserviceGenerator.js +4 -4
  131. package/src/microservices/MicroserviceManager.d.ts +1 -1
  132. package/src/microservices/MicroserviceManager.js +1 -1
  133. package/src/middleware/RateLimiter.d.ts.map +1 -1
  134. package/src/middleware/RateLimiter.js +4 -3
  135. package/src/node-singletons/crypto.d.ts +1 -1
  136. package/src/node-singletons/crypto.d.ts.map +1 -1
  137. package/src/node-singletons/crypto.js +1 -1
  138. package/src/node-singletons/os.d.ts +10 -1
  139. package/src/node-singletons/os.d.ts.map +1 -1
  140. package/src/node-singletons/os.js +10 -1
  141. package/src/openapi/OpenApiGenerator.js +2 -2
  142. package/src/orm/ConnectionManager.d.ts +1 -1
  143. package/src/orm/ConnectionManager.d.ts.map +1 -1
  144. package/src/orm/ConnectionManager.js +37 -19
  145. package/src/orm/Model.d.ts +8 -1
  146. package/src/orm/Model.d.ts.map +1 -1
  147. package/src/orm/Model.js +85 -24
  148. package/src/orm/QueryBuilder.d.ts +12 -2
  149. package/src/orm/QueryBuilder.d.ts.map +1 -1
  150. package/src/orm/QueryBuilder.js +438 -38
  151. package/src/orm/Relationships.d.ts +61 -1
  152. package/src/orm/Relationships.d.ts.map +1 -1
  153. package/src/orm/Relationships.js +190 -0
  154. package/src/orm/adapters/D1RemoteAdapter.d.ts +1 -1
  155. package/src/orm/adapters/D1RemoteAdapter.js +1 -1
  156. package/src/performance/Optimizer.d.ts.map +1 -1
  157. package/src/performance/Optimizer.js +2 -4
  158. package/src/routing/CoreRoutes.d.ts +1 -1
  159. package/src/routing/CoreRoutes.d.ts.map +1 -1
  160. package/src/routing/CoreRoutes.js +2 -116
  161. package/src/routing/error.d.ts.map +1 -1
  162. package/src/routing/error.js +3 -2
  163. package/src/routing/publicRoot.d.ts.map +1 -1
  164. package/src/routing/publicRoot.js +4 -2
  165. package/src/runtime/PluginAutoImports.d.ts.map +1 -1
  166. package/src/runtime/PluginAutoImports.js +8 -4
  167. package/src/runtime/PluginManager.d.ts.map +1 -1
  168. package/src/runtime/PluginManager.js +11 -6
  169. package/src/runtime/RuntimeAdapter.d.ts +3 -3
  170. package/src/runtime/RuntimeAdapter.d.ts.map +1 -1
  171. package/src/runtime/StartupConfigFileRegistry.d.ts +2 -1
  172. package/src/runtime/StartupConfigFileRegistry.d.ts.map +1 -1
  173. package/src/runtime/StartupConfigFileRegistry.js +2 -1
  174. package/src/runtime/adapters/CloudflareAdapter.d.ts.map +1 -1
  175. package/src/runtime/adapters/CloudflareAdapter.js +1 -1
  176. package/src/runtime/adapters/DenoAdapter.d.ts.map +1 -1
  177. package/src/runtime/adapters/DenoAdapter.js +1 -1
  178. package/src/runtime/adapters/FargateAdapter.d.ts +2 -2
  179. package/src/runtime/adapters/FargateAdapter.d.ts.map +1 -1
  180. package/src/runtime/adapters/FargateAdapter.js +1 -1
  181. package/src/runtime/adapters/LambdaAdapter.d.ts +1 -1
  182. package/src/runtime/adapters/LambdaAdapter.d.ts.map +1 -1
  183. package/src/runtime/adapters/LambdaAdapter.js +6 -4
  184. package/src/runtime/adapters/NodeServerAdapter.js +1 -1
  185. package/src/scripts/GenerateEnvArtifacts.js +1 -1
  186. package/src/security/SignedRequest.js +1 -1
  187. package/src/security/StartupSecretValidation.d.ts.map +1 -1
  188. package/src/security/StartupSecretValidation.js +7 -1
  189. package/src/start.d.ts.map +1 -1
  190. package/src/start.js +0 -2
  191. package/src/templates/features/Auth.ts.tpl +4 -4
  192. package/src/templates/project/basic/README.md.tpl +1 -1
  193. package/src/templates/project/basic/app/Middleware/index.ts.tpl +1 -1
  194. package/src/templates/project/basic/config/notification.ts.tpl +1 -1
  195. package/src/templates/project/basic/routes/api.ts.tpl +1 -3
  196. package/src/templates/project/basic/src/index.ts.tpl +1 -1
  197. package/src/templates/project/basic/src/zintrust.plugins.ts.tpl +1 -1
  198. package/src/templates/project/basic/template.json +1 -1
  199. package/src/toolkit/Secrets/index.d.ts.map +1 -1
  200. package/src/toolkit/Secrets/index.js +13 -9
  201. package/src/toolkit/Secrets/providers/AwsSecretsManager.d.ts.map +1 -1
  202. package/src/toolkit/Secrets/providers/AwsSecretsManager.js +8 -7
  203. package/src/toolkit/Secrets/providers/CloudflareKv.d.ts.map +1 -1
  204. package/src/toolkit/Secrets/providers/CloudflareKv.js +7 -6
  205. package/src/tools/http/Http.js +1 -1
  206. package/src/tools/mail/drivers/Ses.d.ts.map +1 -1
  207. package/src/tools/mail/drivers/Ses.js +5 -4
  208. package/src/tools/mail/templates/index.js +2 -2
  209. package/src/tools/notification/drivers/Termii.d.ts.map +1 -1
  210. package/src/tools/notification/drivers/Termii.js +6 -17
  211. package/src/tools/notification/testingHelpers.d.ts.map +1 -1
  212. package/src/tools/queue/Queue.d.ts.map +1 -1
  213. package/src/tools/queue/Queue.js +3 -5
  214. package/src/tools/queue/drivers/Redis.d.ts.map +1 -1
  215. package/src/tools/queue/drivers/Redis.js +7 -1
  216. package/src/tools/storage/drivers/S3.d.ts.map +1 -1
  217. package/src/tools/storage/drivers/S3.js +4 -3
  218. package/src/routes/health.d.ts +0 -2
  219. package/src/routes/health.d.ts.map +0 -1
  220. package/src/routes/health.js +0 -1
  221. package/src/runtime/RuntimeDetector.d.ts +0 -15
  222. package/src/runtime/RuntimeDetector.d.ts.map +0 -1
  223. package/src/runtime/RuntimeDetector.js +0 -271
  224. package/src/templates/project/basic/routes/health.ts.tpl +0 -143
  225. package/src/templates/project/basic/routes/metrics.ts.tpl +0 -22
  226. package/src/workers/BroadcastWorker.d.ts +0 -22
  227. package/src/workers/BroadcastWorker.d.ts.map +0 -1
  228. package/src/workers/BroadcastWorker.js +0 -24
  229. package/src/workers/NotificationWorker.d.ts +0 -22
  230. package/src/workers/NotificationWorker.d.ts.map +0 -1
  231. package/src/workers/NotificationWorker.js +0 -23
  232. package/src/workers/createQueueWorker.d.ts +0 -24
  233. package/src/workers/createQueueWorker.d.ts.map +0 -1
  234. package/src/workers/createQueueWorker.js +0 -114
@@ -331,7 +331,7 @@ const generateQAReport = (results) => {
331
331
  <head>
332
332
  <meta charset="UTF-8">
333
333
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
334
- <title>Zintrust QA Report</title>
334
+ <title>ZinTrust QA Report</title>
335
335
  <link rel="stylesheet" href="base.css">
336
336
  <link rel="stylesheet" href="qa-report.css">
337
337
  </head>
@@ -339,7 +339,7 @@ const generateQAReport = (results) => {
339
339
  <main class="qa-shell">
340
340
  <section class="qa-panel">
341
341
  <header class="qa-hero">
342
- <h1 class="qa-title">Zintrust QA Report</h1>
342
+ <h1 class="qa-title">ZinTrust QA Report</h1>
343
343
  <p class="qa-subtitle">Quality Assurance Suite Results</p>
344
344
  <div class="qa-meta">Generated on ${timestamp}</div>
345
345
  </header>
@@ -360,7 +360,7 @@ const generateQAReport = (results) => {
360
360
  </div>
361
361
  </div>
362
362
 
363
- <footer class="qa-footer">Zintrust Framework QA Suite | Generated automatically</footer>
363
+ <footer class="qa-footer">ZinTrust Framework QA Suite | Generated automatically</footer>
364
364
  </section>
365
365
  </main>
366
366
  </body>
@@ -430,7 +430,7 @@ const addOptions = (command) => {
430
430
  };
431
431
  const executeQA = async (qa, options) => {
432
432
  try {
433
- qa.info('Starting Zintrust QA Suite...');
433
+ qa.info('Starting ZinTrust QA Suite...');
434
434
  const results = createResults();
435
435
  await qa.runLint(results.lint);
436
436
  await qa.runTypeCheck(results.typeCheck);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Resource Control Command
3
+ * Control the resource monitor (start/stop) on the running worker service via HTTP
4
+ */
5
+ export declare const ResourceControlCommand: import("../BaseCommand").IBaseCommand;
6
+ //# sourceMappingURL=ResourceControlCommand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResourceControlCommand.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/ResourceControlCommand.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,eAAO,MAAM,sBAAsB,yCAuCjC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Resource Control Command
3
+ * Control the resource monitor (start/stop) on the running worker service via HTTP
4
+ */
5
+ import { ErrorFactory } from '../../exceptions/ZintrustError.js';
6
+ import { BaseCommand } from '../BaseCommand.js';
7
+ import { Logger } from '../../config/logger.js';
8
+ export const ResourceControlCommand = BaseCommand.create({
9
+ name: 'resource:monitor',
10
+ description: 'Control the resource monitor (start/stop) on the running worker service',
11
+ aliases: ['rm'],
12
+ addOptions: (cmd) => {
13
+ cmd.argument('<action>', 'Action to perform: start or stop');
14
+ cmd.option('--port <port>', 'Worker service port', '7777');
15
+ cmd.option('--host <host>', 'Worker service host', '127.0.0.1');
16
+ },
17
+ execute: async (options) => {
18
+ const action = options.args?.[0];
19
+ const port = options['port'] ?? '7777';
20
+ const host = options['host'] ?? '127.0.0.1';
21
+ if (action === undefined || !['start', 'stop'].includes(action)) {
22
+ Logger.error('Invalid action. Use "start" or "stop".');
23
+ return;
24
+ }
25
+ const url = `http://${host}:${port}/api/resources/${action}`;
26
+ try {
27
+ Logger.info(`Sending ${action} request to ${url}...`);
28
+ const response = await fetch(url, {
29
+ method: 'POST',
30
+ headers: { 'Content-Type': 'application/json' },
31
+ });
32
+ if (!response.ok) {
33
+ throw ErrorFactory.createCliError(`HTTP ${response.status}: ${await response.text()}`);
34
+ }
35
+ const data = (await response.json());
36
+ Logger.info(`Success: ${data.message}`);
37
+ }
38
+ catch (e) {
39
+ Logger.error(`Failed to ${action} resource monitor: ${e.message}`);
40
+ Logger.info('Ensure the worker service is running and the port is correct.');
41
+ }
42
+ },
43
+ });
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Simulate Command
3
- * Internal dev tool that generates a simulated Zintrust app under ./simulate/
3
+ * Internal dev tool that generates a simulated ZinTrust app under ./simulate/
4
4
  * IMPORTANT: this uses the same ProjectScaffolder as `zin new`.
5
5
  * Usage: zin -sim my-blog
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Simulate Command
3
- * Internal dev tool that generates a simulated Zintrust app under ./simulate/
3
+ * Internal dev tool that generates a simulated ZinTrust app under ./simulate/
4
4
  * IMPORTANT: this uses the same ProjectScaffolder as `zin new`.
5
5
  * Usage: zin -sim my-blog
6
6
  */
@@ -31,12 +31,12 @@ const rewriteSimulatedAppDependencyToDist = (appPath, distPath) => {
31
31
  */
32
32
  export const SimulateCommand = {
33
33
  name: 'simulate',
34
- description: '[INTERNAL] Generate simulated Zintrust app for testing new developer experience',
34
+ description: '[INTERNAL] Generate simulated ZinTrust app for testing new developer experience',
35
35
  getCommand() {
36
36
  const command = new Command('simulate')
37
37
  .alias('-sim')
38
38
  .alias('--sim')
39
- .description('[INTERNAL DEV] Create a simulated Zintrust application in simulate/ folder')
39
+ .description('[INTERNAL DEV] Create a simulated ZinTrust application in simulate/ folder')
40
40
  .argument('<name>', 'Name of the simulated app')
41
41
  .action(async (appName) => {
42
42
  try {
@@ -51,7 +51,7 @@ export const SimulateCommand = {
51
51
  template: 'basic',
52
52
  database: 'sqlite',
53
53
  author: 'Internal',
54
- description: `Simulated Zintrust app - ${appName}`,
54
+ description: `Simulated ZinTrust app - ${appName}`,
55
55
  });
56
56
  if (!result.success) {
57
57
  throw ErrorFactory.createCliError(result.message, result.error);
@@ -2,6 +2,7 @@ import { BaseCommand } from '../BaseCommand.js';
2
2
  import { DENO_RUNNER_SOURCE, LAMBDA_RUNNER_SOURCE } from '../commands/runner/index.js';
3
3
  import { EnvFileLoader } from '../utils/EnvFileLoader.js';
4
4
  import { SpawnUtil } from '../utils/spawn.js';
5
+ import { readEnvString } from '../../common/ExternalServiceUtils.js';
5
6
  import { resolveNpmPath } from '../../common/index.js';
6
7
  import { ErrorFactory } from '../../exceptions/ZintrustError.js';
7
8
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from '../../node-singletons/fs.js';
@@ -20,7 +21,7 @@ const normalizeMode = (value) => {
20
21
  return 'development';
21
22
  };
22
23
  const resolveModeFromAppMode = () => {
23
- const raw = typeof process.env['APP_MODE'] === 'string' ? process.env['APP_MODE'].trim() : '';
24
+ const raw = readEnvString('APP_MODE').trim();
24
25
  const normalized = raw.toLowerCase();
25
26
  if (normalized === 'production' || normalized === 'pro' || normalized === 'prod') {
26
27
  return 'production';
@@ -46,13 +47,12 @@ const resolvePort = (options) => {
46
47
  }
47
48
  return parsed;
48
49
  }
49
- // .env is primary (loaded by EnvFileLoader with overrideExisting=true)
50
- const envPort = process.env['APP_PORT'] ?? process.env['PORT'] ?? '';
51
- if (envPort === '')
50
+ const envPortRaw = process.env['APP_PORT'] ?? process.env['PORT'] ?? '';
51
+ if (envPortRaw === '')
52
52
  return undefined;
53
- const parsed = Number.parseInt(envPort, 10);
53
+ const parsed = Number.parseInt(String(envPortRaw), 10);
54
54
  if (!Number.isFinite(parsed) || parsed <= 0 || parsed >= 65536) {
55
- throw ErrorFactory.createCliError(`Error: Invalid APP_PORT/PORT '${envPort}'. Expected 1-65535.`);
55
+ throw ErrorFactory.createCliError(`Error: Invalid APP_PORT/PORT '${envPortRaw}'. Expected 1-65535.`);
56
56
  }
57
57
  return parsed;
58
58
  };
@@ -94,7 +94,7 @@ const resolveWatchPreference = (options, mode) => {
94
94
  const readPackageJson = (cwd) => {
95
95
  const packagePath = path.join(cwd, 'package.json');
96
96
  if (!existsSync(packagePath)) {
97
- throw ErrorFactory.createCliError("Error: No Zintrust app found. Run 'zin new <project>' or ensure package.json exists.");
97
+ throw ErrorFactory.createCliError("Error: No ZinTrust app found. Run 'zin new <project>' or ensure package.json exists.");
98
98
  }
99
99
  try {
100
100
  const raw = readFileSync(packagePath, 'utf-8');
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Upgrade Command
3
3
  *
4
- * Goal: help existing Zintrust projects adopt new safe defaults without forcing
4
+ * Goal: help existing ZinTrust projects adopt new safe defaults without forcing
5
5
  * a full re-scaffold.
6
6
  *
7
7
  * Current scope (minimal/safe):
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Upgrade Command
3
3
  *
4
- * Goal: help existing Zintrust projects adopt new safe defaults without forcing
4
+ * Goal: help existing ZinTrust projects adopt new safe defaults without forcing
5
5
  * a full re-scaffold.
6
6
  *
7
7
  * Current scope (minimal/safe):
@@ -81,7 +81,7 @@ export const UpgradeCommand = Object.freeze({
81
81
  create() {
82
82
  return BaseCommand.create({
83
83
  name: 'upgrade',
84
- description: 'Upgrade an existing Zintrust project in-place (safe, non-destructive)',
84
+ description: 'Upgrade an existing ZinTrust project in-place (safe, non-destructive)',
85
85
  addOptions: (command) => {
86
86
  command.option('--cwd <path>', 'Project directory (default: current working directory)');
87
87
  command.option('--dry-run', 'Print planned changes without writing files');
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Worker Management CLI Commands
3
+ * Command-line interface for managing workers
4
+ */
5
+ import type { IBaseCommand } from '../BaseCommand';
6
+ /**
7
+ * Export worker command creators
8
+ */
9
+ export declare const WorkerCommands: {
10
+ createWorkerListCommand: () => IBaseCommand;
11
+ createWorkerStatusCommand: () => IBaseCommand;
12
+ createWorkerStartCommand: () => IBaseCommand;
13
+ createWorkerStopCommand: () => IBaseCommand;
14
+ createWorkerRestartCommand: () => IBaseCommand;
15
+ createWorkerSummaryCommand: () => IBaseCommand;
16
+ };
17
+ //# sourceMappingURL=WorkerCommands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkerCommands.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/WorkerCommands.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0UrD;;GAEG;AACH,eAAO,MAAM,cAAc;mCAhPS,YAAY;qCA2CV,YAAY;oCAiDb,YAAY;mCA+Bb,YAAY;sCAgCT,YAAY;sCAgCZ,YAAY;CA4DlD,CAAC"}
@@ -0,0 +1,264 @@
1
+ /* eslint-disable no-console */
2
+ /**
3
+ * Worker Management CLI Commands
4
+ * Command-line interface for managing workers
5
+ */
6
+ import { BaseCommand } from '../BaseCommand.js';
7
+ import { Logger } from '../../config/logger.js';
8
+ import { HealthMonitor as HealthMonitorAny, ResourceMonitor as ResourceMonitorAny, WorkerFactory as WorkerFactoryAny, WorkerRegistry as WorkerRegistryAny, } from '../../../packages/workers/src/index.js';
9
+ // Lazy initialization to prevent temporal dead zone issues
10
+ let WorkerFactory;
11
+ let WorkerRegistry;
12
+ let HealthMonitor;
13
+ let ResourceMonitor;
14
+ const getWorkerFactory = () => {
15
+ WorkerFactory ??= WorkerFactoryAny;
16
+ return WorkerFactory;
17
+ };
18
+ const getWorkerRegistry = () => {
19
+ WorkerRegistry ??= WorkerRegistryAny;
20
+ return WorkerRegistry;
21
+ };
22
+ const getHealthMonitor = () => {
23
+ HealthMonitor ??= HealthMonitorAny;
24
+ return HealthMonitor;
25
+ };
26
+ const getResourceMonitor = () => {
27
+ ResourceMonitor ??= ResourceMonitorAny;
28
+ return ResourceMonitor;
29
+ };
30
+ /**
31
+ * Helper: Format table output
32
+ */
33
+ const formatTable = (headers, rows) => {
34
+ const columnWidths = headers.map((h, i) => {
35
+ const maxRowWidth = Math.max(...rows.map((r) => (r[i] || '').length));
36
+ return Math.max(h.length, maxRowWidth);
37
+ });
38
+ const headerRow = headers.map((h, i) => h.padEnd(columnWidths[i])).join(' | ');
39
+ const separator = columnWidths.map((w) => '-'.repeat(w)).join('-+-');
40
+ const dataRows = rows.map((row) => row.map((cell, i) => (cell || '').padEnd(columnWidths[i])).join(' | '));
41
+ return [headerRow, separator, ...dataRows].join('\n');
42
+ };
43
+ /**
44
+ * Worker List Command
45
+ */
46
+ const createWorkerListCommand = () => {
47
+ const ext = async () => {
48
+ try {
49
+ const workers = await getWorkerFactory().listPersisted();
50
+ console.log(`\nTotal Workers: ${workers.length}\n`);
51
+ if (workers.length === 0) {
52
+ console.log('No workers found.');
53
+ return;
54
+ }
55
+ const rows = workers.map((name) => {
56
+ const status = getWorkerRegistry().status(name);
57
+ return [
58
+ name,
59
+ status?.status ?? 'unknown',
60
+ status?.version ?? 'N/A',
61
+ status?.queueName ?? 'N/A',
62
+ String(status?.concurrency ?? 0),
63
+ ];
64
+ });
65
+ console.log(formatTable(['Name', 'Status', 'Version', 'Queue', 'Concurrency'], rows));
66
+ console.log();
67
+ }
68
+ catch (error) {
69
+ Logger.error('worker:list command failed', error);
70
+ process.exit(1);
71
+ }
72
+ };
73
+ const cmd = BaseCommand.create({
74
+ name: 'worker:list',
75
+ description: 'List all workers',
76
+ execute: async () => ext(),
77
+ });
78
+ return cmd;
79
+ };
80
+ /**
81
+ * Worker Status Command
82
+ */
83
+ const createWorkerStatusCommand = () => {
84
+ const ext = async (name) => {
85
+ try {
86
+ if (!name) {
87
+ Logger.error('Error: Worker name is required');
88
+ process.exit(1);
89
+ }
90
+ const status = getWorkerRegistry().status(name);
91
+ const health = await getWorkerFactory().getHealth(name);
92
+ const healthData = typeof health === 'object' && health !== null
93
+ ? health
94
+ : {};
95
+ const metrics = await getWorkerFactory().getMetrics(name);
96
+ console.log(`\n=== Worker: ${name} ===\n`);
97
+ console.log(`Status: ${status?.status}`);
98
+ console.log(`Version: ${status?.version}`);
99
+ console.log(`Queue: ${status?.queueName}`);
100
+ console.log(`Region: ${status?.region ?? 'N/A'}`);
101
+ console.log(`Started: ${status?.startedAt}`);
102
+ console.log(`Concurrency: ${status?.concurrency}`);
103
+ console.log(`\nHealth Score: ${healthData.score ?? 'N/A'}`);
104
+ console.log(`Health Status: ${healthData.status ?? 'N/A'}`);
105
+ console.log(`\nMetrics:`);
106
+ console.log(JSON.stringify(metrics, null, 2));
107
+ console.log();
108
+ }
109
+ catch (error) {
110
+ Logger.error('worker:status command failed', error);
111
+ process.exit(1);
112
+ }
113
+ };
114
+ const cmd = BaseCommand.create({
115
+ name: 'worker:status',
116
+ description: 'Get detailed status of a worker',
117
+ addOptions: (command) => {
118
+ command.argument('<name>', 'Worker name');
119
+ },
120
+ execute: async (options) => ext(options.args?.[0] ?? ''),
121
+ });
122
+ return cmd;
123
+ };
124
+ /**
125
+ * Worker Start Command
126
+ */
127
+ const createWorkerStartCommand = () => {
128
+ const ext = async (name) => {
129
+ try {
130
+ if (!name) {
131
+ Logger.error('Error: Worker name is required');
132
+ process.exit(1);
133
+ }
134
+ await getWorkerFactory().start(name);
135
+ Logger.info(`✓ Worker "${name}" started successfully`);
136
+ }
137
+ catch (error) {
138
+ Logger.error('worker:start command failed', error);
139
+ process.exit(1);
140
+ }
141
+ };
142
+ const cmd = BaseCommand.create({
143
+ name: 'worker:start',
144
+ description: 'Start a worker',
145
+ addOptions: (command) => {
146
+ command.argument('<name>', 'Worker name');
147
+ },
148
+ execute: async (options) => ext(options.args?.[0] ?? ''),
149
+ });
150
+ return cmd;
151
+ };
152
+ /**
153
+ * Worker Stop Command
154
+ */
155
+ const createWorkerStopCommand = () => {
156
+ const ext = async (name) => {
157
+ try {
158
+ if (!name) {
159
+ console.error('Error: Worker name is required');
160
+ process.exit(1);
161
+ }
162
+ await getWorkerFactory().stop(name);
163
+ console.log(`✓ Worker "${name}" stopped successfully`);
164
+ }
165
+ catch (error) {
166
+ Logger.error('worker:stop command failed', error);
167
+ console.error(`Error: ${error.message}`);
168
+ process.exit(1);
169
+ }
170
+ };
171
+ const cmd = BaseCommand.create({
172
+ name: 'worker:stop',
173
+ description: 'Stop a worker',
174
+ addOptions: (command) => {
175
+ command.argument('<name>', 'Worker name');
176
+ },
177
+ execute: async (options) => ext(options.args?.[0] ?? ''),
178
+ });
179
+ return cmd;
180
+ };
181
+ /**
182
+ * Worker Restart Command
183
+ */
184
+ const createWorkerRestartCommand = () => {
185
+ const ext = async (name) => {
186
+ try {
187
+ if (!name) {
188
+ console.error('Error: Worker name is required');
189
+ process.exit(1);
190
+ }
191
+ await getWorkerFactory().restart(name);
192
+ console.log(`✓ Worker "${name}" restarted successfully`);
193
+ }
194
+ catch (error) {
195
+ Logger.error('worker:restart command failed', error);
196
+ console.error(`Error: ${error.message}`);
197
+ process.exit(1);
198
+ }
199
+ };
200
+ const cmd = BaseCommand.create({
201
+ name: 'worker:restart',
202
+ description: 'Restart a worker',
203
+ addOptions: (command) => {
204
+ command.argument('<name>', 'Worker name');
205
+ },
206
+ execute: async (options) => ext(options.args?.[0] ?? ''),
207
+ });
208
+ return cmd;
209
+ };
210
+ /**
211
+ * Worker Summary Command
212
+ */
213
+ const createWorkerSummaryCommand = () => {
214
+ const ext = () => {
215
+ try {
216
+ const workers = getWorkerFactory().list();
217
+ const monitoringSummary = getHealthMonitor().getSummary();
218
+ const resourceUsage = getResourceMonitor().getCurrentUsage('system');
219
+ console.log(`\n=== Worker System Summary ===\n`);
220
+ console.log(`Total Workers: ${workers.length}`);
221
+ console.log(`\nHealth Overview:`);
222
+ const healthCounts = {
223
+ healthy: 0,
224
+ degraded: 0,
225
+ unhealthy: 0,
226
+ critical: 0,
227
+ };
228
+ monitoringSummary.forEach((w) => {
229
+ healthCounts[w.status]++;
230
+ });
231
+ console.log(` Healthy: ${healthCounts.healthy}`);
232
+ console.log(` Degraded: ${healthCounts.degraded}`);
233
+ console.log(` Unhealthy: ${healthCounts.unhealthy}`);
234
+ console.log(` Critical: ${healthCounts.critical}`);
235
+ console.log(`\nSystem Resources:`);
236
+ console.log(` CPU: ${resourceUsage.cpu.toFixed(1)}%`);
237
+ console.log(` Memory: ${resourceUsage.memory.percent.toFixed(1)}% (${(resourceUsage.memory.used / 1024 / 1024 / 1024).toFixed(2)} GB used)`);
238
+ console.log(` Cost (hourly): $${resourceUsage.cost.hourly.toFixed(2)}`);
239
+ console.log(` Cost (daily): $${resourceUsage.cost.daily.toFixed(2)}`);
240
+ console.log();
241
+ }
242
+ catch (error) {
243
+ Logger.error('worker:summary command failed', error);
244
+ process.exit(1);
245
+ }
246
+ };
247
+ const cmd = BaseCommand.create({
248
+ name: 'worker:summary',
249
+ description: 'Get system-wide worker summary',
250
+ execute: () => ext(),
251
+ });
252
+ return cmd;
253
+ };
254
+ /**
255
+ * Export worker command creators
256
+ */
257
+ export const WorkerCommands = {
258
+ createWorkerListCommand,
259
+ createWorkerStatusCommand,
260
+ createWorkerStartCommand,
261
+ createWorkerStopCommand,
262
+ createWorkerRestartCommand,
263
+ createWorkerSummaryCommand,
264
+ };
@@ -11,10 +11,12 @@ export { LogsCleanupCommand } from '../commands/LogsCleanupCommand';
11
11
  export { MakeMailTemplateCommand } from '../commands/MakeMailTemplateCommand';
12
12
  export { MakeNotificationTemplateCommand } from '../commands/MakeNotificationTemplateCommand';
13
13
  export { MigrateCommand } from '../commands/MigrateCommand';
14
+ export { MigrateWorkerCommand } from '../commands/MigrateWorkerCommand';
14
15
  export { NewCommand } from '../commands/NewCommand';
15
16
  export { NotificationWorkCommand } from '../commands/NotificationWorkCommand';
16
17
  export { PrepareCommand } from '../commands/PrepareCommand';
17
18
  export { QueueCommand } from '../commands/QueueCommand';
19
+ export { ResourceControlCommand } from '../commands/ResourceControlCommand';
18
20
  export { RoutesCommand } from '../commands/RoutesCommand';
19
21
  export { SecretsCommand } from '../commands/SecretsCommand';
20
22
  export { StartCommand } from '../commands/StartCommand';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EACL,mBAAmB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AkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -11,10 +11,12 @@ export { LogsCleanupCommand } from '../commands/LogsCleanupCommand.js';
11
11
  export { MakeMailTemplateCommand } from '../commands/MakeMailTemplateCommand.js';
12
12
  export { MakeNotificationTemplateCommand } from '../commands/MakeNotificationTemplateCommand.js';
13
13
  export { MigrateCommand } from '../commands/MigrateCommand.js';
14
+ export { MigrateWorkerCommand } from '../commands/MigrateWorkerCommand.js';
14
15
  export { NewCommand } from '../commands/NewCommand.js';
15
16
  export { NotificationWorkCommand } from '../commands/NotificationWorkCommand.js';
16
17
  export { PrepareCommand } from '../commands/PrepareCommand.js';
17
18
  export { QueueCommand } from '../commands/QueueCommand.js';
19
+ export { ResourceControlCommand } from '../commands/ResourceControlCommand.js';
18
20
  export { RoutesCommand } from '../commands/RoutesCommand.js';
19
21
  export { SecretsCommand } from '../commands/SecretsCommand.js';
20
22
  export { StartCommand } from '../commands/StartCommand.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Configuration Schema
3
- * Defines the structure and types for Zintrust configuration
3
+ * Defines the structure and types for ZinTrust configuration
4
4
  */
5
5
  export interface DatabaseConfig {
6
6
  connection: 'sqlite' | 'postgres' | 'mysql' | 'mariadb';
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigSchema.d.ts","sourceRoot":"","sources":["../../../../src/cli/config/ConfigSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,aAAa,GAAG,YAAY,GAAG,SAAS,CAAC;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,mBAAmB;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;;;;;;;;;;;;;;;;;;;;;;;;EAyCD,CAAC;AAQ3B;;;GAGG;AACH,eAAO,MAAM,WAAW;;;;;;;EAOtB,CAAC;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgDvB,CAAC;AAEH;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAapD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAgB/F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAiBlF"}
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * Configuration Schema
3
- * Defines the structure and types for Zintrust configuration
3
+ * Defines the structure and types for ZinTrust configuration
4
4
  */
5
+ import { Env } from '../../config/env.js';
5
6
  /**
6
7
  * Default configuration values
7
8
  */
8
9
  export const DEFAULT_CONFIG = Object.freeze({
9
10
  name: 'zintrust-app',
10
11
  version: '1.0.0',
11
- description: 'A Zintrust application',
12
+ description: 'A ZinTrust application',
12
13
  author: 'Developer',
13
14
  database: {
14
15
  connection: 'sqlite',
@@ -50,7 +51,7 @@ export const DEFAULT_CONFIG = Object.freeze({
50
51
  /**
51
52
  * Configuration paths
52
53
  */
53
- const HOME_DIR = process.env['HOME'] ?? process.env['USERPROFILE'] ?? '';
54
+ const HOME_DIR = Env.HOME || Env.USERPROFILE || '';
54
55
  const GLOBAL_DIR = `${HOME_DIR}/.zintrust`;
55
56
  /**
56
57
  * Configuration paths
@@ -352,7 +352,7 @@ const loadTemplateFromDisk = (templateName, fallback) => {
352
352
  */
353
353
  const BASIC_TEMPLATE = {
354
354
  name: 'basic',
355
- description: 'Basic Zintrust project structure',
355
+ description: 'Basic ZinTrust project structure',
356
356
  directories: [
357
357
  'config',
358
358
  'app/Controllers',
@@ -373,7 +373,7 @@ const BASIC_TEMPLATE = {
373
373
  };
374
374
  const API_TEMPLATE = {
375
375
  name: 'api',
376
- description: 'API-focused Zintrust project structure',
376
+ description: 'API-focused ZinTrust project structure',
377
377
  directories: [
378
378
  'app/Controllers',
379
379
  'app/Middleware',
@@ -389,7 +389,7 @@ const API_TEMPLATE = {
389
389
  };
390
390
  const MICROSERVICE_TEMPLATE = {
391
391
  name: 'microservice',
392
- description: 'Microservice-focused Zintrust project structure',
392
+ description: 'Microservice-focused ZinTrust project structure',
393
393
  directories: [
394
394
  'app/Controllers',
395
395
  'app/Middleware',
@@ -406,7 +406,7 @@ const MICROSERVICE_TEMPLATE = {
406
406
  };
407
407
  const FULLSTACK_TEMPLATE = {
408
408
  name: 'fullstack',
409
- description: 'Fullstack Zintrust project structure',
409
+ description: 'Fullstack ZinTrust project structure',
410
410
  directories: [
411
411
  'app/Controllers',
412
412
  'app/Middleware',
@@ -521,7 +521,7 @@ tmp/
521
521
  if (!Object.hasOwn(files, 'README.md')) {
522
522
  files['README.md'] = `# {{projectName}}
523
523
 
524
- Starter Task API built with Zintrust.
524
+ Starter Task API built with ZinTrust.
525
525
 
526
526
  ## Run
527
527
 
@@ -1 +1 @@
1
- {"version":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