@opengis/fcore 0.0.1-beta.23 → 0.0.1-beta.24
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/LICENSE +3 -3
- package/README.md +71 -71
- package/dist/config.js +1 -1
- package/dist/context.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/fastify.d.ts.map +1 -1
- package/dist/fastify.js +1 -1
- package/dist/fcore.js +1 -1
- package/dist/migrations/cli.js +1 -1
- package/dist/migrations/runner.js +1 -1
- package/dist/modules/auth/adduser-cli.js +1 -1
- package/dist/modules/auth/passwd-cli.js +1 -1
- package/dist/modules/auth/permission-cli.js +1 -1
- package/dist/modules/auth/route.js +1 -1
- package/dist/modules/auth/schema.js +1 -1
- package/dist/modules/auth/services/change-password.js +1 -1
- package/dist/modules/auth/services/get-current-user.js +1 -1
- package/dist/modules/auth/services/registration.js +1 -1
- package/dist/modules/auth/services/verify-two-factor.js +1 -1
- package/dist/modules/file/mime.js +1 -1
- package/dist/modules/file/route.js +1 -1
- package/dist/modules/file/schema.js +1 -1
- package/dist/modules/file/services/get-file.js +1 -1
- package/dist/modules/file/services/resize-file.js +1 -1
- package/dist/modules/file/services/upload-file.js +1 -1
- package/dist/modules/resource/route.js +1 -1
- package/dist/modules/resource/schema.d.ts +1 -0
- package/dist/modules/resource/schema.d.ts.map +1 -1
- package/dist/modules/resource/schema.js +1 -1
- package/dist/modules/resource/services/add-note.js +1 -1
- package/dist/modules/resource/services/add-resource-file.js +1 -1
- package/dist/modules/resource/services/create-resource-relation.js +1 -1
- package/dist/modules/resource/services/create-resource.js +1 -1
- package/dist/modules/resource/services/delete-resource-relation.js +1 -1
- package/dist/modules/resource/services/delete-resource.js +1 -1
- package/dist/modules/resource/services/export-resource.js +1 -1
- package/dist/modules/resource/services/get-resource.js +1 -1
- package/dist/modules/resource/services/list-resource-relation.js +1 -1
- package/dist/modules/resource/services/list-resources.d.ts.map +1 -1
- package/dist/modules/resource/services/list-resources.js +1 -1
- package/dist/modules/resource/services/search-resource.js +1 -1
- package/dist/modules/resource/services/suggest-resource.js +1 -1
- package/dist/modules/resource/services/update-resource-relation.js +1 -1
- package/dist/modules/resource/services/update-resource.js +1 -1
- package/dist/modules/resource/services/upload-resource-file.js +1 -1
- package/dist/modules/system/route.js +1 -1
- package/dist/modules/system/schema.js +1 -1
- package/dist/modules/system/services/check-system.js +1 -1
- package/dist/modules/system/services/get-access.js +1 -1
- package/dist/modules/system/services/get-api-list.js +1 -1
- package/dist/modules/system/services/get-audit-log.js +1 -1
- package/dist/modules/system/services/get-dictionary.js +1 -1
- package/dist/modules/system/services/get-system-log.js +1 -1
- package/dist/modules/system/services/get-system-settings.js +1 -1
- package/dist/modules/system/services/list-dictionaries.js +1 -1
- package/dist/modules/system/services/set-access.js +1 -1
- package/dist/modules/system/services/update-dictionary.js +1 -1
- package/dist/modules/system/services/update-system-settings.js +1 -1
- package/dist/modules/utils/require-admin.js +1 -1
- package/dist/modules/utils/safe-user.js +1 -1
- package/dist/modules/utils/unsupported.js +1 -1
- package/dist/plugins/audit/audit.js +1 -1
- package/dist/plugins/audit/services/write-audit.js +1 -1
- package/dist/plugins/auth/get-user-permissions.js +1 -1
- package/dist/plugins/auth/index.js +1 -1
- package/dist/plugins/auth/verifyUser.js +1 -1
- package/dist/plugins/dictionary.js +1 -1
- package/dist/plugins/file.js +1 -1
- package/dist/plugins/jwt.js +1 -1
- package/dist/plugins/logger/index.js +1 -1
- package/dist/plugins/logger/transport.js +1 -1
- package/dist/plugins/pg.js +1 -1
- package/dist/plugins/redis.js +1 -1
- package/dist/plugins/resource/resource.js +1 -1
- package/dist/plugins/resource/resource.registry.js +1 -1
- package/dist/plugins/resource/resource.types.d.ts +22 -0
- package/dist/plugins/resource/resource.types.d.ts.map +1 -1
- package/dist/plugins/resource/services/add-dictionary-lookup-data.js +1 -1
- package/dist/plugins/resource/services/add-file-token.js +1 -1
- package/dist/plugins/resource/services/add-table-lookup-data.js +1 -1
- package/dist/plugins/resource/services/create-relation.d.ts +1 -1
- package/dist/plugins/resource/services/create-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/create-relation.js +1 -1
- package/dist/plugins/resource/services/create.js +1 -1
- package/dist/plugins/resource/services/delete-relation.d.ts +1 -1
- package/dist/plugins/resource/services/delete-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/delete-relation.js +1 -1
- package/dist/plugins/resource/services/delete.js +1 -1
- package/dist/plugins/resource/services/find-one.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-one.js +1 -1
- package/dist/plugins/resource/services/find-relation.d.ts.map +1 -1
- package/dist/plugins/resource/services/find-relation.js +1 -1
- package/dist/plugins/resource/services/find.d.ts.map +1 -1
- package/dist/plugins/resource/services/find.js +1 -1
- package/dist/plugins/resource/services/get-table-columns.js +1 -1
- package/dist/plugins/resource/services/update-relation.js +1 -1
- package/dist/plugins/resource/services/update.js +1 -1
- package/dist/plugins/resource/utils/auto-index.js +1 -1
- package/dist/plugins/resource/utils/fields.js +1 -1
- package/dist/plugins/resource/utils/filters.d.ts +2 -1
- package/dist/plugins/resource/utils/filters.d.ts.map +1 -1
- package/dist/plugins/resource/utils/filters.js +1 -1
- package/dist/plugins/resource/utils/permissions.js +1 -1
- package/dist/plugins/resource/utils/sort.js +1 -1
- package/dist/plugins/resource/utils/sql.js +1 -1
- package/dist/plugins/resource/utils/summary.d.ts +3 -0
- package/dist/plugins/resource/utils/summary.d.ts.map +1 -0
- package/dist/plugins/resource/utils/summary.js +1 -0
- package/dist/shared/getIP.js +1 -1
- package/migrations/20260903130000_move_notes_files_to_admin.sql +17 -17
- package/migrations/20260903140000_settings_nulls_not_distinct.sql +18 -18
- package/migrations/20260910170000_core_schema.sql +22 -0
- package/package.json +93 -93
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
CREATE SCHEMA IF NOT EXISTS admin;
|
|
2
|
-
|
|
3
|
-
DO $$
|
|
4
|
-
BEGIN
|
|
5
|
-
IF to_regclass('crm.notes') IS NOT NULL
|
|
6
|
-
AND to_regclass('admin.notes') IS NULL THEN
|
|
7
|
-
ALTER TABLE crm.notes SET SCHEMA admin;
|
|
8
|
-
END IF;
|
|
9
|
-
|
|
10
|
-
IF to_regclass('crm.files') IS NOT NULL
|
|
11
|
-
AND to_regclass('admin.files') IS NULL THEN
|
|
12
|
-
ALTER TABLE crm.files SET SCHEMA admin;
|
|
13
|
-
END IF;
|
|
14
|
-
END
|
|
15
|
-
$$;
|
|
16
|
-
|
|
17
|
-
ALTER INDEX IF EXISTS crm_notes_resource_idx RENAME TO admin_notes_resource_idx;
|
|
1
|
+
CREATE SCHEMA IF NOT EXISTS admin;
|
|
2
|
+
|
|
3
|
+
DO $$
|
|
4
|
+
BEGIN
|
|
5
|
+
IF to_regclass('crm.notes') IS NOT NULL
|
|
6
|
+
AND to_regclass('admin.notes') IS NULL THEN
|
|
7
|
+
ALTER TABLE crm.notes SET SCHEMA admin;
|
|
8
|
+
END IF;
|
|
9
|
+
|
|
10
|
+
IF to_regclass('crm.files') IS NOT NULL
|
|
11
|
+
AND to_regclass('admin.files') IS NULL THEN
|
|
12
|
+
ALTER TABLE crm.files SET SCHEMA admin;
|
|
13
|
+
END IF;
|
|
14
|
+
END
|
|
15
|
+
$$;
|
|
16
|
+
|
|
17
|
+
ALTER INDEX IF EXISTS crm_notes_resource_idx RENAME TO admin_notes_resource_idx;
|
|
18
18
|
ALTER INDEX IF EXISTS crm_notes_uid_idx RENAME TO admin_notes_uid_idx;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
CREATE SCHEMA IF NOT EXISTS admin;
|
|
2
|
-
|
|
3
|
-
CREATE TABLE IF NOT EXISTS admin.settings (
|
|
4
|
-
id text PRIMARY KEY DEFAULT next_id(),
|
|
5
|
-
resource text NOT NULL DEFAULT 'system',
|
|
6
|
-
resource_id text,
|
|
7
|
-
key text NOT NULL,
|
|
8
|
-
value jsonb,
|
|
9
|
-
updated_by text,
|
|
10
|
-
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
11
|
-
created_by text,
|
|
12
|
-
created_at timestamptz NOT NULL DEFAULT now()
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
DROP INDEX IF EXISTS settings_resource_key_uidx;
|
|
16
|
-
|
|
17
|
-
CREATE UNIQUE INDEX settings_resource_key_uidx
|
|
18
|
-
ON admin.settings (resource, resource_id, key)
|
|
1
|
+
CREATE SCHEMA IF NOT EXISTS admin;
|
|
2
|
+
|
|
3
|
+
CREATE TABLE IF NOT EXISTS admin.settings (
|
|
4
|
+
id text PRIMARY KEY DEFAULT next_id(),
|
|
5
|
+
resource text NOT NULL DEFAULT 'system',
|
|
6
|
+
resource_id text,
|
|
7
|
+
key text NOT NULL,
|
|
8
|
+
value jsonb,
|
|
9
|
+
updated_by text,
|
|
10
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
11
|
+
created_by text,
|
|
12
|
+
created_at timestamptz NOT NULL DEFAULT now()
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
DROP INDEX IF EXISTS settings_resource_key_uidx;
|
|
16
|
+
|
|
17
|
+
CREATE UNIQUE INDEX settings_resource_key_uidx
|
|
18
|
+
ON admin.settings (resource, resource_id, key)
|
|
19
19
|
NULLS NOT DISTINCT;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS admin.gallery (
|
|
2
|
+
id text PRIMARY KEY DEFAULT next_id(),
|
|
3
|
+
resource text,
|
|
4
|
+
resource_id text,
|
|
5
|
+
uploaded_name text,
|
|
6
|
+
file_type text,
|
|
7
|
+
file_status numeric,
|
|
8
|
+
file_name text,
|
|
9
|
+
size numeric,
|
|
10
|
+
mime_type text check (mime_type = any(array['image/png','image/jpeg','image/webp']) ),
|
|
11
|
+
tags text[],
|
|
12
|
+
file_path text,
|
|
13
|
+
field_name text,
|
|
14
|
+
status text DEFAULT 'pending', -- File processing status, e.g., 'pending', 'attached'
|
|
15
|
+
expires_at timestamptz DEFAULT now() + interval '1 day',
|
|
16
|
+
verified boolean DEFAULT false,
|
|
17
|
+
resized boolean,
|
|
18
|
+
created_by text REFERENCES admin.users(uid) ,
|
|
19
|
+
created_at timestamptz DEFAULT now(),
|
|
20
|
+
updated_by text REFERENCES admin.users(uid) ,
|
|
21
|
+
updated_at timestamptz default now()
|
|
22
|
+
);
|
package/package.json
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@opengis/fcore",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
4
|
-
"description": "Reusable backend foundation for OpenGIS Node.js applications",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"types": "./dist/index.d.ts",
|
|
8
|
-
"files": [
|
|
9
|
-
"dist",
|
|
10
|
-
"migrations",
|
|
11
|
-
"README.md",
|
|
12
|
-
"LICENSE"
|
|
13
|
-
],
|
|
14
|
-
"exports": {
|
|
15
|
-
".": {
|
|
16
|
-
"types": "./dist/index.d.ts",
|
|
17
|
-
"import": "./dist/index.js"
|
|
18
|
-
},
|
|
19
|
-
"./fastify": {
|
|
20
|
-
"types": "./dist/fastify.d.ts",
|
|
21
|
-
"import": "./dist/fastify.js"
|
|
22
|
-
},
|
|
23
|
-
"./migrate": {
|
|
24
|
-
"types": "./dist/migrations/runner.d.ts",
|
|
25
|
-
"import": "./dist/migrations/runner.js"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"bin": {
|
|
29
|
-
"fcore-migrate": "./dist/migrations/cli.js",
|
|
30
|
-
"fcore-adduser": "./dist/modules/auth/adduser-cli.js",
|
|
31
|
-
"fcore-passwd": "./dist/modules/auth/passwd-cli.js",
|
|
32
|
-
"fcore-permission": "./dist/modules/auth/permission-cli.js"
|
|
33
|
-
},
|
|
34
|
-
"scripts": {
|
|
35
|
-
"clean": "rm -rf dist",
|
|
36
|
-
"build": "npm run clean && tsc -p tsconfig.json && node scripts/obfuscate.mjs",
|
|
37
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
-
"test": "node --test --import tsx test/**/*.test.ts",
|
|
39
|
-
"test-env": "node --env-file=.env.test --test --import tsx test/**/env.test.ts",
|
|
40
|
-
"dev": "bun ./server.ts",
|
|
41
|
-
"adduser": "node --import tsx ./src/modules/auth/adduser-cli.ts",
|
|
42
|
-
"passwd": "node --import tsx ./src/modules/auth/passwd-cli.ts",
|
|
43
|
-
"permission": "node --import tsx ./src/modules/auth/permission-cli.ts",
|
|
44
|
-
"migrate": "node --import tsx src/migrations/cli.ts",
|
|
45
|
-
"migration-test": "node --env-file=.env.test --import tsx src/migrations/cli.ts",
|
|
46
|
-
"prepublishOnly": "npm run build",
|
|
47
|
-
"prepublishOnly1": "npm run build && npm test",
|
|
48
|
-
"patch": "npm version patch && git push && npm publish",
|
|
49
|
-
"minor": "npm version minor && git push && npm publish",
|
|
50
|
-
"major": "npm version major && git push && npm publish"
|
|
51
|
-
},
|
|
52
|
-
"engines": {
|
|
53
|
-
"node": ">=20"
|
|
54
|
-
},
|
|
55
|
-
"dependencies": {
|
|
56
|
-
"@aws-sdk/client-s3": "3.1125.0",
|
|
57
|
-
"@aws-sdk/lib-storage": "3.1125.0",
|
|
58
|
-
"@fastify/cookie": "11.1.2",
|
|
59
|
-
"@fastify/multipart": "10.1.1",
|
|
60
|
-
"@fastify/passport": "4.0.2",
|
|
61
|
-
"@fastify/rate-limit": "11.2.0",
|
|
62
|
-
"@fastify/session": "11.1.2",
|
|
63
|
-
"@sinclair/typebox": "^0.34.52",
|
|
64
|
-
"apache-crypt": "1.2.6",
|
|
65
|
-
"dotenv": "17.4.2",
|
|
66
|
-
"fastify-session-redis-store": "7.1.2",
|
|
67
|
-
"file-type": "22.0.2",
|
|
68
|
-
"ioredis": "6.0.0",
|
|
69
|
-
"jose": "^6.2.12",
|
|
70
|
-
"otplib": "13.5.0",
|
|
71
|
-
"pg": "8.23.0",
|
|
72
|
-
"pino": "10.3.1",
|
|
73
|
-
"pino-abstract-transport": "3.0.0",
|
|
74
|
-
"qrcode": "1.5.4",
|
|
75
|
-
"sharp": "0.35.4"
|
|
76
|
-
},
|
|
77
|
-
"peerDependencies": {
|
|
78
|
-
"fastify": ">=5.12.1"
|
|
79
|
-
},
|
|
80
|
-
"devDependencies": {
|
|
81
|
-
"@types/node": "22.20.1",
|
|
82
|
-
"@types/passport": "1.0.17",
|
|
83
|
-
"@types/passport-local": "1.0.38",
|
|
84
|
-
"@types/pg": "8.23.1",
|
|
85
|
-
"@types/qrcode": "1.5.6",
|
|
86
|
-
"fastify": "5.12.1",
|
|
87
|
-
"javascript-obfuscator": "5.6.0",
|
|
88
|
-
"tsx": "4.23.13",
|
|
89
|
-
"typescript": "7.0.2",
|
|
90
|
-
"vitest": "4.1.11"
|
|
91
|
-
},
|
|
92
|
-
"license": "UNLICENSED"
|
|
93
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@opengis/fcore",
|
|
3
|
+
"version": "0.0.1-beta.24",
|
|
4
|
+
"description": "Reusable backend foundation for OpenGIS Node.js applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"migrations",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./fastify": {
|
|
20
|
+
"types": "./dist/fastify.d.ts",
|
|
21
|
+
"import": "./dist/fastify.js"
|
|
22
|
+
},
|
|
23
|
+
"./migrate": {
|
|
24
|
+
"types": "./dist/migrations/runner.d.ts",
|
|
25
|
+
"import": "./dist/migrations/runner.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"bin": {
|
|
29
|
+
"fcore-migrate": "./dist/migrations/cli.js",
|
|
30
|
+
"fcore-adduser": "./dist/modules/auth/adduser-cli.js",
|
|
31
|
+
"fcore-passwd": "./dist/modules/auth/passwd-cli.js",
|
|
32
|
+
"fcore-permission": "./dist/modules/auth/permission-cli.js"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"clean": "rm -rf dist",
|
|
36
|
+
"build": "npm run clean && tsc -p tsconfig.json && node scripts/obfuscate.mjs",
|
|
37
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
38
|
+
"test": "node --test --import tsx test/**/*.test.ts",
|
|
39
|
+
"test-env": "node --env-file=.env.test --test --import tsx test/**/env.test.ts",
|
|
40
|
+
"dev": "bun ./server.ts",
|
|
41
|
+
"adduser": "node --import tsx ./src/modules/auth/adduser-cli.ts",
|
|
42
|
+
"passwd": "node --import tsx ./src/modules/auth/passwd-cli.ts",
|
|
43
|
+
"permission": "node --import tsx ./src/modules/auth/permission-cli.ts",
|
|
44
|
+
"migrate": "node --import tsx src/migrations/cli.ts",
|
|
45
|
+
"migration-test": "node --env-file=.env.test --import tsx src/migrations/cli.ts",
|
|
46
|
+
"prepublishOnly": "npm run build",
|
|
47
|
+
"prepublishOnly1": "npm run build && npm test",
|
|
48
|
+
"patch": "npm version patch && git push && npm publish",
|
|
49
|
+
"minor": "npm version minor && git push && npm publish",
|
|
50
|
+
"major": "npm version major && git push && npm publish"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=20"
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"@aws-sdk/client-s3": "3.1125.0",
|
|
57
|
+
"@aws-sdk/lib-storage": "3.1125.0",
|
|
58
|
+
"@fastify/cookie": "11.1.2",
|
|
59
|
+
"@fastify/multipart": "10.1.1",
|
|
60
|
+
"@fastify/passport": "4.0.2",
|
|
61
|
+
"@fastify/rate-limit": "11.2.0",
|
|
62
|
+
"@fastify/session": "11.1.2",
|
|
63
|
+
"@sinclair/typebox": "^0.34.52",
|
|
64
|
+
"apache-crypt": "1.2.6",
|
|
65
|
+
"dotenv": "17.4.2",
|
|
66
|
+
"fastify-session-redis-store": "7.1.2",
|
|
67
|
+
"file-type": "22.0.2",
|
|
68
|
+
"ioredis": "6.0.0",
|
|
69
|
+
"jose": "^6.2.12",
|
|
70
|
+
"otplib": "13.5.0",
|
|
71
|
+
"pg": "8.23.0",
|
|
72
|
+
"pino": "10.3.1",
|
|
73
|
+
"pino-abstract-transport": "3.0.0",
|
|
74
|
+
"qrcode": "1.5.4",
|
|
75
|
+
"sharp": "0.35.4"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"fastify": ">=5.12.1"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@types/node": "22.20.1",
|
|
82
|
+
"@types/passport": "1.0.17",
|
|
83
|
+
"@types/passport-local": "1.0.38",
|
|
84
|
+
"@types/pg": "8.23.1",
|
|
85
|
+
"@types/qrcode": "1.5.6",
|
|
86
|
+
"fastify": "5.12.1",
|
|
87
|
+
"javascript-obfuscator": "5.6.0",
|
|
88
|
+
"tsx": "4.23.13",
|
|
89
|
+
"typescript": "7.0.2",
|
|
90
|
+
"vitest": "4.1.11"
|
|
91
|
+
},
|
|
92
|
+
"license": "UNLICENSED"
|
|
93
|
+
}
|