@qwickapps/server 1.4.0 → 1.5.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/CHANGELOG.md +507 -0
- package/README.md +9 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/plugins/bans/bans-plugin.d.ts.map +1 -1
- package/dist/plugins/bans/bans-plugin.js +12 -3
- package/dist/plugins/bans/bans-plugin.js.map +1 -1
- package/dist/plugins/devices/__tests__/devices-plugin.test.d.ts +11 -0
- package/dist/plugins/devices/__tests__/devices-plugin.test.d.ts.map +1 -0
- package/dist/plugins/devices/__tests__/devices-plugin.test.js +410 -0
- package/dist/plugins/devices/__tests__/devices-plugin.test.js.map +1 -0
- package/dist/plugins/devices/__tests__/token-utils.test.d.ts +7 -0
- package/dist/plugins/devices/__tests__/token-utils.test.d.ts.map +1 -0
- package/dist/plugins/devices/__tests__/token-utils.test.js +197 -0
- package/dist/plugins/devices/__tests__/token-utils.test.js.map +1 -0
- package/dist/plugins/devices/adapters/compute-adapter.d.ts +36 -0
- package/dist/plugins/devices/adapters/compute-adapter.d.ts.map +1 -0
- package/dist/plugins/devices/adapters/compute-adapter.js +100 -0
- package/dist/plugins/devices/adapters/compute-adapter.js.map +1 -0
- package/dist/plugins/devices/adapters/index.d.ts +12 -0
- package/dist/plugins/devices/adapters/index.d.ts.map +1 -0
- package/dist/plugins/devices/adapters/index.js +10 -0
- package/dist/plugins/devices/adapters/index.js.map +1 -0
- package/dist/plugins/devices/adapters/mobile-adapter.d.ts +41 -0
- package/dist/plugins/devices/adapters/mobile-adapter.d.ts.map +1 -0
- package/dist/plugins/devices/adapters/mobile-adapter.js +131 -0
- package/dist/plugins/devices/adapters/mobile-adapter.js.map +1 -0
- package/dist/plugins/devices/devices-plugin.d.ts +70 -0
- package/dist/plugins/devices/devices-plugin.d.ts.map +1 -0
- package/dist/plugins/devices/devices-plugin.js +453 -0
- package/dist/plugins/devices/devices-plugin.js.map +1 -0
- package/dist/plugins/devices/index.d.ts +18 -0
- package/dist/plugins/devices/index.d.ts.map +1 -0
- package/dist/plugins/devices/index.js +18 -0
- package/dist/plugins/devices/index.js.map +1 -0
- package/dist/plugins/devices/stores/index.d.ts +9 -0
- package/dist/plugins/devices/stores/index.d.ts.map +1 -0
- package/dist/plugins/devices/stores/index.js +9 -0
- package/dist/plugins/devices/stores/index.js.map +1 -0
- package/dist/plugins/devices/stores/postgres-store.d.ts +26 -0
- package/dist/plugins/devices/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/devices/stores/postgres-store.js +199 -0
- package/dist/plugins/devices/stores/postgres-store.js.map +1 -0
- package/dist/plugins/devices/token-utils.d.ts +100 -0
- package/dist/plugins/devices/token-utils.d.ts.map +1 -0
- package/dist/plugins/devices/token-utils.js +162 -0
- package/dist/plugins/devices/token-utils.js.map +1 -0
- package/dist/plugins/devices/types.d.ts +307 -0
- package/dist/plugins/devices/types.d.ts.map +1 -0
- package/dist/plugins/devices/types.js +10 -0
- package/dist/plugins/devices/types.js.map +1 -0
- package/dist/plugins/index.d.ts +14 -2
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +13 -1
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/notifications/__tests__/notifications-manager.test.d.ts +5 -0
- package/dist/plugins/notifications/__tests__/notifications-manager.test.d.ts.map +1 -0
- package/dist/plugins/notifications/__tests__/notifications-manager.test.js +470 -0
- package/dist/plugins/notifications/__tests__/notifications-manager.test.js.map +1 -0
- package/dist/plugins/notifications/index.d.ts +71 -0
- package/dist/plugins/notifications/index.d.ts.map +1 -0
- package/dist/plugins/notifications/index.js +72 -0
- package/dist/plugins/notifications/index.js.map +1 -0
- package/dist/plugins/notifications/notifications-manager.d.ts +182 -0
- package/dist/plugins/notifications/notifications-manager.d.ts.map +1 -0
- package/dist/plugins/notifications/notifications-manager.js +610 -0
- package/dist/plugins/notifications/notifications-manager.js.map +1 -0
- package/dist/plugins/notifications/notifications-plugin.d.ts +83 -0
- package/dist/plugins/notifications/notifications-plugin.d.ts.map +1 -0
- package/dist/plugins/notifications/notifications-plugin.js +337 -0
- package/dist/plugins/notifications/notifications-plugin.js.map +1 -0
- package/dist/plugins/notifications/types.d.ts +164 -0
- package/dist/plugins/notifications/types.d.ts.map +1 -0
- package/dist/plugins/notifications/types.js +9 -0
- package/dist/plugins/notifications/types.js.map +1 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.d.ts +12 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.d.ts.map +1 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.js +349 -0
- package/dist/plugins/parental/__tests__/parental-plugin.test.js.map +1 -0
- package/dist/plugins/parental/adapters/index.d.ts +8 -0
- package/dist/plugins/parental/adapters/index.d.ts.map +1 -0
- package/dist/plugins/parental/adapters/index.js +7 -0
- package/dist/plugins/parental/adapters/index.js.map +1 -0
- package/dist/plugins/parental/adapters/kids-adapter.d.ts +24 -0
- package/dist/plugins/parental/adapters/kids-adapter.d.ts.map +1 -0
- package/dist/plugins/parental/adapters/kids-adapter.js +174 -0
- package/dist/plugins/parental/adapters/kids-adapter.js.map +1 -0
- package/dist/plugins/parental/index.d.ts +14 -0
- package/dist/plugins/parental/index.d.ts.map +1 -0
- package/dist/plugins/parental/index.js +15 -0
- package/dist/plugins/parental/index.js.map +1 -0
- package/dist/plugins/parental/parental-plugin.d.ts +88 -0
- package/dist/plugins/parental/parental-plugin.d.ts.map +1 -0
- package/dist/plugins/parental/parental-plugin.js +666 -0
- package/dist/plugins/parental/parental-plugin.js.map +1 -0
- package/dist/plugins/parental/stores/index.d.ts +7 -0
- package/dist/plugins/parental/stores/index.d.ts.map +1 -0
- package/dist/plugins/parental/stores/index.js +7 -0
- package/dist/plugins/parental/stores/index.js.map +1 -0
- package/dist/plugins/parental/stores/postgres-store.d.ts +10 -0
- package/dist/plugins/parental/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/parental/stores/postgres-store.js +209 -0
- package/dist/plugins/parental/stores/postgres-store.js.map +1 -0
- package/dist/plugins/parental/types.d.ts +154 -0
- package/dist/plugins/parental/types.d.ts.map +1 -0
- package/dist/plugins/parental/types.js +10 -0
- package/dist/plugins/parental/types.js.map +1 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.d.ts +11 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.d.ts.map +1 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.js +243 -0
- package/dist/plugins/profiles/__tests__/profiles-plugin.test.js.map +1 -0
- package/dist/plugins/profiles/index.d.ts +12 -0
- package/dist/plugins/profiles/index.d.ts.map +1 -0
- package/dist/plugins/profiles/index.js +13 -0
- package/dist/plugins/profiles/index.js.map +1 -0
- package/dist/plugins/profiles/profiles-plugin.d.ts +71 -0
- package/dist/plugins/profiles/profiles-plugin.d.ts.map +1 -0
- package/dist/plugins/profiles/profiles-plugin.js +481 -0
- package/dist/plugins/profiles/profiles-plugin.js.map +1 -0
- package/dist/plugins/profiles/stores/index.d.ts +9 -0
- package/dist/plugins/profiles/stores/index.d.ts.map +1 -0
- package/dist/plugins/profiles/stores/index.js +9 -0
- package/dist/plugins/profiles/stores/index.js.map +1 -0
- package/dist/plugins/profiles/stores/postgres-store.d.ts +18 -0
- package/dist/plugins/profiles/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/profiles/stores/postgres-store.js +310 -0
- package/dist/plugins/profiles/stores/postgres-store.js.map +1 -0
- package/dist/plugins/profiles/types.d.ts +289 -0
- package/dist/plugins/profiles/types.d.ts.map +1 -0
- package/dist/plugins/profiles/types.js +10 -0
- package/dist/plugins/profiles/types.js.map +1 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.d.ts +11 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.d.ts.map +1 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.js +305 -0
- package/dist/plugins/subscriptions/__tests__/subscriptions-plugin.test.js.map +1 -0
- package/dist/plugins/subscriptions/index.d.ts +12 -0
- package/dist/plugins/subscriptions/index.d.ts.map +1 -0
- package/dist/plugins/subscriptions/index.js +13 -0
- package/dist/plugins/subscriptions/index.js.map +1 -0
- package/dist/plugins/subscriptions/stores/index.d.ts +9 -0
- package/dist/plugins/subscriptions/stores/index.d.ts.map +1 -0
- package/dist/plugins/subscriptions/stores/index.js +9 -0
- package/dist/plugins/subscriptions/stores/index.js.map +1 -0
- package/dist/plugins/subscriptions/stores/postgres-store.d.ts +14 -0
- package/dist/plugins/subscriptions/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/subscriptions/stores/postgres-store.js +359 -0
- package/dist/plugins/subscriptions/stores/postgres-store.js.map +1 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.d.ts +82 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.d.ts.map +1 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.js +449 -0
- package/dist/plugins/subscriptions/subscriptions-plugin.js.map +1 -0
- package/dist/plugins/subscriptions/types.d.ts +308 -0
- package/dist/plugins/subscriptions/types.d.ts.map +1 -0
- package/dist/plugins/subscriptions/types.js +10 -0
- package/dist/plugins/subscriptions/types.js.map +1 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.d.ts +11 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.d.ts.map +1 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.js +218 -0
- package/dist/plugins/usage/__tests__/usage-plugin.test.js.map +1 -0
- package/dist/plugins/usage/index.d.ts +12 -0
- package/dist/plugins/usage/index.d.ts.map +1 -0
- package/dist/plugins/usage/index.js +13 -0
- package/dist/plugins/usage/index.js.map +1 -0
- package/dist/plugins/usage/stores/index.d.ts +9 -0
- package/dist/plugins/usage/stores/index.d.ts.map +1 -0
- package/dist/plugins/usage/stores/index.js +9 -0
- package/dist/plugins/usage/stores/index.js.map +1 -0
- package/dist/plugins/usage/stores/postgres-store.d.ts +14 -0
- package/dist/plugins/usage/stores/postgres-store.d.ts.map +1 -0
- package/dist/plugins/usage/stores/postgres-store.js +146 -0
- package/dist/plugins/usage/stores/postgres-store.js.map +1 -0
- package/dist/plugins/usage/types.d.ts +195 -0
- package/dist/plugins/usage/types.d.ts.map +1 -0
- package/dist/plugins/usage/types.js +10 -0
- package/dist/plugins/usage/types.js.map +1 -0
- package/dist/plugins/usage/usage-plugin.d.ts +51 -0
- package/dist/plugins/usage/usage-plugin.d.ts.map +1 -0
- package/dist/plugins/usage/usage-plugin.js +412 -0
- package/dist/plugins/usage/usage-plugin.js.map +1 -0
- package/dist/plugins/users/__tests__/postgres-store.test.d.ts +10 -0
- package/dist/plugins/users/__tests__/postgres-store.test.d.ts.map +1 -0
- package/dist/plugins/users/__tests__/postgres-store.test.js +229 -0
- package/dist/plugins/users/__tests__/postgres-store.test.js.map +1 -0
- package/dist/plugins/users/__tests__/users-plugin.test.js +3 -0
- package/dist/plugins/users/__tests__/users-plugin.test.js.map +1 -1
- package/dist/plugins/users/index.d.ts +2 -2
- package/dist/plugins/users/index.d.ts.map +1 -1
- package/dist/plugins/users/index.js +1 -1
- package/dist/plugins/users/index.js.map +1 -1
- package/dist/plugins/users/stores/postgres-store.d.ts.map +1 -1
- package/dist/plugins/users/stores/postgres-store.js +76 -0
- package/dist/plugins/users/stores/postgres-store.js.map +1 -1
- package/dist/plugins/users/types.d.ts +74 -6
- package/dist/plugins/users/types.d.ts.map +1 -1
- package/dist/plugins/users/users-plugin.d.ts +15 -1
- package/dist/plugins/users/users-plugin.d.ts.map +1 -1
- package/dist/plugins/users/users-plugin.js +29 -0
- package/dist/plugins/users/users-plugin.js.map +1 -1
- package/dist-ui/assets/index-CynOqPkb.js +469 -0
- package/dist-ui/assets/index-CynOqPkb.js.map +1 -0
- package/dist-ui/index.html +1 -1
- package/dist-ui-lib/api/controlPanelApi.d.ts +46 -0
- package/dist-ui-lib/components/StatCard.d.ts +16 -0
- package/dist-ui-lib/dashboard/widgets/NotificationsStatsWidget.d.ts +12 -0
- package/dist-ui-lib/dashboard/widgets/index.d.ts +1 -0
- package/dist-ui-lib/index.js +1822 -1611
- package/dist-ui-lib/index.js.map +1 -1
- package/dist-ui-lib/pages/NotificationsPage.d.ts +9 -0
- package/dist-ui-lib/utils/formatters.d.ts +19 -0
- package/package.json +3 -2
- package/src/index.ts +178 -0
- package/src/plugins/bans/bans-plugin.ts +15 -3
- package/src/plugins/devices/__tests__/devices-plugin.test.ts +551 -0
- package/src/plugins/devices/__tests__/token-utils.test.ts +264 -0
- package/src/plugins/devices/adapters/compute-adapter.ts +139 -0
- package/src/plugins/devices/adapters/index.ts +13 -0
- package/src/plugins/devices/adapters/mobile-adapter.ts +179 -0
- package/src/plugins/devices/devices-plugin.ts +538 -0
- package/src/plugins/devices/index.ts +69 -0
- package/src/plugins/devices/stores/index.ts +9 -0
- package/src/plugins/devices/stores/postgres-store.ts +304 -0
- package/src/plugins/devices/token-utils.ts +213 -0
- package/src/plugins/devices/types.ts +351 -0
- package/src/plugins/index.ts +218 -0
- package/src/plugins/notifications/__tests__/notifications-manager.test.ts +637 -0
- package/src/plugins/notifications/index.ts +91 -0
- package/src/plugins/notifications/notifications-manager.ts +773 -0
- package/src/plugins/notifications/notifications-plugin.ts +398 -0
- package/src/plugins/notifications/types.ts +207 -0
- package/src/plugins/parental/__tests__/parental-plugin.test.ts +465 -0
- package/src/plugins/parental/adapters/index.ts +8 -0
- package/src/plugins/parental/adapters/kids-adapter.ts +206 -0
- package/src/plugins/parental/index.ts +55 -0
- package/src/plugins/parental/parental-plugin.ts +759 -0
- package/src/plugins/parental/stores/index.ts +7 -0
- package/src/plugins/parental/stores/postgres-store.ts +304 -0
- package/src/plugins/parental/types.ts +180 -0
- package/src/plugins/profiles/__tests__/profiles-plugin.test.ts +321 -0
- package/src/plugins/profiles/index.ts +49 -0
- package/src/plugins/profiles/profiles-plugin.ts +546 -0
- package/src/plugins/profiles/stores/index.ts +9 -0
- package/src/plugins/profiles/stores/postgres-store.ts +439 -0
- package/src/plugins/profiles/types.ts +338 -0
- package/src/plugins/subscriptions/__tests__/subscriptions-plugin.test.ts +404 -0
- package/src/plugins/subscriptions/index.ts +51 -0
- package/src/plugins/subscriptions/stores/index.ts +9 -0
- package/src/plugins/subscriptions/stores/postgres-store.ts +482 -0
- package/src/plugins/subscriptions/subscriptions-plugin.ts +530 -0
- package/src/plugins/subscriptions/types.ts +355 -0
- package/src/plugins/usage/__tests__/usage-plugin.test.ts +288 -0
- package/src/plugins/usage/index.ts +39 -0
- package/src/plugins/usage/stores/index.ts +9 -0
- package/src/plugins/usage/stores/postgres-store.ts +213 -0
- package/src/plugins/usage/types.ts +222 -0
- package/src/plugins/usage/usage-plugin.ts +484 -0
- package/src/plugins/users/__tests__/postgres-store.test.ts +326 -0
- package/src/plugins/users/__tests__/users-plugin.test.ts +3 -0
- package/src/plugins/users/index.ts +6 -0
- package/src/plugins/users/stores/postgres-store.ts +104 -0
- package/src/plugins/users/types.ts +82 -6
- package/src/plugins/users/users-plugin.ts +37 -0
- package/ui/src/App.tsx +5 -1
- package/ui/src/api/controlPanelApi.ts +103 -6
- package/ui/src/components/StatCard.tsx +58 -0
- package/ui/src/dashboard/builtInWidgets.tsx +3 -1
- package/ui/src/dashboard/widgets/NotificationsStatsWidget.tsx +167 -0
- package/ui/src/dashboard/widgets/index.ts +1 -0
- package/ui/src/pages/NotificationsPage.tsx +417 -0
- package/ui/src/utils/formatters.ts +33 -0
- package/dist-ui/assets/index-D7DoZ9rL.js +0 -478
- package/dist-ui/assets/index-D7DoZ9rL.js.map +0 -1
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Profiles Plugin
|
|
3
|
+
*
|
|
4
|
+
* Generic multi-profile management plugin for @qwickapps/server.
|
|
5
|
+
* Supports age-based categorization and content filtering.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
// Store instance for helper access
|
|
10
|
+
let currentStore = null;
|
|
11
|
+
let currentConfig = null;
|
|
12
|
+
/**
|
|
13
|
+
* Calculate age from birth date
|
|
14
|
+
*/
|
|
15
|
+
function calculateAge(birthDate) {
|
|
16
|
+
const today = new Date();
|
|
17
|
+
const birth = new Date(birthDate);
|
|
18
|
+
let age = today.getFullYear() - birth.getFullYear();
|
|
19
|
+
const monthDiff = today.getMonth() - birth.getMonth();
|
|
20
|
+
if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
|
|
21
|
+
age--;
|
|
22
|
+
}
|
|
23
|
+
return age;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Check if current time is within allowed hours
|
|
27
|
+
*/
|
|
28
|
+
function isWithinAllowedHours(start, end) {
|
|
29
|
+
if (!start || !end) {
|
|
30
|
+
return true; // No restriction
|
|
31
|
+
}
|
|
32
|
+
const now = new Date();
|
|
33
|
+
const currentTime = now.getHours() * 60 + now.getMinutes();
|
|
34
|
+
const [startHour, startMin] = start.split(':').map(Number);
|
|
35
|
+
const [endHour, endMin] = end.split(':').map(Number);
|
|
36
|
+
const startTime = startHour * 60 + startMin;
|
|
37
|
+
const endTime = endHour * 60 + endMin;
|
|
38
|
+
if (startTime <= endTime) {
|
|
39
|
+
// Normal range (e.g., 08:00 - 20:00)
|
|
40
|
+
return currentTime >= startTime && currentTime <= endTime;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Overnight range (e.g., 20:00 - 08:00)
|
|
44
|
+
return currentTime >= startTime || currentTime <= endTime;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create the Profiles plugin
|
|
49
|
+
*/
|
|
50
|
+
export function createProfilesPlugin(config) {
|
|
51
|
+
const debug = config.debug || false;
|
|
52
|
+
const maxProfilesPerUser = config.maxProfilesPerUser || 10;
|
|
53
|
+
const defaultFilterLevel = config.defaultFilterLevel || 'moderate';
|
|
54
|
+
const apiPrefix = config.api?.prefix || '/profiles';
|
|
55
|
+
function log(message, data) {
|
|
56
|
+
if (debug) {
|
|
57
|
+
console.log(`[ProfilesPlugin] ${message}`, data || '');
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
id: 'profiles',
|
|
62
|
+
name: 'Profiles',
|
|
63
|
+
version: '1.0.0',
|
|
64
|
+
async onStart(_pluginConfig, registry) {
|
|
65
|
+
log('Starting profiles plugin');
|
|
66
|
+
// Initialize the store (creates tables if needed)
|
|
67
|
+
await config.store.initialize();
|
|
68
|
+
log('Profiles plugin migrations complete');
|
|
69
|
+
// Store references for helper access
|
|
70
|
+
currentStore = config.store;
|
|
71
|
+
currentConfig = config;
|
|
72
|
+
// Register health check
|
|
73
|
+
registry.registerHealthCheck({
|
|
74
|
+
name: 'profiles-store',
|
|
75
|
+
type: 'custom',
|
|
76
|
+
check: async () => {
|
|
77
|
+
try {
|
|
78
|
+
await config.store.search({ limit: 1 });
|
|
79
|
+
return {
|
|
80
|
+
healthy: true,
|
|
81
|
+
details: {
|
|
82
|
+
maxProfilesPerUser,
|
|
83
|
+
defaultFilterLevel,
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return { healthy: false };
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
// Add API routes if enabled
|
|
93
|
+
if (config.api?.crud !== false) {
|
|
94
|
+
// List/Search profiles
|
|
95
|
+
registry.addRoute({
|
|
96
|
+
method: 'get',
|
|
97
|
+
path: apiPrefix,
|
|
98
|
+
pluginId: 'profiles',
|
|
99
|
+
handler: async (req, res) => {
|
|
100
|
+
try {
|
|
101
|
+
const params = {
|
|
102
|
+
org_id: req.query.org_id,
|
|
103
|
+
user_id: req.query.user_id,
|
|
104
|
+
age_group: req.query.age_group,
|
|
105
|
+
is_active: req.query.is_active === 'true' ? true : req.query.is_active === 'false' ? false : undefined,
|
|
106
|
+
query: req.query.q,
|
|
107
|
+
page: parseInt(req.query.page) || 1,
|
|
108
|
+
limit: Math.min(parseInt(req.query.limit) || 20, 100),
|
|
109
|
+
sortBy: req.query.sortBy || 'created_at',
|
|
110
|
+
sortOrder: req.query.sortOrder || 'desc',
|
|
111
|
+
};
|
|
112
|
+
const result = await config.store.search(params);
|
|
113
|
+
res.json(result);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
console.error('[ProfilesPlugin] Search error:', error);
|
|
117
|
+
res.status(500).json({ error: 'Failed to search profiles' });
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
// Get profile by ID
|
|
122
|
+
registry.addRoute({
|
|
123
|
+
method: 'get',
|
|
124
|
+
path: `${apiPrefix}/:id`,
|
|
125
|
+
pluginId: 'profiles',
|
|
126
|
+
handler: async (req, res) => {
|
|
127
|
+
try {
|
|
128
|
+
const profile = await config.store.getById(req.params.id);
|
|
129
|
+
if (!profile) {
|
|
130
|
+
return res.status(404).json({ error: 'Profile not found' });
|
|
131
|
+
}
|
|
132
|
+
res.json(profile);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.error('[ProfilesPlugin] Get profile error:', error);
|
|
136
|
+
res.status(500).json({ error: 'Failed to get profile' });
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
// Create profile
|
|
141
|
+
registry.addRoute({
|
|
142
|
+
method: 'post',
|
|
143
|
+
path: apiPrefix,
|
|
144
|
+
pluginId: 'profiles',
|
|
145
|
+
handler: async (req, res) => {
|
|
146
|
+
try {
|
|
147
|
+
const input = {
|
|
148
|
+
org_id: req.body.org_id,
|
|
149
|
+
user_id: req.body.user_id,
|
|
150
|
+
name: req.body.name,
|
|
151
|
+
avatar: req.body.avatar,
|
|
152
|
+
birth_date: req.body.birth_date ? new Date(req.body.birth_date) : undefined,
|
|
153
|
+
age: req.body.age,
|
|
154
|
+
content_filter_level: req.body.content_filter_level || defaultFilterLevel,
|
|
155
|
+
daily_time_limit_minutes: req.body.daily_time_limit_minutes,
|
|
156
|
+
allowed_hours_start: req.body.allowed_hours_start,
|
|
157
|
+
allowed_hours_end: req.body.allowed_hours_end,
|
|
158
|
+
is_default: req.body.is_default,
|
|
159
|
+
metadata: req.body.metadata,
|
|
160
|
+
};
|
|
161
|
+
// Validate required fields
|
|
162
|
+
if (!input.user_id) {
|
|
163
|
+
return res.status(400).json({ error: 'user_id is required' });
|
|
164
|
+
}
|
|
165
|
+
if (!input.name || input.name.trim().length === 0) {
|
|
166
|
+
return res.status(400).json({ error: 'name is required' });
|
|
167
|
+
}
|
|
168
|
+
// Check profile limit
|
|
169
|
+
const currentCount = await config.store.getProfileCount(input.user_id);
|
|
170
|
+
if (currentCount >= maxProfilesPerUser) {
|
|
171
|
+
return res.status(400).json({
|
|
172
|
+
error: `Maximum profiles (${maxProfilesPerUser}) reached for this user`,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const profile = await config.store.create(input);
|
|
176
|
+
res.status(201).json(profile);
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
console.error('[ProfilesPlugin] Create profile error:', error);
|
|
180
|
+
res.status(500).json({ error: 'Failed to create profile' });
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
// Update profile
|
|
185
|
+
registry.addRoute({
|
|
186
|
+
method: 'put',
|
|
187
|
+
path: `${apiPrefix}/:id`,
|
|
188
|
+
pluginId: 'profiles',
|
|
189
|
+
handler: async (req, res) => {
|
|
190
|
+
try {
|
|
191
|
+
const input = {
|
|
192
|
+
name: req.body.name,
|
|
193
|
+
avatar: req.body.avatar,
|
|
194
|
+
birth_date: req.body.birth_date !== undefined
|
|
195
|
+
? (req.body.birth_date ? new Date(req.body.birth_date) : null)
|
|
196
|
+
: undefined,
|
|
197
|
+
age: req.body.age,
|
|
198
|
+
content_filter_level: req.body.content_filter_level,
|
|
199
|
+
daily_time_limit_minutes: req.body.daily_time_limit_minutes,
|
|
200
|
+
allowed_hours_start: req.body.allowed_hours_start,
|
|
201
|
+
allowed_hours_end: req.body.allowed_hours_end,
|
|
202
|
+
is_active: req.body.is_active,
|
|
203
|
+
is_default: req.body.is_default,
|
|
204
|
+
metadata: req.body.metadata,
|
|
205
|
+
};
|
|
206
|
+
const profile = await config.store.update(req.params.id, input);
|
|
207
|
+
if (!profile) {
|
|
208
|
+
return res.status(404).json({ error: 'Profile not found' });
|
|
209
|
+
}
|
|
210
|
+
res.json(profile);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
console.error('[ProfilesPlugin] Update profile error:', error);
|
|
214
|
+
res.status(500).json({ error: 'Failed to update profile' });
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
// Delete profile
|
|
219
|
+
registry.addRoute({
|
|
220
|
+
method: 'delete',
|
|
221
|
+
path: `${apiPrefix}/:id`,
|
|
222
|
+
pluginId: 'profiles',
|
|
223
|
+
handler: async (req, res) => {
|
|
224
|
+
try {
|
|
225
|
+
const deleted = await config.store.delete(req.params.id);
|
|
226
|
+
if (!deleted) {
|
|
227
|
+
return res.status(404).json({ error: 'Profile not found' });
|
|
228
|
+
}
|
|
229
|
+
res.status(204).send();
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
console.error('[ProfilesPlugin] Delete profile error:', error);
|
|
233
|
+
res.status(500).json({ error: 'Failed to delete profile' });
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
// List profiles for a user
|
|
238
|
+
registry.addRoute({
|
|
239
|
+
method: 'get',
|
|
240
|
+
path: `${apiPrefix}/user/:userId`,
|
|
241
|
+
pluginId: 'profiles',
|
|
242
|
+
handler: async (req, res) => {
|
|
243
|
+
try {
|
|
244
|
+
const profiles = await config.store.listByUser(req.params.userId);
|
|
245
|
+
res.json({ profiles });
|
|
246
|
+
}
|
|
247
|
+
catch (error) {
|
|
248
|
+
console.error('[ProfilesPlugin] List user profiles error:', error);
|
|
249
|
+
res.status(500).json({ error: 'Failed to list profiles' });
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
});
|
|
253
|
+
// Get default profile for a user
|
|
254
|
+
registry.addRoute({
|
|
255
|
+
method: 'get',
|
|
256
|
+
path: `${apiPrefix}/user/:userId/default`,
|
|
257
|
+
pluginId: 'profiles',
|
|
258
|
+
handler: async (req, res) => {
|
|
259
|
+
try {
|
|
260
|
+
const profile = await config.store.getDefaultProfile(req.params.userId);
|
|
261
|
+
if (!profile) {
|
|
262
|
+
return res.status(404).json({ error: 'No default profile found' });
|
|
263
|
+
}
|
|
264
|
+
res.json(profile);
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
console.error('[ProfilesPlugin] Get default profile error:', error);
|
|
268
|
+
res.status(500).json({ error: 'Failed to get default profile' });
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
// Set default profile
|
|
273
|
+
registry.addRoute({
|
|
274
|
+
method: 'post',
|
|
275
|
+
path: `${apiPrefix}/:id/set-default`,
|
|
276
|
+
pluginId: 'profiles',
|
|
277
|
+
handler: async (req, res) => {
|
|
278
|
+
try {
|
|
279
|
+
const profile = await config.store.getById(req.params.id);
|
|
280
|
+
if (!profile) {
|
|
281
|
+
return res.status(404).json({ error: 'Profile not found' });
|
|
282
|
+
}
|
|
283
|
+
const success = await config.store.setDefaultProfile(req.params.id, profile.user_id);
|
|
284
|
+
if (!success) {
|
|
285
|
+
return res.status(500).json({ error: 'Failed to set default profile' });
|
|
286
|
+
}
|
|
287
|
+
const updated = await config.store.getById(req.params.id);
|
|
288
|
+
res.json(updated);
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
console.error('[ProfilesPlugin] Set default profile error:', error);
|
|
292
|
+
res.status(500).json({ error: 'Failed to set default profile' });
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
});
|
|
296
|
+
// Check time restrictions
|
|
297
|
+
registry.addRoute({
|
|
298
|
+
method: 'get',
|
|
299
|
+
path: `${apiPrefix}/:id/time-check`,
|
|
300
|
+
pluginId: 'profiles',
|
|
301
|
+
handler: async (req, res) => {
|
|
302
|
+
try {
|
|
303
|
+
const profile = await config.store.getById(req.params.id);
|
|
304
|
+
if (!profile) {
|
|
305
|
+
return res.status(404).json({ error: 'Profile not found' });
|
|
306
|
+
}
|
|
307
|
+
const result = checkTimeRestrictions(profile);
|
|
308
|
+
res.json(result);
|
|
309
|
+
}
|
|
310
|
+
catch (error) {
|
|
311
|
+
console.error('[ProfilesPlugin] Time check error:', error);
|
|
312
|
+
res.status(500).json({ error: 'Failed to check time restrictions' });
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
log('Profiles plugin started');
|
|
318
|
+
},
|
|
319
|
+
async onStop() {
|
|
320
|
+
log('Stopping profiles plugin');
|
|
321
|
+
await config.store.shutdown();
|
|
322
|
+
currentStore = null;
|
|
323
|
+
currentConfig = null;
|
|
324
|
+
log('Profiles plugin stopped');
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
329
|
+
// Helper Functions
|
|
330
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
331
|
+
/**
|
|
332
|
+
* Get the current profile store instance
|
|
333
|
+
*/
|
|
334
|
+
export function getProfileStore() {
|
|
335
|
+
return currentStore;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Create a new profile
|
|
339
|
+
*/
|
|
340
|
+
export async function createProfile(input) {
|
|
341
|
+
if (!currentStore || !currentConfig) {
|
|
342
|
+
throw new Error('Profiles plugin not initialized');
|
|
343
|
+
}
|
|
344
|
+
// Check profile limit
|
|
345
|
+
const currentCount = await currentStore.getProfileCount(input.user_id);
|
|
346
|
+
const maxProfiles = currentConfig.maxProfilesPerUser || 10;
|
|
347
|
+
if (currentCount >= maxProfiles) {
|
|
348
|
+
throw new Error(`Maximum profiles (${maxProfiles}) reached for this user`);
|
|
349
|
+
}
|
|
350
|
+
// Apply default filter level
|
|
351
|
+
if (!input.content_filter_level) {
|
|
352
|
+
input.content_filter_level = currentConfig.defaultFilterLevel || 'moderate';
|
|
353
|
+
}
|
|
354
|
+
return currentStore.create(input);
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Get a profile by ID
|
|
358
|
+
*/
|
|
359
|
+
export async function getProfileById(id) {
|
|
360
|
+
if (!currentStore) {
|
|
361
|
+
throw new Error('Profiles plugin not initialized');
|
|
362
|
+
}
|
|
363
|
+
return currentStore.getById(id);
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Update a profile
|
|
367
|
+
*/
|
|
368
|
+
export async function updateProfile(id, input) {
|
|
369
|
+
if (!currentStore) {
|
|
370
|
+
throw new Error('Profiles plugin not initialized');
|
|
371
|
+
}
|
|
372
|
+
return currentStore.update(id, input);
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Delete a profile
|
|
376
|
+
*/
|
|
377
|
+
export async function deleteProfile(id) {
|
|
378
|
+
if (!currentStore) {
|
|
379
|
+
throw new Error('Profiles plugin not initialized');
|
|
380
|
+
}
|
|
381
|
+
return currentStore.delete(id);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* List profiles for a user
|
|
385
|
+
*/
|
|
386
|
+
export async function listUserProfiles(userId) {
|
|
387
|
+
if (!currentStore) {
|
|
388
|
+
throw new Error('Profiles plugin not initialized');
|
|
389
|
+
}
|
|
390
|
+
return currentStore.listByUser(userId);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Get the default profile for a user
|
|
394
|
+
*/
|
|
395
|
+
export async function getDefaultProfile(userId) {
|
|
396
|
+
if (!currentStore) {
|
|
397
|
+
throw new Error('Profiles plugin not initialized');
|
|
398
|
+
}
|
|
399
|
+
return currentStore.getDefaultProfile(userId);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Set a profile as the default
|
|
403
|
+
*/
|
|
404
|
+
export async function setDefaultProfile(profileId, userId) {
|
|
405
|
+
if (!currentStore) {
|
|
406
|
+
throw new Error('Profiles plugin not initialized');
|
|
407
|
+
}
|
|
408
|
+
return currentStore.setDefaultProfile(profileId, userId);
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Get profiles by age group
|
|
412
|
+
*/
|
|
413
|
+
export async function getProfilesByAgeGroup(userId, ageGroup) {
|
|
414
|
+
if (!currentStore) {
|
|
415
|
+
throw new Error('Profiles plugin not initialized');
|
|
416
|
+
}
|
|
417
|
+
return currentStore.getByAgeGroup(userId, ageGroup);
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Get child profiles (age_group = 'child')
|
|
421
|
+
*/
|
|
422
|
+
export async function getChildProfiles(userId) {
|
|
423
|
+
return getProfilesByAgeGroup(userId, 'child');
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Get the current age for a profile
|
|
427
|
+
*/
|
|
428
|
+
export function getProfileAge(profile) {
|
|
429
|
+
if (profile.birth_date) {
|
|
430
|
+
return calculateAge(profile.birth_date);
|
|
431
|
+
}
|
|
432
|
+
return profile.age || null;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Check time restrictions for a profile
|
|
436
|
+
*/
|
|
437
|
+
export function checkTimeRestrictions(profile) {
|
|
438
|
+
// Check allowed hours
|
|
439
|
+
const withinHours = isWithinAllowedHours(profile.allowed_hours_start, profile.allowed_hours_end);
|
|
440
|
+
if (!withinHours) {
|
|
441
|
+
// Calculate when access will be available
|
|
442
|
+
const now = new Date();
|
|
443
|
+
let availableAt;
|
|
444
|
+
if (profile.allowed_hours_start) {
|
|
445
|
+
const [hour, min] = profile.allowed_hours_start.split(':').map(Number);
|
|
446
|
+
availableAt = new Date(now);
|
|
447
|
+
availableAt.setHours(hour, min, 0, 0);
|
|
448
|
+
if (availableAt <= now) {
|
|
449
|
+
availableAt.setDate(availableAt.getDate() + 1);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return {
|
|
453
|
+
allowed: false,
|
|
454
|
+
reason: 'Outside allowed hours',
|
|
455
|
+
available_at: availableAt,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
// Note: Daily time limit tracking requires usage plugin integration
|
|
459
|
+
// For now, just return allowed if within hours
|
|
460
|
+
return {
|
|
461
|
+
allowed: true,
|
|
462
|
+
minutes_remaining: profile.daily_time_limit_minutes || undefined,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* Get content filter level for a profile
|
|
467
|
+
*/
|
|
468
|
+
export function getContentFilterLevel(profile) {
|
|
469
|
+
return profile.content_filter_level;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Check if profile can access content based on filter level
|
|
473
|
+
*/
|
|
474
|
+
export function canAccessContent(profile, requiredLevel) {
|
|
475
|
+
const levels = ['strict', 'moderate', 'minimal', 'none'];
|
|
476
|
+
const profileLevelIndex = levels.indexOf(profile.content_filter_level);
|
|
477
|
+
const requiredLevelIndex = levels.indexOf(requiredLevel);
|
|
478
|
+
// Profile level must be >= required level (stricter or equal)
|
|
479
|
+
return profileLevelIndex <= requiredLevelIndex;
|
|
480
|
+
}
|
|
481
|
+
//# sourceMappingURL=profiles-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles-plugin.js","sourceRoot":"","sources":["../../../src/plugins/profiles/profiles-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,mCAAmC;AACnC,IAAI,YAAY,GAAwB,IAAI,CAAC;AAC7C,IAAI,aAAa,GAAgC,IAAI,CAAC;AAEtD;;GAEG;AACH,SAAS,YAAY,CAAC,SAAe;IACnC,MAAM,KAAK,GAAG,IAAI,IAAI,EAAE,CAAC;IACzB,MAAM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BAAgB,CAC9B,OAAgB,EAChB,aAAiC;IAEjC,MAAM,MAAM,GAAyB,CAAC,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC/E,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACvE,MAAM,kBAAkB,GAAG,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAEzD,8DAA8D;IAC9D,OAAO,iBAAiB,IAAI,kBAAkB,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugins/profiles/stores/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugins/profiles/stores/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostgreSQL Profile Store
|
|
3
|
+
*
|
|
4
|
+
* Profile storage implementation using PostgreSQL.
|
|
5
|
+
* Includes automatic age group calculation.
|
|
6
|
+
*
|
|
7
|
+
* Copyright (c) 2025 QwickApps.com. All rights reserved.
|
|
8
|
+
*/
|
|
9
|
+
import type { ProfileStore, PostgresProfileStoreConfig, AgeThresholds } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Create a PostgreSQL profile store
|
|
12
|
+
*
|
|
13
|
+
* @param config Configuration including a pg Pool instance
|
|
14
|
+
* @param ageThresholds Optional age thresholds for categorization
|
|
15
|
+
* @returns ProfileStore implementation
|
|
16
|
+
*/
|
|
17
|
+
export declare function postgresProfileStore(config: PostgresProfileStoreConfig, ageThresholds?: AgeThresholds): ProfileStore;
|
|
18
|
+
//# sourceMappingURL=postgres-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres-store.d.ts","sourceRoot":"","sources":["../../../../src/plugins/profiles/stores/postgres-store.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,YAAY,EAMZ,0BAA0B,EAE1B,aAAa,EACd,MAAM,aAAa,CAAC;AAgDrB;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,EAClC,aAAa,GAAE,aAAsC,GACpD,YAAY,CAyWd"}
|