Skip to content

Commit 4aab4e6

Browse files
committed
1.1.0-alpha.0
1 parent 3640f29 commit 4aab4e6

23 files changed

Lines changed: 542 additions & 157 deletions

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [1.1.0] - 2025-08-20
5+
### Added
6+
- Executable class
7+
- CoreKernel Extension
8+
### Changed
9+
- Update Dependencies
10+
- Update Logger level implementation
11+
- Update Database search interface for more complex queries
412
## [1.0.1] - 2024-07-30
513
### Fixed
614
- Bulk operation without cache return zero elements

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2022, GrandlineX
3+
Copyright (c) 2025, GrandlineX
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grandlinex/core",
3-
"version": "1.0.1",
3+
"version": "1.1.0-alpha.0",
44
"description": "Core module",
55
"type": "module",
66
"exports": {
@@ -25,7 +25,7 @@
2525
"build-fix": "node fix.js",
2626
"lint": "eslint src",
2727
"test": "jest --runInBand",
28-
"run": "ts-node-esm src/run.ts",
28+
"run": "node --no-warnings=ExperimentalWarning --loader ts-node/esm src/dev/run.ts",
2929
"pack": "eslint && npm run buildprep && npm pack",
3030
"test-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./coverage\" --reporters=default --reporters=jest-junit",
3131
"doc-converage": "jest --runInBand --ci --collectCoverage --coverageDirectory=\"./docs/coverage\" --reporters=default --reporters=jest-junit",
@@ -46,11 +46,11 @@
4646
"reflect-metadata": "0.2.2"
4747
},
4848
"devDependencies": {
49-
"@types/jest": "29.5.12",
50-
"@types/node": "20.14.13",
49+
"@types/jest": "29.5.14",
50+
"@types/node": "22.15.20",
5151
"@typescript-eslint/eslint-plugin": "7.18.0",
5252
"@typescript-eslint/parser": "7.18.0",
53-
"eslint": "8.57.0",
53+
"eslint": "8.57.1",
5454
"eslint-config-airbnb": "19.0.4",
5555
"eslint-config-airbnb-typescript": "18.0.0",
5656
"eslint-config-prettier": "9.1.0",
@@ -60,19 +60,19 @@
6060
"eslint-plugin-prettier": "5.2.1",
6161
"jest": "29.7.0",
6262
"jest-junit": "16.0.0",
63-
"prettier": "3.3.3",
64-
"ts-jest": "29.1.5",
65-
"ts-loader": "9.5.1",
63+
"prettier": "3.5.3",
64+
"ts-jest": "29.3.4",
65+
"ts-loader": "9.5.2",
6666
"ts-node": "10.9.2",
67-
"typedoc": "0.26.5",
68-
"typescript": "5.5.4"
67+
"typedoc": "0.28.10",
68+
"typescript": "5.9.2"
6969
},
7070
"homepage": "https://www.grandlinex.com/",
7171
"repository": {
7272
"type": "git",
7373
"url": "https://github.com/GrandlineX/core.git"
7474
},
7575
"engines": {
76-
"node": ">=16.0.0"
76+
"node": ">=20.0.0"
7777
}
7878
}

src/CoreKernel.ts

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
} from './modules/index.js';
2525
import CoreModule from './CoreModule.js';
2626
import { XUtil } from './utils/index.js';
27+
import CoreKernelExtension from './classes/CoreKernelExtension.js';
2728

