@akanjs/cli 0.0.41 → 0.0.43

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 (158) hide show
  1. package/index.d.ts +1 -0
  2. package/index.js +34 -7
  3. package/package.json +1 -1
  4. package/src/templates/__scalar/__model__/__model__.constant.js +36 -0
  5. package/src/templates/__scalar/__model__/__model__.dictionary.js +47 -0
  6. package/src/templates/__scalar/__model__/__model__.document.js +34 -0
  7. package/src/templates/app/akan.config.ts.template +5 -0
  8. package/src/templates/app/app/[lang]/(__appName__)/(public)/forgotpassword/page.js +45 -0
  9. package/src/templates/app/app/[lang]/(__appName__)/(public)/page.js +46 -0
  10. package/src/templates/app/app/[lang]/(__appName__)/(public)/privacy/page.js +40 -0
  11. package/src/templates/app/app/[lang]/(__appName__)/(public)/signin/page.js +48 -0
  12. package/src/templates/app/app/[lang]/(__appName__)/(public)/termsofservice/page.js +39 -0
  13. package/src/templates/app/app/[lang]/(__appName__)/(user)/layout.js +41 -0
  14. package/src/templates/app/app/[lang]/(__appName__)/(user)/self/page.js +58 -0
  15. package/src/templates/app/app/[lang]/(__appName__)/layout.js +50 -0
  16. package/src/templates/app/app/[lang]/admin/layout.js +51 -0
  17. package/src/templates/app/app/[lang]/admin/page.js +61 -0
  18. package/src/templates/app/app/csr.js +32 -0
  19. package/src/templates/app/app/index.html.template +13 -0
  20. package/src/templates/app/app/layout.js +36 -0
  21. package/src/templates/app/app/robots.js +41 -0
  22. package/src/templates/app/app/sitemap.js +37 -0
  23. package/src/templates/app/base/baseLogic.js +36 -0
  24. package/src/templates/app/base/index.js +30 -0
  25. package/src/templates/app/capacitor.config.ts.template +8 -0
  26. package/src/templates/app/common/commonLogic.js +36 -0
  27. package/src/templates/app/common/index.js +30 -0
  28. package/src/templates/app/env/env.client.js +39 -0
  29. package/src/templates/app/env/env.client.type.js +36 -0
  30. package/src/templates/app/env/env.server.js +39 -0
  31. package/src/templates/app/jest.config.js +37 -0
  32. package/src/templates/app/lib/___appName__/__appName__.dictionary.js +32 -0
  33. package/src/templates/app/lib/___appName__/__appName__.service.js +43 -0
  34. package/src/templates/app/lib/___appName__/__appName__.store.js +37 -0
  35. package/src/templates/app/lib/___appName__/_server.js +35 -0
  36. package/src/templates/app/lib/option.js +43 -0
  37. package/src/templates/app/lib/setting/Setting.Template.js +55 -0
  38. package/src/templates/app/lib/setting/Setting.Unit.js +36 -0
  39. package/src/templates/app/lib/setting/Setting.Util.js +32 -0
  40. package/src/templates/app/lib/setting/Setting.View.js +49 -0
  41. package/src/templates/app/lib/setting/Setting.Zone.js +78 -0
  42. package/src/templates/app/lib/setting/_server.js +49 -0
  43. package/src/templates/app/lib/setting/index.js +59 -0
  44. package/src/templates/app/lib/setting/setting.constant.js +47 -0
  45. package/src/templates/app/lib/setting/setting.dictionary.js +47 -0
  46. package/src/templates/app/lib/setting/setting.document.js +49 -0
  47. package/src/templates/app/lib/setting/setting.service.js +38 -0
  48. package/src/templates/app/lib/setting/setting.signal.js +35 -0
  49. package/src/templates/app/lib/setting/setting.store.js +42 -0
  50. package/src/templates/app/lib/summary/Summary.Template.js +41 -0
  51. package/src/templates/app/lib/summary/Summary.Unit.js +36 -0
  52. package/src/templates/app/lib/summary/Summary.Util.js +31 -0
  53. package/src/templates/app/lib/summary/Summary.View.js +49 -0
  54. package/src/templates/app/lib/summary/Summary.Zone.js +60 -0
  55. package/src/templates/app/lib/summary/_server.js +49 -0
  56. package/src/templates/app/lib/summary/index.js +65 -0
  57. package/src/templates/app/lib/summary/summary.constant.js +45 -0
  58. package/src/templates/app/lib/summary/summary.dictionary.js +50 -0
  59. package/src/templates/app/lib/summary/summary.document.js +49 -0
  60. package/src/templates/app/lib/summary/summary.service.js +35 -0
  61. package/src/templates/app/lib/summary/summary.signal.js +35 -0
  62. package/src/templates/app/lib/summary/summary.store.js +42 -0
  63. package/src/templates/app/lib/user/User.Template.js +63 -0
  64. package/src/templates/app/lib/user/User.Unit.js +36 -0
  65. package/src/templates/app/lib/user/User.Util.js +92 -0
  66. package/src/templates/app/lib/user/User.View.js +64 -0
  67. package/src/templates/app/lib/user/User.Zone.js +72 -0
  68. package/src/templates/app/lib/user/_server.js +49 -0
  69. package/src/templates/app/lib/user/index.js +59 -0
  70. package/src/templates/app/lib/user/user.constant.js +68 -0
  71. package/src/templates/app/lib/user/user.dictionary.js +53 -0
  72. package/src/templates/app/lib/user/user.document.js +55 -0
  73. package/src/templates/app/lib/user/user.service.js +43 -0
  74. package/src/templates/app/lib/user/user.signal.js +35 -0
  75. package/src/templates/app/lib/user/user.signal.spec.js +38 -0
  76. package/src/templates/app/lib/user/user.signal.test.js +40 -0
  77. package/src/templates/app/lib/user/user.store.js +40 -0
  78. package/src/templates/app/main.js +41 -0
  79. package/src/templates/app/middleware.js +36 -0
  80. package/src/templates/app/nest/backendLogic.js +35 -0
  81. package/src/templates/app/nest/index.js +30 -0
  82. package/src/templates/app/next/frontendLogic.js +35 -0
  83. package/src/templates/app/next/index.js +30 -0
  84. package/src/templates/app/page.test.ts.template +10 -0
  85. package/src/templates/app/playwright.config.ts.template +6 -0
  86. package/src/templates/app/postcss.config.js.template +10 -0
  87. package/src/templates/app/public/favicon.ico +0 -0
  88. package/src/templates/app/public/icons/icon-128x128.png +0 -0
  89. package/src/templates/app/public/icons/icon-144x144.png +0 -0
  90. package/src/templates/app/public/icons/icon-152x152.png +0 -0
  91. package/src/templates/app/public/icons/icon-192x192.png +0 -0
  92. package/src/templates/app/public/icons/icon-256x256.png +0 -0
  93. package/src/templates/app/public/icons/icon-384x384.png +0 -0
  94. package/src/templates/app/public/icons/icon-48x48.png +0 -0
  95. package/src/templates/app/public/icons/icon-512x512.png +0 -0
  96. package/src/templates/app/public/icons/icon-72x72.png +0 -0
  97. package/src/templates/app/public/icons/icon-96x96.png +0 -0
  98. package/src/templates/app/public/logo.svg +70 -0
  99. package/src/templates/app/public/manifest.json.template +67 -0
  100. package/src/templates/app/tsconfig.json.template +22 -0
  101. package/src/templates/app/tsconfig.spec.json.template +7 -0
  102. package/src/templates/app/ui/Footer.js +65 -0
  103. package/src/templates/app/ui/MainHeader.js +129 -0
  104. package/src/templates/app/ui/index.js +31 -0
  105. package/src/templates/client.js +43 -0
  106. package/src/templates/crudPages/[__model__Id]/edit/page.js +71 -0
  107. package/src/templates/crudPages/[__model__Id]/page.js +81 -0
  108. package/src/templates/crudPages/new/page.js +68 -0
  109. package/src/templates/crudPages/page.js +69 -0
  110. package/src/templates/index.js +32 -0
  111. package/src/templates/lib/__lib/extends/summary.constant.js +44 -0
  112. package/src/templates/lib/__lib/lib.constant.js +54 -0
  113. package/src/templates/lib/__lib/lib.dictionary.js +43 -0
  114. package/src/templates/lib/__lib/lib.document.js +42 -0
  115. package/src/templates/lib/__lib/lib.service.js +84 -0
  116. package/src/templates/lib/__lib/lib.signal.js +37 -0
  117. package/src/templates/lib/__lib/lib.store.js +35 -0
  118. package/src/templates/lib/__scalar/_server.js +40 -0
  119. package/src/templates/lib/cnst.js +33 -0
  120. package/src/templates/lib/cnst_.js +52 -0
  121. package/src/templates/lib/db.js +54 -0
  122. package/src/templates/lib/dict.js +46 -0
  123. package/src/templates/lib/fetch.js +49 -0
  124. package/src/templates/lib/sig.js +38 -0
  125. package/src/templates/lib/srv.js +53 -0
  126. package/src/templates/lib/st.js +37 -0
  127. package/src/templates/lib/store.js +53 -0
  128. package/src/templates/lib/usePage.js +34 -0
  129. package/src/templates/libRoot/.gitignore.template +15 -0
  130. package/src/templates/libRoot/jest.config.js +37 -0
  131. package/src/templates/libRoot/package.json.template +5 -0
  132. package/src/templates/libRoot/tsconfig.json.template +11 -0
  133. package/src/templates/libRoot/tsconfig.spec.json.template +7 -0
  134. package/src/templates/module/__Model__.Template.js +52 -0
  135. package/src/templates/module/__Model__.Unit.js +40 -0
  136. package/src/templates/module/__Model__.Util.js +68 -0
  137. package/src/templates/module/__Model__.View.js +46 -0
  138. package/src/templates/module/__Model__.Zone.js +81 -0
  139. package/src/templates/module/__model__.constant.js +70 -0
  140. package/src/templates/module/__model__.dictionary.js +99 -0
  141. package/src/templates/module/__model__.document.js +54 -0
  142. package/src/templates/module/__model__.service.js +42 -0
  143. package/src/templates/module/__model__.signal.js +61 -0
  144. package/src/templates/module/__model__.signal.spec.js +40 -0
  145. package/src/templates/module/__model__.signal.test.js +49 -0
  146. package/src/templates/module/__model__.store.js +40 -0
  147. package/src/templates/module/_server.js +48 -0
  148. package/src/templates/module/index.js +59 -0
  149. package/src/templates/pkgRoot/tsconfig.json.template +12 -0
  150. package/src/templates/server.js +60 -0
  151. package/src/templates/workplaceRoot/.env.template +20 -0
  152. package/src/templates/workplaceRoot/.gitignore.template +195 -0
  153. package/src/templates/workplaceRoot/.prettierignore.template +10 -0
  154. package/src/templates/workplaceRoot/.prettierrc.json.template +5 -0
  155. package/src/templates/workplaceRoot/.swcrc.template +9 -0
  156. package/src/templates/workplaceRoot/README.md.template +37 -0
  157. package/src/templates/workplaceRoot/eslint.config.js.template +141 -0
  158. package/src/templates/workplaceRoot/tsconfig.json.template +29 -0
