Skip to content

Releases: ItemConsulting/enonic-types

Add types for Export Library

15 Oct 06:33
Compare
Choose a tag to compare

New libraries supported

Support has been added for the following libraries:

  • ExportLibrary (XP 7.8.0)

Other

  • Narrower types for Principal has been added using template litterals to enforce string shapes.

Expose types trough XP modules

04 Oct 06:33
Compare
Choose a tag to compare

Big changes

  1. Types must now be imported from the corresponding the XP-modules (like "/lib/xp/content"), instead of being imported from a separate library (like "enonic-types/content").
    This is a cleaner approach, since the types now lives with the functions that use them.
  2. "enonic-types/controller" doesn't have a corresponding library since models the shape of the internal structures in XP. So all the types there has been made available on the global scope under the XP namespace.
    Now you can just use XP.Request without doing any imports.

To use this release you will need to change all the imports in your code like this:

- import { Request, Response } from "enonic-types/controller";
- import { get } from "/lib/xp/content";
- import { Content } from "enonic-types/content";
+ import { get, Content } from "/lib/xp/content";

- export function post(req: Request): Response {
+ export function post(req: XP.Request): XP.Response {
    const content: Content = get({ 
      key: req.params.key!
    })
  
    ...
  }

As you can see, this will clean up imports a bit, and logically group functions and their types together.


From now on you will never do any import ... from "enonic-types/..." directly in your code!

The one exception to this is the import from "enonic-types/libs" to configure __non_webpack_require__ (but I recommend using JavaScript modules import keyword instead of __non_webpack_require__).


Protip: In the upcoming TypeScript 4.5 release we will be able to use type modifiers on import names like this:

import { get, type Content } from "/lib/xp/content";

New features

  1. A new global XP.Controller type has been added. You can use it if you prefer arrow functions for your controllers. It can be used like this:
- import { Request, Response } from "enonic-types/controller";

- export const get = (req: Request): Response => {
+ export const get: XP.Controller = (req) => {

  }

Fix types in SchedulerLib

27 Aug 08:34
Compare
Choose a tag to compare

Bugfixes:

Improve types for GraphQL lib

26 Aug 06:58
Compare
Choose a tag to compare

Thanks to @itemodahl for providing a fix for the GraphQL lib.

Support RouterLib@3.0.0 changes

30 Jul 14:08
37dc974
Compare
Choose a tag to compare

Changes:

  • Update RouterLib to support string | Array<string> as pattern parameter

Fix to authLib `getProfile`

16 Jul 13:18
ddd3357
Compare
Choose a tag to compare

Bugfixes

  • Fix from @maxYurchenko that corrects authLib.getProfile() params

Updates to Repo and Node libraries

25 Jun 15:25
5c1787e
Compare
Choose a tag to compare

Small release with some fixes to types for NodeLibrary and RepoLibrary

Add types for Auditlog library

24 Jun 13:45
936d4a6
Compare
Choose a tag to compare

New libraries supported

Support has been added for the following libraries:

  • AuditlogLibrary (XP 7.2.0)

Other

  • Deprecated CronLib in favor of SchedulerLibrary since 7.7.0
  • Small change to MultiRepoConnection in NodeLib
  • Extract CustomSelectorServiceRequestParams from CustomSelectorServiceRequest

GraphQL and XP 7.7.0 support

01 Jun 13:20
4419c58
Compare
Choose a tag to compare

New libraries supported

Support has been added for the following libraries:

  • SchedulerLibrary (XP 7.7.0)
  • GraphQLLibrary
  • GuillotineLibrary
  • SqlLibrary

Other

  • Deprecated TaskLib functions submit and submitNamed for 7.7.0, and added executeFunction and submitTask as replacements
  • Added min, max and count aggregations for 7.7.0
  • Added imageWidths to processHtml for 7.7.0

Add QRCode, Mustache, XSLT libs

20 May 15:02
fcf86e5
Compare
Choose a tag to compare

New libraries supported

Support has been added for the following libraries:

  • QRCode
  • Mustache
  • XSLT

Improvements

  • Remove readonly statements to enable mutation of more objects (#15)

Bug fixes

  • Fix type for headers in params for mailLib (#14)

Thanks to @maxYurchenko for his contributions!