@akanjs/cli 0.0.118 → 0.0.120

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 (181) hide show
  1. package/cjs/index.js +45 -1
  2. package/cjs/src/templates/libRoot/akan.config.js +36 -0
  3. package/cjs/src/templates/libRoot/base/baseLogic.js +35 -0
  4. package/cjs/src/templates/libRoot/base/index.js +29 -0
  5. package/cjs/src/templates/libRoot/common/commonLogic.js +35 -0
  6. package/cjs/src/templates/libRoot/common/index.js +29 -0
  7. package/cjs/src/templates/libRoot/jest.config.js +1 -1
  8. package/cjs/src/templates/libRoot/lib/___libName__/__libName__.dictionary.js +31 -0
  9. package/cjs/src/templates/libRoot/lib/___libName__/__libName__.service.js +42 -0
  10. package/cjs/src/templates/libRoot/lib/___libName__/__libName__.store.js +36 -0
  11. package/cjs/src/templates/libRoot/lib/___libName__/_server.js +34 -0
  12. package/cjs/src/templates/libRoot/lib/option.js +42 -0
  13. package/cjs/src/templates/libRoot/lib/setting/Setting.Template.js +57 -0
  14. package/cjs/src/templates/libRoot/lib/setting/Setting.Unit.js +38 -0
  15. package/cjs/src/templates/libRoot/lib/setting/Setting.Util.js +34 -0
  16. package/cjs/src/templates/libRoot/lib/setting/Setting.View.js +51 -0
  17. package/cjs/src/templates/libRoot/lib/setting/Setting.Zone.js +80 -0
  18. package/cjs/src/templates/libRoot/lib/setting/_server.js +48 -0
  19. package/cjs/src/templates/libRoot/lib/setting/index.js +61 -0
  20. package/cjs/src/templates/libRoot/lib/setting/setting.constant.js +46 -0
  21. package/cjs/src/templates/libRoot/lib/setting/setting.dictionary.js +46 -0
  22. package/cjs/src/templates/libRoot/lib/setting/setting.document.js +48 -0
  23. package/cjs/src/templates/libRoot/lib/setting/setting.service.js +37 -0
  24. package/cjs/src/templates/libRoot/lib/setting/setting.signal.js +34 -0
  25. package/cjs/src/templates/libRoot/lib/setting/setting.store.js +41 -0
  26. package/cjs/src/templates/libRoot/lib/summary/Summary.Template.js +43 -0
  27. package/cjs/src/templates/libRoot/lib/summary/Summary.Unit.js +38 -0
  28. package/cjs/src/templates/libRoot/lib/summary/Summary.Util.js +33 -0
  29. package/cjs/src/templates/libRoot/lib/summary/Summary.View.js +51 -0
  30. package/cjs/src/templates/libRoot/lib/summary/Summary.Zone.js +62 -0
  31. package/cjs/src/templates/libRoot/lib/summary/_server.js +48 -0
  32. package/cjs/src/templates/libRoot/lib/summary/index.js +67 -0
  33. package/cjs/src/templates/libRoot/lib/summary/summary.constant.js +44 -0
  34. package/cjs/src/templates/libRoot/lib/summary/summary.dictionary.js +49 -0
  35. package/cjs/src/templates/libRoot/lib/summary/summary.document.js +48 -0
  36. package/cjs/src/templates/libRoot/lib/summary/summary.service.js +34 -0
  37. package/cjs/src/templates/libRoot/lib/summary/summary.signal.js +34 -0
  38. package/cjs/src/templates/libRoot/lib/summary/summary.store.js +41 -0
  39. package/cjs/src/templates/libRoot/lib/user/User.Template.js +65 -0
  40. package/cjs/src/templates/libRoot/lib/user/User.Unit.js +38 -0
  41. package/cjs/src/templates/libRoot/lib/user/User.Util.js +94 -0
  42. package/cjs/src/templates/libRoot/lib/user/User.View.js +66 -0
  43. package/cjs/src/templates/libRoot/lib/user/User.Zone.js +74 -0
  44. package/cjs/src/templates/libRoot/lib/user/_server.js +48 -0
  45. package/cjs/src/templates/libRoot/lib/user/index.js +61 -0
  46. package/cjs/src/templates/libRoot/lib/user/user.constant.js +67 -0
  47. package/cjs/src/templates/libRoot/lib/user/user.dictionary.js +52 -0
  48. package/cjs/src/templates/libRoot/lib/user/user.document.js +54 -0
  49. package/cjs/src/templates/libRoot/lib/user/user.service.js +42 -0
  50. package/cjs/src/templates/libRoot/lib/user/user.signal.js +34 -0
  51. package/cjs/src/templates/libRoot/lib/user/user.signal.spec.js +37 -0
  52. package/cjs/src/templates/libRoot/lib/user/user.signal.test.js +39 -0
  53. package/cjs/src/templates/libRoot/lib/user/user.store.js +39 -0
  54. package/cjs/src/templates/libRoot/nest/backendLogic.js +34 -0
  55. package/cjs/src/templates/libRoot/nest/index.js +29 -0
  56. package/cjs/src/templates/libRoot/next/frontendLogic.js +34 -0
  57. package/cjs/src/templates/libRoot/next/index.js +29 -0
  58. package/cjs/src/templates/libRoot/ui/index.js +29 -0
  59. package/esm/index.js +45 -1
  60. package/esm/src/templates/libRoot/akan.config.js +16 -0
  61. package/esm/src/templates/libRoot/base/baseLogic.js +15 -0
  62. package/esm/src/templates/libRoot/base/index.js +9 -0
  63. package/esm/src/templates/libRoot/common/commonLogic.js +15 -0
  64. package/esm/src/templates/libRoot/common/index.js +9 -0
  65. package/esm/src/templates/libRoot/jest.config.js +1 -1
  66. package/esm/src/templates/libRoot/lib/___libName__/__libName__.dictionary.js +11 -0
  67. package/esm/src/templates/libRoot/lib/___libName__/__libName__.service.js +22 -0
  68. package/esm/src/templates/libRoot/lib/___libName__/__libName__.store.js +16 -0
  69. package/esm/src/templates/libRoot/lib/___libName__/_server.js +14 -0
  70. package/esm/src/templates/libRoot/lib/option.js +22 -0
  71. package/esm/src/templates/libRoot/lib/setting/Setting.Template.js +37 -0
  72. package/esm/src/templates/libRoot/lib/setting/Setting.Unit.js +18 -0
  73. package/esm/src/templates/libRoot/lib/setting/Setting.Util.js +14 -0
  74. package/esm/src/templates/libRoot/lib/setting/Setting.View.js +31 -0
  75. package/esm/src/templates/libRoot/lib/setting/Setting.Zone.js +60 -0
  76. package/esm/src/templates/libRoot/lib/setting/_server.js +28 -0
  77. package/esm/src/templates/libRoot/lib/setting/index.js +41 -0
  78. package/esm/src/templates/libRoot/lib/setting/setting.constant.js +26 -0
  79. package/esm/src/templates/libRoot/lib/setting/setting.dictionary.js +26 -0
  80. package/esm/src/templates/libRoot/lib/setting/setting.document.js +28 -0
  81. package/esm/src/templates/libRoot/lib/setting/setting.service.js +17 -0
  82. package/esm/src/templates/libRoot/lib/setting/setting.signal.js +14 -0
  83. package/esm/src/templates/libRoot/lib/setting/setting.store.js +21 -0
  84. package/esm/src/templates/libRoot/lib/summary/Summary.Template.js +23 -0
  85. package/esm/src/templates/libRoot/lib/summary/Summary.Unit.js +18 -0
  86. package/esm/src/templates/libRoot/lib/summary/Summary.Util.js +13 -0
  87. package/esm/src/templates/libRoot/lib/summary/Summary.View.js +31 -0
  88. package/esm/src/templates/libRoot/lib/summary/Summary.Zone.js +42 -0
  89. package/esm/src/templates/libRoot/lib/summary/_server.js +28 -0
  90. package/esm/src/templates/libRoot/lib/summary/index.js +47 -0
  91. package/esm/src/templates/libRoot/lib/summary/summary.constant.js +24 -0
  92. package/esm/src/templates/libRoot/lib/summary/summary.dictionary.js +29 -0
  93. package/esm/src/templates/libRoot/lib/summary/summary.document.js +28 -0
  94. package/esm/src/templates/libRoot/lib/summary/summary.service.js +14 -0
  95. package/esm/src/templates/libRoot/lib/summary/summary.signal.js +14 -0
  96. package/esm/src/templates/libRoot/lib/summary/summary.store.js +21 -0
  97. package/esm/src/templates/libRoot/lib/user/User.Template.js +45 -0
  98. package/esm/src/templates/libRoot/lib/user/User.Unit.js +18 -0
  99. package/esm/src/templates/libRoot/lib/user/User.Util.js +74 -0
  100. package/esm/src/templates/libRoot/lib/user/User.View.js +46 -0
  101. package/esm/src/templates/libRoot/lib/user/User.Zone.js +54 -0
  102. package/esm/src/templates/libRoot/lib/user/_server.js +28 -0
  103. package/esm/src/templates/libRoot/lib/user/index.js +41 -0
  104. package/esm/src/templates/libRoot/lib/user/user.constant.js +47 -0
  105. package/esm/src/templates/libRoot/lib/user/user.dictionary.js +32 -0
  106. package/esm/src/templates/libRoot/lib/user/user.document.js +34 -0
  107. package/esm/src/templates/libRoot/lib/user/user.service.js +22 -0
  108. package/esm/src/templates/libRoot/lib/user/user.signal.js +14 -0
  109. package/esm/src/templates/libRoot/lib/user/user.signal.spec.js +17 -0
  110. package/esm/src/templates/libRoot/lib/user/user.signal.test.js +19 -0
  111. package/esm/src/templates/libRoot/lib/user/user.store.js +19 -0
  112. package/esm/src/templates/libRoot/nest/backendLogic.js +14 -0
  113. package/esm/src/templates/libRoot/nest/index.js +9 -0
  114. package/esm/src/templates/libRoot/next/frontendLogic.js +14 -0
  115. package/esm/src/templates/libRoot/next/index.js +9 -0
  116. package/esm/src/templates/libRoot/ui/index.js +9 -0
  117. package/package.json +1 -1
  118. package/src/cloud/cloud.command.d.ts +1 -0
  119. package/src/cloud/cloud.runner.d.ts +1 -0
  120. package/src/cloud/cloud.script.d.ts +1 -0
  121. package/src/library/library.runner.d.ts +1 -1
  122. package/src/templates/libRoot/akan.config.d.ts +5 -0
  123. package/src/templates/libRoot/base/baseLogic.d.ts +5 -0
  124. package/src/templates/libRoot/base/index.d.ts +5 -0
  125. package/src/templates/libRoot/common/commonLogic.d.ts +5 -0
  126. package/src/templates/libRoot/common/index.d.ts +5 -0
  127. package/src/templates/libRoot/env/env.server.example.ts.template +7 -0
  128. package/src/templates/libRoot/env/env.server.testing.ts.template +7 -0
  129. package/src/templates/libRoot/jest.config.d.ts +1 -1
  130. package/src/templates/libRoot/lib/___libName__/__libName__.dictionary.d.ts +6 -0
  131. package/src/templates/libRoot/lib/___libName__/__libName__.service.d.ts +6 -0
  132. package/src/templates/libRoot/lib/___libName__/__libName__.store.d.ts +6 -0
  133. package/src/templates/libRoot/lib/___libName__/_server.d.ts +7 -0
  134. package/src/templates/libRoot/lib/option.d.ts +6 -0
  135. package/src/templates/libRoot/lib/setting/Setting.Template.d.ts +9 -0
  136. package/src/templates/libRoot/lib/setting/Setting.Unit.d.ts +9 -0
  137. package/src/templates/libRoot/lib/setting/Setting.Util.d.ts +9 -0
  138. package/src/templates/libRoot/lib/setting/Setting.View.d.ts +9 -0
  139. package/src/templates/libRoot/lib/setting/Setting.Zone.d.ts +9 -0
  140. package/src/templates/libRoot/lib/setting/_server.d.ts +6 -0
  141. package/src/templates/libRoot/lib/setting/index.d.ts +9 -0
  142. package/src/templates/libRoot/lib/setting/setting.constant.d.ts +7 -0
  143. package/src/templates/libRoot/lib/setting/setting.dictionary.d.ts +7 -0
  144. package/src/templates/libRoot/lib/setting/setting.document.d.ts +6 -0
  145. package/src/templates/libRoot/lib/setting/setting.service.d.ts +7 -0
  146. package/src/templates/libRoot/lib/setting/setting.signal.d.ts +6 -0
  147. package/src/templates/libRoot/lib/setting/setting.store.d.ts +6 -0
  148. package/src/templates/libRoot/lib/summary/Summary.Template.d.ts +9 -0
  149. package/src/templates/libRoot/lib/summary/Summary.Unit.d.ts +9 -0
  150. package/src/templates/libRoot/lib/summary/Summary.Util.d.ts +9 -0
  151. package/src/templates/libRoot/lib/summary/Summary.View.d.ts +9 -0
  152. package/src/templates/libRoot/lib/summary/Summary.Zone.d.ts +9 -0
  153. package/src/templates/libRoot/lib/summary/_server.d.ts +6 -0
  154. package/src/templates/libRoot/lib/summary/index.d.ts +9 -0
  155. package/src/templates/libRoot/lib/summary/summary.constant.d.ts +7 -0
  156. package/src/templates/libRoot/lib/summary/summary.dictionary.d.ts +7 -0
  157. package/src/templates/libRoot/lib/summary/summary.document.d.ts +6 -0
  158. package/src/templates/libRoot/lib/summary/summary.service.d.ts +7 -0
  159. package/src/templates/libRoot/lib/summary/summary.signal.d.ts +6 -0
  160. package/src/templates/libRoot/lib/summary/summary.store.d.ts +6 -0
  161. package/src/templates/libRoot/lib/user/User.Template.d.ts +9 -0
  162. package/src/templates/libRoot/lib/user/User.Unit.d.ts +9 -0
  163. package/src/templates/libRoot/lib/user/User.Util.d.ts +9 -0
  164. package/src/templates/libRoot/lib/user/User.View.d.ts +9 -0
  165. package/src/templates/libRoot/lib/user/User.Zone.d.ts +9 -0
  166. package/src/templates/libRoot/lib/user/_server.d.ts +6 -0
  167. package/src/templates/libRoot/lib/user/index.d.ts +9 -0
  168. package/src/templates/libRoot/lib/user/user.constant.d.ts +7 -0
  169. package/src/templates/libRoot/lib/user/user.dictionary.d.ts +7 -0
  170. package/src/templates/libRoot/lib/user/user.document.d.ts +7 -0
  171. package/src/templates/libRoot/lib/user/user.service.d.ts +7 -0
  172. package/src/templates/libRoot/lib/user/user.signal.d.ts +6 -0
  173. package/src/templates/libRoot/lib/user/user.signal.spec.d.ts +6 -0
  174. package/src/templates/libRoot/lib/user/user.signal.test.d.ts +6 -0
  175. package/src/templates/libRoot/lib/user/user.store.d.ts +6 -0
  176. package/src/templates/libRoot/nest/backendLogic.d.ts +5 -0
  177. package/src/templates/libRoot/nest/index.d.ts +5 -0
  178. package/src/templates/libRoot/next/frontendLogic.d.ts +5 -0
  179. package/src/templates/libRoot/next/index.d.ts +5 -0
  180. package/src/templates/libRoot/package.json.template +2 -3
  181. package/src/templates/libRoot/ui/index.d.ts +5 -0
