eurobate-sms
Advanced tools
Comparing version 0.0.2 to 0.1.0
@@ -1,5 +0,5 @@ | ||
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from 'enonic-fp/lib/common'; | ||
import { IOEither } from "fp-ts/lib/IOEither"; | ||
import { EnonicError } from 'enonic-fp/lib/common'; | ||
import { EurobateParams, EurobateResponse } from "./index"; | ||
export declare function json(str: string): Either<Error, any>; | ||
export declare function sendSMS(params: EurobateParams): Either<Error, EurobateResponse>; | ||
export declare function json(str: string): IOEither<EnonicError, any>; | ||
export declare function sendSMS(params: EurobateParams): IOEither<EnonicError, EurobateResponse>; |
@@ -1,6 +0,10 @@ | ||
import { parseJSON, chain, filterOrElse } from "fp-ts/lib/Either"; | ||
import { parseJSON } from "fp-ts/lib/Either"; | ||
import { fromEither, chain, filterOrElse } from "fp-ts/lib/IOEither"; | ||
import { pipe } from "fp-ts/lib/pipeable"; | ||
import { request } from 'enonic-fp/lib/http'; | ||
export function json(str) { | ||
return parseJSON(str, function (reason) { return ({ errorKey: "BadRequestError", cause: String(reason) }); }); | ||
return fromEither(parseJSON(str, function (reason) { return ({ | ||
errorKey: "BadGatewayError", | ||
cause: String(reason) | ||
}); })); | ||
} | ||
@@ -16,3 +20,6 @@ export function sendSMS(params) { | ||
}; | ||
return pipe(request(requestParams), chain(function (res) { return json(res.body); }), filterOrElse(function (res) { return res.STATUS !== 'ERROR'; }, function (e) { return ({ errorKey: "BadGatewayError", cause: String(e) }); })); | ||
return pipe(request(requestParams), chain(function (res) { return json(res.body); }), filterOrElse(function (res) { return res.STATUS !== 'ERROR'; }, function (e) { return ({ | ||
errorKey: "BadGatewayError", | ||
cause: String(e) | ||
}); })); | ||
} |
@@ -1,5 +0,5 @@ | ||
import { Either } from "fp-ts/lib/Either"; | ||
import { Error } from 'enonic-fp/lib/common'; | ||
import { IOEither } from "fp-ts/lib/IOEither"; | ||
import { EnonicError } from 'enonic-fp/lib/common'; | ||
import { EurobateParams, EurobateResponse } from "./index"; | ||
export declare function json(str: string): Either<Error, any>; | ||
export declare function sendSMS(params: EurobateParams): Either<Error, EurobateResponse>; | ||
export declare function json(str: string): IOEither<EnonicError, any>; | ||
export declare function sendSMS(params: EurobateParams): IOEither<EnonicError, EurobateResponse>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Either_1 = require("fp-ts/lib/Either"); | ||
var IOEither_1 = require("fp-ts/lib/IOEither"); | ||
var pipeable_1 = require("fp-ts/lib/pipeable"); | ||
var http_1 = require("enonic-fp/lib/http"); | ||
function json(str) { | ||
return Either_1.parseJSON(str, function (reason) { return ({ errorKey: "BadRequestError", cause: String(reason) }); }); | ||
return IOEither_1.fromEither(Either_1.parseJSON(str, function (reason) { return ({ | ||
errorKey: "BadGatewayError", | ||
cause: String(reason) | ||
}); })); | ||
} | ||
@@ -19,4 +23,7 @@ exports.json = json; | ||
}; | ||
return pipeable_1.pipe(http_1.request(requestParams), Either_1.chain(function (res) { return json(res.body); }), Either_1.filterOrElse(function (res) { return res.STATUS !== 'ERROR'; }, function (e) { return ({ errorKey: "BadGatewayError", cause: String(e) }); })); | ||
return pipeable_1.pipe(http_1.request(requestParams), IOEither_1.chain(function (res) { return json(res.body); }), IOEither_1.filterOrElse(function (res) { return res.STATUS !== 'ERROR'; }, function (e) { return ({ | ||
errorKey: "BadGatewayError", | ||
cause: String(e) | ||
}); })); | ||
} | ||
exports.sendSMS = sendSMS; |
{ | ||
"name": "eurobate-sms", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "Wrapper around the Eurobate APIs for JavaScript and TypeScript", | ||
@@ -20,9 +20,9 @@ "main": "lib/index.js", | ||
"axios": "^0.19.0", | ||
"enonic-fp": "^0.0.5", | ||
"fp-ts": "^2.0.5" | ||
"enonic-fp": "^0.1.8", | ||
"fp-ts": "^2.1.1" | ||
}, | ||
"devDependencies": { | ||
"rimraf": "^3.0.0", | ||
"typescript": "^3.5.3" | ||
"typescript": "^3.6.4" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8988
158
+ Addedenonic-fp@0.1.8(transitive)
- Removedenonic-fp@0.0.5(transitive)
Updatedenonic-fp@^0.1.8
Updatedfp-ts@^2.1.1