@akanjs/cli 0.9.47 → 0.9.49

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 (128) hide show
  1. package/cjs/index.js +63 -52
  2. package/cjs/src/guidelines/___library/sharedUiStructureDescription.en.md +1 -1
  3. package/cjs/src/guidelines/databaseModule/databaseModule.instruction.md +9 -21
  4. package/cjs/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -5
  5. package/cjs/src/guidelines/framework/framework.instruction.md +10 -12
  6. package/cjs/src/guidelines/modelConstant/modelConstant.generate.json +0 -7
  7. package/cjs/src/guidelines/modelConstant/modelConstant.instruction.md +14 -19
  8. package/cjs/src/guidelines/modelDocument/modelDocument.instruction.md +0 -24
  9. package/cjs/src/guidelines/modelService/modelService.generate.json +4 -11
  10. package/cjs/src/guidelines/modelService/modelService.instruction.md +12 -75
  11. package/cjs/src/guidelines/modelSignal/modelSignal.generate.json +0 -1
  12. package/cjs/src/guidelines/modelSignal/modelSignal.instruction.md +2 -38
  13. package/cjs/src/guidelines/modelStore/modelStore.instruction.md +1 -3
  14. package/cjs/src/guidelines/modelTemplate/modelTemplate.instruction.md +2 -2
  15. package/cjs/src/guidelines/modelUnit/modelUnit.instruction.md +2 -2
  16. package/cjs/src/guidelines/scalarConstant/scalarConstant.instruction.md +6 -11
  17. package/cjs/src/templates/__scalar/__model__/__model__.constant.js +5 -6
  18. package/cjs/src/templates/__scalar/__model__/__model__.dictionary.js +1 -1
  19. package/cjs/src/templates/app/app/[lang]/layout.js +0 -1
  20. package/cjs/src/templates/app/app/csr.js +3 -1
  21. package/cjs/src/templates/app/lib/___appName__/__appName__.dictionary.js +1 -1
  22. package/cjs/src/templates/app/lib/___appName__/__appName__.service.js +2 -3
  23. package/cjs/src/templates/app/lib/___appName__/__appName__.signal.js +2 -3
  24. package/cjs/src/templates/app/lib/___appName__/__appName__.store.js +2 -3
  25. package/cjs/src/templates/client.js +4 -4
  26. package/cjs/src/templates/crudPages/[__model__Id]/edit/page.js +1 -1
  27. package/cjs/src/templates/crudPages/[__model__Id]/page.js +1 -1
  28. package/cjs/src/templates/crudPages/new/page.js +1 -1
  29. package/cjs/src/templates/crudPages/page.js +1 -1
  30. package/cjs/src/templates/index.js +0 -1
  31. package/cjs/src/templates/lib/__lib/lib.constant.js +0 -1
  32. package/cjs/src/templates/lib/__lib/lib.dictionary.js +7 -4
  33. package/cjs/src/templates/lib/__lib/lib.document.js +4 -3
  34. package/cjs/src/templates/lib/__lib/lib.service.js +1 -1
  35. package/cjs/src/templates/lib/__lib/lib.signal.js +23 -4
  36. package/cjs/src/templates/lib/__lib/lib.store.js +19 -2
  37. package/cjs/src/templates/lib/cnst.js +12 -6
  38. package/cjs/src/templates/lib/db.js +10 -3
  39. package/cjs/src/templates/lib/dict.js +12 -4
  40. package/cjs/src/templates/lib/sig.js +20 -9
  41. package/cjs/src/templates/lib/srv.js +7 -6
  42. package/cjs/src/templates/lib/st.js +10 -8
  43. package/cjs/src/templates/lib/useClient.js +39 -0
  44. package/cjs/src/templates/lib/{usePage.js → useServer.js} +6 -8
  45. package/cjs/src/templates/libRoot/lib/___libName__/__libName__.service.js +2 -3
  46. package/cjs/src/templates/libRoot/lib/___libName__/__libName__.store.js +2 -3
  47. package/cjs/src/templates/module/__model__.constant.js +10 -30
  48. package/cjs/src/templates/module/__model__.dictionary.js +2 -2
  49. package/cjs/src/templates/module/__model__.document.js +2 -8
  50. package/cjs/src/templates/module/__model__.service.js +2 -3
  51. package/cjs/src/templates/module/__model__.signal.js +4 -5
  52. package/cjs/src/templates/module/__model__.store.js +3 -4
  53. package/cjs/src/templates/server.js +4 -4
  54. package/cjs/src/templates/workspaceRoot/.gitignore.template +5 -3
  55. package/esm/index.js +63 -52
  56. package/esm/src/guidelines/___library/sharedUiStructureDescription.en.md +1 -1
  57. package/esm/src/guidelines/databaseModule/databaseModule.instruction.md +9 -21
  58. package/esm/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -5
  59. package/esm/src/guidelines/framework/framework.instruction.md +10 -12
  60. package/esm/src/guidelines/modelConstant/modelConstant.generate.json +0 -7
  61. package/esm/src/guidelines/modelConstant/modelConstant.instruction.md +14 -19
  62. package/esm/src/guidelines/modelDocument/modelDocument.instruction.md +0 -24
  63. package/esm/src/guidelines/modelService/modelService.generate.json +4 -11
  64. package/esm/src/guidelines/modelService/modelService.instruction.md +12 -75
  65. package/esm/src/guidelines/modelSignal/modelSignal.generate.json +0 -1
  66. package/esm/src/guidelines/modelSignal/modelSignal.instruction.md +2 -38
  67. package/esm/src/guidelines/modelStore/modelStore.instruction.md +1 -3
  68. package/esm/src/guidelines/modelTemplate/modelTemplate.instruction.md +2 -2
  69. package/esm/src/guidelines/modelUnit/modelUnit.instruction.md +2 -2
  70. package/esm/src/guidelines/scalarConstant/scalarConstant.instruction.md +6 -11
  71. package/esm/src/templates/__scalar/__model__/__model__.constant.js +5 -6
  72. package/esm/src/templates/__scalar/__model__/__model__.dictionary.js +1 -1
  73. package/esm/src/templates/app/app/[lang]/layout.js +0 -1
  74. package/esm/src/templates/app/app/csr.js +3 -1
  75. package/esm/src/templates/app/lib/___appName__/__appName__.dictionary.js +1 -1
  76. package/esm/src/templates/app/lib/___appName__/__appName__.service.js +2 -3
  77. package/esm/src/templates/app/lib/___appName__/__appName__.signal.js +2 -3
  78. package/esm/src/templates/app/lib/___appName__/__appName__.store.js +2 -3
  79. package/esm/src/templates/client.js +4 -4
  80. package/esm/src/templates/crudPages/[__model__Id]/edit/page.js +1 -1
  81. package/esm/src/templates/crudPages/[__model__Id]/page.js +1 -1
  82. package/esm/src/templates/crudPages/new/page.js +1 -1
  83. package/esm/src/templates/crudPages/page.js +1 -1
  84. package/esm/src/templates/index.js +0 -1
  85. package/esm/src/templates/lib/__lib/lib.constant.js +0 -1
  86. package/esm/src/templates/lib/__lib/lib.dictionary.js +7 -4
  87. package/esm/src/templates/lib/__lib/lib.document.js +4 -3
  88. package/esm/src/templates/lib/__lib/lib.service.js +1 -1
  89. package/esm/src/templates/lib/__lib/lib.signal.js +23 -4
  90. package/esm/src/templates/lib/__lib/lib.store.js +19 -2
  91. package/esm/src/templates/lib/cnst.js +12 -6
  92. package/esm/src/templates/lib/db.js +10 -3
  93. package/esm/src/templates/lib/dict.js +12 -4
  94. package/esm/src/templates/lib/sig.js +20 -9
  95. package/esm/src/templates/lib/srv.js +7 -6
  96. package/esm/src/templates/lib/st.js +10 -8
  97. package/esm/src/templates/lib/useClient.js +19 -0
  98. package/esm/src/templates/lib/useServer.js +11 -0
  99. package/esm/src/templates/libRoot/lib/___libName__/__libName__.service.js +2 -3
  100. package/esm/src/templates/libRoot/lib/___libName__/__libName__.store.js +2 -3
  101. package/esm/src/templates/module/__model__.constant.js +10 -30
  102. package/esm/src/templates/module/__model__.dictionary.js +2 -2
  103. package/esm/src/templates/module/__model__.document.js +2 -8
  104. package/esm/src/templates/module/__model__.service.js +2 -3
  105. package/esm/src/templates/module/__model__.signal.js +4 -5
  106. package/esm/src/templates/module/__model__.store.js +3 -4
  107. package/esm/src/templates/server.js +4 -4
  108. package/esm/src/templates/workspaceRoot/.gitignore.template +5 -3
  109. package/package.json +1 -1
  110. package/src/application/application.command.d.ts +7 -7
  111. package/src/application/application.script.d.ts +3 -1
  112. package/src/guidelines/___library/sharedUiStructureDescription.en.md +1 -1
  113. package/src/guidelines/databaseModule/databaseModule.instruction.md +9 -21
  114. package/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -5
  115. package/src/guidelines/framework/framework.instruction.md +10 -12
  116. package/src/guidelines/modelConstant/modelConstant.instruction.md +14 -19
  117. package/src/guidelines/modelDocument/modelDocument.instruction.md +0 -24
  118. package/src/guidelines/modelService/modelService.instruction.md +12 -75
  119. package/src/guidelines/modelSignal/modelSignal.instruction.md +2 -38
  120. package/src/guidelines/modelStore/modelStore.instruction.md +1 -3
  121. package/src/guidelines/modelTemplate/modelTemplate.instruction.md +2 -2
  122. package/src/guidelines/modelUnit/modelUnit.instruction.md +2 -2
  123. package/src/guidelines/scalarConstant/scalarConstant.instruction.md +6 -11
  124. package/src/templates/lib/useServer.d.ts +4 -0
  125. package/src/workspace/workspace.command.d.ts +1 -0
  126. package/src/workspace/workspace.script.d.ts +1 -0
  127. package/esm/src/templates/lib/usePage.js +0 -13
  128. /package/src/templates/lib/{usePage.d.ts → useClient.d.ts} +0 -0
