@nan0web/core 1.1.2 → 3.1.0
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/README.md +11 -0
- package/package.json +15 -10
- package/src/AppCore.js +4 -1
- package/src/ProjectModel.js +1 -1
- package/src/index.js +4 -10
- package/types/AppCore.d.ts +1 -1
- package/types/ProjectModel.d.ts +1 -1
- package/types/index.d.ts +4 -8
- package/src/Model.js +0 -3
- package/types/Model.d.ts +0 -2
package/README.md
CHANGED
|
@@ -8,16 +8,19 @@ DB‑backed state container with built‑in internationalisation.
|
|
|
8
8
|
## Installation
|
|
9
9
|
|
|
10
10
|
How to install with npm?
|
|
11
|
+
|
|
11
12
|
```bash
|
|
12
13
|
npm install @nan0web/core
|
|
13
14
|
```
|
|
14
15
|
|
|
15
16
|
How to install with pnpm?
|
|
17
|
+
|
|
16
18
|
```bash
|
|
17
19
|
pnpm add @nan0web/core
|
|
18
20
|
```
|
|
19
21
|
|
|
20
22
|
How to install with yarn?
|
|
23
|
+
|
|
21
24
|
```bash
|
|
22
25
|
yarn add @nan0web/core
|
|
23
26
|
```
|
|
@@ -27,6 +30,7 @@ yarn add @nan0web/core
|
|
|
27
30
|
Create an `AppCore` instance with a mock DB and inspect its state.
|
|
28
31
|
|
|
29
32
|
How to instantiate AppCore?
|
|
33
|
+
|
|
30
34
|
```js
|
|
31
35
|
import { AppCore } from "@nan0web/core"
|
|
32
36
|
const db = new DB()
|
|
@@ -39,6 +43,7 @@ console.info(core.uri) // ← /demo
|
|
|
39
43
|
Load translation JSON from the DB and obtain a translation function.
|
|
40
44
|
|
|
41
45
|
How does bootstrapI18n load translations?
|
|
46
|
+
|
|
42
47
|
```js
|
|
43
48
|
const db = new DB({
|
|
44
49
|
predefined: [['i18n/uk.json', { hello: 'Вітаю!' }]],
|
|
@@ -52,6 +57,7 @@ console.info(result) // ← Вітаю!
|
|
|
52
57
|
## State inspection
|
|
53
58
|
|
|
54
59
|
How to retrieve current state?
|
|
60
|
+
|
|
55
61
|
```js
|
|
56
62
|
const db = new DB()
|
|
57
63
|
const core = new AppCore({ db })
|
|
@@ -60,6 +66,7 @@ const state = core.state()
|
|
|
60
66
|
## AppResult helper
|
|
61
67
|
|
|
62
68
|
How to create an AppResult instance?
|
|
69
|
+
|
|
63
70
|
```js
|
|
64
71
|
import { AppResult } from "@nan0web/core"
|
|
65
72
|
const res = new AppResult({ content: 'Done', priority: 2, meta: { ok: true } })
|
|
@@ -70,6 +77,7 @@ console.info(res.content[0]) // ← Done
|
|
|
70
77
|
The base `run` method throws an error – subclasses must implement it.
|
|
71
78
|
|
|
72
79
|
How does run() behave when not overridden?
|
|
80
|
+
|
|
73
81
|
```js
|
|
74
82
|
const db = new DB()
|
|
75
83
|
const core = new AppCore({ db })
|
|
@@ -81,6 +89,7 @@ Core components like `AppCore` and `ProjectModel` implement a `static UI`
|
|
|
81
89
|
metadata block defining their semantic display defaults according to the system contract.
|
|
82
90
|
|
|
83
91
|
How to get semantic static UI data?
|
|
92
|
+
|
|
84
93
|
```js
|
|
85
94
|
import { AppCore, ProjectModel } from "@nan0web/core"
|
|
86
95
|
console.info(`${AppCore.UI.icon} ${AppCore.UI.title}`) // ← ⚙️ Application Core
|
|
@@ -92,3 +101,5 @@ How to contribute? - [check here](./CONTRIBUTING.md)
|
|
|
92
101
|
## License
|
|
93
102
|
|
|
94
103
|
How to license ISC? - [check here](./LICENSE)
|
|
104
|
+
|
|
105
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nan0web/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Core application framework for nan0web with database handling, internationalization, and interface connectivity",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -25,20 +25,25 @@
|
|
|
25
25
|
"author": "ЯRаСлав YaRaSLove <support@yaro.page>",
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@nan0web/release": "^1.0.2",
|
|
29
|
-
"@nan0web/test": "^1.1.3",
|
|
30
28
|
"husky": "^9.1.7",
|
|
31
|
-
"knip": "^5.86.0"
|
|
29
|
+
"knip": "^5.86.0",
|
|
30
|
+
"@nan0web/release": "3.1.0",
|
|
31
|
+
"@nan0web/test": "3.1.0"
|
|
32
|
+
},
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"import": "./src/index.js",
|
|
36
|
+
"types": "./types/index.d.ts"
|
|
37
|
+
}
|
|
32
38
|
},
|
|
33
39
|
"dependencies": {
|
|
34
|
-
"@nan0web/db": "
|
|
35
|
-
"@nan0web/i18n": "
|
|
36
|
-
"@nan0web/
|
|
37
|
-
"@nan0web/types": "^1.6.0"
|
|
40
|
+
"@nan0web/db": "3.1.0",
|
|
41
|
+
"@nan0web/i18n": "3.1.0",
|
|
42
|
+
"@nan0web/types": "3.1.0"
|
|
38
43
|
},
|
|
39
44
|
"scripts": {
|
|
40
|
-
"build": "tsc",
|
|
41
|
-
"clean": "rm -rf .cache/ && rm -rf dist/",
|
|
45
|
+
"build": "rm -rf types && tsc",
|
|
46
|
+
"clean": "rm -rf .cache/ && rm -rf dist/ && rm -rf types/",
|
|
42
47
|
"clean:modules": "rm -rf node_modules",
|
|
43
48
|
"precommit": "npm test",
|
|
44
49
|
"prepush": "npm test",
|
package/src/AppCore.js
CHANGED
|
@@ -17,7 +17,10 @@ import AppResult from './AppResult.js'
|
|
|
17
17
|
* @property {Function} t - Translation function
|
|
18
18
|
*/
|
|
19
19
|
export default class AppCore {
|
|
20
|
-
static DB
|
|
20
|
+
static get DB() {
|
|
21
|
+
return DB
|
|
22
|
+
}
|
|
23
|
+
|
|
21
24
|
static UI = {
|
|
22
25
|
title: 'Application Core',
|
|
23
26
|
description: 'Base application logic and state container',
|
package/src/ProjectModel.js
CHANGED
package/src/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { Model } from './Model.js'
|
|
6
|
-
import { ProjectModel } from './ProjectModel.js'
|
|
1
|
+
export { Model, ModelError } from '@nan0web/types'
|
|
2
|
+
export { ProjectModel } from './ProjectModel.js'
|
|
3
|
+
export { default as AppResult } from './AppResult.js'
|
|
4
|
+
export { default as AppCore, default } from './AppCore.js'
|
|
7
5
|
|
|
8
6
|
/** @typedef {import("./AppCore.js").Language} Language */
|
|
9
|
-
|
|
10
|
-
export { AppCore, AppResult, ExecutableCommand, Model, ProjectModel, ModelError }
|
|
11
|
-
|
|
12
|
-
export default AppCore
|
package/types/AppCore.d.ts
CHANGED
package/types/ProjectModel.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { ProjectModel } from "./ProjectModel.js";
|
|
2
|
+
export { default as AppResult } from "./AppResult.js";
|
|
2
3
|
export type Language = import("./AppCore.js").Language;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { ExecutableCommand } from '@nan0web/protocol';
|
|
6
|
-
import { Model } from './Model.js';
|
|
7
|
-
import { ProjectModel } from './ProjectModel.js';
|
|
8
|
-
import { ModelError } from '@nan0web/types';
|
|
9
|
-
export { AppCore, AppResult, ExecutableCommand, Model, ProjectModel, ModelError };
|
|
4
|
+
export { Model, ModelError } from "@nan0web/types";
|
|
5
|
+
export { default as AppCore, default } from "./AppCore.js";
|
package/src/Model.js
DELETED
package/types/Model.d.ts
DELETED