GithubHelp home page GithubHelp logo

jscutlery / convoyr Goto Github PK

View Code? Open in Web Editor NEW
42.0 42.0 3.0 9.94 MB

Modular HTTP extensions for Angular.

License: MIT License

TypeScript 96.79% JavaScript 2.79% CSS 0.14% HTML 0.23% Shell 0.04%
angular rxjs typescript

convoyr's People

Contributors

edbzn avatar pegaltier avatar renovate-bot avatar renovate[bot] avatar yjaaidi 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

Watchers

 avatar  avatar

convoyr's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.

Plugin Refresh

A plugin that re-fetch data by :

  • interval
  • network reconnection
  • window focus after inactivity

Avoid copying dist files from /dist to libs/xxx/dist for lerna

Lerna needs dist files in directory relative to the package.
We are currently copying that package manually on prepublish. This is cumbersome and error prone.

Maybe we should configure that dist directory in angular.json (but we have to remember to do that again when we create new libs).

We could also just build the needed package in prepublish script instead of build everything with nx before.

HTTP Client wrapper RFC

Summary

In this RFC we propose adding an HTTP client wrapper for Convoyr.

After some discussions with @yjaaidi we think that Convoyr should benefit from having its own HTTP client. Actually we're facing two major issues with Convoyr :

  1. Actual implementation relies on HttpInterceptor which are powerful for handling some global features, like authentication, but is heavily missing a per request plugin mechanism.
  2. From the beginning we really want to make Convoyr platform agnostic, @convoyr/core was initially built with this aspect in mind, but here also, the use of interceptors is very limiting for extending the Node.js platform.

Examples

One basic example.

convoyr.get('/service', { plugins: [createCachePlugin()] })

Another example with Angular.

export class BikeSearchComponent {
  searchControl = new FormControl();
  bikes$ = this.searchControl.valueChanges.pipe(
    startWith(''),
    switchMap((query) =>
      this.convoyr.get<{ bikes: Bike[] }>(
        environment.apiBaseUrl + '/bikes',
        {
          params: { q: query },
          plugins: [createCachePlugin()],
        }
      )
    ),
    shareReplay({ bufferSize: 1, refCount: true })
  );

  constructor(private convoyr: Convoyr) {}
}

Detailed design

Some subtle aspects of this design that we especially appreciate :

  • Use an underlying client through the adapter pattern,
  • isomorphism with Angular HttpClient,
  • provide an Axios adapter,
  • provide an Angular adapter,
  • focus on JSON APIs features.

Execution plan for Angular :

Convoyr.get => Plugin A => Plugin B => Convoyr Angular Adapter => HttpClient.get(...)

For Axios :

Convoyr.get => Plugin A => Plugin B => Convoyr Axios Adapter => Axios.get(...)

NOTE: Suggestions or comments are highly appreciated.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Found renovate config warnings

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore: πŸ“¦ replace dependency npm-run-all with npm-run-all2 ^5.0.0
  • chore: πŸ“¦ update angular-cli monorepo (@angular-devkit/build-angular, @angular/cli)
  • chore: πŸ“¦ update dependency @types/express to v4.17.21
  • chore: πŸ“¦ update dependency jest-date-mock to v1.0.10
  • fix: πŸ“¦ update dependency bytes to v3.1.2
  • chore: πŸ“¦ update dependency @hirez_io/observer-spy to v2.2.0
  • chore: πŸ“¦ update dependency @types/node to v16.18.98
  • chore: πŸ“¦ update dependency all-contributors-cli to v6.26.1
  • chore: πŸ“¦ update dependency prettier to v2.8.8
  • chore: πŸ“¦ update dependency tsickle to ^0.46.0
  • chore: πŸ“¦ update jest monorepo (@types/jest, jest)
  • fix: πŸ“¦ update dependency body-parser to v1.20.2
  • fix: πŸ“¦ update dependency core-js to v3.37.1
  • fix: πŸ“¦ update dependency tslib to v2.6.3
  • fix: πŸ“¦ update dependency zone.js to ~0.14.0
  • chore: πŸ“¦ update actions/cache action to v4
  • chore: πŸ“¦ update actions/checkout action to v4
  • chore: πŸ“¦ update actions/setup-node action to v4
  • chore: πŸ“¦ update codecov/codecov-action action to v4
  • chore: πŸ“¦ update dependency @types/lru-cache to v7
  • chore: πŸ“¦ update dependency @types/node to v20
  • chore: πŸ“¦ update dependency cypress to v13
  • chore: πŸ“¦ update dependency dotenv to v16
  • chore: πŸ“¦ update dependency eslint to v9
  • chore: πŸ“¦ update dependency husky to v9
  • chore: πŸ“¦ update dependency jest-preset-angular to v14
  • chore: πŸ“¦ update dependency lerna to v8
  • chore: πŸ“¦ update dependency lint-staged to v15
  • chore: πŸ“¦ update dependency ng-packagr to v18
  • chore: πŸ“¦ update dependency prettier to v3
  • chore: πŸ“¦ update dependency typescript to v5
  • chore: πŸ“¦ update jest monorepo to v29 (major) (@types/jest, jest, ts-jest)
  • fix: πŸ“¦ update dependency backoff-rxjs to v7
  • fix: πŸ“¦ update dependency lru-cache to v10
  • chore: πŸ“¦ lock file maintenance
  • πŸ” Create all rate-limited PRs at once πŸ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v2
  • actions/setup-node v1
  • actions/cache v2
  • actions/checkout v2
  • actions/setup-node v1
  • actions/cache v2
  • actions/checkout v2
  • actions/setup-node v1
  • actions/cache v2
  • codecov/codecov-action v2.1.0