@@ -0,0 +1,14 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/setting/setting.signal.ts
2
+ function getContent(scanResult, dict = {}) {
3
+ return `
4
+ import { LogSignal, Signal } from "@akanjs/signal";
5
+
6
+ import { cnst, Srvs } from "../cnst";
7
+
8
+ @Signal(() => cnst.Setting)
9
+ export class SettingSignal extends LogSignal(Srvs) {}
10
+ `;
11
+ }
12
+ export {
13
+ getContent as default
14
+ };
@@ -0,0 +1,21 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/setting/setting.store.ts
2
+ function getContent(scanResult, dict = {}) {
3
+ return `
4
+ import { stateOf, Store } from "@akanjs/store";
5
+
6
+ import { cnst } from "../cnst";
7
+ import { fetch, settingGql } from "../fetch";
8
+
9
+ @Store(() => cnst.Setting)
10
+ export class SettingStore extends stateOf(settingGql, {
11
+ // state
12
+ }) {
13
+ async getActiveSetting() {
14
+ this.set({ setting: (await fetch.getActiveSetting()) as cnst.Setting, settingLoading: false });
15
+ }
16
+ }
17
+ `;
18
+ }
19
+ export {
20
+ getContent as default
21
+ };
@@ -0,0 +1,23 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/Summary.Template.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "Summary.Template.tsx",
5
+ content: `
6
+ "use client";
7
+ import { st, usePage } from "@${dict.appName}/client";
8
+
9
+ interface SummaryEditProps {
10
+ summaryId?: string | null;
11
+ }
12
+
13
+ export const General = ({ summaryId = undefined }: SummaryEditProps) => {
14
+ const summaryForm = st.use.summaryForm();
15
+ const { l } = usePage();
16
+ return <div className="flex items-center mb-4"></div>;
17
+ };
18
+ `
19
+ };
20
+ }
21
+ export {
22
+ getContent as default
23
+ };
@@ -0,0 +1,18 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/Summary.Unit.tsx
2
+ function getContent(scanResult, dict = {}) {
3
+ return {
4
+ filename: "Summary.Unit.tsx",
5
+ content: `
6
+ import { ModelProps } from "@akanjs/client";
7
+
8
+ import { cnst } from "../cnst";
9
+
10
+ export const Card = ({ className, summary }: ModelProps<"summary", cnst.LightSummary>) => {
11
+ return <div>{summary.id}</div>;
12
+ };
13
+ `
14
+ };
15
+ }
16
+ export {
17
+ getContent as default
18
+ };
@@ -0,0 +1,13 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/Summary.Util.tsx
2
+ function getContent(scanResult, dict = {}) {
3
+ return {
4
+ filename: "Summary.Util.tsx",
5
+ content: `
6
+ "use client";
7
+ export const noData = 1;
8
+ `
9
+ };
10
+ }
11
+ export {
12
+ getContent as default
13
+ };
@@ -0,0 +1,31 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/Summary.View.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "Summary.View.tsx",
5
+ content: `
6
+ import { User, usePage } from "@${dict.libName}/client";
7
+ import { clsx } from "@akanjs/client";
8
+
9
+ import { cnst } from "../cnst";
10
+
11
+ interface SummaryViewProps {
12
+ className?: string;
13
+ summary: cnst.Summary;
14
+ }
15
+
16
+ export const General = ({ className, summary }: SummaryViewProps) => {
17
+ const { l } = usePage();
18
+ return (
19
+ <div className={clsx(className, "mr-12")}>
20
+ <div className="grid grid-cols-5 gap-4">
21
+ <User.Util.Stat className="col-span-2 " summary={summary} />
22
+ </div>
23
+ </div>
24
+ );
25
+ };
26
+ `
27
+ };
28
+ }
29
+ export {
30
+ getContent as default
31
+ };
@@ -0,0 +1,42 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/Summary.Zone.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "Summary.Zone.tsx",
5
+ content: `
6
+ "use client";
7
+ import { ModelsProps } from "@akanjs/client";
8
+ import { DefaultOf } from "@akanjs/signal";
9
+ import { st, Summary } from "@${dict.libName}/client";
10
+ import { Data } from "@shared/ui";
11
+ import { Loading } from "@util/ui";
12
+
13
+ import { cnst } from "../cnst";
14
+
15
+ export const Admin = ({ sliceName = "summary", init, query }: ModelsProps<cnst.Summary>) => {
16
+ return (
17
+ <Data.ListContainer
18
+ init={init}
19
+ query={query}
20
+ sliceName={sliceName}
21
+ renderItem={Summary.Unit.Card}
22
+ renderTemplate={Summary.Template.General}
23
+ renderTitle={(summary: DefaultOf<cnst.Summary>) => \`\${summary.at}\`}
24
+ renderView={(summary: cnst.Summary) => <Summary.View.General summary={summary} />}
25
+ type="list"
26
+ columns={["type", "status", "createdAt"]}
27
+ actions={(summary: cnst.LightSummary, idx) => ["remove", "edit"]}
28
+ />
29
+ );
30
+ };
31
+
32
+ export const Dashboard = () => {
33
+ const summary = st.use.summary();
34
+ if (!summary) return <Loading.Skeleton active />;
35
+ return <Summary.View.General summary={summary} />;
36
+ };
37
+ `
38
+ };
39
+ }
40
+ export {
41
+ getContent as default
42
+ };
@@ -0,0 +1,28 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/_server.ts
2
+ function getContent(scanResult, dict) {
3
+ return `
4
+ import { databaseModuleOf } from "@akanjs/server";
5
+
6
+ import { cnst } from "../cnst";
7
+ import * as db from "../db";
8
+ import type { ModulesOptions } from "../option";
9
+ import { allSrvs } from "../srv";
10
+ import { SummaryService } from "./summary.service";
11
+ import { SummarySignal } from "./summary.signal";
12
+
13
+ export const registerSummaryModule = (option: ModulesOptions) =>
14
+ databaseModuleOf(
15
+ {
16
+ constant: cnst.summaryCnst,
17
+ database: db.summaryDb,
18
+ signal: SummarySignal,
19
+ service: SummaryService,
20
+ extended: true,
21
+ },
22
+ allSrvs
23
+ );
24
+ `;
25
+ }
26
+ export {
27
+ getContent as default
28
+ };
@@ -0,0 +1,47 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/index.tsx
2
+ function getContent(scanResult, dict = {}) {
3
+ return {
4
+ filename: "index.tsx",
5
+ content: `
6
+ import { Signal } from "@util/ui";
7
+ import { AiOutlineLineChart } from "react-icons/ai";
8
+
9
+ import * as Template from "./Summary.Template";
10
+ import * as Unit from "./Summary.Unit";
11
+ import * as Util from "./Summary.Util";
12
+ import * as View from "./Summary.View";
13
+ import * as Zone from "./Summary.Zone";
14
+
15
+ export const Summary = {
16
+ Menu: {
17
+ Admin: {
18
+ key: "summary",
19
+ label: "Summary",
20
+ icon: <AiOutlineLineChart />,
21
+ render: () => <Zone.Admin />,
22
+ },
23
+ Doc: {
24
+ key: "summary",
25
+ label: "Summary",
26
+ icon: <AiOutlineLineChart />,
27
+ render: () => <Signal.Doc.Zone refName="summary" />,
28
+ },
29
+ Dashboard: {
30
+ key: "summary",
31
+ label: "Summary",
32
+ icon: <AiOutlineLineChart />,
33
+ render: () => <Zone.Dashboard />,
34
+ },
35
+ },
36
+ Template,
37
+ Unit,
38
+ Util,
39
+ View,
40
+ Zone,
41
+ };
42
+ `
43
+ };
44
+ }
45
+ export {
46
+ getContent as default
47
+ };
@@ -0,0 +1,24 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/summary.constant.ts
2
+ function getContent(scanResult, dict) {
3
+ return `
4
+ import { from, Model, over, via } from "@akanjs/constant";
5
+
6
+ import { modelSummaries } from "../__lib/extends/summary.constant";
7
+ import { libSummaries, root } from "../__lib/lib.constant";
8
+
9
+ @Model.Summary("${dict.LibName}Summary")
10
+ export class ${dict.LibName}Summary extends over(...modelSummaries) {}
11
+
12
+ export class SummaryObject extends from(...libSummaries, ${dict.LibName}Summary) {}
13
+ export class SummaryInput extends root.SummaryInput {}
14
+
15
+ @Model.Light("LightSummary")
16
+ export class LightSummary extends via(SummaryObject, ["at"] as const) {}
17
+
18
+ @Model.Full("Summary")
19
+ export class Summary extends via(SummaryObject, LightSummary, root.Summary, root.LightSummary) {}
20
+ `;
21
+ }
22
+ export {
23
+ getContent as default
24
+ };
@@ -0,0 +1,29 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/summary.dictionary.ts
2
+ function getContent(scanResult, dict) {
3
+ return `
4
+ import { ExtendModelDictionary, SignalDictionary } from "@akanjs/dictionary";
5
+
6
+ import { libSummaryDictionary } from "../__lib/lib.dictionary";
7
+ import type { ${dict.LibName}Summary } from "./summary.constant";
8
+ import type { SummarySignal } from "./summary.signal";
9
+
10
+ const modelDictionary = {
11
+ // * ==================== Model ==================== * //
12
+ ...libSummaryDictionary,
13
+ // * ==================== Model ==================== * //
14
+
15
+ // * ==================== Etc ==================== * //
16
+ // * ==================== Etc ==================== * //
17
+ } satisfies ExtendModelDictionary<${dict.LibName}Summary>;
18
+
19
+ const signalDictionary = {
20
+ // * ==================== Endpoint ==================== * //
21
+ // * ==================== Endpoint ==================== * //
22
+ } satisfies SignalDictionary<SummarySignal, ${dict.LibName}Summary>;
23
+
24
+ export const summaryDictionary = { ...modelDictionary, ...signalDictionary };
25
+ `;
26
+ }
27
+ export {
28
+ getContent as default
29
+ };
@@ -0,0 +1,28 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/summary.document.ts
2
+ function getContent(scanResult, dict = {}) {
3
+ return `
4
+ import { beyond, by, Database, inside, type SchemaOf } from "@akanjs/document";
5
+
6
+ import { rootSummary } from "../__lib/lib.document";
7
+ import { cnst } from "../cnst";
8
+
9
+ @Database.Input(() => cnst.SummaryInput)
10
+ export class SummaryInput extends by(rootSummary.Input, cnst.SummaryInput) {}
11
+
12
+ @Database.Document(() => cnst.Summary)
13
+ export class Summary extends by(rootSummary.Doc, cnst.Summary) {}
14
+
15
+ @Database.Model(() => cnst.Summary)
16
+ export class SummaryModel extends inside(rootSummary.Model, cnst.summaryCnst) {}
17
+
18
+ @Database.Middleware(() => cnst.Summary)
19
+ export class SummaryMiddleware extends beyond(SummaryModel, Summary) {
20
+ onSchema(schema: SchemaOf<SummaryModel, Summary>) {
21
+ //
22
+ }
23
+ }
24
+ `;
25
+ }
26
+ export {
27
+ getContent as default
28
+ };
@@ -0,0 +1,14 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/summary.service.ts
2
+ function getContent(scanResult, dict) {
3
+ return `
4
+ import { Service } from "@akanjs/service";
5
+
6
+ import { ProtoSummaryService } from "../__lib/lib.service";
7
+
8
+ @Service("SummaryService")
9
+ export class SummaryService extends ProtoSummaryService {}
10
+ `;
11
+ }
12
+ export {
13
+ getContent as default
14
+ };
@@ -0,0 +1,14 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/summary.signal.ts
2
+ function getContent(scanResult, dict = {}) {
3
+ return `
4
+ import { LogSignal, Signal } from "@akanjs/signal";
5
+
6
+ import { cnst, Srvs } from "../cnst";
7
+
8
+ @Signal(() => cnst.Summary)
9
+ export class SummarySignal extends LogSignal(Srvs) {}
10
+ `;
11
+ }
12
+ export {
13
+ getContent as default
14
+ };
@@ -0,0 +1,21 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/summary/summary.store.ts
2
+ function getContent(scanResult, dict = {}) {
3
+ return `
4
+ import { stateOf, Store } from "@akanjs/store";
5
+
6
+ import { cnst } from "../cnst";
7
+ import { fetch, summaryGql } from "../fetch";
8
+
9
+ @Store(() => cnst.Summary)
10
+ export class SummaryStore extends stateOf(summaryGql, {
11
+ // state
12
+ }) {
13
+ async getActiveSummary() {
14
+ this.set({ summary: (await fetch.getActiveSummary()) as cnst.Summary, summaryLoading: false });
15
+ }
16
+ }
17
+ `;
18
+ }
19
+ export {
20
+ getContent as default
21
+ };
@@ -0,0 +1,45 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/user/User.Template.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "User.Template.tsx",
5
+ content: `
6
+ "use client";
7
+ import { clsx } from "@akanjs/client";
8
+ import { Field } from "@shared/ui";
9
+ import { Layout } from "@util/ui";
10
+ import { st, usePage } from "@${dict.libName}/client";
11
+
12
+ interface UserEditProps {
13
+ className?: string;
14
+ userId?: string | null;
15
+ }
16
+
17
+ export const General = ({ className, userId = undefined }: UserEditProps) => {
18
+ const userForm = st.use.userForm();
19
+ const { l } = usePage();
20
+ return (
21
+ <Layout.Template className={clsx("flex flex-col gap-4", className)}>
22
+ <div className="w-[150px] flex mt-10 md:mt-0">
23
+ <Field.Img
24
+ label={l.field("user", "image")}
25
+ desc={l.desc("user", "image")}
26
+ sliceName="user"
27
+ value={userForm.image}
28
+ onChange={st.do.setImageOnUser}
29
+ />
30
+ </div>
31
+ <Field.Text
32
+ label={l.field("user", "nickname")}
33
+ desc={l.desc("user", "nickname")}
34
+ value={userForm.nickname}
35
+ onChange={st.do.setNicknameOnUser}
36
+ />
37
+ </Layout.Template>
38
+ );
39
+ };
40
+ `
41
+ };
42
+ }
43
+ export {
44
+ getContent as default
45
+ };
@@ -0,0 +1,18 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/user/User.Unit.tsx
2
+ function getContent(scanResult, dict = {}) {
3
+ return {
4
+ filename: "User.Unit.tsx",
5
+ content: `
6
+ import { ModelProps } from "@akanjs/client";
7
+
8
+ import { cnst } from "../cnst";
9
+
10
+ export const Card = ({ className, user }: ModelProps<"user", cnst.LightUser>) => {
11
+ return <div>{user.id}</div>;
12
+ };
13
+ `
14
+ };
15
+ }
16
+ export {
17
+ getContent as default
18
+ };
@@ -0,0 +1,74 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/user/User.Util.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "User.Util.tsx",
5
+ content: `
6
+ "use client";
7
+ import { ModelDashboardProps, ModelInsightProps } from "@akanjs/client";
8
+ import { getQueryMap } from "@akanjs/constant";
9
+ import { cnst, st } from "@${dict.libName}/client";
10
+ import { Data } from "@shared/ui";
11
+ import { AiOutlineEdit, AiOutlineLock, AiOutlineUnlock } from "react-icons/ai";
12
+
13
+ export const Stat = ({
14
+ className,
15
+ summary,
16
+ sliceName = "user",
17
+ queryMap = getQueryMap(cnst.UserSummary),
18
+ hidePresents,
19
+ }: ModelDashboardProps<cnst.Summary>) => {
20
+ return (
21
+ <Data.Dashboard
22
+ className={className}
23
+ summary={summary}
24
+ sliceName={sliceName}
25
+ queryMap={queryMap}
26
+ columns={["totalUser", "dau"]}
27
+ hidePresents={hidePresents}
28
+ />
29
+ );
30
+ };
31
+ export const Insight = ({ className, insight, sliceName = "user" }: ModelInsightProps<cnst.UserInsight>) => {
32
+ return <Data.Insight className={className} insight={insight} sliceName={sliceName} columns={["count"]} />;
33
+ };
34
+
35
+ interface RestrictProps {
36
+ id: string;
37
+ }
38
+ export const Restrict = ({ id }: RestrictProps) => {
39
+ return (
40
+ <button className="gap-2 btn btn-sm" onClick={() => st.do.restrictUser(id, "Violated Community Guidelines")}>
41
+ <AiOutlineLock />
42
+ Restrict
43
+ </button>
44
+ );
45
+ };
46
+
47
+ interface ReleaseProps {
48
+ id: string;
49
+ }
50
+ export const Release = ({ id }: ReleaseProps) => {
51
+ return (
52
+ <button className="gap-2 border-dashed btn btn-sm btn-outline" onClick={() => st.do.releaseUser(id)}>
53
+ <AiOutlineUnlock />
54
+ Release
55
+ </button>
56
+ );
57
+ };
58
+
59
+ export const EditSelf = () => {
60
+ const self = st.use.self();
61
+ const userModal = st.use.userModal();
62
+ return userModal !== "edit" ? (
63
+ <button className="gap-2 btn" onClick={() => st.do.editUser(self)}>
64
+ <AiOutlineEdit />
65
+ Edit
66
+ </button>
67
+ ) : null;
68
+ };
69
+ `
70
+ };
71
+ }
72
+ export {
73
+ getContent as default
74
+ };
@@ -0,0 +1,46 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/user/User.View.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "User.View.tsx",
5
+ content: `
6
+ import { clsx } from "@akanjs/client";
7
+ import { usePage } from "@${dict.libName}/client";
8
+ import { Avatar } from "@util/ui";
9
+ import { AiOutlineUser } from "react-icons/ai";
10
+
11
+ import { cnst } from "../cnst";
12
+
13
+ interface UserViewProps {
14
+ className?: string;
15
+ user: cnst.User;
16
+ }
17
+
18
+ export const General = ({ className, user }: UserViewProps) => {
19
+ const { l } = usePage();
20
+ return (
21
+ <div className={clsx("flex flex-col gap-4", className)}>
22
+ <div>
23
+ <div className="font-bold">Profile</div>
24
+ <div className="text-base">
25
+ <Avatar
26
+ className="flex items-center justify-center w-24 h-24"
27
+ icon={<AiOutlineUser className="text-4xl" />}
28
+ src={user.image?.url}
29
+ />
30
+ </div>
31
+ </div>
32
+ <div>
33
+ <div className="flex gap-2 items-center">
34
+ <div className="font-bold">Nickname</div>
35
+ </div>
36
+ <p className="text-base">{user.nickname}</p>
37
+ </div>
38
+ </div>
39
+ );
40
+ };
41
+ `
42
+ };
43
+ }
44
+ export {
45
+ getContent as default
46
+ };
@@ -0,0 +1,54 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/user/User.Zone.tsx
2
+ function getContent(scanResult, dict) {
3
+ return {
4
+ filename: "User.Zone.tsx",
5
+ content: `
6
+ "use client";
7
+ import { ModelsProps } from "@akanjs/client";
8
+ import { DefaultOf } from "@akanjs/signal";
9
+ import { cnst, st, User } from "@${dict.libName}/client";
10
+ import { Data, Model } from "@shared/ui";
11
+
12
+ export const Admin = ({ sliceName = "user", init, query }: ModelsProps<cnst.User>) => {
13
+ return (
14
+ <Data.ListContainer
15
+ init={init}
16
+ query={query}
17
+ sliceName={sliceName}
18
+ renderItem={User.Unit.Card}
19
+ renderDashboard={User.Util.Stat}
20
+ renderInsight={User.Util.Insight}
21
+ renderTemplate={User.Template.General}
22
+ renderTitle={(user: DefaultOf<cnst.User>) => \`\${user.nickname}\`}
23
+ renderView={(user: cnst.User) => <User.View.General user={user} />}
24
+ type="list"
25
+ columns={["nickname", "status", "lastLoginAt", "createdAt"]}
26
+ actions={(user: cnst.LightUser, idx) => [
27
+ "remove",
28
+ "edit",
29
+ "view",
30
+ user.status === "active"
31
+ ? { type: "restrict", render: () => <User.Util.Restrict id={user.id} /> }
32
+ : { type: "release", render: () => <User.Util.Release id={user.id} /> },
33
+ ]}
34
+ />
35
+ );
36
+ };
37
+
38
+ export const Self = () => {
39
+ const self = st.use.self();
40
+ const userModal = st.use.userModal();
41
+ return userModal === "edit" ? (
42
+ <Model.EditModal type="form" sliceName="user" submitOption={{ path: "self" }}>
43
+ <User.Template.General />
44
+ </Model.EditModal>
45
+ ) : (
46
+ <User.View.General user={self} />
47
+ );
48
+ };
49
+ `
50
+ };
51
+ }
52
+ export {
53
+ getContent as default
54
+ };
@@ -0,0 +1,28 @@
1
+ // pkgs/@akanjs/cli/src/templates/libRoot/lib/user/_server.ts
2
+ function getContent(scanResult, dict = {}) {
3
+ return `
4
+ import { databaseModuleOf } from "@akanjs/server";
5
+
6
+ import { cnst } from "../cnst";
7
+ import * as db from "../db";
8
+ import type { ModulesOptions } from "../option";
9
+ import { allSrvs } from "../srv";
10
+ import { UserService } from "./user.service";
11
+ import { UserSignal } from "./user.signal";
12
+
13
+ export const registerUserModule = (option: ModulesOptions) =>
14
+ databaseModuleOf(
15
+ {
16
+ constant: cnst.userCnst,
17
+ database: db.userDb,
18
+ signal: UserSignal,
19
+ service: UserService,
20
+ extended: true,
21
+ },
22
+ allSrvs
23
+ );
24
+ `;
25
+ }
26
+ export {
27
+ getContent as default
28
+ };