@ng-apimock/base-client
Advanced tools
Comparing version
@@ -6,7 +6,24 @@ # Changelog | ||
# [2.0.0](https://github.com/ng-apimock/base-client/compare/v1.0.16...v2.0.0) (2020-07-08) | ||
### Features | ||
* 🎸 make endpoints base path configurable ([b6ef72e](https://github.com/ng-apimock/base-client/commit/b6ef72e1c6b45e666da2ce5eb6c1d20022514a0b)), closes [#5](https://github.com/ng-apimock/base-client/issues/5) | ||
### BREAKING CHANGES | ||
* 🧨 constructor now accepts a configuration object instead of the baseurl | ||
## [1.0.16](https://github.com/ng-apimock/base-client/compare/v1.0.15...v1.0.16) (2020-06-15) | ||
### Bug Fixes | ||
### Chore | ||
* 🤖 update project repo ([b4c026a](https://github.com/ng-apimock/base-client/commit/b4c026a970a31cbc257a6ca2a2e4eab7e7a6a0a9)) | ||
* 🎡 migrate to github-actions ([5d207f5](https://github.com/ng-apimock/base-client/commit/5d207f5b177451c02829d7a30199795f7c697914)) | ||
* 🐛 remove incorrect import ([eba751d](https://github.com/ng-apimock/base-client/commit/eba751d36752d88bd5e996736db90e77501dc8c4)) | ||
## [1.0.15](https://github.com/ng-apimock/base-client/compare/v1.0.14...v1.0.15) (2020-03-03) | ||
### Feature | ||
* add https support ([3eeab5](https://github.com/ng-apimock/base-client/commit/3eeab54bbe8eb680c56f2a2751916129af57e55d)) |
import { Request } from 'node-fetch'; | ||
import { Client } from './client'; | ||
import { Configuration } from './configuration'; | ||
declare abstract class BaseClient implements Client { | ||
@@ -7,3 +8,4 @@ ngApimockId: string; | ||
private agent; | ||
constructor(baseUrl: string); | ||
private configuration; | ||
constructor(configuration: Configuration); | ||
delayResponse(name: string, delay: number): Promise<any>; | ||
@@ -31,2 +33,2 @@ deleteVariable(key: string): Promise<any>; | ||
} | ||
export { BaseClient, Client }; | ||
export { BaseClient, Client, Configuration }; |
@@ -17,7 +17,8 @@ "use strict"; | ||
const uuid = require("uuid"); | ||
const COOKIE_NAME = 'apimockid'; | ||
const configuration_1 = require("./configuration"); | ||
class BaseClient { | ||
constructor(baseUrl) { | ||
constructor(configuration) { | ||
this.ngApimockId = uuid.v4(); | ||
this.baseUrl = urljoin(baseUrl, 'ngapimock'); | ||
this.configuration = Object.assign(Object.assign({}, configuration_1.DefaultConfiguration), JSON.parse(JSON.stringify(configuration))); | ||
this.baseUrl = urljoin(this.configuration.baseUrl, this.configuration.basePath); | ||
this.agent = new https.Agent({ | ||
@@ -76,3 +77,3 @@ rejectUnauthorized: false | ||
headers: { | ||
Cookie: `${COOKIE_NAME}=${this.ngApimockId}`, | ||
Cookie: `${this.configuration.identifier}=${this.ngApimockId}`, | ||
'Content-Type': 'application/json' | ||
@@ -125,3 +126,3 @@ } | ||
yield this.openUrl(urljoin(this.baseUrl, 'init')); | ||
yield this.setCookie(COOKIE_NAME, this.ngApimockId); | ||
yield this.setCookie(this.configuration.identifier, this.ngApimockId); | ||
return this; | ||
@@ -128,0 +129,0 @@ }); |
{ | ||
"name": "@ng-apimock/base-client", | ||
"description": "Base client for @ng-apimock/core", | ||
"version": "1.0.16", | ||
"version": "2.0.0", | ||
"homepage": "https://github.com/ng-apimock/base-client#readme", | ||
@@ -35,4 +35,4 @@ "author": { | ||
"devDependencies": { | ||
"@commitlint/cli": "8.3.5", | ||
"@commitlint/config-conventional": "8.3.4", | ||
"@commitlint/cli": "9.0.1", | ||
"@commitlint/config-conventional": "9.0.1", | ||
"@semantic-release/changelog": "5.0.1", | ||
@@ -44,21 +44,21 @@ "@semantic-release/commit-analyzer": "8.0.1", | ||
"@semantic-release/release-notes-generator": "9.0.1", | ||
"@types/jest": "26.0.0", | ||
"@types/jest": "26.0.4", | ||
"@types/node-fetch": "2.5.7", | ||
"@types/url-join": "4.0.0", | ||
"@types/uuid": "8.0.0", | ||
"@typescript-eslint/eslint-plugin": "3.3.0", | ||
"@typescript-eslint/parser": "3.3.0", | ||
"@typescript-eslint/eslint-plugin": "3.6.0", | ||
"@typescript-eslint/parser": "3.6.0", | ||
"commitizen": "4.1.2", | ||
"eslint": "7.2.0", | ||
"eslint": "7.4.0", | ||
"eslint-config-airbnb-base": "14.2.0", | ||
"eslint-plugin-import": "2.21.2", | ||
"eslint-plugin-jest": "23.13.2", | ||
"eslint-plugin-import": "2.22.0", | ||
"eslint-plugin-jest": "23.18.0", | ||
"husky": "4.2.5", | ||
"jest": "26.0.1", | ||
"jest": "26.1.0", | ||
"jest-createspyobj": "1.2.2", | ||
"lint-staged": "10.2.10", | ||
"lint-staged": "10.2.11", | ||
"rimraf": "3.0.2", | ||
"semantic-release": "17.0.8", | ||
"ts-jest": "26.1.0", | ||
"typescript": "3.9.5" | ||
"semantic-release": "17.1.1", | ||
"ts-jest": "26.1.1", | ||
"typescript": "3.9.6" | ||
}, | ||
@@ -68,3 +68,3 @@ "dependencies": { | ||
"url-join": "4.0.1", | ||
"uuid": "8.1.0" | ||
"uuid": "8.2.0" | ||
}, | ||
@@ -71,0 +71,0 @@ "husky": { |
@@ -5,2 +5,2 @@ # ng-apimock/base-client [](https://www.npmjs.com/package/@ng-apimock/base-client) [](https://github.com/ng-apimock/base-client/actions?workflow=CI) [](https://sonarcloud.io/dashboard?id=ng-apimock_base-client) [](http://commitizen.github.io/cz-cli/) [](https://github.com/semantic-release/semantic-release) [](https://dependabot.com) [](https://david-dm.org/ng-apimock/base-client) [](https://david-dm.org/ng-apimock/base-client#info=devDependencies)  | ||
## Usage | ||
The base-client is an abstract client interface that can be implemented to connect to the ng-apimock core. | ||
The base-client is an abstract client interface that can be implemented to connect to the @ng-apimock/core. |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
30871
9.44%21
16.67%210
9.95%1
-50%+ Added
- Removed
Updated