Giter VIP home page Giter VIP logo

k1r0s / kaop-ts Goto Github PK

View Code? Open in Web Editor NEW
262.0 8.0 14.0 2.06 MB

Simple Yet Powerful Library of ES2016 Decorators with Strongly typed method Interceptors like BeforeMethod, AfterMethod, OnException, etc

Home Page: https://k1r0s.github.io/kaop-ts/

License: MIT License

TypeScript 93.62% JavaScript 6.38%
aspect-oriented-programming inversion-of-control decorators typescript metadata single-responsibility-principle

kaop-ts's Introduction

kaop

semantic-release Greenkeeper badge Image travis version Coverage Status dependencies dev-dependencies downloads Known Vulnerabilities

Lightweight, solid, framework agnostic and easy to use library written in TypeScript to deal with Cross Cutting Concerns and improve modularity in your code.

Short Description (or what is an Advice)

This library provides a straightforward manner to implement Advices in your app. Advices are pieces of code that can be plugged in several places within OOP paradigm like 'beforeMethod', 'afterInstance'.. etc. Advices are used to change, extend, modify the behavior of methods and constructors non-invasively.

For in deep information about this technique check the resources.

Demo

https://jsbin.com/bogecojuvi/edit?js,console

Get started

npm install kaop-ts --save

Use a join point to plug it to any method/class:

import { afterMethod } from 'kaop-ts'

const double = afterMethod(meta => meta.result *= 2)

class DummyExample {

  @double
  static calculateSomething (num, num2) {
    return num * num2
  }
}

DummyExample.calculateSomething(3, 3) // 18
DummyExample.calculateSomething(5, 5) // 50

Whats new on 3.0

  • Advices no longer use this to access several utilities.
  • Metadata properties have been renamed. Here you can check the reference .
  • JoinPoints support multiple advices:
// join point decorators expect a list of advices
@beforeMethod(advice1, advice2, advice3)
// even you can provide an advice array using spread operator
@beforeMethod(...adviceList)
someMethod() {

}

Docs

Resources

Credits

Made using TypeScript Library Starter

Similar resources

kaop-ts's People

Contributors

aalises avatar alexjoverm avatar greenkeeper[bot] avatar k1r0s avatar kevcjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kaop-ts's Issues

An in-range update of ts-jest is breaking the build 🚨

Version 21.2.4 of ts-jest was just published.

Branch Build failing 🚨
Dependency ts-jest
Current Version 21.2.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Commits

The new version differs by 3 commits.

  • 41206f5 Merge pull request #380 from SimenB/patch-1
  • afc99b3 chore: update version in package.json and AUTHORS
  • 9f4d88a Remove unused jest-util dependency

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Version 4.0.0 silently changes target to es6

Hi,

I didn't read in any release note of the version 4.0.0 that the target in the tsconfig was changed to es6, and this broke my angular application on IE11.

Is it necessary to compile to es6 or it could be set to es5 again?

If it isn't possible, I will fix the library version before 4.0.0

The Log decorator/annotation does not support AoT compilation

At https://github.com/k1r0s/kaop-ts/blob/master/docs/examples.md#log-decorator (and related linked documentation), you give an example that does not pass Angular5's AoT compilation. To get this to work, it should be:

import { afterMethod, IMetadata } from 'kaop-ts';

export function Log(): Function {
  return afterMethod((meta: IMetadata) => {
    const methodName = `${meta.target.constructor.name}::${meta.key}`;
    console.info(`log-decorator: ${methodName} invoked!`);
    console.info(`log-decorator: ${methodName} arguments -> `, meta.args);
    console.info(`log-decorator: ${methodName} result -> `, meta.result);
  });
}

Then, the decorator should be used as @Log() instead of @Log.

An in-range update of ts-jest is breaking the build 🚨

The devDependency ts-jest was updated from 23.10.0 to 23.10.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

Commits