2829
/**
2930
* Core Kernel class
@@ -79,6 +80,8 @@ export default abstract class CoreKernel<
7980

8081
protected eventMap: Map<string, (kernel: CoreKernel<X>) => Promise<unknown>>;
8182

83+
protected extension: Map<string, CoreKernelExtension>;
84+
8285
protected globalLogger: CoreLogger;
8386

8487
/**
@@ -101,6 +104,7 @@ export default abstract class CoreKernel<
101104
this.updateSkip = false;
102105
this.appVersion = 'noVersion';
103106
this.triggerEvent = this.triggerEvent.bind(this);
107+
this.extension = new Map<string, CoreKernelExtension>();
104108
this.eventMap = new Map<
105109
string,
106110
(kernel: CoreKernel<X>) => Promise<unknown>
@@ -296,8 +300,6 @@ export default abstract class CoreKernel<
296300

297301
/**
298302
* register new module
299-
* > In general there are two places to add Modules correctly: In the Kernel constructor or in the pre-trigger-function
300-
*
301303
* @see CoreKernelModule
302304
* @param module
303305
* @typeParam X Type of Crypto client.
@@ -306,6 +308,23 @@ export default abstract class CoreKernel<
306308
this.moduleList.push(...module);
307309
}
308310

311+
/**
312+
* @see CoreKernelExtension
313+
* @param name Name of the extension
314+
* @param ext Extension to add
315+
*/
316+
addExtension(name: string, ext: CoreKernelExtension): void {
317+
this.extension.set(name, ext);
318+
}
319+
320+
/**
321+
* @see CoreKernelExtension
322+
* @param name Name of the extension
323+
*/
324+
getExtension<A extends CoreKernelExtension>(name: string): A | undefined {
325+
return this.extension.get(name) as A | undefined;
326+
}
327+
309328
setBaseModule(module: Y): void {
310329
this.kernelModule = module;
311330
}

src/CoreModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { CoreDBCon, CoreKernelModule } from './classes/index.js';
22
import { InMemCache } from './modules/index.js';
3-
import { OfflineService } from './services/index.js';
3+
import { BackgroundService } from './services/index.js';
44
import { ICoreKernel, ICoreModule } from './lib/index.js';
55
import CoreDb from './database/CoreDb.js';
66

@@ -19,7 +19,7 @@ export default class CoreModule
1919
dbFunc: (mod: CoreModule) => CoreDBCon<any, any>,
2020
) {
2121
super('core', kernel);
22-
this.addService(new OfflineService(this));
22+
this.addService(new BackgroundService(this));
2323
this.cdb = dbFunc(this);
2424
}
2525

src/classes/CoreDBCon.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ICoreKernelModule,
88
ICorePresenter,
99
IDataBase,
10+
QInterfaceSearch,
1011
QueryInterface,
1112
RawQuery,
1213
} from '../lib/index.js';
@@ -277,9 +278,7 @@ export default abstract class CoreDBCon<
277278
*/
278279
abstract findEntity<E extends CoreEntity>(
279280
config: EntityConfig<E>,
280-
search: {
281-
[B in keyof E]?: E[B];
282-
},
281+
search: QInterfaceSearch<E>,
283282
): Promise<E | null>;
284283

285284
/**

src/classes/CoreEntityWrapper.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
import CoreEntity from './CoreEntity.js';
2-
import { ICoreCache, ICoreEntityHandler, QInterface } from '../lib/index.js';
2+
import {
3+
ICoreCache,
4+
ICoreEntityHandler,
5+
QInterface,
6+
QInterfaceSearch,
7+
} from '../lib/index.js';
38
import {
49
ColumnPropMap,
510
ColumnProps,
@@ -150,9 +155,7 @@ export default class CoreEntityWrapper<E extends CoreEntity> {
150155
});
151156
}
152157

153-
async findObj(search: {
154-
[P in keyof E]?: E[P];
155-
}): Promise<E | null> {
158+
async findObj(search: QInterfaceSearch<E>): Promise<E | null> {
156159
return this.e_con.findEntity<E>(
157160
{
158161
className: this.className,

src/classes/CoreKernelExtension.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {
2+
ICoreCache,
3+
ICoreClient,
4+
ICoreElement,
5+
ICoreKernel,
6+
ICoreKernelModule,
7+
ICorePresenter,
8+
IDataBase,
9+
} from '../lib/index.js';
10+
import CoreElement from './CoreElement.js';
11+
12+
export default abstract class CoreKernelExtension<
13+
K extends ICoreKernel<any> = ICoreKernel<any>,
14+
T extends IDataBase<any, any> | null = any,
15+
P extends ICoreClient | null = any,
16+
C extends ICoreCache | null = any,
17+
E extends ICorePresenter<any> | null = any,
18+
>
19+
extends CoreElement<K, T, P, C, E>
20+
implements ICoreElement<K, T, P, C, E>
21+
{
22+
constructor(channel: string, module: ICoreKernelModule<K, T, P, C, E>) {
23+
super(`ex-${channel}`, module);
24+
}
25+
}

0 commit comments

Comments
 (0)