package/cjs/index.js CHANGED
@@ -623,30 +623,6 @@ var withBase = (appName, config, libs, routes = []) => {
623
623
  "@akanjs/ui"
624
624
  ]
625
625
  },
626
- // modularizeImports: {
627
- // "react-icons/?(((\\w*)?/?)*)": {
628
- // transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
629
- // skipDefaultConversion: true,
630
- // },
631
- // lodash: { transform: "lodash/{{member}}", preventFullImport: true },
632
- // ...Object.fromEntries(
633
- // [appName, ...libs].reduce(
634
- // (acc, lib) => [
635
- // ...acc,
636
- // [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
637
- // [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
638
- // [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
639
- // [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
640
- // ],
641
- // [
642
- // ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
643
- // [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
644
- // [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
645
- // ]
646
- // )
647
- // ),
648
- // ...(config.modularizeImports ?? {}),
649
- // },
650
626
  images: {
651
627
  formats: ["image/avif", "image/webp"],
652
628
  ...config.images ?? {},
@@ -661,8 +637,14 @@ var withBase = (appName, config, libs, routes = []) => {
661
637
  ]
662
638
  },
663
639
  webpack: (config2) => {
640
+ const watchOptions = config2.watchOptions;
664
641
  config2.resolve.alias.canvas = false;
665
642
  config2.resolve.alias.encoding = false;
643
+ const ignored = watchOptions?.ignored ? typeof watchOptions.ignored === "string" ? [watchOptions.ignored] : watchOptions.ignored : [];
644
+ config2.watchOptions = {
645
+ ...config2.watchOptions ?? {},
646
+ ...{ ignored: [...ignored, "**/node_modules/**", "**/.git/**", "**/.next/**", "**/dist/**", "**/local/**"] }
647
+ };
666
648
  return config2;
667
649
  },
