@thzero/library_server 0.15.9 → 0.15.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +89 -89
  2. package/boot/index.js +387 -384
  3. package/boot/koa/index.js +157 -157
  4. package/boot/plugins/admin/index.js +6 -6
  5. package/boot/plugins/admin/news.js +35 -35
  6. package/boot/plugins/admin/users.js +35 -35
  7. package/boot/plugins/api.js +58 -58
  8. package/boot/plugins/apiFront.js +31 -31
  9. package/boot/plugins/index.js +71 -71
  10. package/boot/plugins/news.js +46 -46
  11. package/boot/plugins/users.js +48 -48
  12. package/boot/plugins/usersExtended.js +32 -32
  13. package/constants.js +45 -45
  14. package/data/baseNews.js +42 -42
  15. package/data/baseSettingsUser.js +9 -9
  16. package/data/baseUser.js +28 -28
  17. package/data/index.js +24 -24
  18. package/data/named.js +20 -20
  19. package/errors/tokenExpired.js +7 -7
  20. package/license.md +8 -8
  21. package/middleware/authentication.js +67 -67
  22. package/middleware/authorization.js +180 -180
  23. package/package.json +50 -60
  24. package/repository/index.js +151 -151
  25. package/repository/usageMetrics/devnull.js +11 -11
  26. package/routes/admin/index.js +111 -111
  27. package/routes/admin/news.js +14 -14
  28. package/routes/admin/users.js +18 -18
  29. package/routes/baseNews.js +27 -27
  30. package/routes/baseUsers.js +106 -106
  31. package/routes/home.js +16 -16
  32. package/routes/index.js +31 -31
  33. package/routes/news.js +6 -6
  34. package/routes/plans.js +24 -24
  35. package/routes/users.js +6 -6
  36. package/routes/utility.js +34 -34
  37. package/routes/version.js +24 -24
  38. package/service/admin/baseNews.js +45 -45
  39. package/service/admin/index.js +130 -130
  40. package/service/admin/news.js +6 -6
  41. package/service/admin/users.js +107 -107
  42. package/service/baseSecurity.js +44 -44
  43. package/service/baseUser.js +122 -122
  44. package/service/communication.js +6 -6
  45. package/service/config.js +32 -32
  46. package/service/crypto.js +16 -16
  47. package/service/discovery/index.js +6 -6
  48. package/service/discovery/resources/index.js +101 -101
  49. package/service/external.js +19 -19
  50. package/service/externalRest.js +19 -19
  51. package/service/index.js +20 -20
  52. package/service/monitoring.js +13 -0
  53. package/service/news/base.js +49 -49
  54. package/service/news/index.js +6 -6
  55. package/service/news/validation/index.js +6 -6
  56. package/service/plans.js +27 -27
  57. package/service/restCommunication.js +21 -21
  58. package/service/usageMetrics.js +63 -63
  59. package/service/utility.js +37 -37
  60. package/service/version.js +32 -32
  61. package/utility/injector.js +59 -59
  62. package/utility/internalIp/index.js +48 -48
  63. package/utility/list/doubleLinked.js +88 -88
  64. package/utility/list/priorityQueue.js +109 -109
  65. package/utility/list/queue.js +72 -72
  66. package/utility/os.js +22 -22
