@akanjs/cli 0.9.55 → 0.9.56

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.
package/cjs/index.js CHANGED
@@ -2057,9 +2057,10 @@ var Executor = class _Executor {
2057
2057
  async cp(srcPath, destPath) {
2058
2058
  const src = this.getPath(srcPath);
2059
2059
  const dest = this.getPath(destPath);
2060
+ const isDirectory = import_fs4.default.statSync(src).isDirectory();
2060
2061
  if (!import_fs4.default.existsSync(src))
2061
2062
  return;
2062
- if (!import_fs4.default.existsSync(dest))
2063
+ if (!import_fs4.default.existsSync(dest) && isDirectory)
2063
2064
  await import_promises.default.mkdir(dest, { recursive: true });
2064
2065
  await import_promises.default.cp(src, dest, { recursive: true });
2065
2066
  }
@@ -26,7 +26,6 @@ function getContent(scanInfo, dict) {
26
26
  return `
27
27
  import { via } from "@akanjs/constant";
28
28
 
29
-
30
29
  export class ${dict.Model} extends via((field) => ({
31
30
  field: field(String),
32
31
  })) {}
@@ -28,7 +28,7 @@ import { ModelDictionary } from "@akanjs/dictionary";
28
28
 
29
29
  import type { ${dict.Model} } from "./${dict.model}.constant";
30
30
 
31
- export const modelDictionary = {
31
+ export const dictionary = {
32
32
  modelName: ["${dict.Model}", "${dict.Model}"],
33
33
  modelDesc: ["${dict.Model}", "${dict.Model}"],
34
34
 
@@ -40,7 +40,5 @@ export const modelDictionary = {
40
40
  // * ==================== Etc ==================== * //
41
41
  // * ==================== Etc ==================== * //
42
42
  } satisfies ModelDictionary<${dict.Model}>;
43
-
44
- export const ${dict.model}Dictionary = modelDictionary;
45
43
  `;
46
44
  }
@@ -0,0 +1,32 @@
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/app/instrumentation.ts
20
+ var instrumentation_exports = {};
21
+ __export(instrumentation_exports, {
22
+ default: () => getContent
23
+ });
24
+ module.exports = __toCommonJS(instrumentation_exports);
25
+ function getContent(scanInfo, dict) {
26
+ return `
27
+ import { registerClient } from "./client";
28
+
29
+ export const register = async () => {
30
+ await registerClient();
31
+ };`;
32
+ }
@@ -25,12 +25,8 @@ module.exports = __toCommonJS(appName_dictionary_exports);
25
25
  function getContent(scanInfo, dict) {
26
26
  return `
27
27
  import type { SignalDictionary } from "@akanjs/dictionary";
28
- import type { ${dict.AppName}Signal } from "./${dict.appName}.signal";
28
+ import type { ${dict.AppName}Endpoint } from "./${dict.appName}.signal";
29
29
 
30
- const dictionary = {} as const;
31
-
32
- export const signalDictionary = {} satisfies SignalDictionary<${dict.AppName}Signal>;
33
-
34
- export const ${dict.appName}Dictionary = { ...dictionary, ...signalDictionary };
30
+ export const dictionary = {} satisfies SignalDictionary<${dict.AppName}Endpoint>;
35
31
  `;
36
32
  }
@@ -24,10 +24,12 @@ __export(appName_signal_exports, {
24
24
  module.exports = __toCommonJS(appName_signal_exports);
25
25
  function getContent(scanInfo, dict) {
26
26
  return `
27
- import { signal } from "@akanjs/signal";
27
+ import { endpoint, internal } from "@akanjs/signal";
28
28
 
29
- import * as cnst from "../cnst";
29
+ import * as srv from "../srv";
30
30
 
31
- export class ${dict.AppName}Signal extends signal("${dict.AppName}" as const, cnst.Srvs) {}
31
+ export class ${dict.AppName}Internal extends internal(srv.${dict.appName}, () => ({})) {}
32
+
33
+ export class ${dict.AppName}Endpoint extends endpoint(srv.${dict.appName}, () => ({})) {}
32
34
  `;
33
35
  }
@@ -83,7 +83,5 @@ export const signalDictionary = {
83
83
  "argdesc-${dict.model}InsightInPublic-statuses": ["Statuses to filter", "\uD544\uD130\uB9C1\uD560 \uC0C1\uD0DC"],
84
84
  // * ==================== Endpoint ==================== * //
85
85
  } satisfies SignalDictionary<${dict.Model}Signal, ${dict.Model}>;
86
-
87
- export const ${dict.model}Dictionary = { ...modelDictionary, ...signalDictionary };
88
86
  `;
89
87
  }
@@ -28,9 +28,14 @@ import { beyond, by, into, type SchemaOf } from "@akanjs/document";
28
28
 
29
29
  import * as cnst from "../cnst";
30
30
 
31
+ export class ${dict.Model}Filter extends from(cnst.${dict.Model}, (filter) => ({
32
+ query: {},
33
+ sort: {},
34
+ })) {}
35
+
31
36
  export class ${dict.Model} extends by(cnst.${dict.Model}) {}
32
37
 
33
- export class ${dict.Model}Model extends into(${dict.Model}, cnst.${dict.model}) {}
38
+ export class ${dict.Model}Model extends into(${dict.Model}, ${dict.Model}Filter, cnst.${dict.model}) {}
34
39
 
35
40
  export class ${dict.Model}Middleware extends beyond(${dict.Model}Model, ${dict.Model}) {
36
41
  onSchema(schema: SchemaOf<${dict.Model}Model, ${dict.Model}>) {
@@ -24,36 +24,21 @@ __export(model_signal_exports, {
24
24
  module.exports = __toCommonJS(model_signal_exports);
25
25
  function getContent(scanInfo, dict) {
26
26
  return `
27
- import { Int } from "@akanjs/base";
28
- import type { SortOf } from "@akanjs/document";
29
- import { Arg, signal, Mutation, Query, resolve } from "@akanjs/signal";
27
+ import { endpoint, internal, slice } from "@akanjs/signal";
30
28
 
31
29
  import * as cnst from "../cnst";
30
+ import * as srv from "../srv";
32
31
 
33
- export class ${dict.Model}Signal extends signal(cnst.${dict.model}, cnst.Srvs, {
34
- guards: { get: "Public", cru: "Public },
35
- }) {
36
- // * /////////////////////////////////////
37
- // * Public Slice
38
- @Query.Public(() => [cnst.${dict.Model}])
39
- async ${dict.model}ListInPublic(
40
- @Arg.Query("statuses", () => [String], { nullable: true }) statuses: cnst.${dict.Model}Status[] | null,
41
- @Arg.Query("skip", () => Int, { nullable: true }) skip: number | null,
42
- @Arg.Query("limit", () => Int, { nullable: true }) limit: number | null,
43
- @Arg.Query("sort", () => String, { nullable: true }) sort: SortOf<cnst.${dict.Model}Filter> | null
44
- ) {
45
- const ${dict.models} = await this.${dict.model}Service.listByStatuses(statuses, { skip, limit, sort });
46
- return resolve<cnst.${dict.Model}[]>(${dict.models});
47
- }
48
- @Query.Public(() => cnst.${dict.Model}Insight)
49
- async ${dict.model}InsightInPublic(
50
- @Arg.Query("statuses", () => [String], { nullable: true }) statuses: cnst.${dict.Model}Status[] | null
51
- ) {
52
- const ${dict.model}Insight = await this.${dict.model}Service.insightByStatuses(statuses);
53
- return resolve<cnst.${dict.Model}Insight>(${dict.model}Insight);
54
- }
55
- // * Public Slice
56
- // * /////////////////////////////////////
57
- }
32
+ export class ${dict.Model}Internal extends internal(srv.${dict.model}, () => ({})) {}
33
+
34
+ export class ${dict.Model}Slice extends slice(srv.${dict.model}, { guards: { get: "Public", cru: "Public" } }, (init) => ({
35
+ inPublic: init()
36
+ .search("statuses", [cnst.${dict.Model}Status])
37
+ .exec(function (statuses) {
38
+ return this.${dict.model}Service.queryByStatuses(statuses);
39
+ }),
40
+ })) {}
41
+
42
+ export class ${dict.Model}Endpoint extends endpoint(srv.${dict.model}, () => ({})) {}
58
43
  `;
59
44
  }
@@ -26,8 +26,7 @@ function getContent(scanInfo, dict) {
26
26
  return `
27
27
  import { store } from "@akanjs/store";
28
28
 
29
- import * as cnst from "../cnst";
30
- import { fetch, sig } from "../useClient";
29
+ import { sig } from "../useClient";
31
30
 
32
31
  export class ${dict.Model}Store extends store(sig.${dict.model}, {
33
32
  // state
@@ -11,10 +11,12 @@ apps/*/data
11
11
  /releases
12
12
  apps/*/scripts
13
13
  **/.env
14
+ **/env.client.local.ts
14
15
  **/env.client.debug.ts
15
16
  **/env.client.develop.ts
16
17
  **/env.client.main.ts
17
18
  **/env.client.testing.ts
19
+ **/env.server.local.ts
18
20
  **/env.server.debug.ts
19
21
  **/env.server.develop.ts
20
22
  **/env.server.main.ts
package/esm/index.js CHANGED
@@ -2035,9 +2035,10 @@ var Executor = class _Executor {
2035
2035
  async cp(srcPath, destPath) {
2036
2036
  const src = this.getPath(srcPath);
2037
2037
  const dest = this.getPath(destPath);
2038
+ const isDirectory = fs8.statSync(src).isDirectory();
2038
2039
  if (!fs8.existsSync(src))
2039
2040
  return;
2040
- if (!fs8.existsSync(dest))
2041
+ if (!fs8.existsSync(dest) && isDirectory)
2041
2042
  await fsPromise.mkdir(dest, { recursive: true });
2042
2043
  await fsPromise.cp(src, dest, { recursive: true });
2043
2044
  }
@@ -3,7 +3,6 @@ function getContent(scanInfo, dict) {
3
3
  return `
4
4
  import { via } from "@akanjs/constant";
5
5
 
6
-
7
6
  export class ${dict.Model} extends via((field) => ({
8
7
  field: field(String),
9
8
  })) {}
@@ -5,7 +5,7 @@ import { ModelDictionary } from "@akanjs/dictionary";
5
5
 
6
6
  import type { ${dict.Model} } from "./${dict.model}.constant";
7
7
 
8
- export const modelDictionary = {
8
+ export const dictionary = {
9
9
  modelName: ["${dict.Model}", "${dict.Model}"],
10
10
  modelDesc: ["${dict.Model}", "${dict.Model}"],
11
11
 
@@ -17,8 +17,6 @@ export const modelDictionary = {
17
17
  // * ==================== Etc ==================== * //
18
18
  // * ==================== Etc ==================== * //
19
19
  } satisfies ModelDictionary<${dict.Model}>;
20
-
21
- export const ${dict.model}Dictionary = modelDictionary;
22
20
  `;
23
21
  }
24
22
  export {
@@ -0,0 +1,12 @@
1
+ // pkgs/@akanjs/cli/src/templates/app/instrumentation.ts
2
+ function getContent(scanInfo, dict) {
3
+ return `
4
+ import { registerClient } from "./client";
5
+
6
+ export const register = async () => {
7
+ await registerClient();
8
+ };`;
9
+ }
10
+ export {
11
+ getContent as default
12
+ };
@@ -2,13 +2,9 @@
2
2
  function getContent(scanInfo, dict) {
3
3
  return `
4
4
  import type { SignalDictionary } from "@akanjs/dictionary";
5
- import type { ${dict.AppName}Signal } from "./${dict.appName}.signal";
5
+ import type { ${dict.AppName}Endpoint } from "./${dict.appName}.signal";
6
6
 
7
- const dictionary = {} as const;
8
-
9
- export const signalDictionary = {} satisfies SignalDictionary<${dict.AppName}Signal>;
10
-
11
- export const ${dict.appName}Dictionary = { ...dictionary, ...signalDictionary };
7
+ export const dictionary = {} satisfies SignalDictionary<${dict.AppName}Endpoint>;
12
8
  `;
13
9
  }
14
10
  export {
@@ -1,11 +1,13 @@
1
1
  // pkgs/@akanjs/cli/src/templates/app/lib/___appName__/__appName__.signal.ts
2
2
  function getContent(scanInfo, dict) {
3
3
  return `
4
- import { signal } from "@akanjs/signal";
4
+ import { endpoint, internal } from "@akanjs/signal";
5
5
 
6
- import * as cnst from "../cnst";
6
+ import * as srv from "../srv";
7
7
 
8
- export class ${dict.AppName}Signal extends signal("${dict.AppName}" as const, cnst.Srvs) {}
8
+ export class ${dict.AppName}Internal extends internal(srv.${dict.appName}, () => ({})) {}
9
+
10
+ export class ${dict.AppName}Endpoint extends endpoint(srv.${dict.appName}, () => ({})) {}
9
11
  `;
10
12
  }
11
13
  export {
@@ -60,8 +60,6 @@ export const signalDictionary = {
60
60
  "argdesc-${dict.model}InsightInPublic-statuses": ["Statuses to filter", "\uD544\uD130\uB9C1\uD560 \uC0C1\uD0DC"],
61
61
  // * ==================== Endpoint ==================== * //
62
62
  } satisfies SignalDictionary<${dict.Model}Signal, ${dict.Model}>;
63
-
64
- export const ${dict.model}Dictionary = { ...modelDictionary, ...signalDictionary };
65
63
  `;
66
64
  }
67
65
  export {
@@ -5,9 +5,14 @@ import { beyond, by, into, type SchemaOf } from "@akanjs/document";
5
5
 
6
6
  import * as cnst from "../cnst";
7
7
 
8
+ export class ${dict.Model}Filter extends from(cnst.${dict.Model}, (filter) => ({
9
+ query: {},
10
+ sort: {},
11
+ })) {}
12
+
8
13
  export class ${dict.Model} extends by(cnst.${dict.Model}) {}
9
14
 
10
- export class ${dict.Model}Model extends into(${dict.Model}, cnst.${dict.model}) {}
15
+ export class ${dict.Model}Model extends into(${dict.Model}, ${dict.Model}Filter, cnst.${dict.model}) {}
11
16
 
12
17
  export class ${dict.Model}Middleware extends beyond(${dict.Model}Model, ${dict.Model}) {
13
18
  onSchema(schema: SchemaOf<${dict.Model}Model, ${dict.Model}>) {
@@ -1,37 +1,22 @@
1
1
  // pkgs/@akanjs/cli/src/templates/module/__model__.signal.ts
2
2
  function getContent(scanInfo, dict) {
3
3
  return `
4
- import { Int } from "@akanjs/base";
5
- import type { SortOf } from "@akanjs/document";
6
- import { Arg, signal, Mutation, Query, resolve } from "@akanjs/signal";
4
+ import { endpoint, internal, slice } from "@akanjs/signal";
7
5
 
8
6
  import * as cnst from "../cnst";
7
+ import * as srv from "../srv";
9
8
 
10
- export class ${dict.Model}Signal extends signal(cnst.${dict.model}, cnst.Srvs, {
11
- guards: { get: "Public", cru: "Public },
12
- }) {
13
- // * /////////////////////////////////////
14
- // * Public Slice
15
- @Query.Public(() => [cnst.${dict.Model}])
16
- async ${dict.model}ListInPublic(
17
- @Arg.Query("statuses", () => [String], { nullable: true }) statuses: cnst.${dict.Model}Status[] | null,
18
- @Arg.Query("skip", () => Int, { nullable: true }) skip: number | null,
19
- @Arg.Query("limit", () => Int, { nullable: true }) limit: number | null,
20
- @Arg.Query("sort", () => String, { nullable: true }) sort: SortOf<cnst.${dict.Model}Filter> | null
21
- ) {
22
- const ${dict.models} = await this.${dict.model}Service.listByStatuses(statuses, { skip, limit, sort });
23
- return resolve<cnst.${dict.Model}[]>(${dict.models});
24
- }
25
- @Query.Public(() => cnst.${dict.Model}Insight)
26
- async ${dict.model}InsightInPublic(
27
- @Arg.Query("statuses", () => [String], { nullable: true }) statuses: cnst.${dict.Model}Status[] | null
28
- ) {
29
- const ${dict.model}Insight = await this.${dict.model}Service.insightByStatuses(statuses);
30
- return resolve<cnst.${dict.Model}Insight>(${dict.model}Insight);
31
- }
32
- // * Public Slice
33
- // * /////////////////////////////////////
34
- }
9
+ export class ${dict.Model}Internal extends internal(srv.${dict.model}, () => ({})) {}
10
+
11
+ export class ${dict.Model}Slice extends slice(srv.${dict.model}, { guards: { get: "Public", cru: "Public" } }, (init) => ({
12
+ inPublic: init()
13
+ .search("statuses", [cnst.${dict.Model}Status])
14
+ .exec(function (statuses) {
15
+ return this.${dict.model}Service.queryByStatuses(statuses);
16
+ }),
17
+ })) {}
18
+
19
+ export class ${dict.Model}Endpoint extends endpoint(srv.${dict.model}, () => ({})) {}
35
20
  `;
36
21
  }
37
22
  export {
@@ -3,8 +3,7 @@ function getContent(scanInfo, dict) {
3
3
  return `
4
4
  import { store } from "@akanjs/store";
5
5
 
6
- import * as cnst from "../cnst";
7
- import { fetch, sig } from "../useClient";
6
+ import { sig } from "../useClient";
8
7
 
9
8
  export class ${dict.Model}Store extends store(sig.${dict.model}, {
10
9
  // state
@@ -11,10 +11,12 @@ apps/*/data
11
11
  /releases
12
12
  apps/*/scripts
13
13
  **/.env
14
+ **/env.client.local.ts
14
15
  **/env.client.debug.ts
15
16
  **/env.client.develop.ts
16
17
  **/env.client.main.ts
17
18
  **/env.client.testing.ts
19
+ **/env.server.local.ts
18
20
  **/env.server.debug.ts
19
21
  **/env.server.develop.ts
20
22
  **/env.server.main.ts
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "sourceType": "module",
4
4
  "name": "@akanjs/cli",
5
- "version": "0.9.55",
5
+ "version": "0.9.56",
6
6
  "bin": {
7
7
  "akan": "esm/index.js"
8
8
  },
@@ -0,0 +1,6 @@
1
+ import type { AppInfo, LibInfo } from "@akanjs/devkit";
2
+ interface Dict {
3
+ appName: string;
4
+ }
5
+ export default function getContent(scanInfo: AppInfo | LibInfo | null, dict: Dict): string;
6
+ export {};