The new version differs by 13 commits.

  • d9c5b45 Merge pull request #743 from huafu/release/23.10.1
  • e4a3a09 chore(release): 23.10.1
  • ab94359 Merge pull request #742 from huafu/fix-740-no-js-compilation-with-allow-js
  • a844fd4 Merge branch 'master' into fix-740-no-js-compilation-with-allow-js
  • 18dced1 Merge pull request #741 from huafu/e2e-weird-deep-paths
  • 9e7d6a0 test(config): adds test related to allowJs
  • 374dca1 fix(compile): js files were never transpiled thru TS
  • 70fd9af ci(cache): removes some paths from the caching
  • c12dfff fix(windows): normalize paths
  • 0141098 test(e2e): deep paths and coverage
  • 6ccbff3 Merge pull request #736 from huafu/detect-import-and-throw-if-none
  • a2a4be2 fix(config): warn instead of forcing ESM interoperability
  • 21644da Merge pull request #735 from huafu/master

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

allow access to `...advices` throught function prop

when building abstractions you may ship your library with:

export const MyDecorator = beforeMethod(meta => {
  ...stuff that you are not supposed to access
});

would be nice that MyDecorator.advices() gives you back an array of advices which where passed to the join point (beforeMethod on the previous example)

this will be usefull for extending packed decorators that use kaop-ts, for example:

const advices = MyDecorator.advices();
export const MyNewDecorator = beforeMethod(...advices, meta => {
  ...new stuff that happends after advices execution
})

metadata is undefined (Babel)

I create a simple advice just like Get Started, but advices can't find metadata.

  • simple react demo project
  • kaop-ts v1.2.0

App.js

import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
import {afterMethod} from 'kaop-ts'
import {MyAdvices} from './MyAdvices'

class App extends Component {

  constructor(props) {
    super(props);
    this.handleClick = this.handleClick.bind(this);
  }

  @afterMethod(MyAdvices.doubleResult)
  handleClick() {
    alert('You Click It!');
  }

  render() {
    return (
      <div className="App">
        <div className="App-header" onClick={this.handleClick}>
          <img src={logo} className="App-logo" alt="logo"/>
          <h2>Welcome to React</h2>
        </div>
        <p className="App-intro">
          To get started, edit
          <code>src/App.js</code>
          and save to reload.
        </p>
      </div>
    );
  }
}

export default App;

MyAdvices.js

import { AdvicePool, adviceMetadata } from 'kaop-ts'

export class MyAdvices extends AdvicePool {
  static doubleResult (@adviceMetadata metadata) {
    console.log(metadata);     // always output undefined here
  }
}

An in-range update of tslint is breaking the build 🚨

Version 5.7.0 of tslint just got published.

Branch Build failing 🚨
Dependency tslint
Current Version 5.6.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As tslint is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes v5.7.0

🎉 New rules, options, and fixers

🛠 Bugfixes & enhancements

  • [api] AbstractRule#applyWithFunction allows additional parameter that is passed through to walkFn (#3140)
  • [api] AbstractRule#applyWithFunction has better type checking for its type parameter (#2660)
  • [bugfix] member-access autofix now correcly inserts public keyword after decorators (#3162)
  • [bugfix] prefer-const correctly handle catch without binding parameter introduced in [email protected] (#3151)
  • [bugfix] no-invalid-template-strings allows backslash-prefixed template expressions (#3116)
  • [bugfix] deprecation no longer shows errors on imports and exports (#3141)
  • [bugfix] deprecation: fix false positive when calling a function or method where another overload is deprecated (#2883)
  • [bugfix] whitespace: fixed "check-separator" for trivial for cases. (#3132)
  • [bugfix] prefer-object-spread prevent spreading this as it is not allowed by the compiler (#3126)
  • [bugfix] msbuild formatter uses backslashes in paths on Windows (#3145)
  • [bugfix] no-namespace ignores global augmentation (#3161)
  • [enhancement] remove superfluous empty lines on tslint output. (#3121)
  • [enhancement] no-submodule-imports allows whitelisting of submodules like @angular/core/testing (#3129)
  • [enhancement] custom lint rules will be resolved using node's path resolution to allow for loaders like ts-node (#3108)
  • [enhancement] quotemark no longer requires "single" or "double" to be the first option. The rule defaults to "double" if none is specified. (#3114)
  • [enhancement] no-unused-variable autofix removes trailing comments of imports (#3156)
  • [enhancement] no-unnecessary-type-assertion allows certain necessary assertions to prevent type widening (#3120)

Thanks to our contributors!

  • Paul Gschwendtner
  • Andy Hanson
  • ksvitkovsky
  • Santi Albo
  • aervin
  • Junle Li
  • Joscha Feth
  • WiseBird
  • Caleb Eggensperger
  • WGroenestein
  • Bowen Ni
Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

onException typing declaration error

When compiling with the newest version of the library this typing issue with the onException method arises. It could be due to the ts configuration. Importing the MethodSignature from interfaces first and then using it instead of the inline solution seems to fix it.

ERROR in [at-loader] ./node_modules/kaop-ts/dist/types/on-exception.d.ts:2:52 
    TS1110: Type expected.

ERROR in [at-loader] ./node_modules/kaop-ts/dist/types/on-exception.d.ts:2:100 
    TS1005: '(' expected.

ERROR in [at-loader] ./node_modules/kaop-ts/dist/types/on-exception.d.ts:2:75 
    TS2339: Property 'MethodSignature' does not exist on type 'Promise<typeof ".../node_modules/kaop-ts/dist/types/interfaces">'.

Set Up on browser

For this library to be used on the browser, do I have to download the src folder and import from index.ts?

reexport inject and provider from kaop pkg

one of the most used features in this package is DI which is not exclusively provided by this package. As kaop is a hard dependency we can just reexport some of its features

advice order is wrong when on stacked joinpoints [breaking changes]

class Foo {

  @beforeMethod(() => console.log("Fucked"))
  @beforeMethod(() => console.log("Pretty"))
  @beforeMethod(() => console.log("Im"))
  static do0(stuff) {
    return stuff
  }
}

this should print "Fucked Pretty Im" but I does reverse ways

(tests are wrong)

In fact this is intended to be equal order

  @beforeMethod(() => console.log("Im"))
  @beforeMethod(() => console.log("Pretty"))
  @beforeMethod(() => console.log("Fucked"))
  // or 
  @beforeMethod(() => console.log("Im"), () => console.log("Pretty"), () => console.log("Fucked"))

but its just the oposite

An in-range update of @types/node is breaking the build 🚨

Version 8.0.42 of @types/node was just published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.41
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of kaop is breaking the build 🚨

Version 4.1.5 of kaop was just published.

Branch Build failing 🚨
Dependency kaop
Current Version 4.1.4
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

kaop is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of rollup is breaking the build 🚨

The devDependency rollup was updated from 1.18.0 to 1.19.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

rollup is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

Commits

The new version differs by 6 commits.

  • 9af119d 1.19.0
  • b3f361c Update changelog
  • 456f4d2 Avoid variable from empty module name be empty (#3026)
  • 17eaa43 Use id of last module in chunk as name base for auto-generated chunks (#3025)
  • 871bfa0 Switch to a code-splitting build and update dependencies (#3020)
  • 2443783 Unified file emission api (#2999)

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

this.skip(amount: number) or this.break()

new feature to allow advices to skip incoming advices and dispatch to the method directly

caching async request could have many operations, in order to separate concerns it would be nice that advices expose an api through control whole call stack like this.stop does but skipping some calls

@adviceThatChecksIfResourceAlreadyExistsInCache // this advice must skip incoming advices 
@adviceThatPerformAnAjaxRequestToRetrieveSomeResource
@adviceThatStoresTheReceivedDataInCache
handleResponse(data) {
  // stuff
}

export 'IMetadata' was not found in 'kaop-ts'

Hi,

I am facing this error with Angular 4.

export 'IMetadata' was not found in 'kaop-ts'

angular warning

import { Injectable } from '@angular/core'
import { AdvicePool, adviceMetadata, IMetadata } from 'kaop-ts'

@Injectable()
export class LogAspect extends AdvicePool {
  static log(@adviceMetadata meta: IMetadata) {
    console.log('Called: ', meta.target)
    console.log('Args: ', meta.args)
  }
}

promise based decorators?

Actually decorating a method with a async decorator will cause the entire method to be unable to return a value (since we're wrapping the entire method with another function that will trigger asynchronous code)..

Basically, if you need keep track of "when the body method got executed" in order to properly separate concerns, that thing is not possible with the current solution which is callback based.

Currently is possible to execute a method wrapped with an async decorator, so the actual method will be delayed till you fulfill some resource or perform that task. But you don't have any tools to realize about this from the context that you invoke the method.

Promises have this purpose, they aren't just an alternative on asynchronous code, but a convention, and maybe this library needs to take advantage of it

discourage use of arrow functions advice declaration

Join points spect a callback as a first argument

@afterMethod(() => {
  // stuff
  this.next()
})

Problem is, most of transpilers seeing that beautiful lamda function will understand that: THIS NEED TO BE KEEPED!

var _this = this // <- WTF
@afterMethod(function() {
  // stuff
  _this.next()

})

image

kaop-ts already provides this at callback advices so if you write an arrow funciton at advice declaration transpilers will cheat you :(

always try to use function keyword during advice initialization until I find a better solution:

@afterMethod(function() {
  // stuff
  this.next()
})

once context is declared.. I mean, advice is properly declared using a function you are free to use arrow functions inside advice function body ;)

achieve this syntax (refactor suggestion)

function stack(target: Object, propertyKey: string | symbol, parameterIndex: number){

}

function param(target: Object, propertyKey: string | symbol, parameterIndex: number){

}

interface IAdviceMethod {
    apply: (...args) => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => void
}

function before(advice: Function): IAdviceMethod{
    let prop:IAdviceMethod = {
        apply: function(...args){
            return function(target: any, propertyKey: string, descriptor: PropertyDescriptor){
                return descriptor
            }
        }
    }
    return prop
}

class ExampleAdvices /*extends AdviceContainer*/ {

    static saveLocation(@stack meta, @param path){

    }
}

class Dummy {

    @before(ExampleAdvices.saveLocation).apply("/some/path")
    download(){

    }
}

Result of advise's first execution repeating itself in following executions when running all tests

Background

We have an advise that takes care of checking all parameters in a request body before proceeding with the request handler's execution. If there are missing parameters, the advise returns a 400 response. If not, the advise lets the rest of the code run. The advise is the following:

export const checkParam = (properties: string[], message: string) => beforeMethod(async (meta) => {
  const event = meta.args[0]
  let body
  try {
    body = checkAndParseBody(event)
  } catch (e) {
    body = null
  }
  const decodedAuthToken = await extractAuthHeaderVerifyAndDecodeToken(event)
  const params = Object.assign({}, event.pathParameters, event.queryStringParameters, body)
  if (!params || !checkExistingProperties(params, properties)) {
    meta.prevent()
    meta.result = await getCredentialedResponse(400, {message}, getRequestOrigin(event), decodedAuthToken)
  } else {
    event.params = params
  }
  meta.commit()
})

We also have tests that run the request handler function and check for various response codes. The first test checks for a 200, and the next one checks for a 400.

Problem

When running the tests individually they both pass, but running the suite as a whole causes an error in which the second test fails. Instead of receiving a 400 response, it receives a 200 response instead. It's like the first advise's result is "recorded" and used in the following executions.

I also swapped the tests and put the 400 one first and the 200 one second. The second test failed and received a 400 instead of a 200.

[Feature Request] Add @afterException joinPoint

It'd be nice to have this JoinPoint given by the library. Currently it's possible to do that by custom implementation:

static onException () {
  try {
    meta.result = meta.rawMethod.apply(meta.scope, meta.args)
  } catch(e){
    // stuff
  }
}

Although it would be much convenient to have this join point to save some code lines :)

An in-range update of replace-in-file is breaking the build 🚨

Version 2.6.4 of replace-in-file just got published.

Branch Build failing 🚨
Dependency replace-in-file
Current Version 2.6.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As replace-in-file is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 3 commits.

See the full diff

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Function calls are not supported in decorators - Angular 7

Hi,

When executing ng build --prod the following error appears.

ERROR in Error during template compile of 'AppComponent'
  Function calls are not supported in decorators but 'beforeMethod' was called in 'log'
    'log' calls 'beforeMethod' at src\app\kaop-test.ts(4,10).

This only happens with AOT enabled.

Example repo: kaop-ts-issue

remove `this` from kaop API

this keyword can be confusing, and also its no sense to force developers at take care about context since an Advice is a complete ABSTRACT context. Does it have sense to provide half of the api calls as a this context properties?

Would be a better approach to provide these methods (stopped, next, stop, skip*) in metadata properties.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml
  • The new Node.js version is in-range for the engines in 1 of your package.json files, so that was left alone

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of kaop is breaking the build 🚨

Version 3.2.1 of kaop was just published.

Branch Build failing 🚨
Dependency kaop
Current Version 3.2.0
Type dependency

This version is covered by your current version range and after updating it in your project the build failed.

kaop is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 2 commits.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

make param decorators optional (for babel users)

isn't hard to provide a workarround to make kaop detect if developer used @adviceDecorator or @adviceParam. If any of this were provided kaop will inject first parameter as the metadata, and rest of parameters will be parameter decorators sorted as normal.

function myDecorator(metadata, param0, param1, param2) {
    
}

An in-range update of @types/node is breaking the build 🚨

The devDependency @types/node was updated from 10.11.0 to 10.11.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build failed (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

reflect-metadata conflicts with core-js

reflect-metadata and core-js provides polyfills for upper ES versions, however reflect-metadata package, when declared or imported, replaces current Reflect definition, which means it will mess angular globals.

It will be better include another polyfill and try to isolate from third parties, since kaop-ts metadata are not needed outside.

Babel tool throws TypeError when prototype isn't keep when constructor wrapping

Even though V8 class implementation doesn't throw anything and wrapped constructor instances keep proto reference.

This error have anything to do with kaop-ts itself is just a requirement for babel since they don't have a better alternative to assure that instances are created using new keyword rather than invoking the constructor directly as harmony specs explicity point.

more info babel/babel#682

An in-range update of ts-jest is breaking the build 🚨

Version 21.2.0 of ts-jest was just published.

Branch Build failing 🚨
Dependency ts-jest
Current Version 21.1.4
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Release Notes 21.2.0

Enable using "ts-jest" package name directly (#363):

  "jest": {
    "transform": {
      "^.+\\.tsx?$": "ts-jest"
    },
Commits

The new version differs by 7 commits.

  • ce41e53 Merge pull request #363 from martijnthe/change-entry-to-preprocessor.js
  • da25825 Allow pre-release Jest in the next minor range
  • 36e5f9c Merge branch 'master' into change-entry-to-preprocessor.js
  • a4e32df Merge pull request #360 from totopsy/master
  • 8cf2d46 Update AUTHORS
  • bad01ec Change the package entry point to preprocessor.js itself
  • 7c24d0d FIX - README.md 2 times the same line

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

compile down to support [kaop] (vanilla version) features

Many people (also me) don't use transpilers for tiny proyects..

add needed instructions to allow using this repository directly in browsers world:

Without messing (kaop)[https://github.com/k1r0s/kaop] API

var Programmer = Class.inherits(Person, {
  constructor: [Override, function(parent, arg0, arg1){
    parent(arg0, arg1)
    // stuff
  }]
})

then remove kaop lecacy repository

Add support to implement behaviors through interfaces (typings)

(already tested locally)

You often write a behavior to describe what components or views should have to describe a pattern of infrastucture to organize your code.

We're going to describe a pattern between any component that should perform an http request (guess what)

DISCLAIMER: code typed here is a stub, only to represent some problems that my occur in web development.

// requirements needed to implement that behavior
interface RequestReceiverBehavior {
    // requestservice instance AKA service responsible to perform requests
    requestSrv: MyRequestService; 

    // url where request is performed, each component could point to its model.. welp ... (istead of requestUrl this could be a model/resource)
    requestUrl: string;

    // this function is called from a view and triggers the request, but we're supouse that this method is a predicate and its result will be used as the body request
    requestTrigger(): () => Serializable; 

    // this method will be triggered when request success and response will be injected in the arguments
    requestSuccess(): (data: Response) => void;

    // if request fails, optional
    requestError?(): (error: Error) => void;
}

Normaly we're implement directly infrastucture code. Service calls, data parse, what ever we need to deal with the problem domain. Even if we encapsulate all that infrastructure code inside some service we have to implement that code or call in all places. If You're good enough you'll try to separate domain from infrastructure .. But you will run on duplication problems somewhere you must copy that snipped only replacing the ..

@NgComponent({
    ...
})
class DummyComponent implements OnInit, RequestReceiverBehavior {
    @Input()
    public data: any;
    public requestUrl: string;

    constructor(public requestSrv: MyRequestService) {}

    public requestTrigger(){        

        // infrastructure code
        this.requestSrv.doRequest(
            'these arguments are a pattern', 
            that, 
            mostOfTheTimes, 
            coincide...,
            so, this.IZA,
            CrossCuttingConcern
        ).YouHaveToSpecifyACallbackOrSubscribeThisComponent(this.requestHandler)
    }

    public requestHandler(data: any){
        // infrastructure code polluting your domain
        most.Of(theTimes).you('parseDataFromServer', OrSomeOperationsThatHaveNothingDoToWithTheComponentScope)

        // domain
        stuff(data)
        notifyUser()
    }

    public ngOnInit() {
        ...
    }

    private anotherMethodWhichIsntInfrastructure() {

    }
}

This library need to enhace typescript integration by providing declarative decorators and advices that help you to write a strong infrastructure and explicit domain solutions:

@NgComponent({
    ...
})
class DummyComponent implements OnInit, RequestReceiverBehavior {
    @Input()
    public data: any;
    public requestUrl: string;

    constructor(public requestSrv: MyRequestService) {}

    @afterMethod<RequestReceiverBehavior>(Advices.myImplementationTrigger)
    public requestTrigger(dataFromTheView){

        const preparedDataFromTheView = doSomething(dataFromTheView)
        // infrastructure code has gone
        return preparedDataFromTheView;
    }

    @beforeMethod<RequestReceiverBehavior>(Advices.myImplementationCallback)
    public requestHandler(data: any){
        // 
    }

    public ngOnInit() {
        ...
    }

    private anotherMethodWhichIsntInfrastructure() {

    }
}

We're writing advices that recognice what kind of class are dealing with. And, thanks to typescript generics our compiler will complain if we alter the implementation messing something.

class Advices extends AdvicePool {
    static myImplementationTrigger(@adviceMetadata meta: IMetadata<RequestReceiverBehavior>){
        meta.result // will contain the result
        meta.scope // compiler knows that meta.scope will be typeof RequestReceiverBehavior
        // infrastructure code to perform the request...
    }
}

An in-range update of ts-jest is breaking the build 🚨

Version 21.1.1 of ts-jest was just published.

Branch Build failing 🚨
Dependency ts-jest
Current Version 21.1.0
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Commits

The new version differs by 4 commits.

  • d33d311 Merge pull request #342 from kulshekhar/fix-238
  • f98651c Use different current directories for internal tests
  • 051a2d3 Bump version patch
  • 2c034bc Traverse up to find first tsconfig.json

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

An in-range update of @types/node is breaking the build 🚨

Version 8.0.27 of @types/node just got published.

Branch Build failing 🚨
Dependency @types/node
Current Version 8.0.26
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

As @types/node is “only” a devDependency of this project it might not break production or downstream projects, but “only” your build or test tools – preventing new deploys or publishes.

I recommend you give this issue a high priority. I’m sure you can resolve this 💪

Status Details
  • continuous-integration/travis-ci/push The Travis CI build failed Details

Not sure how things should work exactly?

There is a collection of frequently asked questions and of course you may always ask my humans.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.