Skip to content

Releases: deepkit/deepkit-framework

v1.0.1-alpha.93

01 May 19:35
Compare
Choose a tag to compare

This release contains a lot of bugfixes and features. We're working towards the first beta release. You can read more about what is included in the beta in its milestone: https://github.com/deepkit/deepkit-framework/milestone/1

Features

  • new ProgressTracker abstraction (2a36a12, c2e6be8, a8d3c95, 3483e20)
    This new abstraction allows to monitor remote progress of a long-running task with a way to abort it.
class MyController {
    @rpc.action()
    async startMigration(): Promise<ProgressTracker> {
        const progressTracker = new ProgressTracker();
        const total = 100;
        const track = progressTracker.track('migration', total); //multiple tracks are possible

        setTimeout(async () => {
            for (let i = 0; i < total; i++) {
                if (!track.running) break; //user aborted
                //to some heavy work

                //both will be streamed to the client
                track.message = `migration: ${table}`;   
                track.done++;   
            }
        });
        
        return progressTracker;
    }
}


const controller = rpcClient.controller<MyController>('/controller');

const progress = await controller.startMigration();
progress.subscribe(() => {
    console.log(`progress: ${progress.done}/${progress.total}: ${progress.message}`);
});

abortButton.onclick = () => progress.stop();

In @deepkit/desktop-ui there is now a new component that shows progress:

<dui-progress-indicator display="vertical" [progressTracker]="progress"></dui-progress-indicator>
Screen.Recording.2023-05-01.at.21.35.33.mov
  • Core: Add range and zip functions (3dcb39c)
    Same as in Python

  • Core-RxJS: Add decoupleSubject + more docs (850b99a)
    In order to send RXJS shared Subject/BehaviourSubject/ProgressTracker to the client, you can now use decoupleSubject,
    so that the origin subject will not be completed when the client disconnects or manually completes.

//a service not part of 'rpc' scope, so its shared between all clients
class AppState {
    progresses: { [id: number]: ProgressTracker } = {};
}

class MyController {
    constructor(private state: AppState) {
    }

    @rpc.action()
    getProgress(id: number): ProgressTracker {
        //multiple clients can access the progress
        return decoupleSubject(this.state.progresses[id]);
    }

    @rpc.action()
    startProgress(id: number): ProgressTracker {
        this.state.progresses[id] = new ProgressTracker();
    }
}
  • RPC: Make RpcKernelSecurity scoped (d2740e8)

    This allows to inject rpc scoped providers into the security class.

  • Type: Add to validation errors the value that caused the error (98fa1ab)

    This allows to show the value that caused the error in the validation error message.

const oldError = { code: 'minLength', message: 'Min length is 3', path: 'username' }
const newError = { code: 'minLength', message: 'Min length is 3', path: 'username', value: 'Pe' }
  • Type: TypedFormGroup supports now new Angular version (7966ac5)

    With this change you can use TypedFormGroup with Angular 14+.

  • Type: Implement call signatures in object literals (ece8c02)

    With this change it's now supported to read call signatures from TypeScript types.

interface Caller {
    (a: number): string;
}

const type = typeOf<Caller>();
assertType(type, ReflectionKind.objectLiteral);
for (const member of resolveTypeMembers(type)) {
    //one member will be of kind ReflectionKind.callSignature
}
  • Type: Allow working with null objects (2e3f454)

    This change allows to work with null objects (objects created via Object.create(null)).

  • Type-Compiler: Use TS config resolution code to resolve reflection options (bb2ac7e)

    This is an important change in the way the Type-Compiler resolves tsconfig options.
    The old way was our own tsconfig.json resolution algorithm, but with this change we read
    CompilerOptions.configFilePath which is much more correct.

  • Type-Compiler: Support esm module (48de497)

    This should enable the use of @deepkit/type-compiler in ESM environments.

  • Type-Compiler: Print correct module specifier when module was not found (06e3876)

  • Type-Compiler: Load compilerOptions.paths manually if not provided (d872afc)

  • Injector: Allow using sub configuration classes as dependency (ba7c68e)

    Application configurations can now be split into multiple classes and still be used as dependency.

class DatabaseConfig {
    host: string = 'localhost';
    port: number = 3306;
}

class AppConfiguration {
    database: DatabaseConfig = new DatabaseConfig;
}

class Database {
    //refering to a child of `AppConfiguration` is new!
    constructor(config: DatabaseConfig) {
    }
}