package/README.md CHANGED
@@ -1,89 +1,89 @@
1
- ![GitHub package.json version](https://img.shields.io/github/package-json/v/thzero/library_server)
2
- ![David](https://img.shields.io/david/thzero/library_server)
3
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
-
5
- # library_server
6
-
7
- An opinionated library of common functionality to bootstrap a Koa based API application using MongoDb and Firebase.
8
-
9
- ### Installation
10
-
11
- [![NPM](https://nodei.co/npm/@thzero/library_server.png?compact=true)](https://npmjs.org/package/@thzero/library_server)
12
-
13
- ### Requirements
14
-
15
- #### Mongo
16
-
17
- Mongo is required as the server side data source.
18
-
19
- * Install the MongoDb (either locally or in the cloud) server
20
- * Recommendation is MongoDb Atlas (https://www.mongodb.com/cloud/atlas) for development/sandbox
21
- * Create a new MongoDb database in the Mongo server
22
- * Restore the default SocietySidekick MongoDb
23
- * Use the following MongoDb CLI tool to restore the default database located at (https://github.com/thzero/societySidekick-database)
24
-
25
- ```
26
- .\bin\mongorestore --host <mongodb host name> --ssl --username <mongo user name> --password <mongo user password> --authenticationDatabase admin -d production <location of default database>
27
- ```
28
-
29
- Recommended tools for managing Mongo database
30
- * MongoDb Compass (https://www.mongodb.com/products/compass)
31
- * Robo3T (https://robomongo.org)
32
-
33
- #### Firebase
34
-
35
- Google Firebase (https://firebase.google.com) provides the social based authentication; currently only Google social accounts are supported.
36
-
37
- * Add a new project
38
- * Setup **Authentication**, enabled Google in the **Sign-in method**.
39
- * Get the Firebase SDK configuration
40
- * Go to Project Overview->Settings->Service accounts
41
- * Select **Node.js** option
42
- * Click **Generate new private key**
43
-
44
- #### Configuration
45
-
46
- The following setup for configuration is required for an application using this library_server dependency
47
-
48
- * Setup the configuration found in the config\development.json
49
- * Note that this is ignored in the .gitignore
50
- * Configuration looks like the following
51
-
52
- ```
53
- {
54
- "app": {
55
- "auth": {
56
- "apiKey": "<generate a GUID as key in standard nomeclature '#######-####-####-####-############'>",
57
- "claims": {
58
- "check": false,
59
- "useDefault": false
60
- }
61
- },
62
- "cors": {
63
- "origin": "*"
64
- },
65
- "db": {
66
- "atlas": {
67
- "connection": "<mongo connection string>",
68
- "name": "<environment name>"
69
- }
70
- },
71
- "logging": {
72
- "level": <see https://github.com/pinojs/pino/issues/123 for logging levels>,
73
- "prettify": <true of false if you want prettify, if true requres 'pino-prettify' as a dependency>
74
- },
75
- "port": <port to run the server on>
76
- }
77
- }
78
- ```
79
-
80
- ##### Development Tool Configuration
81
-
82
- * Include the following in the package.json for the application.
83
-
84
- ```
85
- "version_major": #,
86
- "version_minor": #,
87
- "version_patch": #,
88
- "version_date": "MM/DD/YYYY",
89
- ```
1
+ ![GitHub package.json version](https://img.shields.io/github/package-json/v/thzero/library_server)
2
+ ![David](https://img.shields.io/david/thzero/library_server)
3
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
+
5
+ # library_server
6
+
7
+ An opinionated library of common functionality to bootstrap a Koa based API application using MongoDb and Firebase.
8
+
9
+ ### Installation
10
+
11
+ [![NPM](https://nodei.co/npm/@thzero/library_server.png?compact=true)](https://npmjs.org/package/@thzero/library_server)
12
+
13
+ ### Requirements
14
+
15
+ #### Mongo
16
+
17
+ Mongo is the only currently supposed option as the server side data source.
18
+
19
+ * Install the MongoDb (either locally or in the cloud) server
20
+ * Recommendation is MongoDb Atlas (https://www.mongodb.com/cloud/atlas) for development/sandbox
21
+ * Create a new MongoDb database in the Mongo server
22
+ * Restore the default SocietySidekick MongoDb
23
+ * Use the following MongoDb CLI tool to restore the default database located at (https://github.com/thzero/societySidekick-database)
24
+
25
+ ```
26
+ .\bin\mongorestore --host <mongodb host name> --ssl --username <mongo user name> --password <mongo user password> --authenticationDatabase admin -d production <location of default database>
27
+ ```
28
+
29
+ Recommended tools for managing Mongo database
30
+ * MongoDb Compass (https://www.mongodb.com/products/compass)
31
+ * Robo3T (https://robomongo.org)
32
+
33
+ #### Firebase
34
+
35
+ Google Firebase (https://firebase.google.com) provides the social based authentication; currently only Google social accounts are supported.
36
+
37
+ * Add a new project
38
+ * Setup **Authentication**, enabled Google in the **Sign-in method**.
39
+ * Get the Firebase SDK configuration
40
+ * Go to Project Overview->Settings->Service accounts
41
+ * Select **Node.js** option
42
+ * Click **Generate new private key**
43
+
44
+ #### Configuration
45
+
46
+ The following setup for configuration is required for an application using this library_server dependency
47
+
48
+ * Setup the configuration found in the config\development.json
49
+ * Note that this is ignored in the .gitignore
50
+ * Configuration looks like the following
51
+
52
+ ```
53
+ {
54
+ "app": {
55
+ "auth": {
56
+ "apiKey": "<generate a GUID as key in standard nomeclature '#######-####-####-####-############'>",
57
+ "claims": {
58
+ "check": false,
59
+ "useDefault": false
60
+ }
61
+ },
62
+ "cors": {
63
+ "origin": "*"
64
+ },
65
+ "db": {
66
+ "atlas": {
67
+ "connection": "<mongo connection string>",
68
+ "name": "<environment name>"
69
+ }
70
+ },
71
+ "logging": {
72
+ "level": <see https://github.com/pinojs/pino/issues/123 for logging levels>,
73
+ "prettify": <true of false if you want prettify, if true requres 'pino-prettify' as a dependency>
74
+ },
75
+ "port": <port to run the server on>
76
+ }
77
+ }
78
+ ```
79
+
80
+ ##### Development Tool Configuration
81
+
82
+ * Include the following in the package.json for the application.
83
+
84
+ ```
85
+ "version_major": #,
86
+ "version_minor": #,
87
+ "version_patch": #,
88
+ "version_date": "MM/DD/YYYY",
89
+ ```