@@ -0,0 +1,99 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.dictionary.ts
20
+ var model_dictionary_exports = {};
21
+ __export(model_dictionary_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_dictionary_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import {
28
+ baseTrans,
29
+ getBaseSignalTrans,
30
+ ModelDictionary,
31
+ SignalDictionary,
32
+ SummaryDictionary,
33
+ } from "@akanjs/dictionary";
34
+
35
+ import type { ${dict.Model}, ${dict.Model}Filter, ${dict.Model}Insight, ${dict.Model}Summary } from "./${dict.model}.constant";
36
+ import type { ${dict.Model}Signal } from "./${dict.model}.signal";
37
+
38
+ const modelDictionary = {
39
+ ...baseTrans,
40
+ modelName: ["${dict.Model}", "${dict.Model}"],
41
+ modelDesc: [
42
+ "${dict.Model} description",
43
+ "${dict.Model} \uC124\uBA85",
44
+ ],
45
+
46
+ // * ==================== Model ==================== * //
47
+ field: ["Field", "\uD544\uB4DC"],
48
+ "desc-field": ["Field", "\uD544\uB4DC"],
49
+ // * ==================== Model ==================== * //
50
+
51
+ // * ==================== Insight ==================== * //
52
+ count: ["Count", "\uAC1C\uC218"],
53
+ "desc-count": ["${dict.Model} count in current query settting", "\uD604\uC7AC \uCFFC\uB9AC \uC124\uC815\uC5D0 \uB9DE\uB294 \uBC30\uB108 \uC218"],
54
+ // * ==================== Insight ==================== * //
55
+
56
+ // * ==================== Filter ==================== * //
57
+ // * ==================== Filter ==================== * //
58
+
59
+ // * ==================== Etc ==================== * //
60
+ "enum-status-active": ["Active", "\uD65C\uC131"],
61
+ "enumdesc-status-active": ["Active status", "\uD65C\uC131 \uC0C1\uD0DC"],
62
+ // * ==================== Etc ==================== * //
63
+ } satisfies ModelDictionary<${dict.Model}, ${dict.Model}Insight, ${dict.Model}Filter>;
64
+
65
+ export const ${dict.model}SummaryDictionary = {
66
+ // * ==================== Summary ==================== * //
67
+ total${dict.Model}: ["Total${dict.Model}", "\uCD1D \uBC30\uB108 \uC218"],
68
+ "desc-total${dict.Model}": ["Total ${dict.model} count in the database", "\uB370\uC774\uD130\uBCA0\uC774\uC2A4\uC5D0 \uC800\uC7A5\uB41C \uCD1D \uBC30\uB108 \uC218"],
69
+ // * ==================== Summary ==================== * //
70
+ } satisfies SummaryDictionary<${dict.Model}Summary>;
71
+
72
+ const signalDictionary = {
73
+ ...getBaseSignalTrans("${dict.model}" as const),
74
+ // * ==================== Endpoint ==================== * //
75
+ "api-${dict.model}ListInPublic": ["${dict.Model} List In Public", "\uACF5\uAC1C\uB41C ${dict.Model} \uB9AC\uC2A4\uD2B8"],
76
+ "apidesc-${dict.model}ListInPublic": ["Get a list of public ${dict.model}", "\uACF5\uAC1C\uB41C ${dict.Model}\uC758 \uB9AC\uC2A4\uD2B8\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4"],
77
+ "arg-${dict.model}ListInPublic-statuses": ["Statuses", "\uC0C1\uD0DC"],
78
+ "argdesc-${dict.model}ListInPublic-statuses": ["Statuses to filter", "\uD544\uD130\uB9C1\uD560 \uC0C1\uD0DC"],
79
+ "arg-${dict.model}ListInPublic-skip": ["Skip", "\uAC74\uB108\uB6F0\uAE30"],
80
+ "argdesc-${dict.model}ListInPublic-skip": ["Number of items to skip", "\uAC74\uB108\uB6F8 \uC544\uC774\uD15C \uC218"],
81
+ "arg-${dict.model}ListInPublic-limit": ["Limit", "\uC81C\uD55C"],
82
+ "argdesc-${dict.model}ListInPublic-limit": ["Maximum number of items to return", "\uBC18\uD658\uD560 \uCD5C\uB300 \uC544\uC774\uD15C \uC218"],
83
+ "arg-${dict.model}ListInPublic-sort": ["Sort", "\uC815\uB82C"],
84
+ "argdesc-${dict.model}ListInPublic-sort": ["Sort order of the items", "\uC544\uC774\uD15C\uC758 \uC815\uB82C \uC21C\uC11C"],
85
+
86
+ "api-${dict.model}InsightInPublic": ["${dict.Model} Insight In Public", "\uACF5\uAC1C\uB41C ${dict.Model} \uC778\uC0AC\uC774\uD2B8"],
87
+ "apidesc-${dict.model}InsightInPublic": [
88
+ "Get insight data for public ${dict.model}",
89
+ "\uACF5\uAC1C\uB41C ${dict.Model}\uC5D0 \uB300\uD55C \uC778\uC0AC\uC774\uD2B8 \uB370\uC774\uD130\uB97C \uAC00\uC838\uC635\uB2C8\uB2E4",
90
+ ],
91
+ "arg-${dict.model}InsightInPublic-statuses": ["Statuses", "\uC0C1\uD0DC"],
92
+ "argdesc-${dict.model}InsightInPublic-statuses": ["Statuses to filter", "\uD544\uD130\uB9C1\uD560 \uC0C1\uD0DC"],
93
+ // * ==================== Endpoint ==================== * //
94
+ } satisfies SignalDictionary<${dict.Model}Signal, ${dict.Model}>;
95
+
96
+ export const ${dict.model}Dictionary = { ...modelDictionary, ...signalDictionary };
97
+ `;
98
+ }
99
+ module.exports = module.exports.default;
@@ -0,0 +1,54 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.document.ts
20
+ var model_document_exports = {};
21
+ __export(model_document_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_document_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import { beyond, by, Database, into, type SchemaOf } from "@akanjs/document";
28
+
29
+ import { cnst } from "../cnst";
30
+
31
+ @Database.Input(() => cnst.${dict.Model}Input)
32
+ export class ${dict.Model}Input extends by(cnst.${dict.Model}Input) {}
33
+
34
+ @Database.Document(() => cnst.${dict.Model})
35
+ export class ${dict.Model} extends by(cnst.${dict.Model}) {}
36
+
37
+ @Database.Model(() => cnst.${dict.Model})
38
+ export class ${dict.Model}Model extends into(${dict.Model}, cnst.${dict.Model}Cnst) {
39
+ async getSummary(): Promise<cnst.${dict.Model}Summary> {
40
+ return {
41
+ ...(await this.getDefaultSummary()),
42
+ };
43
+ }
44
+ }
45
+
46
+ @Database.Middleware(() => cnst.${dict.Model})
47
+ export class ${dict.Model}Middleware extends beyond(${dict.Model}Model, ${dict.Model}) {
48
+ onSchema(schema: SchemaOf<${dict.Model}Model, ${dict.Model}>) {
49
+ // schema.index({ status: 1 })
50
+ }
51
+ }
52
+ `;
53
+ }
54
+ module.exports = module.exports.default;
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.service.ts
20
+ var model_service_exports = {};
21
+ __export(model_service_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_service_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import { DbService, Service } from "@akanjs/service";
28
+
29
+ import { cnst } from "../cnst";
30
+ import * as db from "../db";
31
+
32
+ @Service("${dict.Model}Service")
33
+ export class ${dict.Model}Service extends DbService(db.${dict.Model}Db) {
34
+ async summarize(): Promise<cnst.${dict.Model}Summary> {
35
+ return {
36
+ ...(await this.${dict.Model}Model.getSummary()),
37
+ };
38
+ }
39
+ }
40
+ `;
41
+ }
42
+ module.exports = module.exports.default;
@@ -0,0 +1,61 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.signal.ts
20
+ var model_signal_exports = {};
21
+ __export(model_signal_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_signal_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import { Int } from "@akanjs/base";
28
+ import { SortOf } from "@akanjs/constant";
29
+ import { Arg, DbSignal, Mutation, Query, resolve, Signal } from "@akanjs/signal";
30
+
31
+ import { cnst, Srvs } from "../cnst";
32
+
33
+ @Signal(() => cnst.${dict.Model})
34
+ export class ${dict.Model}Signal extends DbSignal(cnst.${dict.model}Cnst, Srvs, {
35
+ guards: { get: Query.Public, cru: Mutation.Public },
36
+ }) {
37
+ // * /////////////////////////////////////
38
+ // * Public Slice
39
+ @Query.Public(() => [cnst.${dict.Model}])
40
+ async ${dict.model}ListInPublic(
41
+ @Arg.Query("statuses", () => [String], { nullable: true }) statuses: cnst.${dict.Model}Status[] | null,
42
+ @Arg.Query("skip", () => Int, { nullable: true }) skip: number | null,
43
+ @Arg.Query("limit", () => Int, { nullable: true }) limit: number | null,
44
+ @Arg.Query("sort", () => String, { nullable: true }) sort: SortOf<cnst.${dict.Model}Filter> | null
45
+ ) {
46
+ const ${dict.models} = await this.${dict.model}Service.listByStatuses(statuses, { skip, limit, sort });
47
+ return resolve<cnst.${dict.Model}[]>(${dict.models});
48
+ }
49
+ @Query.Public(() => cnst.${dict.Model}Insight)
50
+ async ${dict.model}InsightInPublic(
51
+ @Arg.Query("statuses", () => [String], { nullable: true }) statuses: cnst.${dict.Model}Status[] | null
52
+ ) {
53
+ const ${dict.model}Insight = await this.${dict.model}Service.insightByStatuses(statuses);
54
+ return resolve<cnst.${dict.Model}Insight>(${dict.model}Insight);
55
+ }
56
+ // * Public Slice
57
+ // * /////////////////////////////////////
58
+ }
59
+ `;
60
+ }
61
+ module.exports = module.exports.default;
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.signal.spec.ts
20
+ var model_signal_spec_exports = {};
21
+ __export(model_signal_spec_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_signal_spec_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import * as adminSpec from "@shared/lib/admin/admin.signal.spec";
28
+ import * as userSpec from "@${dict.appName}/lib/user/user.signal.spec";
29
+ import { cnst } from "../cnst";
30
+ import { fetch } from "../fetch";
31
+ import { sampleOf } from "@akanjs/test";
32
+
33
+ export const create${dict.Model} = async (adminAgent: userSpec.AdminAgent, userAgent: userSpec.UserAgent) => {
34
+ const ${dict.model}Input = sampleOf(cnst.${dict.Model}Input);
35
+ const ${dict.model} = await adminAgent.fetch.create${dict.Model}(${dict.model}Input);
36
+ return ${dict.model};
37
+ };
38
+ `;
39
+ }
40
+ module.exports = module.exports.default;
@@ -0,0 +1,49 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.signal.test.ts
20
+ var model_signal_test_exports = {};
21
+ __export(model_signal_test_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_signal_test_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import * as adminSpec from "@shared/lib/admin/admin.signal.spec";
28
+ import * as userSpec from "@${dict.appName}/lib/user/user.signal.spec";
29
+ import * as ${dict.model}Spec from "@${dict.appName}/lib/${dict.model}/${dict.model}.signal.spec";
30
+ import { cnst } from "../cnst";
31
+ import { fetch } from "../fetch";
32
+
33
+ describe("${dict.Model} Signal", () => {
34
+ describe("${dict.Model} Service", () => {
35
+ let adminAgent: userSpec.AdminAgent;
36
+ let userAgent: userSpec.UserAgent;
37
+ let ${dict.model}: cnst.${dict.Model};
38
+ beforeAll(async () => {
39
+ // adminAgent = await adminSpec.getAdminAgentWithInitialize();
40
+ // userAgent = await userSpec.getUserAgentWithPhone();
41
+ });
42
+ it("can create ${dict.model}", async () => {
43
+ // ${dict.model} = await ${dict.model}Spec.create${dict.Model}(adminAgent, userAgent);
44
+ });
45
+ });
46
+ });
47
+ `;
48
+ }
49
+ module.exports = module.exports.default;
@@ -0,0 +1,40 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/__model__.store.ts
20
+ var model_store_exports = {};
21
+ __export(model_store_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(model_store_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import { stateOf, Store } from "@akanjs/store";
28
+
29
+ import { cnst } from "../cnst";
30
+ import { fetch } from "../fetch";
31
+
32
+ @Store(() => cnst.${dict.Model})
33
+ export class ${dict.Model}Store extends stateOf(fetch.${dict.model}Gql, {
34
+ // state
35
+ }) {
36
+ // action
37
+ }
38
+ `;
39
+ }
40
+ module.exports = module.exports.default;
@@ -0,0 +1,48 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/_server.ts
20
+ var server_exports = {};
21
+ __export(server_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(server_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import { databaseModuleOf } from "@akanjs/server";
28
+
29
+ import * as db from "../db";
30
+ import type { ModulesOptions } from "../option";
31
+ import { ${dict.Model}Service } from "./${dict.model}.service";
32
+ import { ${dict.Model}Signal } from "./${dict.model}.signal";
33
+ import { allSrvs } from "../srv";
34
+ import { cnst } from "../cnst";
35
+
36
+ export const register${dict.Model}Module = (option: ModulesOptions) =>
37
+ databaseModuleOf(
38
+ {
39
+ constant: cnst.${dict.Model}Cnst,
40
+ database: db.${dict.Model}Db,
41
+ signal: ${dict.Model}Signal,
42
+ service: ${dict.Model}Service,
43
+ },
44
+ allSrvs
45
+ );
46
+ `;
47
+ }
48
+ module.exports = module.exports.default;
@@ -0,0 +1,59 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/module/index.tsx
20
+ var module_exports = {};
21
+ __export(module_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(module_exports);
25
+ function getContent(scanResult, dict) {
26
+ return `
27
+ import { Signal } from "@util/ui";
28
+ import { AiOutlineDatabase } from "react-icons/ai";
29
+
30
+ import * as Template from "./${dict.Model}.Template";
31
+ import * as Unit from "./${dict.Model}.Unit";
32
+ import * as Util from "./${dict.Model}.Util";
33
+ import * as View from "./${dict.Model}.View";
34
+ import * as Zone from "./${dict.Model}.Zone";
35
+
36
+ export const ${dict.Model} = {
37
+ Menu: {
38
+ Admin: {
39
+ key: "${dict.model}",
40
+ label: "${dict.Model}",
41
+ icon: <AiOutlineDatabase />,
42
+ render: () => <Zone.Admin />,
43
+ },
44
+ Doc: {
45
+ key: "${dict.model}",
46
+ label: "${dict.Model}",
47
+ icon: <AiOutlineDatabase />,
48
+ render: () => <Signal.Doc.Zone refName="${dict.model}" />,
49
+ },
50
+ },
51
+ Template,
52
+ Unit,
53
+ Util,
54
+ View,
55
+ Zone,
56
+ };
57
+ `;
58
+ }
59
+ module.exports = module.exports.default;
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "module": "commonjs",
5
+ "declaration": true,
6
+ "esModuleInterop": true,
7
+ "types": ["node"]
8
+ },
9
+ "files": [],
10
+ "references": [],
11
+ "include": ["**/*.ts", "**/*.tsx"]
12
+ }
@@ -0,0 +1,60 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // pkgs/@akanjs/cli/src/templates/server.ts
20
+ var server_exports = {};
21
+ __export(server_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(server_exports);
25
+ var capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
26
+ function getContent(scanResult, dict = {}) {
27
+ if (!scanResult)
28
+ return null;
29
+ const libs = scanResult.akanConfig.libs;
30
+ const databaseModules = scanResult.files.services.databases;
31
+ const serviceModules = scanResult.files.services.services;
32
+ return `
33
+ import type { Module } from "@akanjs/server";
34
+ ${libs.map((lib) => `import { registerModules as register${capitalize(lib)}Modules } from "@${lib}/server";`).join("\n")}
35
+
36
+ import { registerScalarModule } from "./lib/__scalar/_server";
37
+ ${serviceModules.map((module2) => `import { register${capitalize(module2)}Module } from "./lib/_${module2}/_server";`).join("\n")}
38
+ ${databaseModules.map((module2) => `import { register${capitalize(module2)}Module } from "./lib/${module2}/_server";`).join("\n")}
39
+ import { type ModulesOptions, registerGlobalModule } from "./lib/option";
40
+
41
+ export const registerModules = (options: ModulesOptions, isChild?: boolean) => {
42
+ const modules = [
43
+ ${libs.map((lib) => ` ...(!isChild ? register${capitalize(lib)}Modules(options, true) : []),`).join("\n")}
44
+ registerGlobalModule(options),
45
+ registerScalarModule(options),
46
+ ${serviceModules.map((module2) => ` register${capitalize(module2)}Module(options),`).join("\n")}
47
+ ${databaseModules.map((module2) => ` register${capitalize(module2)}Module(options),`).join("\n")}
48
+ ] as Module[];
49
+ return modules;
50
+ };
51
+
52
+ export { env } from "./env/env.server.testing";
53
+ export * as db from "./lib/db";
54
+ export * as srv from "./lib/srv";
55
+ export * as option from "./lib/option";
56
+ export { cnst } from "./lib/cnst";
57
+ export { fetch } from "./lib/fetch";
58
+ `;
59
+ }
60
+ module.exports = module.exports.default;
@@ -0,0 +1,20 @@
1
+ # organization configuration, no need to change
2
+ NEXT_PUBLIC_REPO_NAME=<%= repoName %>
3
+ NEXT_PUBLIC_SERVE_DOMAIN="<%= serveDomain %>"
4
+
5
+ # development branch, debug, develop, main, etc. mainly it changes databases.
6
+ NEXT_PUBLIC_ENV=debug
7
+
8
+ # local, cloud, edge it changes the connection point of the clients.
9
+ NEXT_PUBLIC_OPERATION_MODE=local
10
+ # hybrid app specific config, will be depreciated in the future
11
+ APP_OPERATION_MODE=local
12
+
13
+ # backend service mode, federation, batch, all
14
+ SERVER_MODE=federation
15
+
16
+ # analyze the bundle size
17
+ ANALYZE=false
18
+
19
+ # log level, debug, info, warn, error
20
+ NEXT_PUBLIC_LOG_LEVEL=debug