@thzero/library_server 0.18.7 → 0.18.9

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 (53) hide show
  1. package/README.md +93 -93
  2. package/boot/index.js +474 -466
  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 +64 -64
  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/openSource.js +66 -66
  21. package/package.json +38 -38
  22. package/repository/index.js +182 -182
  23. package/repository/usageMetrics/devnull.js +16 -16
  24. package/routes/index.js +76 -76
  25. package/service/admin/baseNews.js +45 -45
  26. package/service/admin/index.js +130 -130
  27. package/service/admin/news.js +6 -6
  28. package/service/admin/users.js +107 -107
  29. package/service/baseSecurity.js +183 -183
  30. package/service/baseUser.js +122 -122
  31. package/service/communication.js +6 -6
  32. package/service/config.js +37 -37
  33. package/service/crypto.js +16 -16
  34. package/service/discovery/index.js +6 -6
  35. package/service/discovery/resources/index.js +101 -101
  36. package/service/external.js +19 -19
  37. package/service/externalRest.js +19 -19
  38. package/service/index.js +20 -20
  39. package/service/monitoring.js +12 -12
  40. package/service/news/base.js +59 -59
  41. package/service/news/index.js +6 -6
  42. package/service/news/validation/index.js +6 -6
  43. package/service/plans.js +31 -31
  44. package/service/restCommunication.js +21 -21
  45. package/service/usageMetrics.js +84 -84
  46. package/service/utility.js +188 -188
  47. package/service/version.js +37 -37
  48. package/utility/injector.js +59 -59
  49. package/utility/internalIp/index.js +48 -48
  50. package/utility/list/doubleLinked.js +88 -88
  51. package/utility/list/priorityQueue.js +109 -109
  52. package/utility/list/queue.js +72 -72
  53. package/utility/os.js +20 -20
