bajo 2.21.1 → 2.23.0

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 (67) hide show
  1. package/.jsdoc.conf.json +1 -1
  2. package/class/app.js +139 -115
  3. package/class/bajo.js +108 -92
  4. package/class/base.js +25 -9
  5. package/class/cache.js +32 -19
  6. package/class/err.js +11 -9
  7. package/class/log.js +102 -52
  8. package/class/plugin.js +45 -35
  9. package/class/print.js +45 -44
  10. package/class/tools.js +7 -1
  11. package/docs/App.html +1 -23
  12. package/docs/Bajo.html +1 -6
  13. package/docs/Base.html +1 -1
  14. package/docs/Cache.html +1 -1
  15. package/docs/Err.html +2 -2
  16. package/docs/Log.html +4 -4
  17. package/docs/Plugin.html +1 -1
  18. package/docs/Print.html +1 -1
  19. package/docs/Tools.html +1 -1
  20. package/docs/class_app.js.html +141 -117
  21. package/docs/class_bajo.js.html +98 -91
  22. package/docs/class_base.js.html +27 -11
  23. package/docs/class_cache.js.html +34 -21
  24. package/docs/class_err.js.html +13 -11
  25. package/docs/class_log.js.html +104 -54
  26. package/docs/class_plugin.js.html +47 -37
  27. package/docs/class_print.js.html +47 -46
  28. package/docs/class_tools.js.html +9 -3
  29. package/docs/data/search.json +1 -1
  30. package/docs/global.html +1 -1
  31. package/docs/index.html +1 -1
  32. package/docs/index.js.html +8 -4
  33. package/docs/{class__helper.js.html → lib_helper.js.html} +208 -96
  34. package/docs/lib_hook.js.html +231 -0
  35. package/docs/module-Helper.html +8 -1
  36. package/docs/module-Hook.html +3 -0
  37. package/docs/module-Lib.html +1 -8
  38. package/index.js +1 -1
  39. package/{class/_helper.js → lib/helper.js} +206 -94
  40. package/lib/hook.js +228 -0
  41. package/package.json +1 -1
  42. package/wiki/CHANGES.md +11 -0
  43. package/wiki/ECOSYSTEM.md +6 -6
  44. package/docs/class_helper_bajo.js.html +0 -398
  45. package/docs/class_helper_base.js.html +0 -246
  46. package/docs/class_misc_err.js.html +0 -129
  47. package/docs/class_misc_log.js.html +0 -210
  48. package/docs/class_misc_print.js.html +0 -267
  49. package/docs/lib_current-loc.js.html +0 -36
  50. package/docs/lib_find-deep.js.html +0 -27
  51. package/docs/lib_formats.js.html +0 -68
  52. package/docs/lib_freeze.js.html +0 -54
  53. package/docs/lib_import-module.js.html +0 -61
  54. package/docs/lib_index.js.html +0 -9
  55. package/docs/lib_log-levels.js.html +0 -38
  56. package/docs/lib_parse-args-argv.js.html +0 -83
  57. package/docs/lib_parse-env.js.html +0 -53
  58. package/docs/lib_resolve-path.js.html +0 -27
  59. package/docs/lib_shim.js.html +0 -40
  60. package/docs/module-Helper_Bajo.html +0 -3
  61. package/docs/module-Helper_Base.html +0 -3
  62. package/lib/find-deep.js +0 -24
  63. package/lib/formats.js +0 -65
  64. package/lib/freeze.js +0 -51
  65. package/lib/import-module.js +0 -58
  66. package/lib/index.js +0 -6
  67. package/lib/log-levels.js +0 -35
