@akanjs/cli 0.9.48 → 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.
- package/cjs/index.js +63 -52
- package/cjs/src/guidelines/___library/sharedUiStructureDescription.en.md +1 -1
- package/cjs/src/guidelines/databaseModule/databaseModule.instruction.md +9 -21
- package/cjs/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -5
- package/cjs/src/guidelines/framework/framework.instruction.md +10 -12
- package/cjs/src/guidelines/modelConstant/modelConstant.generate.json +0 -7
- package/cjs/src/guidelines/modelConstant/modelConstant.instruction.md +14 -19
- package/cjs/src/guidelines/modelDocument/modelDocument.instruction.md +0 -24
- package/cjs/src/guidelines/modelService/modelService.generate.json +4 -11
- package/cjs/src/guidelines/modelService/modelService.instruction.md +12 -75
- package/cjs/src/guidelines/modelSignal/modelSignal.generate.json +0 -1
- package/cjs/src/guidelines/modelSignal/modelSignal.instruction.md +2 -38
- package/cjs/src/guidelines/modelStore/modelStore.instruction.md +1 -3
- package/cjs/src/guidelines/modelTemplate/modelTemplate.instruction.md +2 -2
- package/cjs/src/guidelines/modelUnit/modelUnit.instruction.md +2 -2
- package/cjs/src/guidelines/scalarConstant/scalarConstant.instruction.md +6 -11
- package/cjs/src/templates/__scalar/__model__/__model__.constant.js +5 -6
- package/cjs/src/templates/__scalar/__model__/__model__.dictionary.js +1 -1
- package/cjs/src/templates/app/app/[lang]/layout.js +0 -1
- package/cjs/src/templates/app/app/csr.js +3 -1
- package/cjs/src/templates/app/lib/___appName__/__appName__.dictionary.js +1 -1
- package/cjs/src/templates/app/lib/___appName__/__appName__.service.js +2 -3
- package/cjs/src/templates/app/lib/___appName__/__appName__.signal.js +2 -3
- package/cjs/src/templates/app/lib/___appName__/__appName__.store.js +2 -3
- package/cjs/src/templates/client.js +4 -4
- package/cjs/src/templates/crudPages/[__model__Id]/edit/page.js +1 -1
- package/cjs/src/templates/crudPages/[__model__Id]/page.js +1 -1
- package/cjs/src/templates/crudPages/new/page.js +1 -1
- package/cjs/src/templates/crudPages/page.js +1 -1
- package/cjs/src/templates/index.js +0 -1
- package/cjs/src/templates/lib/__lib/lib.constant.js +0 -1
- package/cjs/src/templates/lib/__lib/lib.dictionary.js +7 -4
- package/cjs/src/templates/lib/__lib/lib.document.js +4 -3
- package/cjs/src/templates/lib/__lib/lib.service.js +1 -1
- package/cjs/src/templates/lib/__lib/lib.signal.js +23 -4
- package/cjs/src/templates/lib/__lib/lib.store.js +19 -2
- package/cjs/src/templates/lib/cnst.js +12 -6
- package/cjs/src/templates/lib/db.js +10 -3
- package/cjs/src/templates/lib/dict.js +12 -4
- package/cjs/src/templates/lib/sig.js +20 -9
- package/cjs/src/templates/lib/srv.js +7 -6
- package/cjs/src/templates/lib/st.js +10 -8
- package/cjs/src/templates/lib/useClient.js +39 -0
- package/cjs/src/templates/lib/{usePage.js → useServer.js} +6 -8
- package/cjs/src/templates/libRoot/lib/___libName__/__libName__.service.js +2 -3
- package/cjs/src/templates/libRoot/lib/___libName__/__libName__.store.js +2 -3
- package/cjs/src/templates/module/__model__.constant.js +10 -30
- package/cjs/src/templates/module/__model__.dictionary.js +2 -2
- package/cjs/src/templates/module/__model__.document.js +2 -8
- package/cjs/src/templates/module/__model__.service.js +2 -3
- package/cjs/src/templates/module/__model__.signal.js +4 -5
- package/cjs/src/templates/module/__model__.store.js +3 -4
- package/cjs/src/templates/server.js +5 -4
- package/cjs/src/templates/workspaceRoot/.gitignore.template +5 -3
- package/esm/index.js +63 -52
- package/esm/src/guidelines/___library/sharedUiStructureDescription.en.md +1 -1
- package/esm/src/guidelines/databaseModule/databaseModule.instruction.md +9 -21
- package/esm/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -5
- package/esm/src/guidelines/framework/framework.instruction.md +10 -12
- package/esm/src/guidelines/modelConstant/modelConstant.generate.json +0 -7
- package/esm/src/guidelines/modelConstant/modelConstant.instruction.md +14 -19
- package/esm/src/guidelines/modelDocument/modelDocument.instruction.md +0 -24
- package/esm/src/guidelines/modelService/modelService.generate.json +4 -11
- package/esm/src/guidelines/modelService/modelService.instruction.md +12 -75
- package/esm/src/guidelines/modelSignal/modelSignal.generate.json +0 -1
- package/esm/src/guidelines/modelSignal/modelSignal.instruction.md +2 -38
- package/esm/src/guidelines/modelStore/modelStore.instruction.md +1 -3
- package/esm/src/guidelines/modelTemplate/modelTemplate.instruction.md +2 -2
- package/esm/src/guidelines/modelUnit/modelUnit.instruction.md +2 -2
- package/esm/src/guidelines/scalarConstant/scalarConstant.instruction.md +6 -11
- package/esm/src/templates/__scalar/__model__/__model__.constant.js +5 -6
- package/esm/src/templates/__scalar/__model__/__model__.dictionary.js +1 -1
- package/esm/src/templates/app/app/[lang]/layout.js +0 -1
- package/esm/src/templates/app/app/csr.js +3 -1
- package/esm/src/templates/app/lib/___appName__/__appName__.dictionary.js +1 -1
- package/esm/src/templates/app/lib/___appName__/__appName__.service.js +2 -3
- package/esm/src/templates/app/lib/___appName__/__appName__.signal.js +2 -3
- package/esm/src/templates/app/lib/___appName__/__appName__.store.js +2 -3
- package/esm/src/templates/client.js +4 -4
- package/esm/src/templates/crudPages/[__model__Id]/edit/page.js +1 -1
- package/esm/src/templates/crudPages/[__model__Id]/page.js +1 -1
- package/esm/src/templates/crudPages/new/page.js +1 -1
- package/esm/src/templates/crudPages/page.js +1 -1
- package/esm/src/templates/index.js +0 -1
- package/esm/src/templates/lib/__lib/lib.constant.js +0 -1
- package/esm/src/templates/lib/__lib/lib.dictionary.js +7 -4
- package/esm/src/templates/lib/__lib/lib.document.js +4 -3
- package/esm/src/templates/lib/__lib/lib.service.js +1 -1
- package/esm/src/templates/lib/__lib/lib.signal.js +23 -4
- package/esm/src/templates/lib/__lib/lib.store.js +19 -2
- package/esm/src/templates/lib/cnst.js +12 -6
- package/esm/src/templates/lib/db.js +10 -3
- package/esm/src/templates/lib/dict.js +12 -4
- package/esm/src/templates/lib/sig.js +20 -9
- package/esm/src/templates/lib/srv.js +7 -6
- package/esm/src/templates/lib/st.js +10 -8
- package/esm/src/templates/lib/useClient.js +19 -0
- package/esm/src/templates/lib/useServer.js +11 -0
- package/esm/src/templates/libRoot/lib/___libName__/__libName__.service.js +2 -3
- package/esm/src/templates/libRoot/lib/___libName__/__libName__.store.js +2 -3
- package/esm/src/templates/module/__model__.constant.js +10 -30
- package/esm/src/templates/module/__model__.dictionary.js +2 -2
- package/esm/src/templates/module/__model__.document.js +2 -8
- package/esm/src/templates/module/__model__.service.js +2 -3
- package/esm/src/templates/module/__model__.signal.js +4 -5
- package/esm/src/templates/module/__model__.store.js +3 -4
- package/esm/src/templates/server.js +5 -4
- package/esm/src/templates/workspaceRoot/.gitignore.template +5 -3
- package/package.json +1 -1
- package/src/application/application.command.d.ts +7 -7
- package/src/application/application.script.d.ts +3 -1
- package/src/guidelines/___library/sharedUiStructureDescription.en.md +1 -1
- package/src/guidelines/databaseModule/databaseModule.instruction.md +9 -21
- package/src/guidelines/fieldDecorator/fieldDecorator.instruction.md +0 -5
- package/src/guidelines/framework/framework.instruction.md +10 -12
- package/src/guidelines/modelConstant/modelConstant.instruction.md +14 -19
- package/src/guidelines/modelDocument/modelDocument.instruction.md +0 -24
- package/src/guidelines/modelService/modelService.instruction.md +12 -75
- package/src/guidelines/modelSignal/modelSignal.instruction.md +2 -38
- package/src/guidelines/modelStore/modelStore.instruction.md +1 -3
- package/src/guidelines/modelTemplate/modelTemplate.instruction.md +2 -2
- package/src/guidelines/modelUnit/modelUnit.instruction.md +2 -2
- package/src/guidelines/scalarConstant/scalarConstant.instruction.md +6 -11
- package/src/templates/lib/useServer.d.ts +4 -0
- package/src/workspace/workspace.command.d.ts +1 -0
- package/src/workspace/workspace.script.d.ts +1 -0
- package/esm/src/templates/lib/usePage.js +0 -13
- /package/src/templates/lib/{usePage.d.ts → useClient.d.ts} +0 -0
|
@@ -30,19 +30,21 @@ function getContent(scanInfo, dict = {}) {
|
|
|
30
30
|
const serviceModules = [...scanInfo.service.entries()].filter(([_, fileTypes]) => fileTypes.has("store")).map(([key]) => key);
|
|
31
31
|
return `
|
|
32
32
|
"use client";
|
|
33
|
-
import {
|
|
34
|
-
import { MixStore,
|
|
33
|
+
import { st as baseSt, StoreOf } from "@akanjs/store";
|
|
34
|
+
import { MixStore, storeInfo } from "@akanjs/store";
|
|
35
35
|
|
|
36
36
|
import { libStores } from "./__lib/lib.store";
|
|
37
37
|
${databaseModules.map((module2) => `import { ${capitalize(module2)}Store } from "./${module2}/${module2}.store";`).join("\n")}
|
|
38
38
|
${serviceModules.map((module2) => `import { ${capitalize(module2)}Store } from "./_${module2}/${module2}.store";`).join("\n")}
|
|
39
39
|
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
) {}
|
|
40
|
+
${databaseModules.map((module2) => `export { ${capitalize(module2)}Store } from "./${module2}/${module2}.store";`).join("\n")}
|
|
41
|
+
${serviceModules.map((module2) => `export { ${capitalize(module2)}Store } from "./_${module2}/${module2}.store";`).join("\n")}
|
|
42
|
+
|
|
43
|
+
${databaseModules.map((module2) => `export const ${module2} = storeInfo.register("${module2}" as const, ${capitalize(module2)}Store);`).join("\n")}
|
|
44
|
+
${serviceModules.map((module2) => `export const ${module2} = storeInfo.register("${module2}" as const, ${capitalize(module2)}Store);`).join("\n")}
|
|
45
|
+
|
|
46
|
+
export class RootStore extends MixStore(...libStores, ${[...databaseModules, ...serviceModules].join(",\n ")}) {}
|
|
44
47
|
|
|
45
|
-
export const
|
|
46
|
-
export const st = makeStore(baseSt, store${scanInfo.type === "lib" ? `, { library: true }` : ""});
|
|
48
|
+
export const st = baseSt as StoreOf<RootStore>;
|
|
47
49
|
`;
|
|
48
50
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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/lib/useClient.ts
|
|
20
|
+
var useClient_exports = {};
|
|
21
|
+
__export(useClient_exports, {
|
|
22
|
+
default: () => getContent
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(useClient_exports);
|
|
25
|
+
function getContent(scanInfo, dict = {}) {
|
|
26
|
+
return `
|
|
27
|
+
import { makePageProto } from "@akanjs/client";
|
|
28
|
+
import type * as signal from "./sig";
|
|
29
|
+
import * as cnst from "./cnst";
|
|
30
|
+
|
|
31
|
+
import type { dictionary } from "./dict";
|
|
32
|
+
|
|
33
|
+
export const { msg, Revert, usePage, sig, fetch, registerClient } = makePageProto<
|
|
34
|
+
typeof dictionary,
|
|
35
|
+
typeof signal.fetch,
|
|
36
|
+
typeof signal
|
|
37
|
+
>(cnst);
|
|
38
|
+
`;
|
|
39
|
+
}
|
|
@@ -16,18 +16,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
};
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
|
|
19
|
-
// pkgs/@akanjs/cli/src/templates/lib/
|
|
20
|
-
var
|
|
21
|
-
__export(
|
|
19
|
+
// pkgs/@akanjs/cli/src/templates/lib/useServer.ts
|
|
20
|
+
var useServer_exports = {};
|
|
21
|
+
__export(useServer_exports, {
|
|
22
22
|
default: () => getContent
|
|
23
23
|
});
|
|
24
|
-
module.exports = __toCommonJS(
|
|
24
|
+
module.exports = __toCommonJS(useServer_exports);
|
|
25
25
|
function getContent(scanInfo, dict = {}) {
|
|
26
26
|
return `
|
|
27
|
-
import {
|
|
27
|
+
import type { fetch as sigFetch } from "./sig";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const { msg, Revert, usePage } = makePageProto<typeof dictionary>();
|
|
29
|
+
export const fetch = global.fetch as unknown as typeof sigFetch;
|
|
32
30
|
`;
|
|
33
31
|
}
|
|
@@ -24,11 +24,10 @@ __export(libName_service_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(libName_service_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
import {
|
|
27
|
+
import { serve } from "@akanjs/service";
|
|
28
28
|
|
|
29
29
|
// import type * as srv from "../srv";
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
export class ${dict.LibName}Service extends LogService("${dict.libName}Service") {}
|
|
31
|
+
export class ${dict.LibName}Service extends serve("${dict.libName}" as const, { serverMode: "batch" }) {}
|
|
33
32
|
`;
|
|
34
33
|
}
|
|
@@ -24,10 +24,9 @@ __export(libName_store_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(libName_store_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
import {
|
|
27
|
+
import { store } from "@akanjs/store";
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
export class ${dict.LibName}Store extends scalarStateOf("${dict.libName}" as const, {
|
|
29
|
+
export class ${dict.LibName}Store extends store("${dict.libName}" as const, {
|
|
31
30
|
// state
|
|
32
31
|
}) {
|
|
33
32
|
// action
|
|
@@ -25,43 +25,23 @@ module.exports = __toCommonJS(model_constant_exports);
|
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
27
|
import { enumOf, Int } from "@akanjs/base";
|
|
28
|
-
import {
|
|
28
|
+
import { via } from "@akanjs/constant";
|
|
29
29
|
|
|
30
30
|
export const ${dict.Model}Status = enumOf(["active"] as const);
|
|
31
31
|
export type ${dict.Model}Status = enumOf<typeof ${dict.Model}Status>;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
field: string | null;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Model.Object("${dict.Model}Object")
|
|
40
|
-
export class ${dict.Model}Object extends via(${dict.Model}Input) {
|
|
41
|
-
@Field.Prop(() => String, { enum: ${dict.Model}Status, default: "active" })
|
|
42
|
-
status: ${dict.Model}Status;
|
|
43
|
-
}
|
|
33
|
+
export class ${dict.Model}Input extends via((field) => ({
|
|
34
|
+
field: field(String).optional(),
|
|
35
|
+
})) {}
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
|
|
37
|
+
export class ${dict.Model}Object extends via(${dict.Model}Input, (field) => ({
|
|
38
|
+
status: field(${dict.Model}Status, { default: "active" }),
|
|
39
|
+
})) {}
|
|
47
40
|
|
|
48
|
-
|
|
49
|
-
export class ${dict.Model} extends via(${dict.Model}Object, Light${dict.Model}) {}
|
|
41
|
+
export class Light${dict.Model} extends via(${dict.Model}Object, ["status"] as const, (resolve) => ({})) {}
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
export class ${dict.Model}Insight {
|
|
53
|
-
@Field.Prop(() => Int, { default: 0, accumulate: { $sum: 1 } })
|
|
54
|
-
count: number;
|
|
55
|
-
}
|
|
43
|
+
export class ${dict.Model} extends via(${dict.Model}Object, Light${dict.Model}, (resolve) => ({})) {}
|
|
56
44
|
|
|
57
|
-
|
|
58
|
-
export class ${dict.Model}Filter extends sortOf(${dict.Model}, {}) {
|
|
59
|
-
@Filter.Mongo()
|
|
60
|
-
inStatus(
|
|
61
|
-
@Filter.Arg("status", () => String) status: ${dict.Model}Status,
|
|
62
|
-
) {
|
|
63
|
-
return { status };
|
|
64
|
-
}
|
|
65
|
-
}
|
|
45
|
+
export class ${dict.Model}Insight extends via(${dict.Model}, (field) => ({})) {}
|
|
66
46
|
`;
|
|
67
47
|
}
|
|
@@ -29,7 +29,7 @@ import { baseTrans, getBaseSignalTrans, ModelDictionary, SignalDictionary } from
|
|
|
29
29
|
import type { ${dict.Model}, ${dict.Model}Filter, ${dict.Model}Insight, ${dict.Model}Summary } from "./${dict.model}.constant";
|
|
30
30
|
import type { ${dict.Model}Signal } from "./${dict.model}.signal";
|
|
31
31
|
|
|
32
|
-
const modelDictionary = {
|
|
32
|
+
export const modelDictionary = {
|
|
33
33
|
...baseTrans,
|
|
34
34
|
modelName: ["${dict.Model}", "${dict.Model}"],
|
|
35
35
|
modelDesc: [
|
|
@@ -60,7 +60,7 @@ const modelDictionary = {
|
|
|
60
60
|
// * ==================== Etc ==================== * //
|
|
61
61
|
} satisfies ModelDictionary<${dict.Model}, ${dict.Model}Insight, ${dict.Model}Filter>;
|
|
62
62
|
|
|
63
|
-
const signalDictionary = {
|
|
63
|
+
export const signalDictionary = {
|
|
64
64
|
...getBaseSignalTrans("${dict.model}" as const),
|
|
65
65
|
// * ==================== Endpoint ==================== * //
|
|
66
66
|
"api-${dict.model}ListInPublic": ["${dict.Model} List In Public", "\uACF5\uAC1C\uB41C ${dict.Model} \uB9AC\uC2A4\uD2B8"],
|
|
@@ -24,20 +24,14 @@ __export(model_document_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(model_document_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
import { beyond, by,
|
|
27
|
+
import { beyond, by, into, type SchemaOf } from "@akanjs/document";
|
|
28
28
|
|
|
29
29
|
import * as cnst from "../cnst";
|
|
30
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
31
|
export class ${dict.Model} extends by(cnst.${dict.Model}) {}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
export class ${dict.Model}Model extends into(${dict.Model}, cnst.${dict.model}Cnst) {}
|
|
33
|
+
export class ${dict.Model}Model extends into(${dict.Model}, cnst.${dict.model}) {}
|
|
39
34
|
|
|
40
|
-
@Database.Middleware(() => cnst.${dict.Model})
|
|
41
35
|
export class ${dict.Model}Middleware extends beyond(${dict.Model}Model, ${dict.Model}) {
|
|
42
36
|
onSchema(schema: SchemaOf<${dict.Model}Model, ${dict.Model}>) {
|
|
43
37
|
// schema.index({ status: 1 })
|
|
@@ -24,12 +24,11 @@ __export(model_service_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(model_service_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
import {
|
|
27
|
+
import { serve } from "@akanjs/service";
|
|
28
28
|
|
|
29
29
|
import * as cnst from "../cnst";
|
|
30
30
|
import * as db from "../db";
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
export class ${dict.Model}Service extends DbService(db.${dict.model}Db) {}
|
|
32
|
+
export class ${dict.Model}Service extends serve(db.${dict.model}) {}
|
|
34
33
|
`;
|
|
35
34
|
}
|
|
@@ -25,14 +25,13 @@ module.exports = __toCommonJS(model_signal_exports);
|
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
27
|
import { Int } from "@akanjs/base";
|
|
28
|
-
import { SortOf } from "@akanjs/
|
|
29
|
-
import { Arg,
|
|
28
|
+
import type { SortOf } from "@akanjs/document";
|
|
29
|
+
import { Arg, signal, Mutation, Query, resolve } from "@akanjs/signal";
|
|
30
30
|
|
|
31
31
|
import * as cnst from "../cnst";
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
guards: { get: Query.Public, cru: Mutation.Public },
|
|
33
|
+
export class ${dict.Model}Signal extends signal(cnst.${dict.model}, cnst.Srvs, {
|
|
34
|
+
guards: { get: "Public", cru: "Public },
|
|
36
35
|
}) {
|
|
37
36
|
// * /////////////////////////////////////
|
|
38
37
|
// * Public Slice
|
|
@@ -24,13 +24,12 @@ __export(model_store_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(model_store_exports);
|
|
25
25
|
function getContent(scanInfo, dict) {
|
|
26
26
|
return `
|
|
27
|
-
import {
|
|
27
|
+
import { store } from "@akanjs/store";
|
|
28
28
|
|
|
29
29
|
import * as cnst from "../cnst";
|
|
30
|
-
import { fetch } from "../
|
|
30
|
+
import { fetch, sig } from "../useClient";
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
export class ${dict.Model}Store extends stateOf(fetch.${dict.model}Gql, {
|
|
32
|
+
export class ${dict.Model}Store extends store(sig.${dict.model}, {
|
|
34
33
|
// state
|
|
35
34
|
}) {
|
|
36
35
|
// action
|
|
@@ -34,17 +34,17 @@ function getContent(scanInfo, dict = {}) {
|
|
|
34
34
|
import { databaseModuleOf, scalarModulesOf, serviceModuleOf, type Module } from "@akanjs/server";
|
|
35
35
|
${libs.map((lib) => `import { registerModules as register${capitalize(lib)}Modules } from "@${lib}/server";`).join("\n")}
|
|
36
36
|
|
|
37
|
-
import * as db from "./lib/db";
|
|
38
|
-
import { allSrvs } from "./lib/srv";
|
|
39
37
|
import * as cnst from "./lib/cnst";
|
|
38
|
+
import * as db from "./lib/db";
|
|
40
39
|
import * as srv from "./lib/srv";
|
|
40
|
+
import { allSrvs } from "./lib/srv";
|
|
41
41
|
import * as sig from "./lib/sig";
|
|
42
42
|
import { type ModulesOptions, registerGlobalModule } from "./lib/option";
|
|
43
43
|
|
|
44
44
|
// database modules
|
|
45
45
|
${databaseModules.map(([model]) => {
|
|
46
46
|
const Model = capitalize(model);
|
|
47
|
-
return `const register${Model}Module = () => databaseModuleOf({ constant: cnst.${model}
|
|
47
|
+
return `const register${Model}Module = () => databaseModuleOf({ constant: cnst.${model}, database: db.${model}, signal: sig.${Model}Signal, service: srv.${Model}Service }, allSrvs);`;
|
|
48
48
|
}).join("\n")}
|
|
49
49
|
|
|
50
50
|
// service modules
|
|
@@ -70,9 +70,10 @@ ${databaseModules.map(([model]) => ` register${capitalize(model)}Module(),`).
|
|
|
70
70
|
export { env } from "./env/env.server.testing";
|
|
71
71
|
export * as db from "./lib/db";
|
|
72
72
|
export * as srv from "./lib/srv";
|
|
73
|
+
export * as sig from "./lib/sig";
|
|
73
74
|
export * as option from "./lib/option";
|
|
74
75
|
export * as cnst from "./lib/cnst";
|
|
75
76
|
export { fetch } from "./lib/sig";
|
|
76
|
-
export * from "./lib/dict";
|
|
77
|
+
export * as dict from "./lib/dict";
|
|
77
78
|
`;
|
|
78
79
|
}
|
|
@@ -90,7 +90,8 @@ apps/*/lib/db.ts
|
|
|
90
90
|
apps/*/lib/srv.ts
|
|
91
91
|
apps/*/lib/st.ts
|
|
92
92
|
apps/*/lib/sig.ts
|
|
93
|
-
apps/*/lib/
|
|
93
|
+
apps/*/lib/useClient.ts
|
|
94
|
+
apps/*/lib/useServer.ts
|
|
94
95
|
apps/*/lib/*/index.tsx
|
|
95
96
|
apps/*/client.ts
|
|
96
97
|
apps/*/server.ts
|
|
@@ -100,8 +101,9 @@ libs/*/lib/db.ts
|
|
|
100
101
|
libs/*/lib/srv.ts
|
|
101
102
|
libs/*/lib/st.ts
|
|
102
103
|
libs/*/lib/sig.ts
|
|
103
|
-
libs/*/lib/
|
|
104
|
-
|
|
104
|
+
libs/*/lib/useClient.ts
|
|
105
|
+
libs/*/lib/useServer.ts
|
|
106
|
+
libs/*/lib/*/index.tsx
|
|
105
107
|
libs/*/client.ts
|
|
106
108
|
libs/*/server.ts
|
|
107
109
|
libs/*/index.ts
|
package/esm/index.js
CHANGED
|
@@ -603,30 +603,6 @@ var withBase = (appName, config, libs, routes = []) => {
|
|
|
603
603
|
"@akanjs/ui"
|
|
604
604
|
]
|
|
605
605
|
},
|
|
606
|
-
// modularizeImports: {
|
|
607
|
-
// "react-icons/?(((\\w*)?/?)*)": {
|
|
608
|
-
// transform: "@react-icons/all-files/{{ matches.[1] }}/{{member}}",
|
|
609
|
-
// skipDefaultConversion: true,
|
|
610
|
-
// },
|
|
611
|
-
// lodash: { transform: "lodash/{{member}}", preventFullImport: true },
|
|
612
|
-
// ...Object.fromEntries(
|
|
613
|
-
// [appName, ...libs].reduce(
|
|
614
|
-
// (acc, lib) => [
|
|
615
|
-
// ...acc,
|
|
616
|
-
// [`@${lib}/ui`, { transform: `@${lib}/ui/{{member}}`, skipDefaultConversion: true }],
|
|
617
|
-
// [`@${lib}/next`, { transform: `@${lib}/next/{{member}}`, skipDefaultConversion: true }],
|
|
618
|
-
// [`@${lib}/common`, { transform: `@${lib}/common/{{member}}`, skipDefaultConversion: true }],
|
|
619
|
-
// [`@${lib}/client`, { transform: `@${lib}/lib/{{ camelCase member }}`, skipDefaultConversion: true }],
|
|
620
|
-
// ],
|
|
621
|
-
// [
|
|
622
|
-
// ["@contract", { transform: `@contract/src/{{member}}`, skipDefaultConversion: true }],
|
|
623
|
-
// [`@akanjs/next`, { transform: `@akanjs/next/src/{{member}}`, skipDefaultConversion: true }],
|
|
624
|
-
// [`@akanjs/common`, { transform: `@akanjs/common/src/{{member}}`, skipDefaultConversion: true }],
|
|
625
|
-
// ]
|
|
626
|
-
// )
|
|
627
|
-
// ),
|
|
628
|
-
// ...(config.modularizeImports ?? {}),
|
|
629
|
-
// },
|
|
630
606
|
images: {
|
|
631
607
|
formats: ["image/avif", "image/webp"],
|
|
632
608
|
...config.images ?? {},
|
|
@@ -641,8 +617,14 @@ var withBase = (appName, config, libs, routes = []) => {
|
|
|
641
617
|
]
|
|
642
618
|
},
|
|
643
619
|
webpack: (config2) => {
|
|
620
|
+
const watchOptions = config2.watchOptions;
|
|
644
621
|
config2.resolve.alias.canvas = false;
|
|
645
622
|
config2.resolve.alias.encoding = false;
|
|
623
|
+
const ignored = watchOptions?.ignored ? typeof watchOptions.ignored === "string" ? [watchOptions.ignored] : watchOptions.ignored : [];
|
|
624
|
+
config2.watchOptions = {
|
|
625
|
+
...config2.watchOptions ?? {},
|
|
626
|
+
...{ ignored: [...ignored, "**/node_modules/**", "**/.git/**", "**/.next/**", "**/dist/**", "**/local/**"] }
|
|
627
|
+
};
|
|
646
628
|
return config2;
|
|
647
629
|
},
|
|
648
630
|
turbopack: {
|
|
@@ -2628,12 +2610,12 @@ var AppExecutor = class _AppExecutor extends SysExecutor {
|
|
|
2628
2610
|
]);
|
|
2629
2611
|
await Promise.all([
|
|
2630
2612
|
...targetPublicDeps.map(
|
|
2631
|
-
(dep) =>
|
|
2613
|
+
(dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/public`, `${projectPublicLibPath}/${dep}`, {
|
|
2632
2614
|
recursive: true
|
|
2633
2615
|
})
|
|
2634
2616
|
),
|
|
2635
2617
|
...targetAssetsDeps.map(
|
|
2636
|
-
(dep) =>
|
|
2618
|
+
(dep) => fsPromise.cp(`${this.workspace.workspaceRoot}/libs/${dep}/assets`, `${projectAssetsLibPath}/${dep}`, {
|
|
2637
2619
|
recursive: true
|
|
2638
2620
|
})
|
|
2639
2621
|
)
|
|
@@ -4336,6 +4318,7 @@ var ApplicationRunner = class {
|
|
|
4336
4318
|
write: false,
|
|
4337
4319
|
entryPoints: [`${app.cwdPath}/main.ts`],
|
|
4338
4320
|
bundle: true,
|
|
4321
|
+
minify: true,
|
|
4339
4322
|
format: "cjs",
|
|
4340
4323
|
packages: "external",
|
|
4341
4324
|
platform: "node",
|
|
@@ -4349,7 +4332,6 @@ var ApplicationRunner = class {
|
|
|
4349
4332
|
name: `${app.name}/backend`,
|
|
4350
4333
|
description: `${app.name} backend`,
|
|
4351
4334
|
version: "1.0.0",
|
|
4352
|
-
// type: "module",
|
|
4353
4335
|
main: "./main.js",
|
|
4354
4336
|
engines: { node: ">=20" },
|
|
4355
4337
|
dependencies
|
|
@@ -4363,6 +4345,7 @@ var ApplicationRunner = class {
|
|
|
4363
4345
|
write: true,
|
|
4364
4346
|
entryPoints: [`${app.cwdPath}/main.ts`],
|
|
4365
4347
|
bundle: true,
|
|
4348
|
+
minify: false,
|
|
4366
4349
|
packages: "external",
|
|
4367
4350
|
platform: "node",
|
|
4368
4351
|
format: "cjs",
|
|
@@ -4444,6 +4427,7 @@ var ApplicationRunner = class {
|
|
|
4444
4427
|
outDir: `${app.dist.cwdPath}/csr`,
|
|
4445
4428
|
sourcemap: false,
|
|
4446
4429
|
emptyOutDir: true,
|
|
4430
|
+
minify: true,
|
|
4447
4431
|
rollupOptions: {
|
|
4448
4432
|
// ...(process.env.USE_AKANJS_PKGS === "true" ? {} : { external: ["next/server"] }),
|
|
4449
4433
|
input: `${app.cwdPath}/app/index.html`
|
|
@@ -4829,6 +4813,12 @@ var ApplicationScript = class {
|
|
|
4829
4813
|
await this.#runner.removeApplication(app);
|
|
4830
4814
|
spinner.succeed(`Application ${app.name} (apps/${app.name}) removed`);
|
|
4831
4815
|
}
|
|
4816
|
+
async sync(sys3) {
|
|
4817
|
+
if (sys3.type === "app")
|
|
4818
|
+
await this.syncApplication(sys3);
|
|
4819
|
+
else
|
|
4820
|
+
await this.libraryScript.syncLibrary(sys3);
|
|
4821
|
+
}
|
|
4832
4822
|
async syncApplication(app) {
|
|
4833
4823
|
const spinner = app.spinning("Scanning application...");
|
|
4834
4824
|
const scanInfo = await this.#runner.scanSync(app);
|
|
@@ -4844,15 +4834,16 @@ var ApplicationScript = class {
|
|
|
4844
4834
|
await this.syncApplication(app);
|
|
4845
4835
|
await Promise.all([this.buildBackend(app, { sync: false }), this.buildFrontend(app, { sync: false })]);
|
|
4846
4836
|
}
|
|
4847
|
-
async start(app, { dbup = true, open: open2 = false } = {}) {
|
|
4837
|
+
async start(app, { dbup = true, open: open2 = false, sync = true } = {}) {
|
|
4848
4838
|
const needDbup = app.getEnv() === "local" && dbup;
|
|
4849
|
-
|
|
4839
|
+
if (sync)
|
|
4840
|
+
await this.syncApplication(app);
|
|
4850
4841
|
if (needDbup)
|
|
4851
4842
|
await this.dbup(app.workspace);
|
|
4852
4843
|
const [backend, frontend, { server: csrServer, eventEmitter: csr }] = await Promise.all([
|
|
4853
4844
|
this.startBackend(app, { open: open2, withInk: true, sync: false }),
|
|
4854
4845
|
this.startFrontend(app, { open: open2, withInk: true, sync: false }),
|
|
4855
|
-
this.startCsr(app, { open: open2, withInk: true })
|
|
4846
|
+
this.startCsr(app, { open: open2, withInk: true, sync: false })
|
|
4856
4847
|
]);
|
|
4857
4848
|
process.on("SIGINT", async () => {
|
|
4858
4849
|
await csrServer.close();
|
|
@@ -5037,8 +5028,8 @@ var ApplicationCommand = class {
|
|
|
5037
5028
|
async removeApplication(app) {
|
|
5038
5029
|
await this.applicationScript.removeApplication(app);
|
|
5039
5030
|
}
|
|
5040
|
-
async
|
|
5041
|
-
await this.applicationScript.
|
|
5031
|
+
async sync(sys3) {
|
|
5032
|
+
await this.applicationScript.sync(sys3);
|
|
5042
5033
|
}
|
|
5043
5034
|
async script(app, filename) {
|
|
5044
5035
|
await this.applicationScript.script(app, filename);
|
|
@@ -5061,23 +5052,23 @@ var ApplicationCommand = class {
|
|
|
5061
5052
|
async buildAndroid(app) {
|
|
5062
5053
|
await this.applicationScript.buildAndroid(app);
|
|
5063
5054
|
}
|
|
5064
|
-
async start(app, open2) {
|
|
5065
|
-
await this.applicationScript.start(app, { open: open2 });
|
|
5055
|
+
async start(app, open2, sync) {
|
|
5056
|
+
await this.applicationScript.start(app, { open: open2, sync });
|
|
5066
5057
|
}
|
|
5067
|
-
async startBackend(app, open2) {
|
|
5068
|
-
await this.applicationScript.startBackend(app, { open: open2 });
|
|
5058
|
+
async startBackend(app, open2, sync) {
|
|
5059
|
+
await this.applicationScript.startBackend(app, { open: open2, sync });
|
|
5069
5060
|
}
|
|
5070
|
-
async startFrontend(app, open2, turbo) {
|
|
5071
|
-
await this.applicationScript.startFrontend(app, { open: open2, turbo });
|
|
5061
|
+
async startFrontend(app, open2, turbo, sync) {
|
|
5062
|
+
await this.applicationScript.startFrontend(app, { open: open2, turbo, sync });
|
|
5072
5063
|
}
|
|
5073
|
-
async startCsr(app, open2) {
|
|
5074
|
-
await this.applicationScript.startCsr(app, { open: open2 });
|
|
5064
|
+
async startCsr(app, open2, sync) {
|
|
5065
|
+
await this.applicationScript.startCsr(app, { open: open2, sync });
|
|
5075
5066
|
}
|
|
5076
|
-
async startIos(app, open2, release) {
|
|
5077
|
-
await this.applicationScript.startIos(app, { open: open2, operation: release ? "release" : "local" });
|
|
5067
|
+
async startIos(app, open2, release, sync) {
|
|
5068
|
+
await this.applicationScript.startIos(app, { open: open2, operation: release ? "release" : "local", sync });
|
|
5078
5069
|
}
|
|
5079
|
-
async startAndroid(app, open2, release) {
|
|
5080
|
-
await this.applicationScript.startAndroid(app, { open: open2, operation: release ? "release" : "local" });
|
|
5070
|
+
async startAndroid(app, open2, release, sync) {
|
|
5071
|
+
await this.applicationScript.startAndroid(app, { open: open2, operation: release ? "release" : "local", sync });
|
|
5081
5072
|
}
|
|
5082
5073
|
async releaseIos(app) {
|
|
5083
5074
|
await this.applicationScript.releaseIos(app);
|
|
@@ -5122,8 +5113,8 @@ __decorateClass([
|
|
|
5122
5113
|
], ApplicationCommand.prototype, "removeApplication", 1);
|
|
5123
5114
|
__decorateClass([
|
|
5124
5115
|
Target.Public(),
|
|
5125
|
-
__decorateParam(0,
|
|
5126
|
-
], ApplicationCommand.prototype, "
|
|
5116
|
+
__decorateParam(0, Sys())
|
|
5117
|
+
], ApplicationCommand.prototype, "sync", 1);
|
|
5127
5118
|
__decorateClass([
|
|
5128
5119
|
Target.Public(),
|
|
5129
5120
|
__decorateParam(0, App()),
|
|
@@ -5156,35 +5147,41 @@ __decorateClass([
|
|
|
5156
5147
|
__decorateClass([
|
|
5157
5148
|
Target.Public({ short: true }),
|
|
5158
5149
|
__decorateParam(0, App()),
|
|
5159
|
-
__decorateParam(1, Option("open", { type: "boolean", desc: "open web browser?", default: false }))
|
|
5150
|
+
__decorateParam(1, Option("open", { type: "boolean", desc: "open web browser?", default: false })),
|
|
5151
|
+
__decorateParam(2, Option("sync", { type: "boolean", desc: "sync application", default: true }))
|
|
5160
5152
|
], ApplicationCommand.prototype, "start", 1);
|
|
5161
5153
|
__decorateClass([
|
|
5162
5154
|
Target.Public({ short: true }),
|
|
5163
5155
|
__decorateParam(0, App()),
|
|
5164
|
-
__decorateParam(1, Option("open", { type: "boolean", desc: "open graphql playground", default: false }))
|
|
5156
|
+
__decorateParam(1, Option("open", { type: "boolean", desc: "open graphql playground", default: false })),
|
|
5157
|
+
__decorateParam(2, Option("sync", { type: "boolean", desc: "sync application", default: true }))
|
|
5165
5158
|
], ApplicationCommand.prototype, "startBackend", 1);
|
|
5166
5159
|
__decorateClass([
|
|
5167
5160
|
Target.Public({ short: true }),
|
|
5168
5161
|
__decorateParam(0, App()),
|
|
5169
5162
|
__decorateParam(1, Option("open", { type: "boolean", desc: "open web browser", default: false })),
|
|
5170
|
-
__decorateParam(2, Option("turbo", { type: "boolean", desc: "turbo", default: false }))
|
|
5163
|
+
__decorateParam(2, Option("turbo", { type: "boolean", desc: "turbo", default: false })),
|
|
5164
|
+
__decorateParam(3, Option("sync", { type: "boolean", desc: "sync application", default: true }))
|
|
5171
5165
|
], ApplicationCommand.prototype, "startFrontend", 1);
|
|
5172
5166
|
__decorateClass([
|
|
5173
5167
|
Target.Public({ short: true }),
|
|
5174
5168
|
__decorateParam(0, App()),
|
|
5175
|
-
__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 }))
|
|
5176
5171
|
], ApplicationCommand.prototype, "startCsr", 1);
|
|
5177
5172
|
__decorateClass([
|
|
5178
5173
|
Target.Public({ short: true }),
|
|
5179
5174
|
__decorateParam(0, App()),
|
|
5180
5175
|
__decorateParam(1, Option("open", { type: "boolean", desc: "open ios simulator", default: false })),
|
|
5181
|
-
__decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
|
|
5176
|
+
__decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false })),
|
|
5177
|
+
__decorateParam(3, Option("sync", { type: "boolean", desc: "sync application", default: true }))
|
|
5182
5178
|
], ApplicationCommand.prototype, "startIos", 1);
|
|
5183
5179
|
__decorateClass([
|
|
5184
5180
|
Target.Public({ short: true }),
|
|
5185
5181
|
__decorateParam(0, App()),
|
|
5186
5182
|
__decorateParam(1, Option("open", { type: "boolean", desc: "open android simulator", default: false })),
|
|
5187
|
-
__decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false }))
|
|
5183
|
+
__decorateParam(2, Option("release", { type: "boolean", desc: "release mode", default: false })),
|
|
5184
|
+
__decorateParam(3, Option("sync", { type: "boolean", desc: "sync application", default: true }))
|
|
5188
5185
|
], ApplicationCommand.prototype, "startAndroid", 1);
|
|
5189
5186
|
__decorateClass([
|
|
5190
5187
|
Target.Public(),
|
|
@@ -6390,6 +6387,13 @@ var WorkspaceScript = class {
|
|
|
6390
6387
|
...pkgNames.filter((pkgName) => pkgName !== "contract").map((pkgName) => this.#runner.lint(PkgExecutor.from(workspace, pkgName), workspace, { fix }))
|
|
6391
6388
|
]);
|
|
6392
6389
|
}
|
|
6390
|
+
async syncAll(workspace) {
|
|
6391
|
+
const [appNames, libNames] = await workspace.getExecs();
|
|
6392
|
+
for (const libName of libNames)
|
|
6393
|
+
await this.libraryScript.syncLibrary(LibExecutor.from(workspace, libName));
|
|
6394
|
+
for (const appName of appNames)
|
|
6395
|
+
await this.applicationScript.syncApplication(AppExecutor.from(workspace, appName));
|
|
6396
|
+
}
|
|
6393
6397
|
};
|
|
6394
6398
|
|
|
6395
6399
|
// pkgs/@akanjs/cli/src/workspace/workspace.command.ts
|
|
@@ -6411,6 +6415,9 @@ var WorkspaceCommand = class {
|
|
|
6411
6415
|
async lintAll(fix, workspace) {
|
|
6412
6416
|
await this.workspaceScript.lintAll(workspace, { fix });
|
|
6413
6417
|
}
|
|
6418
|
+
async syncAll(workspace) {
|
|
6419
|
+
await this.workspaceScript.syncAll(workspace);
|
|
6420
|
+
}
|
|
6414
6421
|
};
|
|
6415
6422
|
__decorateClass([
|
|
6416
6423
|
Target.Public(),
|
|
@@ -6433,6 +6440,10 @@ __decorateClass([
|
|
|
6433
6440
|
__decorateParam(0, Option("fix", { type: "boolean", default: true })),
|
|
6434
6441
|
__decorateParam(1, Workspace())
|
|
6435
6442
|
], WorkspaceCommand.prototype, "lintAll", 1);
|
|
6443
|
+
__decorateClass([
|
|
6444
|
+
Target.Public(),
|
|
6445
|
+
__decorateParam(0, Workspace())
|
|
6446
|
+
], WorkspaceCommand.prototype, "syncAll", 1);
|
|
6436
6447
|
WorkspaceCommand = __decorateClass([
|
|
6437
6448
|
Commands()
|
|
6438
6449
|
], 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('
|
|
98
|
+
placeholder?: string; // Default: "~ \${l('base.priceUnit')}"
|
|
99
99
|
}
|
|
100
100
|
\`\`\`
|
|
101
101
|
Key features:
|