Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-api

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-api - npm Package Compare versions

Comparing version 0.4.2 to 0.5.0

dist/index.d.ts

1

dist/api-config.d.ts

@@ -10,2 +10,3 @@ import { RequestOptions } from '@angular/http';

constructor(config?: any);
token: string;
}

@@ -22,5 +22,16 @@ "use strict";

headers.set('Content-Type', this.contentType);
headers.set(this.authHeaderName, this.authHeaderPrefix + " " + localStorage.getItem(this.tokenName));
headers.set(this.authHeaderName, this.authHeaderPrefix + " " + this.token);
this.requestOptions = new http_1.RequestOptions({ headers: headers });
}
Object.defineProperty(ApiConfig.prototype, "token", {
get: function () {
return localStorage.getItem(this.tokenName);
},
set: function (token) {
this.requestOptions.headers.set(this.authHeaderName, this.authHeaderPrefix + " " + token);
localStorage.setItem(this.tokenName, token);
},
enumerable: true,
configurable: true
});
ApiConfig = __decorate([

@@ -33,2 +44,2 @@ core_1.Injectable(),

exports.ApiConfig = ApiConfig;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9hcGktY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSxxQkFBeUIsZUFBZSxDQUFDLENBQUE7QUFDekMscUJBQXNDLGVBQWUsQ0FBQyxDQUFBO0FBR3REO0lBUUUsbUJBQVksTUFBWTtRQUN0QixJQUFJLENBQUMsT0FBTyxHQUFHLE1BQU0sQ0FBQyxPQUFPLElBQUksRUFBRSxDQUFDO1FBQ3BDLElBQUksQ0FBQyxXQUFXLEdBQUcsTUFBTSxDQUFDLFdBQVcsSUFBSSxrQkFBa0IsQ0FBQztRQUM1RC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0aG9yaXphdGlvbic7XG4gICAgdGhpcy5hdXRoSGVhZGVyUHJlZml4ID0gY29uZmlnLmF1dGhIZWFkZXJQcmVmaXggfHwgJ0JlYXJlcic7XG5cbiAgICBsZXQgaGVhZGVyczogSGVhZGVycyA9IG5ldyBIZWFkZXJzKCk7XG4gICAgaGVhZGVycy5zZXQoJ0NvbnRlbnQtVHlwZScsIHRoaXMuY29udGVudFR5cGUpO1xuICAgIGhlYWRlcnMuc2V0KHRoaXMuYXV0aEhlYWRlck5hbWUsIGAke3RoaXMuYXV0aEhlYWRlclByZWZpeH0gJHt0aGlzLnRva2VufWApO1xuICAgIHRoaXMucmVxdWVzdE9wdGlvbnMgPSBuZXcgUmVxdWVzdE9wdGlvbnMoe2hlYWRlcnN9KTtcbiAgfVxuXG4gIGdldCB0b2tlbigpOiBzdHJpbmcge1xuICAgIHJldHVybiBsb2NhbFN0b3JhZ2UuZ2V0SXRlbSh0aGlzLnRva2VuTmFtZSk7XG4gIH1cblxuICBzZXQgdG9rZW4odG9rZW46IHN0cmluZykge1xuICAgIHRoaXMucmVxdWVzdE9wdGlvbnMuaGVhZGVycy5zZXQodGhpcy5hdXRoSGVhZGVyTmFtZSwgYCR7dGhpcy5hdXRoSGVhZGVyUHJlZml4fSAke3Rva2VufWApO1xuICAgIGxvY2FsU3RvcmFnZS5zZXRJdGVtKHRoaXMudG9rZW5OYW1lLCB0b2tlbik7XG4gIH1cbn1cbiJdfQ==

4

dist/api-http.d.ts

@@ -5,5 +5,5 @@ import { Http, Response, RequestOptions } from '@angular/http';

export declare class ApiHttp {
private apiConfig;
config: ApiConfig;
private http;
constructor(apiConfig: ApiConfig, http: Http);
constructor(config: ApiConfig, http: Http);
url(path: string, params?: any): string;

@@ -10,0 +10,0 @@ requestOptions(options?: RequestOptions): RequestOptions;

@@ -16,4 +16,4 @@ "use strict";

var ApiHttp = (function () {
function ApiHttp(apiConfig, http) {
this.apiConfig = apiConfig;
function ApiHttp(config, http) {
this.config = config;
this.http = http;

@@ -24,6 +24,6 @@ }

var interpolatedPath = api_helpers_1.ApiHelpers.interpolate(path, params);
return this.apiConfig.baseUrl + "/" + interpolatedPath;
return this.config.baseUrl + "/" + interpolatedPath;
};
ApiHttp.prototype.requestOptions = function (options) {
return this.apiConfig.requestOptions.merge(options);
return this.config.requestOptions.merge(options);
};

@@ -52,2 +52,2 @@ ApiHttp.prototype.get = function (url, options) {

exports.ApiHttp = ApiHttp;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLWh0dHAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvYXBpLWh0dHAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLHFCQUF5QixlQUFlLENBQUMsQ0FBQTtBQUN6QyxxQkFBNkMsZUFBZSxDQUFDLENBQUE7QUFFN0QsNEJBQXlCLGVBQWUsQ0FBQyxDQUFBO0FBQ3pDLDJCQUF3QixjQUFjLENBQUMsQ0FBQTtBQUd2QztJQUNFLGlCQUFvQixTQUFvQixFQUNwQixJQUFVO1FBRFYsY0FBUyxHQUFULFNBQVMsQ0FBVztRQUNwQixTQUFJLEdBQUosSUFBSSxDQUFNO0lBQzlCLENBQUM7SUFFRCxxQkFBRyxHQUFILFVBQUksSUFBWSxFQUFFLE1BQWdCO1FBQWhCLHNCQUFnQixHQUFoQixXQUFnQjtRQUNoQyxJQUFJLGdCQUFnQixHQUFHLHdCQUFVLENBQUMsV0FBVyxDQUFDLElBQUksRUFBRSxNQUFNLENBQUMsQ0FBQztRQUM1RCxNQUFNLENBQUksSUFBSSxDQUFDLFNBQVMsQ0FBQyxPQUFPLFNBQUksZ0JBQWtCLENBQUM7SUFDekQsQ0FBQztJQUVELGdDQUFjLEdBQWQsVUFBZSxPQUF3QjtRQUNyQyxNQUFNLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUMsS0FBSyxDQU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pXG4gICAgICAubWFwKChyZXM6IFJlc3BvbnNlKSA9PiB0aGlzLmRlc2VyaWFsaXplKHJlcy5qc29uKCkpKTtcbiAgfVxuXG4gIHVwZGF0ZShtb2RlbDogVCk6IE9ic2VydmFibGU8VD4ge1xuICAgIHJldHVybiB0aGlzLmh0dHAucHV0KFxuICAgICAgQXBpSGVscGVycy5pbnRlcnBvbGF0ZShgJHt0aGlzLnBhdGh9LzppZGAsIG1vZGVsKSxcbiAgICAgIHRoaXMuc2VyaWFsaXplKG1vZGVsKVxuICAgICkubWFwKChyZXM6IFJlc3BvbnNlKSA9PiB0aGlzLmRlc2VyaWFsaXplKHJlcy5qc29uKCkpKTtcbiAgfVxuXG4gIGRlbGV0ZShtb2RlbDogVCk6IE9ic2VydmFibGU8Ym9vbGVhbj4ge1xuICAgIGxldCByZXF1ZXN0T3B0aW9ucyA9IG5ldyBSZXF1ZXN0T3B0aW9ucyh7Ym9keTogJyd9KTtcblxuICAgIHJldHVybiB0aGlzLmh0dHAuZGVsZXRlKFxuICAgICAgQXBpSGVscGVycy5pbnRlcnBvbGF0ZShgJHt0aGlzLnBhdGh9LzppZGAsIG1vZGVsKSxcbiAgICAgIHJlcXVlc3RPcHRpb25zXG4gICAgKS5tYXAoKHJlczogUmVzcG9uc2UpID0+IHJlcy5vayk7XG4gIH1cbn1cbiJdfQ==

@@ -1,76 +0,38 @@

// Turn on full stack traces in errors to help debugging
Error.stackTraceLimit=Infinity;
Error.stackTraceLimit = Infinity;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 100;
require('core-js/client/shim');
require('reflect-metadata');
// Cancel Karma's synchronous start,
// we will call `__karma__.start()` later, once all the specs are loaded.
__karma__.loaded = function() {};
require('ts-helpers');
System.config({
baseURL: '/base/',
defaultJSExtensions: true,
map: {
'rxjs': 'node_modules/rxjs',
'@angular': 'node_modules/@angular'
},
packages: {
'@angular/core': {
main: 'index.js'
},
'@angular/compiler': {
main: 'index.js'
},
'@angular/common': {
main: 'index.js'
},
'@angular/http': {
main: 'index.js'
},
'@angular/platform-browser': {
main: 'index.js'
},
'@angular/platform-browser-dynamic': {
main: 'index.js'
}
}
});
require('zone.js/dist/zone');
require('zone.js/dist/long-stack-trace-zone');
require('zone.js/dist/proxy');
require('zone.js/dist/sync-test');
require('zone.js/dist/jasmine-patch');
require('zone.js/dist/async-test');
require('zone.js/dist/fake-async-test');
Promise.all([
System.import('@angular/core/testing'),
System.import('@angular/platform-browser-dynamic/testing')
]).then(function (providers) {
var testing = providers[0];
var testingBrowser = providers[1];
/*
Ok, this is kinda crazy. We can use the the context method on
require that webpack created in order to tell webpack
what files we actually want to require or import.
Below, context will be a function/object with file names as keys.
using that regex we are saying look in client/app and find
any file that ends with '.spec.ts' and get its path. By passing in true
we say do this recursively
*/
var appContext = require.context('./test', true, /\.spec\.ts/);
testing.setBaseTestProviders(testingBrowser.TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS,
testingBrowser.TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS);
// get all the files, for each file, call the context function
// that will require the file and load it up here. Context will
// loop and require those spec files here
appContext.keys().forEach(appContext);
}).then(function() {
// Finally, load all spec files.
// This will run the tests directly.
return Promise.all(
Object.keys(window.__karma__.files) // All files served by Karma.
.filter(onlySpecFiles)
.map(file2moduleName)
.map(function(path) {
return System.import(path).then(function(module) {
if (module.hasOwnProperty('main')) {
module.main();
} else {
throw new Error('Module ' + path + ' does not implement main() method.');
}
});
}));
}).then(__karma__.start, __karma__.error);
// Select BrowserDomAdapter.
// see https://github.com/AngularClass/angular2-webpack-starter/issues/124
// Somewhere in the test setup
var testing = require('@angular/core/testing');
var browser = require('@angular/platform-browser-dynamic/testing');
function onlySpecFiles(path) {
return /[\.|_]spec\.js$/.test(path);
}
// Normalize paths to module names.
function file2moduleName(filePath) {
return filePath.replace(/\\/g, '/')
.replace(/^\/base\//, '')
.replace(/\.js/, '');
}
testing.TestBed.initTestEnvironment(browser.BrowserDynamicTestingModule, browser.platformBrowserDynamicTesting());
// Karma configuration
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: './',
basePath: '',

@@ -14,36 +13,45 @@ // frameworks to use

files: [
// for Travis
'node_modules/es6-shim/es6-shim.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/zone.js/dist/long-stack-trace-zone.js',
'node_modules/zone.js/dist/jasmine-patch.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/reflect-metadata/Reflect.js',
{ pattern: 'node_modules/@angular/**/*.js', included: false, watched: false, served: true },
{ pattern: 'node_modules/rxjs/**/*.js', included: false, watched: false, served: true },
{ pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: false, watched: false, served: true }, // PhantomJS2 (and possibly others) might require it
{ pattern: 'src/**/*.ts', included: false, watched: true }, // source files
{ pattern: 'test/**/*.ts', included: false, watched: true }, // test files
'karma-shim.js'
{ pattern: './karma-shim.js', watched: false },
],
// list of files to exclude
exclude: [
'node_modules/angular2/**/*_spec.js'
],
exclude: [],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'**/*.ts': ['typescript']
'./karma-shim.js': ['webpack', 'sourcemap']
},
typescriptPreprocessor: {
options: {
webpack: {
context: __dirname,
devtool: 'inline-source-map',
resolve: {
modulesDirectories: [
'src',
'test',
'node_modules'
],
extensions: ['', '.js', '.ts', '.json', '.scss', '.css', '.html']
},
typings: [
"typings/index.d.ts"
]
module: {
loaders: [
{
test: /\.ts$/,
loaders: ['ts']
}
]
},
},
webpackMiddleware: {
// webpack-dev-middleware configuration
// i. e.
stats: 'errors-only'
},
webpackServer: {
noInfo: true // please don't spam the console when running in karma!
},
// test results reporter to use

@@ -54,3 +62,2 @@ // possible values: 'dots', 'progress'

// web server port

@@ -67,3 +74,3 @@ port: 9876,

// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
autoWatch: true,

@@ -76,8 +83,4 @@ // start these browsers

// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultanous
concurrency: Infinity
singleRun: false,
})
};
{
"name": "ng2-api",
"version": "0.4.2",
"version": "0.5.0",
"description": "Angular2 API services",
"main": "dist/ng2-api.js",
"typings": "dist/ng2-api.d.ts",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {

@@ -12,4 +12,5 @@ "clean": "rimraf typings src/*.{js,d.ts}",

"test": "karma start",
"test:w": "karma start --no-single-run --auto-watch",
"prepublish": "npm run build"
"test:ci": "karma start --singleRun",
"prepublish": "npm run build",
"postinstall": "typings install"
},

@@ -47,3 +48,4 @@ "keywords": [

"karma-phantomjs-launcher": "^1.0.0",
"karma-typescript-preprocessor": "0.2.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "1.7.0",
"phantomjs-prebuilt": "^2.1.7",

@@ -53,7 +55,9 @@ "reflect-metadata": "0.1.2",

"rxjs": "5.0.0-beta.6",
"systemjs": "^0.19.26",
"ts-helpers": "^1.1.1",
"ts-loader": "^0.8.1",
"tslint": "^3.9.0",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"zone.js": "^0.6.12"
"webpack": "^1.12.13",
"zone.js": "^0.6.17"
},

@@ -60,0 +64,0 @@ "peerDependencies": {

@@ -61,3 +61,3 @@ # ng2-api

localStorage.setItem('profile', JSON.stringify(user));
localStorage.setItem('token', token);
this.http.config.token = token;
this.authenticated = true;

@@ -71,3 +71,3 @@ this.user = user;

localStorage.removeItem('profile');
localStorage.removeItem('token');
this.http.config.token = '';
this.authenticated = false;

@@ -165,4 +165,3 @@ this.user = null;

npm i
npm run build
npm run test:w
npm test

@@ -169,0 +168,0 @@ ## License

@@ -22,5 +22,14 @@ import {Injectable} from '@angular/core';

headers.set('Content-Type', this.contentType);
headers.set(this.authHeaderName, `${this.authHeaderPrefix} ${localStorage.getItem(this.tokenName)}`);
headers.set(this.authHeaderName, `${this.authHeaderPrefix} ${this.token}`);
this.requestOptions = new RequestOptions({headers});
}
get token(): string {
return localStorage.getItem(this.tokenName);
}
set token(token: string) {
this.requestOptions.headers.set(this.authHeaderName, `${this.authHeaderPrefix} ${token}`);
localStorage.setItem(this.tokenName, token);
}
}

@@ -9,3 +9,3 @@ import {Injectable} from '@angular/core';

export class ApiHttp {
constructor(private apiConfig: ApiConfig,
constructor(public config: ApiConfig,
private http: Http) {

@@ -16,7 +16,7 @@ }

let interpolatedPath = ApiHelpers.interpolate(path, params);
return `${this.apiConfig.baseUrl}/${interpolatedPath}`;
return `${this.config.baseUrl}/${interpolatedPath}`;
}
requestOptions(options?: RequestOptions): RequestOptions {
return this.apiConfig.requestOptions.merge(options);
return this.config.requestOptions.merge(options);
}

@@ -23,0 +23,0 @@

@@ -25,3 +25,3 @@ import {Response, RequestOptions} from '@angular/http';

deserialize(data: any): T {
return <T>(this.config.objectRoot ? data[this.config.objectRoot]||data : data);
return <T>(this.config.objectRoot ? data[this.config.objectRoot] || data : data);
}

@@ -28,0 +28,0 @@

@@ -1,37 +0,29 @@

import {URLSearchParams} from '@angular/http';
import {ApiHelpers} from '../src/api-helpers';
import { URLSearchParams } from '@angular/http';
import { ApiHelpers } from '../src/api-helpers';
import {
expect,
it,
describe
} from '@angular/core/testing';
describe('ApiHelpers', () => {
describe('interpolate', () => {
it('should interpolate :post_id and :id', () => {
let comment = {id: 2, post_id: 1, content: 'Good work!'};
let interpolatedPath = ApiHelpers.interpolate('/posts/:post_id/comments/:id', comment);
expect(interpolatedPath).toEqual('/posts/1/comments/2');
expect(comment).toEqual({id: 2, post_id: 1, content: 'Good work!'});
});
export function main() {
describe('ApiHelpers', () => {
describe('interpolate', () => {
it('should interpolate :post_id and :id', () => {
let comment = {id: 2, post_id: 1, content: 'Good work!'};
let interpolatedPath = ApiHelpers.interpolate('/posts/:post_id/comments/:id', comment);
expect(interpolatedPath).toEqual('/posts/1/comments/2');
expect(comment).toEqual({id: 2, post_id: 1, content: 'Good work!'});
});
it('should interpolate :post_id and remove it', () => {
let search = {post_id: 1, order_by: '-created_at'};
let interpolatedPath = ApiHelpers.interpolate('/posts/:post_id/comments', search, true);
expect(interpolatedPath).toEqual('/posts/1/comments');
expect(search).toEqual({order_by: '-created_at'});
});
it('should interpolate :post_id and remove it', () => {
let search = {post_id: 1, order_by: '-created_at'};
let interpolatedPath = ApiHelpers.interpolate('/posts/:post_id/comments', search, true);
expect(interpolatedPath).toEqual('/posts/1/comments');
expect(search).toEqual({order_by: '-created_at'});
});
});
describe('toSearch', () => {
it('should build URLSearchParams', () => {
let search = {post_id: 1, order_by: '-created_at'};
let urlSearchParams = ApiHelpers.toSearch(search);
expect(urlSearchParams instanceof URLSearchParams).toEqual(true);
expect(urlSearchParams.toString()).toEqual('post_id=1&order_by=-created_at');
});
describe('toSearch', () => {
it('should build URLSearchParams', () => {
let search = {post_id: 1, order_by: '-created_at'};
let urlSearchParams = ApiHelpers.toSearch(search);
expect(urlSearchParams instanceof URLSearchParams).toEqual(true);
expect(urlSearchParams.toString()).toEqual('post_id=1&order_by=-created_at');
});
});
};
});

@@ -18,5 +18,5 @@ {

"files": [
"src/ng2-api.ts",
"src/index.ts",
"typings/index.d.ts"
]
}
{
"name": "ng2-api",
"version": false,
"globalDevDependencies": {
"es6-shim": "registry:dt/es6-shim#0.31.2+20160317120654",
"jasmine": "registry:dt/jasmine#2.2.0+20160412134438",
"require": "registry:dt/require#2.1.20+20160316155526"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc