@opengis/fastify-table 1.1.48 → 1.1.50
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/.gitlab-ci.yml +18 -0
- package/Changelog.md +2 -2
- package/crud/funcs/getAccess.js +3 -2
- package/crud/funcs/utils/getFolder.js +9 -0
- package/package.json +1 -1
- package/table/controllers/data.js +2 -2
- package/utils.js +2 -0
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- pull
|
|
3
|
+
|
|
4
|
+
latest-253:
|
|
5
|
+
stage: pull
|
|
6
|
+
tags:
|
|
7
|
+
- cdn
|
|
8
|
+
variables:
|
|
9
|
+
GIT_STRATEGY: none
|
|
10
|
+
script:
|
|
11
|
+
- cd /data/softpro/docs/fastify-table && git reset --hard && git pull origin main
|
|
12
|
+
- npm install
|
|
13
|
+
- npm run docs:build
|
|
14
|
+
- rm -rf /data/softpro/apidocs/fastify-table || true
|
|
15
|
+
- mkdir -p /data/softpro/apidocs/fastify-table || true
|
|
16
|
+
- cp -R ./docs/.vitepress/dist/* /data/softpro/apidocs/fastify-table
|
|
17
|
+
only:
|
|
18
|
+
- main
|
package/Changelog.md
CHANGED
package/crud/funcs/getAccess.js
CHANGED
|
@@ -29,8 +29,9 @@ export default async function getAccess({ table, user = {} }) {
|
|
|
29
29
|
const { uid } = user;
|
|
30
30
|
const body = await getTemplate('table', table) || {};
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
// console.log(user?.type);
|
|
33
|
+
if (config.auth?.disable || user?.type === 'admin' || body?.public || body.access === 'public' || (body.access === 'user' && user.uid)) {
|
|
34
|
+
return { actions: ['get'].concat(user.uid ? body.actions || body.action_default || [] : []), query: '1=1' };
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
if (!uid || !body?.table) return null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import config from '../../../config.js';
|
|
3
|
+
|
|
4
|
+
export default function getFolder(req, type = 'server') {
|
|
5
|
+
if (!['server', 'local'].includes(type)) throw new Error('params type is invalid');
|
|
6
|
+
const types = { local: req.root || config.root, server: req.mapServerRoot || config.mapServerRoot };
|
|
7
|
+
const filepath = path.posix.join(types[type] || `/data/local/${req.pg?.options?.database || ''}`, req.folder || config.folder || '');
|
|
8
|
+
return filepath;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import getAccess from '../../crud/funcs/getAccess.js';
|
|
|
6
6
|
import setToken from '../../crud/funcs/setToken.js';
|
|
7
7
|
import gisIRColumn from './utils/gisIRColumn.js';
|
|
8
8
|
import applyHook from '../../hook/funcs/applyHook.js';
|
|
9
|
-
import config from '../../config.js';
|
|
9
|
+
// import config from '../../config.js';
|
|
10
10
|
|
|
11
11
|
const maxLimit = 100;
|
|
12
12
|
export default async function dataAPI(req) {
|
|
@@ -36,7 +36,7 @@ export default async function dataAPI(req) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const {
|
|
39
|
-
table, columns, sql, cardSql, filters, form, meta, sqlColumns, public: ispublic,
|
|
39
|
+
table, columns = [], sql, cardSql, filters, form, meta, sqlColumns, public: ispublic,
|
|
40
40
|
} = loadTable;
|
|
41
41
|
|
|
42
42
|
const tableMeta = await getMeta(table);
|
package/utils.js
CHANGED
|
@@ -41,12 +41,14 @@ import getOpt from './crud/funcs/getOpt.js';
|
|
|
41
41
|
import setOpt from './crud/funcs/setOpt.js';
|
|
42
42
|
|
|
43
43
|
import isFileExists from './crud/funcs/isFileExists.js';
|
|
44
|
+
import getFolder from './crud/funcs/utils/getFolder.js';
|
|
44
45
|
|
|
45
46
|
import logger from './logger/getLogger.js';
|
|
46
47
|
|
|
47
48
|
export default null;
|
|
48
49
|
export {
|
|
49
50
|
config,
|
|
51
|
+
getFolder,
|
|
50
52
|
handlebars,
|
|
51
53
|
getFilterSQL,
|
|
52
54
|
addCron,
|