npm
libs/angular/package.json
  • tslib ^2.0.0
  • @angular/common >= 9.1.11
  • @angular/core >= 9.1.11
  • rxjs ^6.5.4
libs/core/package.json
  • tslib ^2.0.0
  • rxjs ^6.5.4
libs/plugin-auth/package.json
  • tslib ^2.0.0
  • rxjs ^6.5.4
libs/plugin-cache/package.json
  • buffer ^6.0.0
  • bytes ^3.1.0
  • lru-cache ^6.0.0
  • tslib ^2.0.0
  • rxjs ^6.5.4
libs/plugin-retry/package.json
  • backoff-rxjs ^6.3.3
  • tslib ^2.0.0
  • rxjs ^6.5.4
package.json
  • @angular/animations ^11.0.1
  • @angular/cdk ^11.0.0
  • @angular/common ^11.0.1
  • @angular/compiler ^11.0.1
  • @angular/core ^11.0.1
  • @angular/flex-layout ^9.0.0-beta.31
  • @angular/forms ^11.0.1
  • @angular/material ^11.0.0
  • @angular/platform-browser ^11.0.1
  • @angular/platform-browser-dynamic ^11.0.1
  • @angular/router ^11.0.1
  • @nrwl/angular ^11.0.0
  • body-parser ^1.19.0
  • core-js ^3.6.4
  • cors ^2.8.5
  • express 4.19.2
  • rxjs ~6.6.0
  • tslib ^2.0.0
  • zone.js ~0.11.0
  • @angular-devkit/build-angular ~0.1102.0
  • @angular/cli 11.2.15
  • @angular/compiler-cli ^11.0.1
  • @angular/language-service ^11.0.1
  • @commitlint/cli 12.1.4
  • @commitlint/config-angular ^12.0.0
  • @commitlint/config-conventional ^12.0.0
  • @hirez_io/observer-spy ^2.0.0
  • @nrwl/cypress 11.3.1
  • @nrwl/express ^11.0.0
  • @nrwl/jest 11.3.1
  • @nrwl/node 11.3.1
  • @nrwl/workspace 11.3.1
  • @types/express 4.17.13
  • @types/jest 27.0.3
  • @types/lru-cache ^5.1.0
  • @types/node ^16.0.0
  • all-contributors-cli ^6.12.0
  • codelyzer ^6.0.0
  • cypress 6.9.1
  • dotenv 10.0.0
  • eslint 7.32.0
  • husky ^6.0.0
  • jest 27.4.3
  • jest-date-mock ^1.0.8
  • jest-preset-angular 8.4.0
  • lerna ^4.0.0
  • lint-staged 11.1.2
  • ng-packagr ^11.0.0
  • npm-run-all ^4.1.5
  • prettier 2.5.1
  • rxjs-marbles ^7.0.0
  • ts-jest 27.1.5
  • ts-node ~9.1.0
  • tsickle ^0.43.0
  • tslint ~6.1.0
  • typescript ~4.1.0

  • Check this box to trigger a request for Renovate to run again on this repository

πŸ› Multiple request params on HttpParams not honored.

I just installed this plugin with the settings you defined in the readme in my AppModule. Immediately, a form directive that was using the code below started failing. Upon further inspection, we could see that it would only include the last param we set. The moment we removed convoyr from AppModule, both request params were back on the url.

Example:

@Injectable({providedIn: 'root'})
export class HotelUrlNameService {
  isUrlNameAvailable(hotelIdentifier: string, urlName: string): Observable<UniqueResult> {

    const params = new HttpParams()
    .set('hotelIdentifier', hotelIdentifier)
    .set('urlName', urlName)
    ;

    return this.httpClient.get<UniqueResult>(`${this.environment.inventoryAPIEndpointBaseURL}/api/administration/hotel/urlname`, { params });
  }

  constructor(private readonly httpClient: HttpClient,
              @Inject(ENVIRONMENT) private readonly environment: any) {
  }
}

ReSTful Cache Plugin

A specific cache plugin for ReSTful API, probably based on the current cache plugin could improve caching by understanding the semantics of the API.

Here are some examples:

GET /items => {items: [{id: '123', name: 'demo'}]}
GET /items/123 => cache hit => {id: '123', name: 'demo'}
(PATCH|PUT) /items/123  {name: 'updated demo'} => {id: '123', name: 'updated demo'} => update item in storage using response
GET /items => {items: [{id: '123', name: 'updated demo'}]}

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.