const app = new App({
    config: AppConfiguration,
    providers: [
        Database
    ]
}).run();
  • Mongo: Adds support for expireAfterSeconds index (81765c5)

  • Mongo: Adds export for FindAndModifyCommand to allow $rename (6a00da9)

  • Mongo: Adds export for AggregateCommand to allow custom queries (7f6b4b3)

  • Mongo: Adds export for UpdateCommand to allow custom queries (4d627d2)

  • API-Console-GUI: Show the route description with white-space:pre-wrap to respect the newlines the developer used in description for formatting (058f090)

  • HTTP: Graceful shutdown including waiting for active http requests (09fb4d5)

  • HTTP: Add thrown Error in controller to http.OnAccessDenied event (53ffb33)

  • HTTP: Add support for DI auto-wiring in methods of event class listeners (ff432d8)

  • HTTP: Allow injecting http values (query/path/header) into http listener (01c24c4)

    This allows to inject services and HTTP request data into http listeners the same way as it is possible in routes.

@http.controller('/:groupId')
class Controller {
    @http.GET('/:userId')
    handle(userId: number, request: HttpRequest) {
        // ...
    }
}

class Listener {
    @eventDispatcher.listen(httpWorkflow.onController)
    handle(event: typeof httpWorkflow.onController.event, groupId: HttpPath<number>) {
        // access to the route path parameter `:groupId`
    }
}
  • HTTP: Handle HttpError errors in parameter resolver (0ead2fe)

    Additionally, to HttpQuery, HttpBody, HttpQueries it's now possible to inject header values.

class Controller {
    @http.GET('/:userId')
    handle(userId: number, authorization: HttpHeader<string>) {
        // access HTTP 'authorization' header
    }
}
  • HTTP: Allow reading parameter object (name -> value) for a route in onController event (6872dee)

  • Desktop-UI: Add new state abstraction (e786f09)

    This introduces a new state abstraction model for complex applications. It allows to register
    a class with properties and methods as state. The state is monitored and change-detection (as well as state persistence)
    triggered automatically. Properties marked as PartOfUrl will be persisted automatically in the URL (query parameter).

class State extends EfficientState {

    // stored in URL
    shop: number & PartOfUrl = 0;

    // stored in localStorage
    sidebarVisible: boolean = true;
}


@NgModule({
    providers: [
        provideState(State)
    ],
})
export class AppModule {
}

@Component({
    template: `
        Store: {{state.shop}}
        
        <!-- This triggers state listeners and changes the URL since PartOfUrl -- >
        <dui-button(click) = 'state.shop = 2' > Change < /dui-button>
        `
})
class Component {
    constructor(public state: State) {
    }
}
  • Desktop-UI: Table freezed columns support (e786f09)

    This allows to freeze columns in a table. The user can then scroll the table horizontally and the frozen columns
    will stay visible.

<dui-table [items]="items" [freezeColumns]="1">
    // ...
</dui-table>
Screen.Recording.2023-05-01.at.21.25.10.mov
  • Desktop-UI: Tab-button: remove [model] API (5b1e015)
  • Desktop-IO: Hotkey component, animated duiDialog (like quick-look macOS) (327c35c)

This feature allows to attach hotkeys to arbitrary dui-buttons.

<dui-button hotkey="meta+s">Save</dui-button>

The user can now press cmd+s to trigger the button. When alt (or option on macOS) is pressed,
the button will reveal its keymap.

Screen.Recording.2023-05-01.at.21.24.39.mov
  • ORM: Support RegExp directly as filter value + case-insensitive filter (b14fca2)

  • ORM: Support Query.use in joins (2ac4866)

  • ORM: Add Query.use/Query.fetch method to allow more dynamic query composition (ee439cd)

  • Add everywhere .js extension to support ESM (2fd3dda)

    This should be it possible to use Deepkit Framework in ESM environments.

Fixes

  • Logger: Maintain logger level when scoped logger is created (f590558)
  • Type: Default assignment for optional literals (05247ae)
  • Type: Treat keyof this as any so that it does not work in a strange unexpected way (e02fa0d)
  • Logger: Don't use rawMessage in JSONTransport so that color xml is removed (e1f956c)
  • RPC: Unwrap type only to determine inner type, don't use as return type (9898223)
  • Core: Move reflection option for database tests to it matches latest compiler changes (f938643)
  • Core: Remove debug statement + set compiler host only when not overridden (713bd1c)
  • Core: Removed debug statements (dc3abbc)
  • Core: Invalid json syntax in tsconfig (ac093c8)
  • Type-Compiler: Make sure only TS/TSX files are pro...
