bajo-spatial 2.0.1 → 2.2.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.
- package/.github/FUNDING.yml +0 -0
- package/.github/workflows/repo-lockdown.yml +0 -0
- package/.jsdoc.conf.json +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/docs/BajoSpatial.html +0 -0
- package/docs/data/search.json +0 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/index.js.html +0 -0
- package/docs/scripts/core.js +476 -477
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +36 -36
- package/docs/scripts/search.js +105 -105
- package/docs/scripts/search.min.js +0 -0
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +1 -1
- package/docs/scripts/third-party/hljs-line-num-original.js +282 -285
- package/docs/scripts/third-party/hljs-line-num.js +1 -1
- package/docs/scripts/third-party/hljs-original.js +1195 -1202
- package/docs/scripts/third-party/hljs.js +1 -1
- package/docs/scripts/third-party/popper.js +1 -1
- package/docs/scripts/third-party/tippy.js +1 -1
- package/docs/scripts/third-party/tocbot.js +508 -509
- package/docs/scripts/third-party/tocbot.min.js +0 -0
- package/docs/static/bitcoin.jpeg +0 -0
- package/docs/static/home.md +0 -0
- package/docs/static/logo-ecosystem.png +0 -0
- package/docs/static/logo.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
- package/docs/styles/clean-jsdoc-theme-light.css +0 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
- package/docs/styles/clean-jsdoc-theme.min.css +0 -0
- package/extend/bajo/hook/dobo@before-find-record.js +10 -0
- package/extend/waibuStatic/virtual.json +0 -0
- package/index.js +13 -13
- package/package.json +4 -3
- package/wiki/CHANGES.md +5 -0
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
- package/wiki/toc.json +0 -0
- package/extend/bajo/hook/dobo@before-record-find.js +0 -11
|
File without changes
|
package/docs/static/bitcoin.jpeg
CHANGED
|
File without changes
|
package/docs/static/home.md
CHANGED
|
File without changes
|
|
File without changes
|
package/docs/static/logo.png
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const beforeFindRecord = {
|
|
2
|
+
level: 1001,
|
|
3
|
+
handler: async function (modelName, filter, options) {
|
|
4
|
+
if (!filter.bbox || !this.app.dobo) return
|
|
5
|
+
const model = this.app.dobo.getModel(modelName)
|
|
6
|
+
filter.query = await this.buildBboxQuery({ bbox: filter.bbox, query: filter.query, model, options })
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default beforeFindRecord
|
|
File without changes
|
package/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import anekaSpatial from 'aneka-spatial/index.js'
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Plugin factory
|
|
5
3
|
*
|
|
@@ -14,18 +12,15 @@ async function factory (pkgName) {
|
|
|
14
12
|
*
|
|
15
13
|
* @class
|
|
16
14
|
*/
|
|
17
|
-
class BajoSpatial extends this.app.
|
|
18
|
-
static alias = 'spatial'
|
|
19
|
-
|
|
15
|
+
class BajoSpatial extends this.app.baseClass.Base {
|
|
20
16
|
constructor () {
|
|
21
17
|
super(pkgName, me.app)
|
|
22
18
|
this.config = {}
|
|
23
|
-
this.app.lib.anekaSpatial = anekaSpatial
|
|
24
19
|
}
|
|
25
20
|
|
|
26
|
-
buildBboxQuery = async ({ bbox, query,
|
|
21
|
+
buildBboxQuery = async ({ bbox, query = {}, model, options = {} } = {}) => {
|
|
27
22
|
const { merge, isEmpty } = this.app.lib._
|
|
28
|
-
const props =
|
|
23
|
+
const props = model.properties.map(item => item.name)
|
|
29
24
|
const { bboxLatField = 'lat', bboxLngField = 'lng' } = options
|
|
30
25
|
if (props.includes(bboxLatField) && props.includes(bboxLngField)) {
|
|
31
26
|
const [minx, miny, maxx, maxy] = await this.parseBbox(bbox)
|
|
@@ -34,9 +29,14 @@ async function factory (pkgName) {
|
|
|
34
29
|
q[bboxLatField] = { $gte: miny, $lte: maxy }
|
|
35
30
|
if (isEmpty(query)) query = q
|
|
36
31
|
else {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
else
|
|
32
|
+
if (query.$and) {
|
|
33
|
+
query.$and.push(q)
|
|
34
|
+
} else if (query.$or) {
|
|
35
|
+
const old = query.$or
|
|
36
|
+
query = { $and: [old, q] }
|
|
37
|
+
} else {
|
|
38
|
+
merge(query, q)
|
|
39
|
+
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
return query
|
|
@@ -46,8 +46,8 @@ async function factory (pkgName) {
|
|
|
46
46
|
item = item + ''
|
|
47
47
|
if (item.includes(',')) return
|
|
48
48
|
if (!this.app.bajoCommonDb || !this.app.dobo) return
|
|
49
|
-
const
|
|
50
|
-
const country = await
|
|
49
|
+
const model = this.app.dobo.getModel('CdbCountry')
|
|
50
|
+
const country = await model.getRecord(item, { throwNotFound: false })
|
|
51
51
|
if (country) return country.bbox
|
|
52
52
|
throw this.error('Invalid country bbox \'%s\'', item, { statusCode: 400 })
|
|
53
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bajo-spatial",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Spatial functions for Bajo Framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"bajo": {
|
|
12
|
-
"type": "plugin"
|
|
12
|
+
"type": "plugin",
|
|
13
|
+
"alias": "spatial"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
},
|
|
29
30
|
"homepage": "https://github.com/ardhi/bajo-spatial#readme",
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@turf/turf": "^7.
|
|
32
|
+
"@turf/turf": "^7.3.1",
|
|
32
33
|
"aneka-spatial": "^0.0.4",
|
|
33
34
|
"geolib": "^3.3.4"
|
|
34
35
|
},
|
package/wiki/CHANGES.md
ADDED
package/wiki/CONFIG.md
CHANGED
|
File without changes
|
package/wiki/CONTRIBUTING.md
CHANGED
|
File without changes
|
package/wiki/toc.json
CHANGED
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
const beforeRecordFind = {
|
|
2
|
-
level: 1001,
|
|
3
|
-
handler: async function (name, filter, options) {
|
|
4
|
-
if (!filter.bbox) return
|
|
5
|
-
const { getSchema } = this.app.dobo
|
|
6
|
-
const schema = getSchema(name)
|
|
7
|
-
filter.query = await this.buildBboxQuery({ bbox: filter.bbox, query: filter.query, schema, options })
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export default beforeRecordFind
|