trailpack-proxy-generics
Advanced tools
Comparing version 0.0.18 to 0.0.19
@@ -8,1 +8,3 @@ exports.EmailGenericService = require('./EmailGenericService') | ||
exports.GeolocationGenericService = require('./GeolocationGenericService') | ||
exports.ImageGenericService = require('./ImageGenericService') | ||
exports.RenderGenericService = require('./RenderGenericService') |
@@ -7,3 +7,3 @@ /** | ||
module.exports = { | ||
type: 'misc', | ||
type: 'extension', | ||
/** | ||
@@ -10,0 +10,0 @@ * Configure the lifecycle of this pack; that is, how it boots up, and which |
'use strict' | ||
const joi = require('joi') | ||
// TODO schema | ||
module.exports = joi.object().keys({ | ||
@@ -6,0 +5,0 @@ prefix: [joi.string().allow('').optional(), joi.allow(null)], |
@@ -9,1 +9,3 @@ exports.proxyGenericsConfig = require('./proxyGenericsConfig') | ||
exports.geolocationProvider = require('./geolocationProvider') | ||
exports.imageProvider = require('./imageProvider') | ||
exports.renderService = require('./renderService') |
@@ -28,3 +28,15 @@ 'use strict' | ||
options: joi.object() | ||
}), | ||
geolocation_provider: joi.object().keys({ | ||
adapter: joi.any(), | ||
options: joi.object() | ||
}), | ||
image_provider: joi.object().keys({ | ||
adapter: joi.any(), | ||
options: joi.object() | ||
}), | ||
render_service: joi.object().keys({ | ||
adapter: joi.any(), | ||
options: joi.object() | ||
}) | ||
}).unknown() |
@@ -530,3 +530,25 @@ 'use sticy' | ||
} | ||
}, | ||
validateRenderService: { | ||
render: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.renderService.render, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
}, | ||
renderSuccess: (config) => { | ||
return new Promise((resolve, reject) => { | ||
joi.validate(config, lib.Schemas.renderService.renderSuccess, (err, value) => { | ||
if (err) { | ||
return reject(new Errors.ValidationError(err)) | ||
} | ||
return resolve(value) | ||
}) | ||
}) | ||
} | ||
} | ||
} |
{ | ||
"name": "trailpack-proxy-generics", | ||
"version": "0.0.18", | ||
"version": "0.0.19", | ||
"description": "Generics - Trailpack for Proxy Engine", | ||
@@ -31,7 +31,7 @@ "homepage": "https://cali-style.com", | ||
"lodash": "^4.11.1", | ||
"eslint": "^2.4", | ||
"eslint-config-trails": "^2", | ||
"eslint": "^3.0.0", | ||
"eslint-config-trails": "^2.0.0", | ||
"mocha": "^2.4.5", | ||
"smokesignals": "v2-latest", | ||
"trails": "v2-latest" | ||
"smokesignals": "^2.0.0", | ||
"trails": "^2.0.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "scripts": { |
@@ -8,11 +8,14 @@ # trailpack-proxy-generics | ||
## Generic features that require adapters built with love from [Cali-Style](https://cali-style.com) | ||
## An adapter protocol for common functions, built with love from [Cali-Style](https://cali-style.com) | ||
Looking for [Proxy Engine?](https://github.com/calistyle/trailpack-proxy-engine) | ||
Generics are common features that every web application needs but implements differently. The result of a Generic is a normalized way of handling these different services. | ||
For example: Email Provider, Payment Processors, Tax Provider, Shipping Provider, Fulfillment, Geolocation, whatever you need! | ||
Generics are common features that web applications need but implement differently. The result of a Generic is a normalized way of handling these different services. | ||
Can you think of a generic we missed? Create a PR! | ||
A generic is a great way to implement 3rd parties. You can write your application to implement a single service but easily swap out the the 3rd party. | ||
Current Generics: Email Provider, Payment Processors, Tax Provider, Shipping Provider, Fulfillment, Geolocation, Image Manipulation, HTML rendering, whatever you need! | ||
Can you think of a generic or method we missed? Create a PR! | ||
## Install | ||
@@ -41,3 +44,3 @@ | ||
payment_processor: { | ||
adapter: require('<adpater>'), | ||
adapter: require('<adapter>'), | ||
options: { | ||
@@ -109,2 +112,3 @@ whatever_key: '<what ever you need here>' | ||
* [Stripe](https://github.com/CaliStyle/proxy-generics-stripe) | ||
* [Authorize.net](https://github.com/CaliStyle/proxy-generics-authorize-net) | ||
@@ -195,2 +199,15 @@ ### Tax Provider | ||
### Image Provider | ||
Handles image manipulation | ||
#### Creating an Image Provider Plugin | ||
### Render Service | ||
Handles rendering of html | ||
#### RenderGenericService.render | ||
Render a string into HTML | ||
#### Creating an Render Service Plugin | ||
[npm-image]: https://img.shields.io/npm/v/trailpack-proxy-generics.svg?style=flat-square | ||
@@ -197,0 +214,0 @@ [npm-url]: https://npmjs.org/package/trailpack-proxy-generics |
@@ -45,2 +45,6 @@ 'use strict' | ||
options: {} | ||
}, | ||
render_service: { | ||
adapter: require('./fixtures/FakeRender'), | ||
options: {} | ||
} | ||
@@ -47,0 +51,0 @@ } |
74706
116
2360
218