1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/lib/services/state-schema.js
Christopher Kolstad c17a1980a2
Add service layer
This simplifies stores to just be storage interaction, they no longer react to events.

Controllers now call services and awaits the result from the call.

When the service calls are returned the database is updated.
This simplifies testing dramatically, cause you know that your state is
updated when returned from a call, rather than hoping the store has
picked up the event (which really was a command) and reacted to it.

Events are still emitted from eventStore, so other parts of the app can
react to events as they're being sent out.

As part of the move to services, we now also emit an application-created
event when we see a new client application.

Fixes: #685
Fixes: #595
2021-01-21 10:59:19 +01:00

21 lines
457 B
JavaScript

const joi = require('joi');
const { featureSchema } = require('./feature-schema');
const strategySchema = require('./strategy-schema');
// TODO: Extract to seperate file
const stateSchema = joi.object().keys({
version: joi.number(),
features: joi
.array()
.optional()
.items(featureSchema),
strategies: joi
.array()
.optional()
.items(strategySchema),
});
module.exports = {
stateSchema,
};