Skip to content

Commit

Permalink
Merge pull request #29 from holidayextras/depsVersionUpForNode16
Browse files Browse the repository at this point in the history
Update to node 16 and hapi 21
  • Loading branch information
putvande authored May 3, 2023
2 parents d6c5f94 + df356ff commit 3ab6c26
Show file tree
Hide file tree
Showing 5 changed files with 10,250 additions and 6,216 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14
16
30 changes: 15 additions & 15 deletions lib/pluginTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

'use strict'

var Q = require('q')
var Transformer = require('transformer')
const Q = require('q')
const Transformer = require('transformer')

/**
* Creates a rejected promise structure as per our plugin interface dictates
Expand All @@ -13,23 +13,23 @@ var Transformer = require('transformer')
*/
function buildReject (error, context) {
return {
error: error,
error,
origin: 'pluginTransformer',
data: context
}
}

const register = async(server) => {
var transformer = new Transformer()
const register = async (server) => {
const transformer = new Transformer()

await transformer.startReplication()
.then(function () {
.then(function () {
// Replication always on, once it's finished successfully allow access to our get() function
server.expose('getConfiguration', getConfiguration)
})
server.expose('getConfiguration', getConfiguration)
})

function getConfiguration (options) {
var deferred = Q.defer()
const deferred = Q.defer()

try {
// check for everything thats required
Expand All @@ -38,11 +38,11 @@ const register = async(server) => {
}

transformer.get(options)
.then(function (result) {
deferred.resolve(result)
}, function (error) {
deferred.reject(buildReject(error, options))
})
.then(function (result) {
deferred.resolve(result)
}, function (error) {
deferred.reject(buildReject(error, options))
})
} catch (error) {
// any exceptions that have been thrown we need to send that back with a rejected deferred
deferred.reject(buildReject(error, options))
Expand All @@ -53,7 +53,7 @@ const register = async(server) => {
}

const pkg = require('../package.json')
const {version, name} = pkg
const { version, name } = pkg

exports.plugin = {
register,
Expand Down
Loading

0 comments on commit 3ab6c26

Please sign in to comment.