bajo 2.25.1 → 2.26.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.
- package/class/bajo.js +3 -3
- package/package.json +1 -1
- package/test/unit/bajo.test.js +1 -1
- package/wiki/CHANGES.md +92 -87
package/class/bajo.js
CHANGED
|
@@ -502,8 +502,8 @@ class Bajo extends Plugin {
|
|
|
502
502
|
if (type === 'auto') {
|
|
503
503
|
if (value instanceof Date) type = 'datetime'
|
|
504
504
|
}
|
|
505
|
-
if (['float', 'double'].includes(type) && this.anekaSpatial) {
|
|
506
|
-
const { latToDms, lngToDms } = this.anekaSpatial
|
|
505
|
+
if (['float', 'double'].includes(type) && this.app.lib.anekaSpatial) {
|
|
506
|
+
const { latToDms, lngToDms } = this.app.lib.anekaSpatial
|
|
507
507
|
if (options.latitude) return latToDms(value)
|
|
508
508
|
if (options.longitude) return lngToDms(value)
|
|
509
509
|
}
|
|
@@ -1143,7 +1143,7 @@ class Bajo extends Plugin {
|
|
|
1143
1143
|
* @param {object} [options={}] - Options to be passed to the config handlers.
|
|
1144
1144
|
* @returns {Object|Array|null} The result from the first successful config handler, or null if none succeed.
|
|
1145
1145
|
*/
|
|
1146
|
-
|
|
1146
|
+
parseConfig = async (input, exts, options = {}) => {
|
|
1147
1147
|
let result
|
|
1148
1148
|
options.readFromFile = false
|
|
1149
1149
|
const handlers = exts ? this.app.configHandlers.filter(h => exts.includes(h.ext)) : this.app.configHandlers
|
package/package.json
CHANGED
package/test/unit/bajo.test.js
CHANGED
|
@@ -121,7 +121,7 @@ describe('bajo (unit)', () => {
|
|
|
121
121
|
const saved = await bajo.saveAsDownload('file.txt', 'abc', false)
|
|
122
122
|
expect(fs.existsSync(saved)).to.equal(true)
|
|
123
123
|
|
|
124
|
-
const p = await bajo.
|
|
124
|
+
const p = await bajo.parseConfig('{"x":1}', ['.json'])
|
|
125
125
|
expect(p).to.deep.equal({ x: 1 })
|
|
126
126
|
})
|
|
127
127
|
|
package/wiki/CHANGES.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# Changes
|
|
2
2
|
|
|
3
|
+
## 2026-07-26
|
|
4
|
+
|
|
5
|
+
- [2.26.1] Bug fix in `format()`
|
|
6
|
+
|
|
3
7
|
## 2026-07-24
|
|
4
8
|
|
|
5
9
|
- [2.25.0] Add `tools.bindThid()`
|
|
6
10
|
- [2.25.0] Add `tools.selfBind()`
|
|
7
11
|
- [2.25.0] Add `options.merge='concat'` in `readConfig()`
|
|
8
12
|
- [2.25.1] Bug fix in `parseWithConfig()`
|
|
13
|
+
- [2.26.0] Rename `parseWithConfig()` to `parseConfig()`
|
|
9
14
|
|
|
10
15
|
## 2026-07-23
|
|
11
16
|
|
|
@@ -24,26 +29,26 @@
|
|
|
24
29
|
|
|
25
30
|
## 2026-07-02
|
|
26
31
|
|
|
27
|
-
- [2.21.1] Bug fix in
|
|
32
|
+
- [2.21.1] Bug fix in `index.js`
|
|
28
33
|
|
|
29
34
|
## 2026-07-01
|
|
30
35
|
|
|
31
|
-
- [2.21.0] Add
|
|
36
|
+
- [2.21.0] Add `.yml/.yaml` to the configHandlers core
|
|
32
37
|
- [2.21.0] Remove obsolete packages
|
|
33
38
|
- [2.21.0] Upgrade package dependencies to the latest version
|
|
34
|
-
- [2.21.0] Remove
|
|
35
|
-
- [2.21.0] Remove
|
|
39
|
+
- [2.21.0] Remove `emptyDir()`
|
|
40
|
+
- [2.21.0] Remove `getGlobalModuleDir()`
|
|
36
41
|
|
|
37
42
|
## 2026-06-28
|
|
38
43
|
|
|
39
|
-
- [2.20.1] Bug fix in
|
|
44
|
+
- [2.20.1] Bug fix in `readConfig()`
|
|
40
45
|
|
|
41
46
|
## 2026-06-26
|
|
42
47
|
|
|
43
|
-
- [2.20.0] Add source
|
|
44
|
-
- [2.20.0] Bug fix in
|
|
45
|
-
- [2.20.0] Add
|
|
46
|
-
- [2.20.0] Add
|
|
48
|
+
- [2.20.0] Add source `ns` to the config handlers
|
|
49
|
+
- [2.20.0] Bug fix in `bajo.readConfig()`
|
|
50
|
+
- [2.20.0] Add `bajo.readAsConfig()`
|
|
51
|
+
- [2.20.0] Add `params.noDot` to the `app.getConfigFormats()`
|
|
47
52
|
|
|
48
53
|
## 2026-06-26
|
|
49
54
|
|
|
@@ -52,93 +57,93 @@
|
|
|
52
57
|
|
|
53
58
|
## 2026-06-12
|
|
54
59
|
|
|
55
|
-
- [2.18.0] Move plugin related methods to
|
|
56
|
-
- [2.18.0] Last argument of
|
|
60
|
+
- [2.18.0] Move plugin related methods to `app`
|
|
61
|
+
- [2.18.0] Last argument of `app.dump()` serves as options if it a plain object with certain keys
|
|
57
62
|
|
|
58
63
|
## 2026-06-03
|
|
59
64
|
|
|
60
|
-
- [2.17.0] Combine all helpers to
|
|
61
|
-
- [2.17.0]
|
|
62
|
-
- [2.17.0] Bug fix in
|
|
65
|
+
- [2.17.0] Combine all helpers to `_helper.js`
|
|
66
|
+
- [2.17.0] `callHandler()` now can accept an instance of `Tools` as its scope too
|
|
67
|
+
- [2.17.0] Bug fix in `app.dump()`
|
|
63
68
|
|
|
64
69
|
## 2026-06-01
|
|
65
70
|
|
|
66
|
-
- [2.16.0] Upgrade
|
|
67
|
-
- [2.16.0] Adding caller filename to the
|
|
68
|
-
- [2.16.0] Formatting
|
|
71
|
+
- [2.16.0] Upgrade `aneka@0.14.0`
|
|
72
|
+
- [2.16.0] Adding caller filename to the `app.dump()`
|
|
73
|
+
- [2.16.0] Formatting `app.dump()` to be more catchy when `bajoCli` is loaded
|
|
69
74
|
|
|
70
75
|
## 2026-05-30
|
|
71
76
|
|
|
72
|
-
- [2.15.1] Bug fix in
|
|
77
|
+
- [2.15.1] Bug fix in `app.boot()`
|
|
73
78
|
|
|
74
79
|
## 2026-05-28
|
|
75
80
|
|
|
76
|
-
- [2.15.0] Add built-in cache feature through
|
|
77
|
-
- [2.15.0] Bug fix in
|
|
78
|
-
- [2.15.0] Add cache feature to
|
|
81
|
+
- [2.15.0] Add built-in cache feature through `app.cache` instance
|
|
82
|
+
- [2.15.0] Bug fix in `eachPlugins()`
|
|
83
|
+
- [2.15.0] Add cache feature to `readConfig()`
|
|
79
84
|
- [2.15.0] Add feature to read many hooks as one file
|
|
80
85
|
|
|
81
86
|
## 2026-05-22
|
|
82
87
|
|
|
83
|
-
- [2.14.1] Bug fix in
|
|
84
|
-
- [2.14.1] Bug fix in
|
|
88
|
+
- [2.14.1] Bug fix in `helper.buildBaseConfig()`
|
|
89
|
+
- [2.14.1] Bug fix in `helper.collectHooks()`
|
|
85
90
|
|
|
86
91
|
## 2026-05-16
|
|
87
92
|
|
|
88
|
-
- [2.14.0] Add
|
|
89
|
-
- [2.14.0] Add
|
|
90
|
-
- [2.14.0] Add
|
|
91
|
-
- [2.14.0] Add
|
|
92
|
-
- [2.14.0] Add
|
|
93
|
-
- [2.14.0] Add
|
|
93
|
+
- [2.14.0] Add `bajo:beforeReadConfig()` hook
|
|
94
|
+
- [2.14.0] Add `bajo.override:beforeReadConfig()` hook
|
|
95
|
+
- [2.14.0] Add `bajo.extend:beforeReadConfig()` hook
|
|
96
|
+
- [2.14.0] Add `bajo:afterReadConfig()` hook
|
|
97
|
+
- [2.14.0] Add `bajo.override:afterReadConfig()` hook
|
|
98
|
+
- [2.14.0] Add `bajo.extend:afterReadConfig()` hook
|
|
94
99
|
|
|
95
100
|
## 2026-05-02
|
|
96
101
|
|
|
97
|
-
- [2.13.1] Bug fix in
|
|
98
|
-
- [2.13.1] Bug fix in
|
|
102
|
+
- [2.13.1] Bug fix in `app.t()`
|
|
103
|
+
- [2.13.1] Bug fix in `bajo.join()`
|
|
99
104
|
|
|
100
105
|
## 2026-04-28
|
|
101
106
|
|
|
102
|
-
- [2.13.0] Add
|
|
103
|
-
- [2.13.0] Bug fix in
|
|
107
|
+
- [2.13.0] Add `options.merge` to `readConfig()`
|
|
108
|
+
- [2.13.0] Bug fix in `err.js`
|
|
104
109
|
|
|
105
110
|
## 2026-04-25
|
|
106
111
|
|
|
107
|
-
- [2.12.1] Bug fix in
|
|
112
|
+
- [2.12.1] Bug fix in `readConfig()`
|
|
108
113
|
|
|
109
114
|
## 2026-04-23
|
|
110
115
|
|
|
111
|
-
- [2.12.0] Remove
|
|
112
|
-
- [2.12.0] Add feature to read in extended path
|
|
116
|
+
- [2.12.0] Remove `breakNsPathFromFile()`
|
|
117
|
+
- [2.12.0] Add feature to read in extended path `readConfig()`
|
|
113
118
|
|
|
114
119
|
## 2026-04-11
|
|
115
120
|
|
|
116
|
-
- [2.11.1] Bug fix in
|
|
117
|
-
- [2.11.1] Bug fix in
|
|
121
|
+
- [2.11.1] Bug fix in `join()`
|
|
122
|
+
- [2.11.1] Bug fix in `format()`
|
|
118
123
|
|
|
119
124
|
## 2026-04-07
|
|
120
125
|
|
|
121
|
-
- [2.11.0] Change
|
|
122
|
-
- [2.11.0] Bug fix in
|
|
126
|
+
- [2.11.0] Change `dispose()` to be an async function
|
|
127
|
+
- [2.11.0] Bug fix in `_prepTrans()`
|
|
123
128
|
|
|
124
129
|
## 2026-03-30
|
|
125
130
|
|
|
126
|
-
- [2.10.0] Add ability to pass options of
|
|
127
|
-
- [2.10.0] Freezing config object now occurs
|
|
128
|
-
- [2.10.0] Bug fix in
|
|
129
|
-
- [2.10.1] Bug fix in
|
|
131
|
+
- [2.10.0] Add ability to pass options of `configHandlers` with type `.js`
|
|
132
|
+
- [2.10.0] Freezing config object now occurs `{ns}:afterStart()`
|
|
133
|
+
- [2.10.0] Bug fix in `print.fatal()` when argument is an Error object
|
|
134
|
+
- [2.10.1] Bug fix in `fromJs()`
|
|
130
135
|
|
|
131
136
|
## 2026-03-25
|
|
132
137
|
|
|
133
|
-
- [2.9.0] Add
|
|
134
|
-
- [2.9.0] Bug fix in
|
|
138
|
+
- [2.9.0] Add `dump()` now available through out plugins
|
|
139
|
+
- [2.9.0] Bug fix in `buildCollections()`, now items to be collected are parsed with `aneka.parseObject()`
|
|
135
140
|
|
|
136
141
|
## 2026-03-22
|
|
137
142
|
|
|
138
|
-
- [2.8.0] Add
|
|
139
|
-
- [2.8.0] Bug fix in
|
|
140
|
-
- [2.8.0] Bug fix in
|
|
141
|
-
- [2.8.0] Bug fix in
|
|
143
|
+
- [2.8.0] Add `options.readFromFile` in `readConfig()`
|
|
144
|
+
- [2.8.0] Bug fix in `readConfig()` while reading `json` file
|
|
145
|
+
- [2.8.0] Bug fix in `fromJson()`
|
|
146
|
+
- [2.8.0] Bug fix in `toJson()`
|
|
142
147
|
|
|
143
148
|
## 2026-03-15
|
|
144
149
|
|
|
@@ -147,47 +152,47 @@
|
|
|
147
152
|
## 2026-03-11
|
|
148
153
|
|
|
149
154
|
- [2.7.2] Bug fix in env dependent config building
|
|
150
|
-
- [2.7.2]
|
|
155
|
+
- [2.7.2] `selfBind()` now also accept string for single method
|
|
151
156
|
|
|
152
157
|
## 2026-03-10
|
|
153
158
|
|
|
154
|
-
- [2.7.1] Using
|
|
159
|
+
- [2.7.1] Using `textToArray()` from `aneka` instead of custom function to parse text into array
|
|
155
160
|
|
|
156
161
|
## 2026-03-02
|
|
157
162
|
|
|
158
|
-
- [2.7.0] Add
|
|
163
|
+
- [2.7.0] Add `useDefaultName` parameter to `buildCollection()`
|
|
159
164
|
- [2.7.0] Add some translations
|
|
160
165
|
|
|
161
166
|
## 2026-02-26
|
|
162
167
|
|
|
163
|
-
- [2.6.2] Bug fix in
|
|
168
|
+
- [2.6.2] Bug fix in `getMethod()`
|
|
164
169
|
|
|
165
170
|
## 2026-02-23
|
|
166
171
|
|
|
167
|
-
- [2.6.1] Bug fix in
|
|
168
|
-
- [2.6.1] Bug fix in
|
|
172
|
+
- [2.6.1] Bug fix in `readConfig()`
|
|
173
|
+
- [2.6.1] Bug fix in `base.loadConfig()`
|
|
169
174
|
|
|
170
175
|
## 2026-02-20
|
|
171
176
|
|
|
172
|
-
- [2.6.0] Upgrade to
|
|
173
|
-
- [2.6.0] Add
|
|
174
|
-
- [2.6.0] Bug fix in
|
|
177
|
+
- [2.6.0] Upgrade to `aneka@0.12.0`
|
|
178
|
+
- [2.6.0] Add `te()`
|
|
179
|
+
- [2.6.0] Bug fix in `formatErrorDetails()` in `Err` class
|
|
175
180
|
|
|
176
181
|
## 2026-02-08
|
|
177
182
|
|
|
178
|
-
- [2.5.0] Bug fix in handling log for
|
|
179
|
-
- [2.5.0] Add
|
|
180
|
-
- [2.5.0] Add
|
|
183
|
+
- [2.5.0] Bug fix in handling log for `error` level
|
|
184
|
+
- [2.5.0] Add `log.getErrorMessage()` to get the right value of error message
|
|
185
|
+
- [2.5.0] Add `timeZone` in config for datetime data type
|
|
181
186
|
|
|
182
187
|
## 2026-01-29
|
|
183
188
|
|
|
184
|
-
- [2.4.0] Hooks can now be added through
|
|
185
|
-
- [2.4.1] Bug fix in
|
|
186
|
-
- [2.4.2] Bug fix in getting wrongly parsed
|
|
189
|
+
- [2.4.0] Hooks can now be added through `config` object. This is specially usefull if you provide a custom config object on app boot
|
|
190
|
+
- [2.4.1] Bug fix in `runHook()` resolver. Source defaults to `main` if not provided. Scope defaults to `bajo` if not found/initialized yet
|
|
191
|
+
- [2.4.2] Bug fix in getting wrongly parsed `env` value
|
|
187
192
|
|
|
188
193
|
## 2026-01-24
|
|
189
194
|
|
|
190
|
-
- [2.3.2] Hook now can be executed without waiting if property
|
|
195
|
+
- [2.3.2] Hook now can be executed without waiting if property `noWait` is `true`
|
|
191
196
|
|
|
192
197
|
## 2026-01-21
|
|
193
198
|
|
|
@@ -195,14 +200,14 @@
|
|
|
195
200
|
|
|
196
201
|
## 2026-01-18
|
|
197
202
|
|
|
198
|
-
- [2.3.0]
|
|
199
|
-
- [2.3.0] Package upgrade to
|
|
200
|
-
- [2.3.0] Bug fix in
|
|
203
|
+
- [2.3.0] `App` constructor now accept an object as its parameter. For details, please see documentation
|
|
204
|
+
- [2.3.0] Package upgrade to `aneka@0.11.0`
|
|
205
|
+
- [2.3.0] Bug fix in `checkDependencies()`
|
|
201
206
|
|
|
202
207
|
## 2026-01-16
|
|
203
208
|
|
|
204
209
|
- [2.2.1] Bug fix in multiple appearance of loaded plugins info
|
|
205
|
-
- [2.2.1] Bug fix in
|
|
210
|
+
- [2.2.1] Bug fix in `app.lib.parseObject()` wrapper
|
|
206
211
|
|
|
207
212
|
## 2026-01-11
|
|
208
213
|
|
|
@@ -210,7 +215,7 @@
|
|
|
210
215
|
|
|
211
216
|
## 2025-12-29
|
|
212
217
|
|
|
213
|
-
- [2.2.0] Add
|
|
218
|
+
- [2.2.0] Add `this.selfBind()` to class `Plugin`
|
|
214
219
|
|
|
215
220
|
## 2025-12-27
|
|
216
221
|
|
|
@@ -218,20 +223,20 @@
|
|
|
218
223
|
|
|
219
224
|
## 2025-12-27
|
|
220
225
|
|
|
221
|
-
- [2.2.0] Add config object
|
|
226
|
+
- [2.2.0] Add config object `this.config.runtime` to adjust some runtime settings
|
|
222
227
|
|
|
223
228
|
## 2025-12-24
|
|
224
229
|
|
|
225
|
-
- [2.2.0] Pass
|
|
226
|
-
- [2.2.0] Add
|
|
227
|
-
- [2.2.0] Upgrade
|
|
230
|
+
- [2.2.0] Pass `true` to `this.app.exit()` to exit abruptly. Defaults to `SIGINT`
|
|
231
|
+
- [2.2.0] Add `detailsMessage` to `Err` class if error object has `details` in payload
|
|
232
|
+
- [2.2.0] Upgrade `aneka@0.10.0`
|
|
228
233
|
- [2.2.0] Bugfix: program arguments should not parsed as object
|
|
229
234
|
|
|
230
235
|
## 2025-12-21
|
|
231
236
|
|
|
232
|
-
- [2.2.0]
|
|
233
|
-
- [2.2.0] In case of unknown plugin or plugin isn't loaded,
|
|
234
|
-
- [2.2.0]
|
|
237
|
+
- [2.2.0] `runHook()` now accept both `alias` & `ns` prefixed name
|
|
238
|
+
- [2.2.0] In case of unknown plugin or plugin isn't loaded, `runHook` simply exit silently
|
|
239
|
+
- [2.2.0] `this.app.pluginClass` is now `this.app.baseClass` and all containing class definition keys are pascal cased to match with their constructor names
|
|
235
240
|
|
|
236
241
|
## 2025-12-20
|
|
237
242
|
|
|
@@ -239,29 +244,29 @@
|
|
|
239
244
|
|
|
240
245
|
## 2025-12-19
|
|
241
246
|
|
|
242
|
-
- [2.2.0] Upgrade to
|
|
247
|
+
- [2.2.0] Upgrade to `aneka@0.9.0`
|
|
243
248
|
|
|
244
249
|
## 2025-12-13
|
|
245
250
|
|
|
246
|
-
- [2.2.0] Add
|
|
251
|
+
- [2.2.0] Add `app.lib.formatText()`
|
|
247
252
|
- [2.2.0] Move most bajo methods that doesn't relate to Bajo to app.lib functions
|
|
248
253
|
|
|
249
254
|
## 2025-12-11
|
|
250
255
|
|
|
251
|
-
- [2.1.1] Upgrade to
|
|
256
|
+
- [2.1.1] Upgrade to `aneka@0.5.0`
|
|
252
257
|
|
|
253
258
|
## 2025-12-09
|
|
254
259
|
|
|
255
|
-
- [2.1.1] Upgrade to
|
|
260
|
+
- [2.1.1] Upgrade to `aneka@0.2.3`
|
|
256
261
|
- [2.1.1] Some organizatory file location changes
|
|
257
|
-
- [2.1.1] Typo on class
|
|
262
|
+
- [2.1.1] Typo on class `Tools`
|
|
258
263
|
|
|
259
264
|
## 2025-12-05
|
|
260
265
|
|
|
261
|
-
- [2.1.1] Upgrade to
|
|
262
|
-
- [2.1.1] New class
|
|
266
|
+
- [2.1.1] Upgrade to `aneka@0.2.1`
|
|
267
|
+
- [2.1.1] New class `Tools`, serves as anchestor for `Err` & `Print`
|
|
263
268
|
|
|
264
269
|
## 2025-12-03
|
|
265
270
|
|
|
266
|
-
- [2.1.1] Add method
|
|
267
|
-
- [2.1.1] Now you can put your plugins either in
|
|
271
|
+
- [2.1.1] Add method `getPkgInfo()` to plugins main class.
|
|
272
|
+
- [2.1.1] Now you can put your plugins either in `{dataDir}/config/.plugins` or directly as an array in your app `package.json` under the `bajo.plugins` tree. The later takes precedence.
|