668
650
  turbopack: {
@@ -2650,12 +2632,12 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
2650
2632
  ]);
2651
2633
  await Promise.all([
2652
2634
  ...targetPublicDeps.map(
2653
- (dep) => import_fs4.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/public`) && import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
2635
+ (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
2654
2636
  recursive: true
2655
2637
  })
2656
2638
  ),
2657
2639
  ...targetAssetsDeps.map(
2658
- (dep) => import_fs4.default.existsSync(`${this.workspace.workspaceRoot}/libs/${dep}/assets`) && import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
2640
+ (dep) => import_promises.default.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
2659
2641
  recursive: true
2660
2642
  })
2661
2643
  )
@@ -4355,6 +4337,7 @@ var ApplicationRunner = class {
4355
4337
  write: false,
4356
4338
  entryPoints: [`${app.cwdPath}/main.ts`],
4357
4339
  bundle: true,
4340
+ minify: true,
4358
4341
  format: "cjs",
4359
4342
  packages: "external",
4360
4343
  platform: "node",
@@ -4368,7 +4351,6 @@ var ApplicationRunner = class {
4368
4351
  name: `${app.name}/backend`,
4369
4352
  description: `${app.name} backend`,
4370
4353
  version: "1.0.0",
4371
- // type: "module",
4372
4354
  main: "./main.js",
4373
4355
  engines: { node: ">=20" },
4374
4356
  dependencies
@@ -4382,6 +4364,7 @@ var ApplicationRunner = class {
4382
4364
  write: true,
4383
4365
  entryPoints: [`${app.cwdPath}/main.ts`],
4384
4366
  bundle: true,
4367
+ minify: false,
4385
4368
  packages: "external",
4386
4369
  platform: "node",
4387
4370
  format: "cjs",
@@ -4463,6 +4446,7 @@ var ApplicationRunner = class {
4463
4446
  outDir: `${app.dist.cwdPath}/csr`,
4464
4447
  sourcemap: false,
4465
4448
  emptyOutDir: true,
4449
+ minify: true,
4466
4450
  rollupOptions: {
4467
4451
  // ...(process.env.USE_AKANJS_PKGS === "true" ? {} : { external: ["next/server"] }),
4468
4452
  input: `${app.cwdPath}/app/index.html`
@@ -4848,6 +4832,12 @@ var ApplicationScript = class {
4848
4832
  await this.#runner.removeApplication(app);
4849
4833
  spinner.succeed(`Application ${app.name} (apps/${app.name}) removed`);
4850
4834
  }
4835
+ async sync(sys3) {
4836
+ if (sys3.type === "app")
4837
+ await this.syncApplication(sys3);
4838
+ else
4839
+ await this.libraryScript.syncLibrary(sys3);
4840
+ }
4851
4841
  async syncApplication(app) {
4852
4842
  const spinner = app.spinning("Scanning application...");
4853
4843
  const scanInfo = await this.#runner.scanSync(app);
@@ -4863,15 +4853,16 @@ var ApplicationScript = class {
4863
4853
  await this.syncApplication(app);
4864
4854
  await Promise.all([this.buildBackend(app, { sync: false }), this.buildFrontend(app, { sync: false })]);
4865
4855
  }
4866
- async start(app, { dbup = true, open: open2 = false } = {}) {
4856
+ async start(app, { dbup = true, open: open2 = false, sync = true } = {}) {
4867
4857
  const needDbup = app.getEnv() === "local" && dbup;
4868
- await this.syncApplication(app);
4858
+ if (sync)
4859
+ await this.syncApplication(app);
4869
4860
  if (needDbup)
4870
4861
  await this.dbup(app.workspace);
4871
4862
  const [backend, frontend, { server: csrServer, eventEmitter: csr }] = await Promise.all([
4872
4863
  this.startBackend(app, { open: open2, withInk: true, sync: false }),
4873
4864
  this.startFrontend(app, { open: open2, withInk: true, sync: false }),
4874
- this.startCsr(app, { open: open2, withInk: true })
4865
+ this.startCsr(app, { open: open2, withInk: true, sync: false })
4875
4866
  ]);
4876
4867
  process.on("SIGINT", async () => {
4877
4868
  await csrServer.close();
@@ -5056,8 +5047,8 @@ var ApplicationCommand = class {
5056
5047
  async removeApplication(app) {
5057
5048
  await this.applicationScript.removeApplication(app);
5058
5049
  }
5059
- async syncApplication(app) {
5060
- await this.applicationScript.syncApplication(app);
5050
+ async sync(sys3) {
5051
+ await this.applicationScript.sync(sys3);
5061
5052
  }
5062
5053
  async script(app, filename) {
5063
5054
  await this.applicationScript.script(app, filename);
@@ -5080,23 +5071,23 @@ var ApplicationCommand = class {
5080
5071
  async buildAndroid(app) {
5081
5072
  await this.applicationScript.buildAndroid(app);
5082
5073
  }
5083
- async start(app, open2) {
5084
- await this.applicationScript.start(app, { open: open2 });
5074
+ async start(app, open2, sync) {
5075
+ await this.applicationScript.start(app, { open: open2, sync });
5085
5076
  }
5086
- async startBackend(app, open2) {
5087
- await this.applicationScript.startBackend(app, { open: open2 });
5077
+ async startBackend(app, open2, sync) {
5078
+ await this.applicationScript.startBackend(app, { open: open2, sync });
5088
5079
  }
5089
- async startFrontend(app, open2, turbo) {
5090
- await this.applicationScript.startFrontend(app, { open: open2, turbo });
5080
+ async startFrontend(app, open2, turbo, sync) {
5081
+ await this.applicationScript.startFrontend(app, { open: open2, turbo, sync });
5091
5082
  }
5092
- async startCsr(app, open2) {
5093
- await this.applicationScript.startCsr(app, { open: open2 });
5083
+ async startCsr(app, open2, sync) {
5084
+ await this.applicationScript.startCsr(app, { open: open2, sync });
5094
5085
  }
5095
- async startIos(app, open2, release) {
5096
- await this.applicationScript.startIos(app, { open: open2, operation: release ? "release" : "local" });
5086
+ async startIos(app, open2, release, sync) {
5087
+ await this.applicationScript.startIos(app, { open: open2, operation: release ? "release" : "local", sync });
5097
5088
  }
5098
- async startAndroid(app, open2, release) {
5099
- await this.applicationScript.startAndroid(app, { open: open2, operation: release ? "release" : "local" });
5089
+ async startAndroid(app, open2, release, sync) {
5090
+ await this.applicationScript.startAndroid(app, { open: open2, operation: release ? "release" : "local", sync });
5100
5091
  }
5101
5092
  async releaseIos(app) {
5102
5093
  await this.applicationScript.releaseIos(app);
@@ -5141,8 +5132,8 @@ __decorateClass([
5141
5132
  ], ApplicationCommand.prototype, "removeApplication", 1);
5142
5133
  __decorateClass([
5143
5134
  Target.Public(),
5144
- __decorateParam(0, App())
5145
- ], ApplicationCommand.prototype, "syncApplication", 1);
5135
+ __decorateParam(0, Sys())
5136
+ ], ApplicationCommand.prototype, "sync", 1);
5146
5137
  __decorateClass([
5147
5138
  Target.Public(),
5148
5139
  __decorateParam(0, App()),
@@ -5175,35 +5166,41 @@ __decorateClass([
5175
5166
  __decorateClass([
5176
5167
  Target.Public({ short: true }),
5177
5168
  __decorateParam(0, App()),
5178
- __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser?", default: false }))
5169
+ __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser?", default: false })),
5170
+ __decorateParam(2, Option("sync", { type: "boolean", desc: "sync application", default: true }))
5179
5171
  ], ApplicationCommand.prototype, "start", 1);
5180
5172
  __decorateClass([
5181
5173
  Target.Public({ short: true }),
5182
5174
  __decorateParam(0, App()),
5183
- __decorateParam(1, Option("open", { type: "boolean", desc: "open graphql playground", default: false }))
5175
+ __decorateParam(1, Option("open", { type: "boolean", desc: "open graphql playground", default: false })),
5176
+ __decorateParam(2, Option("sync", { type: "boolean", desc: "sync application", default: true }))
5184
5177
  ], ApplicationCommand.prototype, "startBackend", 1);
5185
5178
  __decorateClass([
5186
5179
  Target.Public({ short: true }),
5187
5180
  __decorateParam(0, App()),
5188
5181
  __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false })),
5189
- __decorateParam(2, Option("turbo", { type: "boolean", desc: "turbo", default: false }))
5182
+ __decorateParam(2, Option("turbo", { type: "boolean", desc: "turbo", default: false })),
5183
+ __decorateParam(3, Option("sync", { type: "boolean", desc: "sync application", default: true }))
5190
5184
  ], ApplicationCommand.prototype, "startFrontend", 1);
5191
5185
  __decorateClass([
5192
5186
  Target.Public({ short: true }),
5193
5187
  __decorateParam(0, App()),
5194
- __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false }))
5188
+ __decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false })),
5189
+ __decorateParam(2, Option("sync", { type: "boolean", desc: "sync application", default: true }))
5195
5190
  ], ApplicationCommand.prototype, "startCsr", 1);
5196
5191
  __decorateClass([
5197
5192
  Target.Public({ short: true }),
5198
5193
  __decorateParam(0, App()),
5199
5194
  __decorateParam(1, Option("open", { type: "boolean", desc: "open ios simulator", default: false })),
5200
- __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
5195
+ __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false })),
5196
+ __decorateParam(3, Option("sync", { type: "boolean", desc: "sync application", default: true }))
5201
5197
  ], ApplicationCommand.prototype, "startIos", 1);
5202
5198
  __decorateClass([
5203
5199
  Target.Public({ short: true }),
5204
5200
  __decorateParam(0, App()),
5205
5201
  __decorateParam(1, Option("open", { type: "boolean", desc: "open android simulator", default: false })),
5206
- __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
5202
+ __decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false })),
5203
+ __decorateParam(3, Option("sync", { type: "boolean", desc: "sync application", default: true }))
5207
5204
  ], ApplicationCommand.prototype, "startAndroid", 1);
5208
5205
  __decorateClass([
5209
5206
  Target.Public(),
@@ -6409,6 +6406,13 @@ var WorkspaceScript = class {
6409
6406
  ...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.#runner.lint(PkgExecutor.from(workspace, pkgName), workspace, { fix }))
6410
6407
  ]);
6411
6408
  }
6409
+ async syncAll(workspace) {
6410
+ const [appNames, libNames] = await workspace.getExecs();
6411
+ for (const libName of libNames)
6412
+ await this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName));
6413
+ for (const appName of appNames)
6414
+ await this.applicationScript.syncApplication(AppExecutor.from(workspace, appName));
6415
+ }
6412
6416
  };
6413
6417
 
6414
6418
  // pkgs/@akanjs/cli/src/workspace/workspace.command.ts
@@ -6430,6 +6434,9 @@ var WorkspaceCommand = class {
6430
6434
  async lintAll(fix, workspace) {
6431
6435
  await this.workspaceScript.lintAll(workspace, { fix });
6432
6436
  }
6437
+ async syncAll(workspace) {
6438
+ await this.workspaceScript.syncAll(workspace);
6439
+ }
6433
6440
  };
6434
6441
  __decorateClass([
6435
6442
  Target.Public(),
@@ -6452,6 +6459,10 @@ __decorateClass([
6452
6459
  __decorateParam(0, Option("fix", { type: "boolean", default: true })),
6453
6460
  __decorateParam(1, Workspace())
6454
6461
  ], WorkspaceCommand.prototype, "lintAll", 1);
6462
+ __decorateClass([
6463
+ Target.Public(),
6464
+ __decorateParam(0, Workspace())
6465
+ ], WorkspaceCommand.prototype, "syncAll", 1);
6455
6466
  WorkspaceCommand = __decorateClass([
6456
6467
  Commands()
6457
6468
  ], WorkspaceCommand);
@@ -95,7 +95,7 @@ Key features:
95
95
  interface PriceProps {
96
96
  // Similar to Text but specialized for prices
97
97
  maxlength?: number; // Default: 80
98
- placeholder?: string; // Default: "~ \${l('shared.priceUnit')}"
98
+ placeholder?: string; // Default: "~ \${l('base.priceUnit')}"
99
99
  }
100
100
  \`\`\`
101
101
  Key features:
@@ -47,7 +47,7 @@ export const UserRole = enumOf(["user", "admin"] as const);
47
47
  export type UserRole = enumOf<typeof UserRole>;
48
48
 
49
49
  // Define input model (for create/update operations)
50
- @Model.Input("UserInput")
50
+
51
51
  export class UserInput {
52
52
  @Field.Prop(() => String, { validate: validate.email, type: "email", example: "user@example.com" })
53
53
  email: string;
@@ -57,7 +57,7 @@ export class UserInput {
57
57
  }
58
58
 
59
59
  // Define object model (full data model)
60
- @Model.Object("UserObject")
60
+
61
61
  export class UserObject extends via(UserInput) {
62
62
  @Field.Prop(() => [String], [{ enum: UserRole, example: ["user"] }])
63
63
  roles: (typeof UserRole.value)[];
@@ -67,7 +67,7 @@ export class UserObject extends via(UserInput) {
67
67
  }
68
68
 
69
69
  // Define light model (client-side model with essential fields)
70
- @Model.Light("LightUser")
70
+
71
71
  export class LightUser extends via(UserObject, ["email", "roles"] as const) {
72
72
  hasAccess(role: UserRole) {
73
73
  return this.roles.includes(role);
@@ -75,11 +75,11 @@ export class LightUser extends via(UserObject, ["email", "roles"] as const) {
75
75
  }
76
76
 
77
77
  // Define full model (server-side model with all fields)
78
- @Model.Full("User")
78
+
79
79
  export class User extends via(UserObject, LightUser) {}
80
80
 
81
81
  // Define filter model (for queries)
82
- @Model.Filter("UserFilter")
82
+
83
83
  export class UserFilter extends sortOf(User, {}) {
84
84
  @Filter.Mongo()
85
85
  byEmail(@Filter.Arg("email", () => String) email: string) {
@@ -99,12 +99,8 @@ import { hashPassword } from "@shared/nest";
99
99
 
100
100
  import * as cnst from "../cnst";
101
101
 
102
- // Input model for database operations
103
- @Database.Input(() => cnst.UserInput)
104
- export class UserInput extends by(cnst.UserInput) {}
105
-
106
102
  // Document model with methods
107
- @Database.Document(() => cnst.User)
103
+
108
104
  export class User extends by(cnst.User) {
109
105
  addRole(role: cnst.UserRole) {
110
106
  if (!this.roles.includes(role)) this.roles = [...this.roles, role];
@@ -118,7 +114,7 @@ export class User extends by(cnst.User) {
118
114
  }
119
115
 
120
116
  // Model with database operations
121
- @Database.Model(() => cnst.User)
117
+
122
118
  export class UserModel extends into(User, cnst.userCnst, ...user.models) {
123
119
  @Loader.ByField("email") userEmailLoader: Loader<string, User>;
124
120
 
@@ -132,7 +128,7 @@ export class UserModel extends into(User, cnst.userCnst, ...user.models) {
132
128
  }
133
129
 
134
130
  // Middleware for hooks and indexes
135
- @Database.Middleware(() => cnst.User)
131
+
136
132
  export class UserMiddleware extends beyond(UserModel, User) {
137
133
  onSchema(schema: SchemaOf<UserModel, User>) {
138
134
  // Hash password before saving
@@ -158,7 +154,7 @@ export class UserMiddleware extends beyond(UserModel, User) {
158
154
  Implement business logic in the service:
159
155
 
160
156
  ```typescript
161
- import { DbService, Service, Srv, Use } from "@akanjs/service";
157
+ import { DbService, Srv, Use } from "@akanjs/service";
162
158
  import { Account, type Me } from "@akanjs/signal";
163
159
  import { isPasswordMatch } from "@shared/nest";
164
160
 
@@ -167,7 +163,6 @@ import * as db from "../db";
167
163
  import type * as option from "../option";
168
164
  import type * as srv from "../srv";
169
165
 
170
- @Service("UserService")
171
166
  export class UserService extends DbService(db.userDb) {
172
167
  @Use() protected readonly config: option.SecurityConfig;
173
168
  @Srv() protected readonly securityService: srv.util.SecurityService;
@@ -211,7 +206,6 @@ import { Account, Arg, DbSignal, Me, Mutation, Query, resolve, Signal } from "@a
211
206
  import * as cnst from "../cnst";
212
207
  import type * as db from "../db";
213
208
 
214
- @Signal(() => cnst.User)
215
209
  export class UserSignal extends DbSignal(cnst.userCnst, cnst.Srvs, {
216
210
  guards: { get: Query.Public, cru: Mutation.Admin },
217
211
  }) {
@@ -584,36 +578,30 @@ export const Layout = () => (
584
578
  ## Best Practices
585
579
 
586
580
  1. **Naming Conventions**
587
-
588
581
  - Use PascalCase for classes and components (e.g., `UserService`, `User.Unit.tsx`)
589
582
  - Use camelCase for files (e.g., `user.service.ts`, `user.document.ts`)
590
583
 
591
584
  2. **Security**
592
-
593
585
  - Use `@Field.Secret` for sensitive data like passwords
594
586
  - Apply proper permission guards to queries and mutations (`@Query.Admin`, `@Mutation.Public`)
595
587
  - Validate input data using the `validate` option in `@Field.Prop`
596
588
 
597
589
  3. **Code Organization**
598
-
599
590
  - Keep business logic in service files
600
591
  - Use signals for API calls only, not for business logic
601
592
  - Define reusable utility methods in document models
602
593
 
603
594
  4. **Performance**
604
-
605
595
  - Use dataloader pattern (`@Loader.ByField`) for efficient database access
606
596
  - Create proper indexes in the middleware
607
597
  - Use projections to limit returned fields when appropriate
608
598
 
609
599
  5. **Testing**
610
-
611
600
  - Create signal tests for each API endpoint
612
601
  - Mock services for unit testing signals
613
602
  - Use integration tests for testing complex workflows
614
603
 
615
604
  6. **UI Components**
616
-
617
605
  - Follow the separation between Template, Unit, View, and Zone components
618
606
  - Make components reusable across different parts of the application
619
607
  - Use dictionary files for all UI text to support internationalization
@@ -348,7 +348,6 @@ code: string;
348
348
  ### Input Models
349
349
 
350
350
  ```typescript
351
- @Model.Input("ProductInput")
352
351
  export class ProductInput {
353
352
  @Field.Prop(() => String)
354
353
  name: string;
@@ -361,7 +360,6 @@ export class ProductInput {
361
360
  ### Object Models
362
361
 
363
362
  ```typescript
364
- @Model.Object("ProductObject")
365
363
  export class ProductObject extends via(ProductInput) {
366
364
  @Field.Prop(() => Date, { default: dayjs() })
367
365
  createdAt: Dayjs;
@@ -371,21 +369,18 @@ export class ProductObject extends via(ProductInput) {
371
369
  ### Light Models
372
370
 
373
371
  ```typescript
374
- @Model.Light("LightProduct")
375
372
  export class LightProduct extends via(ProductObject, ["name", "price", "status"] as const) {}
376
373
  ```
377
374
 
378
375
  ### Full Models
379
376
 
380
377
  ```typescript
381
- @Model.Full("Product")
382
378
  export class Product extends via(ProductObject, LightProduct) {}
383
379
  ```
384
380
 
385
381
  ### Scalar Models
386
382
 
387
383
  ```typescript
388
- @Model.Scalar("Address")
389
384
  export class Address {
390
385
  @Field.Prop(() => String)
391
386
  street: string;
@@ -203,12 +203,10 @@ import { Project } from "./project.constant";
203
203
  import { projectService } from "./project.service";
204
204
 
205
205
  export class ProjectSignal {
206
- @Signal()
207
206
  async projectList() {
208
207
  return projectService.getProjects();
209
208
  }
210
209
 
211
- @Signal()
212
210
  async createProject(data: Partial<Project>) {
213
211
  return projectService.createProject(data);
214
212
  }
@@ -229,7 +227,11 @@ export const ProjectView = () => {
229
227
  return (
230
228
  <div>
231
229
  <h1>{l("project.modelName")}</h1>
232
- <div className="grid gap-4">{data?.map((project) => <ProjectUnit key={project.id} project={project} />)}</div>
230
+ <div className="grid gap-4">
231
+ {data?.map((project) => (
232
+ <ProjectUnit key={project.id} project={project} />
233
+ ))}
234
+ </div>
233
235
  </div>
234
236
  );
235
237
  };
@@ -322,22 +324,18 @@ import { Task, TaskFilter } from "./task.constant";
322
324
  import { taskService } from "./task.service";
323
325
 
324
326
  export class TaskSignal {
325
- @Signal()
326
327
  async taskList(query: TaskFilter, skip = 0, limit = 20) {
327
328
  return taskService.getTasks(query);
328
329
  }
329
330
 
330
- @Signal()
331
331
  async task(taskId: string) {
332
332
  return taskService.getTask(taskId);
333
333
  }
334
334
 
335
- @Signal()
336
335
  async createTask(data: Partial<Task>) {
337
336
  return taskService.createTask(data);
338
337
  }
339
338
 
340
- @Signal()
341
339
  async updateTaskStatus(taskId: string, status: Task["status"]) {
342
340
  return taskService.updateTaskStatus(taskId, status);
343
341
  }
@@ -581,22 +579,18 @@ import { Product, ProductFilter } from "./product.constant";
581
579
  import { productService } from "./product.service";
582
580
 
583
581
  export class ProductSignal {
584
- @Signal()
585
582
  async productList(query: ProductFilter, skip = 0, limit = 20) {
586
583
  return productService.getProducts(query, skip, limit);
587
584
  }
588
585
 
589
- @Signal()
590
586
  async product(productId: string) {
591
587
  return productService.getProduct(productId);
592
588
  }
593
589
 
594
- @Signal()
595
590
  async createProduct(data: Partial<Product>) {
596
591
  return productService.createProduct(data);
597
592
  }
598
593
 
599
- @Signal()
600
594
  async updateProduct(productId: string, data: Partial<Product>) {
601
595
  return productService.updateProduct(productId, data);
602
596
  }
@@ -625,7 +619,11 @@ export const ProductList = () => {
625
619
  ) : error ? (
626
620
  <div>Error: {error.message}</div>
627
621
  ) : (
628
- <ul>{products?.map((product) => <li key={product.id}>{product.name}</li>)}</ul>
622
+ <ul>
623
+ {products?.map((product) => (
624
+ <li key={product.id}>{product.name}</li>
625
+ ))}
626
+ </ul>
629
627
  )}
630
628
 
631
629
  <button onClick={() => createProduct({ name: "New Product" })} disabled={isCreating}>
@@ -63,13 +63,6 @@
63
63
  "filterText": "enumOf",
64
64
  "sample": 3
65
65
  },
66
- {
67
- "type": "example",
68
- "description": "Models with custom Filter methods",
69
- "path": "{apps,libs}/*/lib/*/*.constant.ts",
70
- "filterText": "@Filter.Mongo",
71
- "sample": 2
72
- },
73
66
  {
74
67
  "type": "example",
75
68
  "description": "Models with reference fields",