@thzero/library_server 0.15.45 → 0.16.1

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 (52) hide show
  1. package/README.md +89 -89
  2. package/boot/index.js +392 -392
  3. package/boot/plugins/admin/index.js +6 -6
  4. package/boot/plugins/admin/news.js +33 -33
  5. package/boot/plugins/admin/users.js +33 -33
  6. package/boot/plugins/api.js +57 -57
  7. package/boot/plugins/apiFront.js +31 -31
  8. package/boot/plugins/index.js +70 -70
  9. package/boot/plugins/news.js +44 -44
  10. package/boot/plugins/users.js +46 -46
  11. package/boot/plugins/usersExtended.js +32 -32
  12. package/constants.js +45 -45
  13. package/data/baseNews.js +42 -42
  14. package/data/baseSettingsUser.js +9 -9
  15. package/data/baseUser.js +28 -28
  16. package/data/index.js +24 -24
  17. package/data/named.js +20 -20
  18. package/errors/tokenExpired.js +7 -7
  19. package/license.md +8 -8
  20. package/package.json +38 -38
  21. package/repository/index.js +151 -151
  22. package/repository/usageMetrics/devnull.js +11 -11
  23. package/routes/index.js +76 -76
  24. package/service/admin/baseNews.js +45 -45
  25. package/service/admin/index.js +130 -130
  26. package/service/admin/news.js +6 -6
  27. package/service/admin/users.js +107 -107
  28. package/service/baseSecurity.js +44 -44
  29. package/service/baseUser.js +122 -122
  30. package/service/communication.js +6 -6
  31. package/service/config.js +32 -32
  32. package/service/crypto.js +16 -16
  33. package/service/discovery/index.js +6 -6
  34. package/service/discovery/resources/index.js +101 -101
  35. package/service/external.js +19 -19
  36. package/service/externalRest.js +19 -19
  37. package/service/index.js +20 -20
  38. package/service/monitoring.js +12 -12
  39. package/service/news/base.js +49 -49
  40. package/service/news/index.js +6 -6
  41. package/service/news/validation/index.js +6 -6
  42. package/service/plans.js +27 -27
  43. package/service/restCommunication.js +21 -21
  44. package/service/usageMetrics.js +57 -57
  45. package/service/utility.js +37 -37
  46. package/service/version.js +32 -32
  47. package/utility/injector.js +59 -59
  48. package/utility/internalIp/index.js +48 -48
  49. package/utility/list/doubleLinked.js +88 -88
  50. package/utility/list/priorityQueue.js +109 -109
  51. package/utility/list/queue.js +72 -72
  52. 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 an API application using MongoDb and Firebase. Currently either Fastify or Koa can be used as the web server; Fastify will be the focus going forward due to lack of support and updates with the Koa stack.
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
- ```
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 an API application using MongoDb and Firebase. Currently either Fastify or Koa can be used as the web server; Fastify will be the focus going forward due to lack of support and updates with the Koa stack.
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
+ ```