Skip to content

Commit 424ca88

Browse files
committed
resolve merge conflicts
2 parents a0067a1 + bc1b54b commit 424ca88

File tree

7 files changed

+8
-63
lines changed

7 files changed

+8
-63
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ module.exports = {
66
commonjs: true,
77
es2020: true,
88
},
9+
extends: ['standard', 'plugin:prettier/recommended'],
910
parserOptions: {
1011
ecmaVersion: 11,
1112
sourceType: 'module',
1213
ecmaFeatures: {
1314
modules: true,
14-
},
15+
}
1516
},
1617
extends: ['eslint:recommended', 'plugin:prettier/recommended'],
1718
rules: {},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"jsdoc-to-markdown": "7.1.1",
7575
"mocha": "10.0.0",
7676
"mocha-esm": "1.1.1",
77-
"prettier": "^2.8.0",
77+
"prettier": "^2.8.1",
7878
"split": "1.0.1",
7979
"standard": "^17.0.0",
8080
"yarn": "1.22.19"

src/adapters/datasources/datasource-mongodb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class DataSourceMongoDb extends DataSource {
191191
let objects = []
192192
const ctx = this
193193

194-
const upsert = async () => {
194+
async function upsert() {
195195
const operations = objects.map(obj => {
196196
return {
197197
replaceOne: {

src/aegis.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ const router = {
135135
}
136136

137137
function makeRoutes() {
138-
router.adminRoute(getConfig, http)
139-
router.userRoutes(getRoutes)
140138
router.autoRoutes(endpoint, 'get', liveUpdate, http)
141139
router.autoRoutes(endpoint, 'get', getModels, http)
142140
router.autoRoutes(endpoint, 'post', postModels, http)

src/domain/make-ports.js

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,8 @@ function setPortTimeout(options) {
6868

6969
// Retry the port on timeout
7070
const retry = async () => {
71-
<<<<<<< HEAD
72-
<<<<<<< HEAD
73-
=======
7471
// undo running
7572
if (model.compensate) return
76-
>>>>>>> 1a3ba16255209b243b8d77032a27c83a376472f7
77-
=======
78-
// undo running
79-
if (model.compensate) return
80-
>>>>>>> 29ccd6b6db2aa3bc99c3a1d2a5e5b263fc49bf79
8173
// Notify interested parties
8274
model.emit(portTimeout(model.getName(), portName), timerArgs)
8375
// Invoke optional custom handlerdw
@@ -86,15 +78,7 @@ function setPortTimeout(options) {
8678
await async(model[portName](...timerArgs.nextArg))
8779
}
8880

89-
<<<<<<< HEAD
90-
<<<<<<< HEAD
91-
const timerId = expired() ? null : setTimeout(retry, timeout)
92-
=======
9381
const timerId = setTimeout(retry, timeout)
94-
>>>>>>> 1a3ba16255209b243b8d77032a27c83a376472f7
95-
=======
96-
const timerId = setTimeout(retry, timeout)
97-
>>>>>>> 29ccd6b6db2aa3bc99c3a1d2a5e5b263fc49bf79
9882

9983
return {
10084
expired,
@@ -112,20 +96,12 @@ function setPortTimeout(options) {
11296
/**
11397
* @param {function({model:Model,port:string},{*})} cb
11498
*/
115-
<<<<<<< HEAD
11699
function getPortCallback(cb) {
117-
=======
118-
function getPortCallback (cb) {
119-
>>>>>>> 29ccd6b6db2aa3bc99c3a1d2a5e5b263fc49bf79
120100
if (typeof cb === 'function') return cb
121101
return portHandler
122102
}
123103

124-
<<<<<<< HEAD
125104
function hydrate(broker, datasource, eventInfo) {
126-
=======
127-
function hydrate (broker, datasource, eventInfo) {
128-
>>>>>>> 29ccd6b6db2aa3bc99c3a1d2a5e5b263fc49bf79
129105
const model = eventInfo.model
130106
const modelName = eventInfo.model.modelName
131107
if (!modelName) return eventInfo.model
@@ -145,24 +121,8 @@ function addPortListener(portName, portConf, broker, datasource) {
145121
if (portConf.consumesEvent) {
146122
const callback = getPortCallback(portConf.callback)
147123

148-
<<<<<<< HEAD
149-
async function listen (eventInfo) {
150-
const model = hydrate(broker, datasource, eventInfo)
151-
152-
console.log(
153-
`event ${eventInfo.eventName} fired: calling port ${portName}`,
154-
eventInfo
155-
)
156-
// invoke this port
157-
await async(model[portName](callback))
158-
}
159-
<<<<<<< HEAD
160-
161-
broker.on(portConf.consumesEvent, listen)
162-
=======
163124
async function listen(eventInfo) {
164125
const model = hydrate(broker, datasource, eventInfo)
165-
>>>>>>> 1a3ba16255209b243b8d77032a27c83a376472f7
166126

167127
console.log(
168128
`event ${eventInfo.eventName} fired: calling port ${portName}`,
@@ -171,8 +131,6 @@ function addPortListener(portName, portConf, broker, datasource) {
171131
// invoke this port
172132
await async(model[portName](callback))
173133
}
174-
=======
175-
>>>>>>> 29ccd6b6db2aa3bc99c3a1d2a5e5b263fc49bf79
176134
broker.on(portConf.consumesEvent, listen, { singleton: true })
177135
return true
178136
}
@@ -247,7 +205,7 @@ export default function makePorts(ports, adapters, broker, datasource) {
247205
portName,
248206
portConf,
249207
model: this,
250-
args
208+
args,
251209
})
252210

253211
// call the inbound or oubound adapte
@@ -309,4 +267,4 @@ export default function makePorts(ports, adapters, broker, datasource) {
309267
}
310268
})
311269
.reduce((p, c) => ({ ...p, ...c }))
312-
}
270+
}

src/domain/model.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,6 @@ const Model = (() => {
116116
.reduce((a, b) => ({ ...a, ...b }, {}))
117117
}
118118

119-
function approveChanges(changes, approvedChanges) {
120-
return Object.entries(changes)
121-
.filter(([k, v]) => approvedChanges.includes(k))
122-
.map(([k, v]) => ({ [k]: v }))
123-
.reduce((a, b) => ({ ...a, ...b }, {}))
124-
}
125-
126-
function approveChanges(changes, approvedChanges) {
127-
return Object.entries(changes)
128-
.filter(([k, v]) => approvedChanges.includes(k))
129-
.map(([k, v]) => ({ [k]: v }))
130-
.reduce((a, b) => ({ ...a, ...b }, {}))
131-
}
132-
133119
const defaultOnUpdate = (model, changes) => ({ ...model, ...changes })
134120
const defaultOnDelete = model => withTimestamp('deleteTime')(model)
135121
const defaultValidate = (model, changes) => defaultOnUpdate(model, changes)

src/domain/use-cases/invoke-port.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export default function makeInvokePort({
2525
threadpool,
2626
modelName,
2727
models,
28+
context,
29+
authorize = async x => await x(),
2830
} = {}) {
2931
//const inboundPorts = models.getModelSpec(modelName).getInboundPortFunctions()
3032

0 commit comments

Comments
 (0)