package/lib/hook.js ADDED
@@ -0,0 +1,228 @@
1
+ /**
2
+ * @module Hook
3
+ */
4
+
5
+ /**
6
+ * @typedef THook
7
+ * @type {Object}
8
+ * @property {string} name - Hook name
9
+ * @property {string} ns - Hook namespace
10
+ * @property {function} handler - Hook handler function
11
+ * @property {number} [level=999] - Hook level (lower number means higher priority)
12
+ * @property {string} src - Hook source (origin plugin namespace). Bajo will set this automatically, any value you set will be overriden.
13
+ * @property {boolean} [noWait=false] - If true, Bajo will not wait for this hook to complete before proceeding to the next hook. Default is false.
14
+ */
15
+
16
+ /**
17
+ * Run before boot process. You can use this hook to do some pre-boot process.
18
+ *
19
+ * @name bajo:beforeBoot
20
+ * @async
21
+ * @method
22
+ */
23
+
24
+ /**
25
+ * Run after boot process. You can use this hook to do some post-boot process.
26
+ *
27
+ * @name bajo:afterBoot
28
+ * @async
29
+ * @method
30
+ */
31
+
32
+ /**
33
+ * Run after hooks are collected. You can use this hook to modify the collected hooks before
34
+ * they are recognized as application hooks.
35
+ *
36
+ * @async
37
+ * @method
38
+ * @name bajo:afterCollectHooks
39
+ * @param {Array<module:Hook~THook>} hooks - Array of hook objects
40
+ * @see module:Helper.collectHooks
41
+ */
42
+
43
+ /**
44
+ * Run before all plugins are initialized. You can use this hook to do some pre-initialization process.
45
+ *
46
+ * @async
47
+ * @method
48
+ * @name bajo:beforeAllInit
49
+ * @see module:Helper.run
50
+ */
51
+
52
+ /**
53
+ * Run after all plugins are initialized. You can use this hook to do some post-initialization process.
54
+ *
55
+ * @async
56
+ * @method
57
+ * @name bajo:afterAllInit
58
+ * @see module:Helper.run
59
+ */
60
+
61
+ /**
62
+ * Run before all plugins are started. You can use this hook to do some pre-start process.
63
+ *
64
+ * @async
65
+ * @method
66
+ * @name bajo:beforeAllStart
67
+ * @see module:Helper.run
68
+ */
69
+
70
+ /**
71
+ * Run after all plugins are started. You can use this hook to do some post-start process.
72
+ *
73
+ * @async
74
+ * @method
75
+ * @name bajo:afterAllStart
76
+ * @see module:Helper.run
77
+ */
78
+
79
+ /**
80
+ * Run before `{ns}` plugins are initialized. You can use this hook to do some pre-initialization process.
81
+ *
82
+ * @async
83
+ * @method
84
+ * @name {ns}:beforeInit
85
+ * @see module:Helper.run
86
+ */
87
+
88
+ /**
89
+ * Run after `{ns}` plugins are initialized. You can use this hook to do some post-initialization process.
90
+ *
91
+ * @async
92
+ * @method
93
+ * @name {ns}:afterInit
94
+ * @see module:Helper.run
95
+ */
96
+
97
+ /**
98
+ * Run after `{ns}` plugins are initialized. You can use this hook to do some pre-start process.
99
+ *
100
+ * @async
101
+ * @method
102
+ * @name {ns}:beforeStart
103
+ * @see module:Helper.run
104
+ */
105
+
106
+ /**
107
+ * Run after `{ns}` plugins are started. You can use this hook to do some post-start process.
108
+ *
109
+ * @async
110
+ * @method
111
+ * @name {ns}:afterStart
112
+ * @see module:Helper.run
113
+ */
114
+
115
+ /**
116
+ * Run before applet is run. `{ns}` is the applet's namespace
117
+ *
118
+ * @name {ns}:beforeAppletRun
119
+ * @async
120
+ * @method
121
+ * @param {...any} args - Arguments passed to the applet
122
+ * @see module:Helper.runAsApplet
123
+ */
124
+
125
+ /**
126
+ * Run after applet is run. `{ns}` is the applet's namespace
127
+ *
128
+ * @name {ns}:afterAppletRun
129
+ * @async
130
+ * @method
131
+ * @param {...any} args - Arguments passed to the applet
132
+ * @see module:Helper.runAsApplet
133
+ */
134
+
135
+ /**
136
+ * Run before collection is built.
137
+ *
138
+ * @async
139
+ * @method
140
+ * @name bajo:beforeBuildCollection
141
+ * @param {string} container - Collection container name
142
+ * @see Bajo#buildCollections
143
+ */
144
+
145
+ /**
146
+ * Run after collection is built.
147
+ *
148
+ * @async
149
+ * @method
150
+ * @name bajo:afterBuildCollection
151
+ * @param {string} container - Collection container name
152
+ * @param {array<object>} items - Collection items
153
+ * @see Bajo#buildCollections
154
+ */
155
+
156
+ /**
157
+ * Run after a non override/extended configuration file is read.
158
+ *
159
+ * @async
160
+ * @method
161
+ * @name bajo.default:afterReadConfig
162
+ * @param {string} file - Config file path
163
+ * @param {string} orgObj - Original config object before parsing
164
+ * @param {object} options - readConfig options
165
+ */
166
+
167
+ /**
168
+ * Run before a configuration file override is read.
169
+ *
170
+ * @async
171
+ * @method
172
+ * @name bajo.override:beforeReadConfig
173
+ * @param {string} fileExt - Config file extension
174
+ * @param {object} options - readConfig options
175
+ */
176
+
177
+ /**
178
+ * Run after a configuration file override is read.
179
+ *
180
+ * @async
181
+ * @method
182
+ * @name bajo.override:afterReadConfig
183
+ * @param {string} fileExt - Config file extension
184
+ * @param {object} result - Resulting config object after parsing
185
+ * @param {object} options - readConfig options
186
+ */
187
+
188
+ /**
189
+ * Run before a extended configuration file is read.
190
+ *
191
+ * @async
192
+ * @method
193
+ * @name bajo.extend:beforeReadConfig
194
+ * @param {string} fileExt - Config file extension
195
+ * @param {object} options - readConfig options
196
+ */
197
+
198
+ /**
199
+ * Run after a extended configuration file is read.
200
+ *
201
+ * @async
202
+ * @method
203
+ * @name bajo.extend:afterReadConfig
204
+ * @param {string} fileExt - Config file extension
205
+ * @param {object} result - Resulting config object after parsing
206
+ * @param {object} options - readConfig options
207
+ */
208
+
209
+ /**
210
+ * Run before a configuration file is read.
211
+ *
212
+ * @async
213
+ * @method
214
+ * @name bajo:beforeReadConfig
215
+ * @param {string} file - Config file path
216
+ * @param {object} options - readConfig options
217
+ */
218
+
219
+ /**
220
+ * Run after all read processes of a configuration file are completed.
221
+ *
222
+ * @async
223
+ * @method
224
+ * @name bajo:afterReadConfig
225
+ * @param {string} file - Config file path
226
+ * @param {object} result - Resulting config object after parsing
227
+ * @param {object} options - readConfig options
228
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bajo",
3
- "version": "2.21.1",
3
+ "version": "2.23.0",
4
4
  "description": "The ultimate framework for whipping up massive apps in no time",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changes
2
2
 
3
+
4
+ ## 2026-07-13
5
+
6
+ - [2.23.0] Add `getDownloadDir()`
7
+
8
+ ## 2026-07-08
9
+
10
+ - [2.22.0] Update documentations
11
+ - [2.22.0] Reorganize project files
12
+ - [2.22.0] Bug fix in boot process
13
+
3
14
  ## 2026-07-02
4
15
 
5
16
  - [2.21.1] Bug fix in ```index.js```
package/wiki/ECOSYSTEM.md CHANGED
@@ -23,12 +23,12 @@
23
23
  | ------- | ---- | -- | ----- | ----------- |
24
24
  | [dobo](https://github.com/ardhi/dobo) | [Docs](https://ardhi.github.io/dobo) | dobo | db | Dobo DBMS |
25
25
  | [dobo-extra](https://github.com/ardhi/dobo-extra) | [Docs](https://ardhi.github.io/dobo-extra) | doboExtra | dbx | Dobo Extra Tools/Utility |
26
- | [dobo-couchdb](https://github.com/ardhi/dobo-couchdb) | [Docs](https://ardhi.github.io/dobo-couchdb) | doboCouchdb | dbcouch | CouchDB Driver |
27
- | [dobo-elasticsearch](https://github.com/ardhi/dobo-elasticsearch) | [Docs](https://ardhi.github.io/dobo-elasticsearch) | doboElasticsearch | dbes | Elasticsearch Driver |
28
- | [dobo-knex](https://github.com/ardhi/dobo-knex) | [Docs](https://ardhi.github.io/dobo-knex) | doboKnex | dbknex | Knex/SQL Driver |
29
- | [dobo-mongodb](https://github.com/ardhi/dobo-mongodb) | [Docs](https://ardhi.github.io/dobo-mongodb) | doboMongodb | dbmongo | MongoDB Driver |
30
- | [dobo-redis](https://github.com/ardhi/dobo-redis) | [Docs](https://ardhi.github.io/dobo-redis) | doboRedis | dbredis | Redis Driver |
31
- | [dobo-restproxy](https://github.com/ardhi/dobo-restproxy) | [Docs](https://ardhi.github.io/dobo-restproxy) | doboRestproxy | dbrpx | Restproxy Driver |
26
+ | [dobo-couchdb](https://github.com/ardhi/dobo-couchdb) | [Docs](https://ardhi.github.io/dobo-couchdb) | doboCouchdb | dbcouch | CouchDB Adapter |
27
+ | [dobo-elasticsearch](https://github.com/ardhi/dobo-elasticsearch) | [Docs](https://ardhi.github.io/dobo-elasticsearch) | doboElasticsearch | dbes | Elasticsearch Adapter |
28
+ | [dobo-knex](https://github.com/ardhi/dobo-knex) | [Docs](https://ardhi.github.io/dobo-knex) | doboKnex | dbknex | Knex/SQL Adapter |
29
+ | [dobo-mongodb](https://github.com/ardhi/dobo-mongodb) | [Docs](https://ardhi.github.io/dobo-mongodb) | doboMongodb | dbmongo | MongoDB Adapter |
30
+ | [dobo-redis](https://github.com/ardhi/dobo-redis) | [Docs](https://ardhi.github.io/dobo-redis) | doboRedis | dbredis | Redis Adapter |
31
+ | [dobo-restproxy](https://github.com/ardhi/dobo-restproxy) | [Docs](https://ardhi.github.io/dobo-restproxy) | doboRestproxy | dbrpx | Restproxy Adapter |
32
32
  | [dobo-restproxy-jsonserver](https://github.com/ardhi/dobo-restproxy-jsonserver) | [Docs](https://ardhi.github.io/dobo-restproxy-jsonserver) | doboResporoxyJsonserver | dbrpxjs |JsonServer Support for doboRestproxy |
33
33
  | [dobo-restproxy-ndut](https://github.com/ardhi/dobo-restproxy-ndut) | [Docs](https://ardhi.github.io/dobo-restproxy-ndut) | doboRestproxyNdut | dbrpxndut | NDUT Support for doboRestproxy |
34
34