This repository has been archived by the owner on Jul 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
/
manifest.js
208 lines (190 loc) · 7.39 KB
/
manifest.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
'use strict';
const Confidence = require('confidence');
const Config = require('./config');
const Package = require('./package.json');
const Path = require('path');
const criteria = {
env: process.env.NODE_ENV
};
const manifest = {
$meta: 'This file defines the plot device.',
server: {
debug: {
request: ['error']
},
routes: {
security: true
},
port: Config.get('/port/web')
},
register: {
plugins: [
{
plugin: '@hapi/good',
options: {
reporters: {
myConsoleReporter: [
{
module: '@hapi/good-squeeze',
name: 'Squeeze',
args: [{
error: '*',
log: '*',
request: '*',
response:'*'
}]
},
{
module: '@hapi/good-console',
args: [{
color: {
$filter: 'env',
production: false,
$default: true
}
}]
},
'stdout'
]
}
}
},
{
plugin: '@hapi/basic'
},
{
plugin: 'hapi-remote-address'
},
{
plugin: '@hapi/inert'
},
{
plugin: '@hapi/vision'
},
{
plugin:'hapi-swagger',
options: {
securityDefinitions: {
'basic': {
'type': 'apiKey',
'name': 'Authorization',
'in': 'header'
}
},
security: [{ 'basic': [] }],
info: {
title: 'Frame API Documentation',
version: Package.version,
description: `Check out the **[Github Wiki](https://github.com/jedireza/frame/wiki)** for common questions and how-tos.
A few key things to be aware of:
The core User model found in the /api/users/ endpoints have these basic fields: _id, email, username, password, isActive, roles, timeCreated.
This framework decorates the core User models with additional role specific fields via mapping it to 1 or more roles. Frame comes with 2 default roles, customers and admins.
/api/accounts/ is the "customer account" role.
When users sign up via /api/signup the framework automatically creates a new User and a new Account (aka customer role) and links the two. Users can have multiple roles but each new instance of a role model can only be mapped to one user.
The customer Account role adds these additional fields for users who are customers: "name" (first, middle last), "notes", and "status". "Notes" allows admins to add notes to accounts.
/api/admins/ is the "admin" role.
This role contains a "name" (first, middle, last), "permissions", and "groups" property allowing you to assign multiple admin-groups. The first admin-group is "root" which is allowed to perform the "Root Scope" actions.
More details on [Users, Roles & Groups](https://github.com/jedireza/frame/wiki/Users,-Roles-&-Groups)
More details on [Admin & Admin Group Permissions](https://github.com/jedireza/frame/wiki/Admin-&-Admin-Group-Permissions)`
},
grouping: 'tags',
sortTags: 'alpha',
tags: [
{
name: 'accounts',
description: 'endpoints to interact with customer role.'
},{
name: 'admin-groups',
description: 'endpoints to interact with admin groups.'
},{
name: 'admins',
description: 'endpoints to interact with admin roles.'
},{
name: 'contact'
},{
name: 'login',
description: 'endpoints for login flow.'
},{
name: 'logout'
},{
name: 'main'
},{
name: 'session',
description: 'endpoints to interact with user sessions.'
},{
name: 'signup'
},{
name: 'statuses',
description: 'endpoints to interact with customer role (account) statuses.'
},{
name: 'users',
description: 'endpoints to interact with users (outside of roles)'
}
]
}
},
{
plugin: 'hapi-mongo-models',
options: {
mongodb: Config.get('/hapiMongoModels/mongodb'),
models: [
Path.resolve(__dirname, './server/models/account'),
Path.resolve(__dirname, './server/models/admin-group'),
Path.resolve(__dirname, './server/models/admin'),
Path.resolve(__dirname, './server/models/auth-attempt'),
Path.resolve(__dirname, './server/models/session'),
Path.resolve(__dirname, './server/models/status'),
Path.resolve(__dirname, './server/models/user')
],
autoIndex: Config.get('/hapiMongoModels/autoIndex')
}
},
{
plugin: './server/auth'
},
{
plugin: './server/api/accounts'
},
{
plugin: './server/api/admin-groups'
},
{
plugin: './server/api/admins'
},
{
plugin: './server/api/contact'
},
{
plugin: './server/api/main'
},
{
plugin: './server/api/login'
},
{
plugin: './server/api/logout'
},
{
plugin: './server/api/sessions'
},
{
plugin: './server/api/signup'
},
{
plugin: './server/api/statuses'
},
{
plugin: './server/api/users'
},
{
plugin: './server/web/main'
}
]
}
};
const store = new Confidence.Store(manifest);
exports.get = function (key) {
return store.get(key, criteria);
};
exports.meta = function (key) {
return store.meta(key, criteria);
};