package/README.md CHANGED
@@ -1,93 +1,93 @@
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
- ### Requirements
10
-
11
- #### NodeJs
12
-
13
- Requires [NodeJs ](https://nodejs.org) version 18+.
14
-
15
- ### Installation
16
-
17
- [![NPM](https://nodei.co/npm/@thzero/library_server.png?compact=true)](https://npmjs.org/package/@thzero/library_server)
18
-
19
- #### Mongo
20
-
21
- Mongo is the only currently supposed option as the server side data source.
22
-
23
- * Install the MongoDb (either locally or in the cloud) server
24
- * Recommendation is MongoDb Atlas (https://www.mongodb.com/cloud/atlas) for development/sandbox
25
- * Create a new MongoDb database in the Mongo server
26
- * Restore the default SocietySidekick MongoDb
27
- * Use the following MongoDb CLI tool to restore the default database located at (https://github.com/thzero/societySidekick-database)
28
-
29
- ```
30
- .\bin\mongorestore --host <mongodb host name> --ssl --username <mongo user name> --password <mongo user password> --authenticationDatabase admin -d production <location of default database>
31
- ```
32
-
33
- Recommended tools for managing Mongo database
34
- * MongoDb Compass (https://www.mongodb.com/products/compass)
35
- * Robo3T (https://robomongo.org)
36
-
37
- #### Firebase
38
-
39
- Google Firebase (https://firebase.google.com) provides the social based authentication; currently only Google social accounts are supported.
40
-
41
- * Add a new project
42
- * Setup **Authentication**, enabled Google in the **Sign-in method**.
43
- * Get the Firebase SDK configuration
44
- * Go to Project Overview->Settings->Service accounts
45
- * Select **Node.js** option
46
- * Click **Generate new private key**
47
-
48
- #### Configuration
49
-
50
- The following setup for configuration is required for an application using this library_server dependency
51
-
52
- * Setup the configuration found in the config\development.json
53
- * Note that this is ignored in the .gitignore
54
- * Configuration looks like the following
55
-
56
- ```
57
- {
58
- "app": {
59
- "auth": {
60
- "apiKey": "<generate a GUID as key in standard nomeclature '#######-####-####-####-############'>",
61
- "claims": {
62
- "check": false,
63
- "useDefault": false
64
- }
65
- },
66
- "cors": {
67
- "origin": "*"
68
- },
69
- "db": {
70
- "atlas": {
71
- "connection": "<mongo connection string>",
72
- "name": "<environment name>"
73
- }
74
- },
75
- "logging": {
76
- "level": <see https://github.com/pinojs/pino/issues/123 for logging levels>,
77
- "prettify": <true of false if you want prettify, if true requres 'pino-prettify' as a dependency>
78
- },
79
- "port": <port to run the server on>
80
- }
81
- }
82
- ```
83
-
84
- ##### Development Tool Configuration
85
-
86
- * Include the following in the package.json for the application.
87
-
88
- ```
89
- "version_major": #,
90
- "version_minor": #,
91
- "version_patch": #,
92
- "version_date": "MM/DD/YYYY",
93
- ```
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
+ ### Requirements
10
+
11
+ #### NodeJs
12
+
13
+ Requires [NodeJs ](https://nodejs.org) version 18+.
14
+
15
+ ### Installation
16
+
17
+ [![NPM](https://nodei.co/npm/@thzero/library_server.png?compact=true)](https://npmjs.org/package/@thzero/library_server)
18
+
19
+ #### Mongo
20
+
21
+ Mongo is the only currently supposed option as the server side data source.
22
+
23
+ * Install the MongoDb (either locally or in the cloud) server
24
+ * Recommendation is MongoDb Atlas (https://www.mongodb.com/cloud/atlas) for development/sandbox
25
+ * Create a new MongoDb database in the Mongo server
26
+ * Restore the default SocietySidekick MongoDb
27
+ * Use the following MongoDb CLI tool to restore the default database located at (https://github.com/thzero/societySidekick-database)
28
+
29
+ ```
30
+ .\bin\mongorestore --host <mongodb host name> --ssl --username <mongo user name> --password <mongo user password> --authenticationDatabase admin -d production <location of default database>
31
+ ```
32
+
33
+ Recommended tools for managing Mongo database
34
+ * MongoDb Compass (https://www.mongodb.com/products/compass)
35
+ * Robo3T (https://robomongo.org)
36
+
37
+ #### Firebase
38
+
39
+ Google Firebase (https://firebase.google.com) provides the social based authentication; currently only Google social accounts are supported.
40
+
41
+ * Add a new project
42
+ * Setup **Authentication**, enabled Google in the **Sign-in method**.
43
+ * Get the Firebase SDK configuration
44
+ * Go to Project Overview->Settings->Service accounts
45
+ * Select **Node.js** option
46
+ * Click **Generate new private key**
47
+
48
+ #### Configuration
49
+
50
+ The following setup for configuration is required for an application using this library_server dependency
51
+
52
+ * Setup the configuration found in the config\development.json
53
+ * Note that this is ignored in the .gitignore
54
+ * Configuration looks like the following
55
+
56
+ ```
57
+ {
58
+ "app": {
59
+ "auth": {
60
+ "apiKey": "<generate a GUID as key in standard nomeclature '#######-####-####-####-############'>",
61
+ "claims": {
62
+ "check": false,
63
+ "useDefault": false
64
+ }
65
+ },
66
+ "cors": {
67
+ "origin": "*"
68
+ },
69
+ "db": {
70
+ "atlas": {
71
+ "connection": "<mongo connection string>",
72
+ "name": "<environment name>"
73
+ }
74
+ },
75
+ "logging": {
76
+ "level": <see https://github.com/pinojs/pino/issues/123 for logging levels>,
77
+ "prettify": <true of false if you want prettify, if true requres 'pino-prettify' as a dependency>
78
+ },
79
+ "port": <port to run the server on>
80
+ }
81
+ }
82
+ ```
83
+
84
+ ##### Development Tool Configuration
85
+
86
+ * Include the following in the package.json for the application.
87
+
88
+ ```
89
+ "version_major": #,
90
+ "version_minor": #,
91
+ "version_patch": #,
92
+ "version_date": "MM/DD/YYYY",
93
+ ```