Read more

v1.0.1-alpha.87

19 Feb 14:36
Compare
Choose a tag to compare

Features

  • ORM Browser Module: Allowed to serve ORM Browser in custom apps (d7ff30a)
  • ORM: Added deep (dot path) patch support for all database adapters (0cec35f)
  • HTTP: Silently serialize unpopulated references (9ac824d)
  • Type: Detect primary-key-only reference objects (0f4cf65)
  • Type: Support nested loosely typed discriminated unions (07c937b)
  • Type: Added isGlobalTypeClass/isCustomTypeClass (ec55a42)
  • Create App: publish @deepkit/create-app to easily setup a Deepkit project via npm init @deepkit/app my-app (81fc37a)
  • Desktop UI: Support dynamic sidebars (3709d73)
  • Desktop UI: Support angular v15 (7103470)

Fixes

  • HTTP: Returned Response object are not serialized (221e968)
  • Mongo: Fixed aggregation without accumulators (68770a6)
  • Type: Correctly report invalid date types (10868e4)
  • Unpopulated back references in class instances (9274e60)
  • Type: Remove type from ValidationError as it's not easily serializable in BSON (d773a7c)
  • Mongo: Fixed early error in sockets correctly (a026840)
  • SQL: Correctly merge multiple ALTER TABLE into one in schema migration (243bee9)
  • API Console Module: Dist needs to be present in unbuilt state so that linking works correctly (dbb12f4)
  • Type: Allow much more string date formats to be valid union fallback member (5218a10)
  • BSON: Serialize object type + nested documents (755b6d1)
  • HTTP: Allow to read the request body multiple times (d020be8)
  • MySQL: MySQL expects the table name in DROP INDEX (fe5c54b)
  • SQL: Correctly format multiple nested joins (e4c12de)
  • SQLite: SQL schema parser ignores now invalid foreign keys (bb770da)
  • Type: Merge two object literals overrides left properties (2ef28b9)

Chore

  • Used newer postgres version in tests (156caa2)
  • Ensure database token with default constructor params work (a34e939)
  • Type Compiler: Added ts-ignore to all synthetic imports (ec55a42)

Contributors

  • Marc J. Schmidt
  • René Fritz

How to update

npx update-by-scope @deepkit

v1.0.1-alpha.77

03 Dec 18:52
Compare
Choose a tag to compare

Features

  • TypeScript 4.8 support
  • SQL: Added LIKE support for all db adapters (613c3a3)
  • ORM: Added SELECT FOR UPDATE/SHARE support (2170c5e)
  • Type Compiler: Support reflectionOptions to exclude d.ts files from being embedded (d46c35e)
  • HTTP: Make action groups ordered (2b099dc)
  • Type Compiler: Target=es2022 now correctly loads TS libs (c8b92a2)
  • Type: Allow using (self) function type reference (7191c58)
  • Framework: Expose log messages in TestingFacade (28de687)
  • Create App: New package @deepkit/create-app to easily get a Deepkit project up and going via npm init @deepkit/app project-name (3088e82)
  • Type: Support key remapping in mapped types (031b070)

Fixes

  • SQLite: Fix off-by-one in max number of active connections (d7890e1)
  • Type: Make sure validation returns all errors on object literals (2bb6ef1, 7e965bd)
  • HTTP: Filter with forRoutes() (b139e70)
  • Type Compiler: Converted more function calls to new signature (64e525a)
  • Type Compiler: Correctly serialize dist path (bacd233)
  • ORM: Optional reference fields (e229380)
  • Test: Correct type of reference (d18196b)
  • BSON: Make sure ValueWithBSONSerializer correctly serializes undefined/null (e7edfce)
  • SQL: Allow batch updating multiple different changed fields (513a818)
  • SQL: Make sure the database serializer is used for formatting (e5bf873)
  • SQLite: Memory dbs can only have 1 connection (3ad9678)
  • RPC: Memory leak with registered client as peer (db9d365)
  • Type: Keep optionality of property signatures intact when doing mapped types + distributive conditional types (1687a57)
  • Mongo: Scram response needs to extend from BaseResponse (c1d6c41)
  • HTTP: Add type to RouteParameterResolverContext (f74c1ec)

