Skip to content

Releases: ItemConsulting/enonic-types

Add types for notification library

15 Dec 09:33
35b80d8
Compare
Choose a tag to compare

This release adds TypeScript types for the Notification Library, which allows developers to send push notifications to users.

Controller types for WebSocket

08 Dec 14:58
a6a5e4a
Compare
Choose a tag to compare

Add types to controller.ts for handling websocket connections:

  • The WebSocketResponse interface can be used to initiate a connection
  • The WebSocketEvent type can be used by a webSocketEvent(event: WebSocketEvent) function in a controller to handle incoming messages and connections.
  • The Request.webSocket constant can be used to check if this is an attempt to open a web socket connection in a get(req: Request) function.

Add support for admin, cluster and task libraries

26 Nov 09:39
63f7f91
Compare
Choose a tag to compare

Support has been added for the following libraries:

  • AdminLibrary
  • ClusterLibrary
  • TaskLibrary

Remove nullability for portalLib.{getComponent,getContent}

25 Nov 11:28
e91cf0a
Compare
Choose a tag to compare

The functions portalLib.getComponent() and portalLib.getContent() will not return null if used in the documented legal places (page, part and layout).

The types for these two functions has now been changed so that they don't return null!

The functions can return null if a developer tries to use them in a webapp or error handler, but a null in these places would probably trigger an exception, which would be good, and stop the developer from using it here at all.

If the developer wants to reuse code between e.g a page controller and the error handler, there is of course nothing stopping them from adding a null check, but the compiler will not enforce this check anymore.

Add TestingLib support and missing methods in NodeLib

27 Oct 12:42
f9fcbeb
Compare
Choose a tag to compare
  • This release adds support for TestingLibrary. Though the way to use it is not clear in starter-webpack.
  • NodeLibrary gets missing functions in RepoConnection
  • ContentLib.query gets metadata support with _score and _sort fields

Add types for WebsocketLib

11 Sep 06:53
7d0e743
Compare
Choose a tag to compare

Adds support for WebsocketLibrary and improvements to documentation.

Simplify library paths

10 Sep 12:46
60f8ba4
Compare
Choose a tag to compare

All import paths changed

The "/lib/" part of all import paths has been removed since it gave no value to the developers.

// import { Content } from 'enonic-types/lib/content'; // old style
import { Content } from 'enonic-types/content'; // new style

// import { Component } from 'enonic-types/lib/portal'; // old style
import { Component } from 'enonic-types/portal'; // new style

Note on upgrading

When upgrading to this version, we recommend just doing a replace on all the code in your project, where enonic-types/lib/ becomes enonic-types/