Chore

  • Package.json: Add "types" in package.json "exports" (b04dae7)
  • Remove turbo-net (752c1db)
  • Readme: Add links to community packages and examples to readme (37c3962)
  • Updated GUIs to angular v15 (5ddf841)

Contributors

  • Tim van Dam
  • Marc J. Schmidt
  • Char2s
  • Pavel Voronin
  • fergusean
  • CristianPi

Update

To update your project to the newest Deepkit versions, you can use:

npx update-by-scope @deepkit

v1.0.1-alpha.75

02 Aug 05:19
Compare
Choose a tag to compare

Features

c3242b9 - feature(http): allow to resolve parameter resolver from parent modules [Marc J. Schmidt]
8660099 - feature(type): support for generic class type reflection [Marc J. Schmidt]
1d984fe - feature(type): keep typeName + typeArguments of the expression chain and set type.typename to first (not last anymore). [Marc J. Schmidt]

Bugfixes

0e5543a - fix(type-compiler): do not transform {default() {}} expression as function name can not be preserved. [Marc J. Schmidt]
c94175b - fix(type): type any correctly validates. [Marc J. Schmidt]
0e62b1d - fix(type): added isSameType(function, function) strict comparison on function implementations (#330) [Tim van Dam]
41264ee - fix: lock time drift [Marc J. Schmidt]
dbf71b0 - fix(orm): join without hydration. [Marc J. Schmidt]
88ce7d4 - fix(type): keep type annotations when intersection already decorated type. [Marc J. Schmidt]

Chore

9cc2e27 - chore(type): test to cover function parameter serialisation [Marc J. Schmidt]
c0f5299 - chore(sqlite): make sure m2m joins work [Marc J. Schmidt]

alpha-74

19 Jul 19:29
Compare
Choose a tag to compare

Features

c2400a6 - feature(type): support static reflection [Marc J. Schmidt]

Bug fixes

27f7ec2 - fix(framework): app:config now creates a table that does not overflow (#309) [Tim van Dam]
76aa716 - fix(http): fix route resolving for routes taking no params (#306) [Char2s]
da9e415 - fix(http): do not use JSONResponse/HTMLResponse runtime types for serialisation [Marc J. Schmidt]
291c96c - fix(type): same-type check for enum, fixes multiple enums in unions. [Marc J. Schmidt]
aa19cab - fix(type): support readonly T expression. [Marc J. Schmidt]
a8265b0 - fix(type): isFunction for minimised class expressions [Marc J. Schmidt]
20cb35f - fix(type): correct use of readonly keyword on constructor properties [Marc J. Schmidt]
293a335 - fix(type-compiler): decorating export default async functions correctly [Marc J. Schmidt]
aefc2ac - fix(http): disable stream test [Marc J. Schmidt]
fe633da - fix(sql): delete query correctly serialises constraint [Marc J. Schmidt]
e56a5af - fix(framework): setup logger correctly in createTestingApp [Marc J. Schmidt]

Chore

5d33aa0 - chore: add dark mode/white deepkit logo to README (#310) [Tim van Dam]
81d998c - chore(type): add test for camel case naming strategy. [Marc J. Schmidt]
8b347fc - chore(type): add test for exported type string literals [Marc J. Schmidt]

alpha-72

11 Jul 22:41
Compare
Choose a tag to compare
alpha-72 Pre-release
Pre-release

Version alpha-72 comes with a lot of new features and bugfixes.

Features

const app = new App({
    providers: [Database],
    imports: [new FrameworkModule]
});

const router = app.get(HttpRouterRegistry);

router.get('/:text', (text: string) => {
    return 'Hello ' + text;
});
router.get('/user/:id', async (id: number & Positive, database: Database) => {
    return await database.query(User).filter({id}).findOne();
});
new App({
    listeners: [
        onServerMainBootstrap.listen((event, logger: Logger) => {
            logger.log('Server started');
        });
    ],
}).run();
  • Type compiler no longer uses TypeScript's TypeChecker and added a loader API that is the foundation for per-file compilation support for build systems like esbuild/SWC.

3016a28 - feature(sql): infer new Date default value as NOW() column DEFAULT expression. [Marc J. Schmidt]
9ba00d0 - feature(http): update formidable to v2 [Marc J. Schmidt]
8c675ec - feat(injector): support type injection on Injector [Char2s]
b6436ed - feature(app): functional modules [Marc J. Schmidt]
8639d89 - feat(http): implement stream support [Char2s]
ba98832 - feature(http): allow to provide RegExp object in R in HttpRegExp[T, R]. [Marc J. Schmidt]
beb9ef1 - feature(type): add test for dynamic runtime types [Marc J. Schmidt]
2dc1fbf - feature(framework): allow to listen to orm events in modules [Marc J. Schmidt]
0812f68 - feature(orm): use @deepkit/event for event handling [Marc J. Schmidt]
4aae2fe - feature(event): allow to register late listeners [Marc J. Schmidt]
41e5564 - feature(type): allow to control whether properties set explicitly undefined for null/undefined values. [Marc J. Schmidt]
03dde6e - feat(framework): replace TestHttpResponse with MemoryHttpResponse (#245) [Char2s]
3093949 - feature(type-compiler): stop using TypeChecker entirely and allow loader-pattern, to better support webpack/esbuild/SWC. [Marc J. Schmidt]
20f94f6 - feat(http): add more http errors [Char2s]
7fe644a - feature(injector): Allow to use Inject[] in factories [Marc J. Schmidt]
a599b7c - feat(orm): redesign query filter methods (#257) [Char2s]

Bufixes / Chore

6399152 - fix(type-compiler): default default function [Marc J. Schmidt]
ddee3f9 - fix(type): TypeClass contains now all properties [Marc J. Schmidt]
7750053 - chore: ignore tests in npm publish [Marc J. Schmidt]
be4571d - chore: fix install compiler in GUI projects [Marc J. Schmidt]
26add9a - chore: fix package stuff [Marc J. Schmidt]
07c991f - fix(http): adjust parse body for new formidable API [Marc J. Schmidt]
aa5cd0a - fix(type): keep annotations when same type is intersected [Marc J. Schmidt]
7a3eb8e - chore: update various packages and update package-lock to v2 [Marc J. Schmidt]
a7b35bf - chore(orm): coding style [Marc J. Schmidt]
3752d4e - chore(crypto): initialise createBuffer once [Marc J. Schmidt]
3ad5f5b - fix(crypto): use Uint8Array in browsers [Keritial]
7e38414 - docs(dev): add package prerequisites [Char2s]
cc1ad3d - chore(type): assert union test [Marc J. Schmidt]
0703a79 - fix(http): fix parameter resolver context value [Char2s]
1385d26 - Input arg for PUT method in autocrud updated to type HttpBody [Kiran K]
86f61b1 - fix(postgres): add @types/pg to dependencies [Tim van Dam]
1cce6e6 - fix(injector): remove unused deps property [Tim van Dam]
c336067 - fix(http): filterMiddlewaresForRoute should only needs one match [Nex Zhu]
4374fa7 - Fix an error reported by TSC 4.7.4 [Rafael Ávila de Espíndola]
9280412 - Use host.resolveModuleNames when available [Rafael Ávila de Espíndola]
78b8559 - fix(type): empty array validation keep state intact [Marc J. Schmidt]
db2ee9a - fix(api-console): use correct environment headers in requests [Marc J. Schmidt]
263b107 - chore: fix typedoc [Marc J. Schmidt]
13ef687 - fix(type): infer parameters of function with a single parameter [Marc J. Schmidt]
ae1f6d0 - chore(http): add test for reference deserialization [Marc J. Schmidt]
3c0f711 - chore: enable pull requests builds [Marc J. Schmidt]
17160ac - chore: try buildjet 2vcpu [Marc J. Schmidt]
fe88e75 - chore: try buildjet [Marc J. Schmidt]
f7b59bb - chore: github actions mongo [Marc J. Schmidt]
292ce9d - chore: bson readme [Marc J. Schmidt]
18b038f - chore: increase memory limit for test:coverage [Marc J. Schmidt]
0347bbd - chore: remove typedoc [Marc J. Schmidt]
c082c75 - chore: try using github CI server [Marc J. Schmidt]
55a8a56 - fix(type): disabled loosely throws for primitives in cast() [Marc J. Schmidt]
aeaef01 - fix(api-console): fix request headers (#233) [Char2s]
568fa60 - chore(type): move test files to tests/ directly [Marc J. Schmidt]
25020bd - chore(injector): add test for inheritance [Marc J. Schmidt]
e135620 - fix(sql): limit with joins [Marc J. Schmidt]
a6f5734 - fix(api-console): serialize date correctly