underpost 2.8.0 → 2.8.6
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/.dockerignore +1 -0
- package/.github/workflows/ghpkg.yml +19 -49
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/publish.yml +5 -5
- package/.github/workflows/pwa-microservices-template.page.yml +12 -4
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/.vscode/extensions.json +17 -71
- package/.vscode/settings.json +20 -4
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +103 -3
- package/Dockerfile +24 -66
- package/README.md +1 -28
- package/bin/build.js +186 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +168 -157
- package/bin/file.js +59 -16
- package/bin/hwt.js +0 -10
- package/bin/index.js +201 -61
- package/bin/ssl.js +19 -11
- package/bin/util.js +24 -101
- package/bin/vs.js +26 -2
- package/conf.js +30 -132
- package/docker-compose.yml +1 -1
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +55 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +125 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +17 -0
- package/manifests/valkey/statefulset.yaml +39 -0
- package/package.json +133 -134
- package/src/api/core/core.service.js +1 -1
- package/src/api/user/user.model.js +16 -3
- package/src/api/user/user.service.js +1 -1
- package/src/cli/cluster.js +202 -0
- package/src/cli/cron.js +90 -0
- package/src/cli/db.js +212 -0
- package/src/cli/deploy.js +318 -0
- package/src/cli/env.js +52 -0
- package/src/cli/fs.js +149 -0
- package/src/cli/image.js +148 -0
- package/src/cli/repository.js +125 -0
- package/src/cli/script.js +53 -0
- package/src/cli/secrets.js +37 -0
- package/src/cli/test.js +118 -0
- package/src/client/components/core/Account.js +4 -2
- package/src/client/components/core/Auth.js +24 -6
- package/src/client/components/core/CalendarCore.js +127 -50
- package/src/client/components/core/CommonJs.js +282 -19
- package/src/client/components/core/Css.js +2 -1
- package/src/client/components/core/CssCore.js +8 -4
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +22 -6
- package/src/client/components/core/JoyStick.js +8 -5
- package/src/client/components/core/LoadingAnimation.js +8 -1
- package/src/client/components/core/Modal.js +47 -18
- package/src/client/components/core/Panel.js +93 -31
- package/src/client/components/core/PanelForm.js +27 -19
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/SignUp.js +4 -1
- package/src/client/components/core/Translate.js +61 -9
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/services/core/core.service.js +15 -8
- package/src/client/services/default/default.management.js +4 -2
- package/src/client/ssr/Render.js +4 -1
- package/src/client/ssr/body/CacheControl.js +2 -2
- package/src/client/ssr/body/DefaultSplashScreen.js +3 -3
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/sw/default.sw.js +26 -6
- package/src/db/mongo/MongooseDB.js +29 -1
- package/src/index.js +91 -17
- package/src/runtime/lampp/Lampp.js +1 -13
- package/src/runtime/xampp/Xampp.js +0 -13
- package/src/server/auth.js +3 -3
- package/src/server/backup.js +49 -93
- package/src/server/client-build.js +41 -50
- package/src/server/client-formatted.js +6 -3
- package/src/server/client-icons.js +1 -1
- package/src/server/conf.js +207 -57
- package/src/server/dns.js +30 -55
- package/src/server/downloader.js +0 -8
- package/src/server/logger.js +22 -15
- package/src/server/network.js +17 -43
- package/src/server/process.js +25 -2
- package/src/server/proxy.js +4 -26
- package/src/server/runtime.js +30 -30
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +3 -0
- package/test/api.test.js +0 -8
- package/src/dns.js +0 -22
- package/src/server/prompt-optimizer.js +0 -28
- package/startup.js +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventSchedulerService } from '../../services/event-scheduler/event-scheduler.service.js';
|
|
2
2
|
import { Auth } from './Auth.js';
|
|
3
3
|
import { BtnIcon } from './BtnIcon.js';
|
|
4
|
-
import { newInstance, range, s4 } from './CommonJs.js';
|
|
4
|
+
import { isValidDate, newInstance, range, s4 } from './CommonJs.js';
|
|
5
5
|
import { renderCssAttr } from './Css.js';
|
|
6
6
|
import { Modal } from './Modal.js';
|
|
7
7
|
import { NotificationManager } from './NotificationManager.js';
|
|
@@ -13,15 +13,27 @@ import { append, getQueryParams, getTimeZone, htmls, s, sa } from './VanillaJs.j
|
|
|
13
13
|
|
|
14
14
|
// https://fullcalendar.io/docs/event-object
|
|
15
15
|
|
|
16
|
+
const daysOfWeekOptions = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
|
17
|
+
|
|
18
|
+
const eventDateFactory = (event) =>
|
|
19
|
+
newInstance({
|
|
20
|
+
event: { ...event.extendedProps, title: event._def.title },
|
|
21
|
+
start: event.start,
|
|
22
|
+
end: event.end,
|
|
23
|
+
});
|
|
24
|
+
|
|
16
25
|
const CalendarCore = {
|
|
17
26
|
RenderStyle: async function () {},
|
|
18
27
|
Data: {},
|
|
19
|
-
Render: async function (
|
|
28
|
+
Render: async function (
|
|
29
|
+
options = { idModal: '', Elements: {}, heightTopBar: 50, heightBottomBar: 50, hiddenDates: [] },
|
|
30
|
+
) {
|
|
20
31
|
this.Data[options.idModal] = {
|
|
21
32
|
data: [],
|
|
22
33
|
originData: [],
|
|
23
34
|
filesData: [],
|
|
24
35
|
calendar: {},
|
|
36
|
+
hiddenDates: options.hiddenDates ? options.hiddenDates : [],
|
|
25
37
|
};
|
|
26
38
|
|
|
27
39
|
const { heightTopBar, heightBottomBar } = options;
|
|
@@ -40,56 +52,89 @@ const CalendarCore = {
|
|
|
40
52
|
};
|
|
41
53
|
getSrrData();
|
|
42
54
|
|
|
43
|
-
const dateFormat = (date) =>
|
|
44
|
-
html`<span
|
|
45
|
-
style="${renderCssAttr({
|
|
46
|
-
style: {
|
|
47
|
-
'font-size': '14px',
|
|
48
|
-
color: '#888',
|
|
49
|
-
},
|
|
50
|
-
})}"
|
|
51
|
-
>${new Date(date).toLocaleString().replaceAll(',', '')}</span
|
|
52
|
-
>`;
|
|
53
|
-
|
|
54
55
|
const getPanelData = async () => {
|
|
55
56
|
const result = await EventSchedulerService.get({
|
|
56
|
-
id: `${getQueryParams().cid ? getQueryParams().cid : 'creatorUser'}`,
|
|
57
|
+
id: `${getQueryParams().cid ? getQueryParams().cid : Auth.getToken() ? 'creatorUser' : ''}`,
|
|
57
58
|
});
|
|
58
59
|
NotificationManager.Push({
|
|
59
60
|
html: result.status === 'success' ? Translate.Render('success-get-events-scheduler') : result.message,
|
|
60
61
|
status: result.status,
|
|
61
62
|
});
|
|
62
63
|
if (result.status === 'success') {
|
|
63
|
-
const resultData = Array.isArray(result.data) ? result.data : [result.data];
|
|
64
|
+
const resultData = Array.isArray(result.data) ? result.data : result.data ? [result.data] : [];
|
|
64
65
|
this.Data[options.idModal].filesData = [];
|
|
65
66
|
this.Data[options.idModal].originData = newInstance(resultData);
|
|
66
67
|
this.Data[options.idModal].data = resultData.map((o) => {
|
|
67
68
|
if (o.creatorUserId && options.Elements.Data.user.main.model.user._id === o.creatorUserId) o.tools = true;
|
|
68
69
|
o.id = o._id;
|
|
69
|
-
|
|
70
|
-
o.end = dateFormat(o.end);
|
|
70
|
+
|
|
71
71
|
this.Data[options.idModal].filesData.push({});
|
|
72
72
|
return o;
|
|
73
73
|
});
|
|
74
|
+
setTimeout(() => {
|
|
75
|
+
renderCalendar(
|
|
76
|
+
resultData.map((o) => {
|
|
77
|
+
// FREQ=WEEKLY;
|
|
78
|
+
// if (o.daysOfWeek && o.daysOfWeek.length > 0) {
|
|
79
|
+
// o.rrule = `RRULE:BYDAY=${o.daysOfWeek.map((d) => `${d[0]}${d[1]}`.toUpperCase()).join(',')}`;
|
|
80
|
+
// }
|
|
81
|
+
// o.rrule = 'FREQ=WEEKLY;BYDAY=SU;BYHOUR=10,11;COUNT=10';
|
|
82
|
+
if (o.daysOfWeek && o.daysOfWeek.length > 0)
|
|
83
|
+
o.daysOfWeek = o.daysOfWeek.map((v, i) => daysOfWeekOptions.indexOf(v));
|
|
84
|
+
else delete o.daysOfWeek;
|
|
85
|
+
// o.exdate = ['2024-04-02'];
|
|
86
|
+
// delete o.end;
|
|
87
|
+
// delete o.start;
|
|
88
|
+
|
|
89
|
+
return o;
|
|
90
|
+
}),
|
|
91
|
+
);
|
|
92
|
+
});
|
|
74
93
|
}
|
|
75
94
|
};
|
|
76
95
|
|
|
77
|
-
const renderCalendar = () => {
|
|
96
|
+
const renderCalendar = (events) => {
|
|
78
97
|
const calendarEl = s(`.calendar-${idPanel}`);
|
|
79
98
|
this.Data[options.idModal].calendar = new FullCalendar.Calendar(calendarEl, {
|
|
80
|
-
|
|
99
|
+
allDaySlot: false,
|
|
100
|
+
plugins: [
|
|
101
|
+
FullCalendar.DayGrid.default,
|
|
102
|
+
FullCalendar.TimeGrid.default,
|
|
103
|
+
FullCalendar.List.default,
|
|
104
|
+
// https://fullcalendar.io/docs/rrule-plugin
|
|
105
|
+
FullCalendar.RRule.default,
|
|
106
|
+
],
|
|
81
107
|
// initialView: 'dayGridWeek',
|
|
82
108
|
timeZone: getTimeZone(),
|
|
83
109
|
dateClick: function (arg) {
|
|
84
110
|
console.error('calendar dateClick', arg.date.toString());
|
|
85
111
|
},
|
|
86
|
-
events: [{ title: 'Meeting', start: new Date() }],
|
|
112
|
+
events: events ?? [{ title: 'Meeting', start: new Date() }],
|
|
87
113
|
initialView: 'dayGridMonth',
|
|
88
114
|
headerToolbar: {
|
|
89
115
|
left: 'prev,next today',
|
|
90
116
|
center: 'title',
|
|
91
117
|
right: 'dayGridMonth,timeGridWeek,listWeek',
|
|
92
118
|
},
|
|
119
|
+
eventClick: async function (args) {
|
|
120
|
+
const dateData = eventDateFactory(args.event);
|
|
121
|
+
// element -> args.el
|
|
122
|
+
// remove all events associated -> args.event.remove();
|
|
123
|
+
// console.error('eventClick', JSON.stringify(dateData, null, 4));
|
|
124
|
+
if (options.eventClick) await options.eventClick(dateData, args);
|
|
125
|
+
},
|
|
126
|
+
eventClassNames: function (args) {
|
|
127
|
+
// console.error('eventClassNames', JSON.stringify(dateData, null, 4));
|
|
128
|
+
if (!args.event.extendedProps._id) return args.event.remove();
|
|
129
|
+
const dateData = eventDateFactory(args.event);
|
|
130
|
+
if (
|
|
131
|
+
new Date(dateData.start).getTime() <= new Date().getTime() ||
|
|
132
|
+
CalendarCore.Data[options.idModal].hiddenDates.find(
|
|
133
|
+
(d) => d.eventSchedulerId === dateData.event._id && d.date === dateData.start,
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
return ['hide'];
|
|
137
|
+
},
|
|
93
138
|
});
|
|
94
139
|
|
|
95
140
|
this.Data[options.idModal].calendar.render();
|
|
@@ -139,29 +184,52 @@ const CalendarCore = {
|
|
|
139
184
|
rules: [{ type: 'isEmpty' }],
|
|
140
185
|
},
|
|
141
186
|
{
|
|
142
|
-
id: '
|
|
143
|
-
model: '
|
|
187
|
+
id: 'title',
|
|
188
|
+
model: 'title',
|
|
144
189
|
inputType: 'text',
|
|
145
190
|
rules: [{ type: 'isEmpty' }],
|
|
146
191
|
panel: { type: 'title' },
|
|
147
192
|
},
|
|
148
193
|
{
|
|
149
|
-
id: '
|
|
150
|
-
model: '
|
|
151
|
-
inputType: '
|
|
152
|
-
rules: [],
|
|
153
|
-
panel: { type: 'info-row'
|
|
194
|
+
id: 'description',
|
|
195
|
+
model: 'description',
|
|
196
|
+
inputType: 'text',
|
|
197
|
+
rules: [{ type: 'isEmpty' }],
|
|
198
|
+
panel: { type: 'info-row' },
|
|
154
199
|
},
|
|
155
200
|
{
|
|
156
201
|
id: 'start',
|
|
157
202
|
model: 'start',
|
|
158
203
|
inputType: 'datetime-local',
|
|
159
|
-
|
|
204
|
+
translateCode: 'startTime',
|
|
205
|
+
panel: { type: 'info-row' },
|
|
160
206
|
},
|
|
161
207
|
{
|
|
162
208
|
id: 'end',
|
|
163
209
|
model: 'end',
|
|
164
210
|
inputType: 'datetime-local',
|
|
211
|
+
translateCode: 'endTime',
|
|
212
|
+
panel: { type: 'info-row' },
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
id: 'daysOfWeek',
|
|
216
|
+
model: 'daysOfWeek',
|
|
217
|
+
inputType: 'dropdown-checkbox',
|
|
218
|
+
dropdown: {
|
|
219
|
+
options: daysOfWeekOptions,
|
|
220
|
+
},
|
|
221
|
+
panel: { type: 'list' },
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
id: 'startTime',
|
|
225
|
+
model: 'startTime',
|
|
226
|
+
inputType: 'time',
|
|
227
|
+
panel: { type: 'info-row' },
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
id: 'endTime',
|
|
231
|
+
model: 'endTime',
|
|
232
|
+
inputType: 'time',
|
|
165
233
|
panel: { type: 'info-row' },
|
|
166
234
|
},
|
|
167
235
|
];
|
|
@@ -209,14 +277,14 @@ const CalendarCore = {
|
|
|
209
277
|
data: this.Data[options.idModal].data,
|
|
210
278
|
formContainerClass: '',
|
|
211
279
|
scrollClassContainer: `main-body-calendar-${options.idModal}`,
|
|
280
|
+
role: options.role,
|
|
212
281
|
originData: () => this.Data[options.idModal].originData,
|
|
213
282
|
filesData: () => this.Data[options.idModal].filesData,
|
|
214
283
|
onClick: async function ({ payload }) {
|
|
215
284
|
if (options.route) {
|
|
216
285
|
setQueryPath({ path: options.route, queryPath: payload._id });
|
|
217
286
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
218
|
-
|
|
219
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
287
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
220
288
|
}
|
|
221
289
|
},
|
|
222
290
|
titleIcon,
|
|
@@ -250,12 +318,19 @@ const CalendarCore = {
|
|
|
250
318
|
],
|
|
251
319
|
on: {
|
|
252
320
|
add: async function ({ data, editId }) {
|
|
321
|
+
if (data.daysOfWeek && data.daysOfWeek.length > 0 && daysOfWeekOptions[data.daysOfWeek[0]]) {
|
|
322
|
+
data.daysOfWeek = data.daysOfWeek.map((d) => daysOfWeekOptions[d]);
|
|
323
|
+
}
|
|
324
|
+
data.timeZoneClient = getTimeZone();
|
|
253
325
|
const {
|
|
254
326
|
status,
|
|
255
327
|
message,
|
|
256
328
|
data: documentData,
|
|
257
329
|
} = editId
|
|
258
|
-
? await EventSchedulerService.put({
|
|
330
|
+
? await EventSchedulerService.put({
|
|
331
|
+
id: editId,
|
|
332
|
+
body: { ...data, _id: undefined },
|
|
333
|
+
})
|
|
259
334
|
: await EventSchedulerService.post({ body: data });
|
|
260
335
|
NotificationManager.Push({
|
|
261
336
|
html:
|
|
@@ -268,10 +343,9 @@ const CalendarCore = {
|
|
|
268
343
|
});
|
|
269
344
|
|
|
270
345
|
if (status === 'success') {
|
|
271
|
-
|
|
272
|
-
data.
|
|
273
|
-
data
|
|
274
|
-
data._id = documentData._id;
|
|
346
|
+
documentData.tools = true;
|
|
347
|
+
// data._id = documentData._id;
|
|
348
|
+
data = documentData;
|
|
275
349
|
|
|
276
350
|
let originObj, indexOriginObj;
|
|
277
351
|
let filesData = {};
|
|
@@ -291,8 +365,7 @@ const CalendarCore = {
|
|
|
291
365
|
|
|
292
366
|
setQueryPath({ path: options.route, queryPath: documentData._id });
|
|
293
367
|
if (options.parentIdModal) Modal.Data[options.parentIdModal].query = `${window.location.search}`;
|
|
294
|
-
|
|
295
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
368
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
296
369
|
}
|
|
297
370
|
return { data, status, message };
|
|
298
371
|
},
|
|
@@ -319,11 +392,8 @@ const CalendarCore = {
|
|
|
319
392
|
status,
|
|
320
393
|
});
|
|
321
394
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
if (CalendarCore.Data[options.idModal].updatePanel)
|
|
325
|
-
await CalendarCore.Data[options.idModal].updatePanel();
|
|
326
|
-
}
|
|
395
|
+
setQueryPath({ path: options.route, queryPath: '' });
|
|
396
|
+
await CalendarCore.Data[options.idModal].updatePanel();
|
|
327
397
|
|
|
328
398
|
return { status };
|
|
329
399
|
}
|
|
@@ -334,17 +404,21 @@ const CalendarCore = {
|
|
|
334
404
|
<div class="in" style="margin-bottom: 100px"></div>`;
|
|
335
405
|
};
|
|
336
406
|
|
|
337
|
-
let
|
|
338
|
-
let lasUserId;
|
|
407
|
+
let delayBlock = false;
|
|
339
408
|
this.Data[options.idModal].updatePanel = async () => {
|
|
409
|
+
if (delayBlock) return;
|
|
410
|
+
else {
|
|
411
|
+
delayBlock = true;
|
|
412
|
+
setTimeout(() => {
|
|
413
|
+
delayBlock = false;
|
|
414
|
+
}, 500);
|
|
415
|
+
}
|
|
340
416
|
const cid = getQueryParams().cid ? getQueryParams().cid : '';
|
|
341
|
-
if (lastCid === cid && lasUserId === options.Elements.Data.user.main.model.user._id) return;
|
|
342
417
|
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
343
|
-
lasUserId = newInstance(options.Elements.Data.user.main.model.user._id);
|
|
344
|
-
lastCid = cid;
|
|
345
418
|
if (s(`.main-body-calendar-${options.idModal}`)) {
|
|
346
|
-
if (Auth.getToken())
|
|
347
|
-
else getSrrData();
|
|
419
|
+
// if (Auth.getToken())
|
|
420
|
+
// else getSrrData();
|
|
421
|
+
await getPanelData();
|
|
348
422
|
htmls(`.main-body-calendar-${options.idModal}`, await panelRender());
|
|
349
423
|
}
|
|
350
424
|
};
|
|
@@ -360,7 +434,10 @@ const CalendarCore = {
|
|
|
360
434
|
},
|
|
361
435
|
});
|
|
362
436
|
|
|
363
|
-
if (options.route === 'home')
|
|
437
|
+
// if (options.route === 'home')
|
|
438
|
+
setTimeout(() => {
|
|
439
|
+
CalendarCore.Data[options.idModal].updatePanel();
|
|
440
|
+
});
|
|
364
441
|
|
|
365
442
|
return html`
|
|
366
443
|
<style>
|
|
@@ -518,25 +518,25 @@ function getDirname(path) {
|
|
|
518
518
|
return parts.join('/'); // Adjust separator if needed for Windows ('\')
|
|
519
519
|
}
|
|
520
520
|
|
|
521
|
-
const isDayValid = (day) => {
|
|
522
|
-
const date = new Date();
|
|
523
|
-
date.setDate(day);
|
|
524
|
-
return date.getDate() === day;
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
const isMonthValid = (month) => {
|
|
528
|
-
const date = new Date();
|
|
529
|
-
date.setMonth(month - 1);
|
|
530
|
-
return date.getMonth() === month - 1;
|
|
531
|
-
};
|
|
532
|
-
|
|
533
521
|
const isValidDate = (day, month, year) => {
|
|
534
|
-
if (!
|
|
535
|
-
|
|
536
|
-
|
|
522
|
+
if (!month && !year) return !(new Date(day) == 'Invalid Date');
|
|
523
|
+
// new Date('2025-12-28')
|
|
524
|
+
// Sat Dec 27 2025 19:00:00 GMT-0500 (Eastern Standard Time)
|
|
525
|
+
// new Date('2025/12/28')
|
|
526
|
+
// Sun Dec 28 2025 00:00:00 GMT-0500 (Eastern Standard Time)
|
|
527
|
+
return !(new Date(`${year}/${month}/${day}`) == 'Invalid Date');
|
|
528
|
+
};
|
|
537
529
|
|
|
538
|
-
|
|
539
|
-
|
|
530
|
+
// console.log(req.body.timeZoneClient, Intl.DateTimeFormat().resolvedOptions().timeZone);
|
|
531
|
+
// DateTime.fromISO("2017-05-15T09:10:23", { zone: "Europe/Paris" });
|
|
532
|
+
const strToDateUTC = (date = '2025-01-30T14:32') => {
|
|
533
|
+
const year = parseInt(date.split('-')[0]);
|
|
534
|
+
const month = parseInt(date.split('-')[1]);
|
|
535
|
+
const day = parseInt(date.split('-')[2].split('T')[0]);
|
|
536
|
+
const hour = parseInt(date.split('T')[1].split(':')[0]);
|
|
537
|
+
const minute = parseInt(date.split('T')[1].split(':')[1]);
|
|
538
|
+
date = new Date(Date.UTC(year, month - 1, day, hour, minute, 0, 0));
|
|
539
|
+
return date;
|
|
540
540
|
};
|
|
541
541
|
|
|
542
542
|
const isValidFormat = (value, format) => {
|
|
@@ -573,6 +573,14 @@ const isValidFormat = (value, format) => {
|
|
|
573
573
|
}
|
|
574
574
|
};
|
|
575
575
|
|
|
576
|
+
const getCurrentTrace = () => {
|
|
577
|
+
try {
|
|
578
|
+
_stack;
|
|
579
|
+
} catch (error) {
|
|
580
|
+
return error.stack.split('is not defined')[1];
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
|
|
576
584
|
/**
|
|
577
585
|
* Returns the time difference between UTC time and local time, in minutes.
|
|
578
586
|
* @memberof CommonJS
|
|
@@ -662,6 +670,22 @@ function componentFromStr(numStr, percent) {
|
|
|
662
670
|
return percent ? Math.floor((255 * Math.min(100, num)) / 100) : Math.min(255, num);
|
|
663
671
|
}
|
|
664
672
|
|
|
673
|
+
const isChileanIdentityDocument = function (rutCompleto) {
|
|
674
|
+
const dv = function (T) {
|
|
675
|
+
let M = 0,
|
|
676
|
+
S = 1;
|
|
677
|
+
for (; T; T = Math.floor(T / 10)) S = (S + (T % 10) * (9 - (M++ % 6))) % 11;
|
|
678
|
+
return S ? S - 1 : 'k';
|
|
679
|
+
};
|
|
680
|
+
rutCompleto = rutCompleto.replace('‐', '-');
|
|
681
|
+
if (!/^[0-9]+[-|‐]{1}[0-9kK]{1}$/.test(rutCompleto)) return false;
|
|
682
|
+
var tmp = rutCompleto.split('-');
|
|
683
|
+
var digv = tmp[1];
|
|
684
|
+
var rut = tmp[0];
|
|
685
|
+
if (digv == 'K') digv = 'k';
|
|
686
|
+
return dv(rut) == digv;
|
|
687
|
+
};
|
|
688
|
+
|
|
665
689
|
function rgbToHex(rgb) {
|
|
666
690
|
const rgbRegex = /^rgb\(\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*,\s*(-?\d+)(%?)\s*\)$/;
|
|
667
691
|
let result,
|
|
@@ -685,10 +709,242 @@ const hexToNumber = (hex = 0xdc) => Number(hex) || parseFloat(hex, 16);
|
|
|
685
709
|
|
|
686
710
|
const numberToHex = (number = 0) => number.toString(16);
|
|
687
711
|
|
|
712
|
+
const generateRandomPasswordSelection = (length) => {
|
|
713
|
+
const _random = (arr) => {
|
|
714
|
+
const rand = Math.floor(Math.random() * arr.length);
|
|
715
|
+
return arr[rand];
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
const uppercase = [
|
|
719
|
+
'A',
|
|
720
|
+
'B',
|
|
721
|
+
'C',
|
|
722
|
+
'D',
|
|
723
|
+
'E',
|
|
724
|
+
'F',
|
|
725
|
+
'G',
|
|
726
|
+
'H',
|
|
727
|
+
'I',
|
|
728
|
+
'J',
|
|
729
|
+
'K',
|
|
730
|
+
'L',
|
|
731
|
+
'M',
|
|
732
|
+
'N',
|
|
733
|
+
'O',
|
|
734
|
+
'P',
|
|
735
|
+
'Q',
|
|
736
|
+
'R',
|
|
737
|
+
'S',
|
|
738
|
+
'T',
|
|
739
|
+
'U',
|
|
740
|
+
'V',
|
|
741
|
+
'W',
|
|
742
|
+
'X',
|
|
743
|
+
'Y',
|
|
744
|
+
'Z',
|
|
745
|
+
];
|
|
746
|
+
const lowercase = [
|
|
747
|
+
'a',
|
|
748
|
+
'b',
|
|
749
|
+
'c',
|
|
750
|
+
'd',
|
|
751
|
+
'e',
|
|
752
|
+
'f',
|
|
753
|
+
'g',
|
|
754
|
+
'h',
|
|
755
|
+
'i',
|
|
756
|
+
'j',
|
|
757
|
+
'k',
|
|
758
|
+
'l',
|
|
759
|
+
'm',
|
|
760
|
+
'n',
|
|
761
|
+
'o',
|
|
762
|
+
'p',
|
|
763
|
+
'q',
|
|
764
|
+
'r',
|
|
765
|
+
's',
|
|
766
|
+
't',
|
|
767
|
+
'u',
|
|
768
|
+
'v',
|
|
769
|
+
'w',
|
|
770
|
+
'x',
|
|
771
|
+
'y',
|
|
772
|
+
'z',
|
|
773
|
+
];
|
|
774
|
+
const special = [
|
|
775
|
+
'~',
|
|
776
|
+
'!',
|
|
777
|
+
'@',
|
|
778
|
+
'#',
|
|
779
|
+
'$',
|
|
780
|
+
'%',
|
|
781
|
+
'^',
|
|
782
|
+
'&',
|
|
783
|
+
'*',
|
|
784
|
+
'(',
|
|
785
|
+
')',
|
|
786
|
+
'_',
|
|
787
|
+
'+',
|
|
788
|
+
'-',
|
|
789
|
+
'=',
|
|
790
|
+
'{',
|
|
791
|
+
'}',
|
|
792
|
+
'[',
|
|
793
|
+
']',
|
|
794
|
+
':',
|
|
795
|
+
';',
|
|
796
|
+
'?',
|
|
797
|
+
',',
|
|
798
|
+
'.',
|
|
799
|
+
'|',
|
|
800
|
+
'\\',
|
|
801
|
+
];
|
|
802
|
+
const numbers = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
|
803
|
+
|
|
804
|
+
const nonSpecial = [...uppercase, ...lowercase, ...numbers];
|
|
805
|
+
|
|
806
|
+
let password = '';
|
|
807
|
+
|
|
808
|
+
for (let i = 0; i < length; i++) {
|
|
809
|
+
// Previous character is a special character
|
|
810
|
+
if (i !== 0 && special.includes(password[i - 1])) {
|
|
811
|
+
password += _random(nonSpecial);
|
|
812
|
+
} else password += _random([...nonSpecial, ...special]);
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return password;
|
|
816
|
+
};
|
|
817
|
+
|
|
688
818
|
// 0x = Hexadecimal
|
|
689
819
|
// 0b = Binary
|
|
690
820
|
// 0o = Octal
|
|
691
821
|
|
|
822
|
+
const commitData = {
|
|
823
|
+
feat: {
|
|
824
|
+
description: 'A new feature',
|
|
825
|
+
title: 'Features',
|
|
826
|
+
emoji: '✨',
|
|
827
|
+
},
|
|
828
|
+
fix: {
|
|
829
|
+
description: 'A bug fix',
|
|
830
|
+
title: 'Bug Fixes',
|
|
831
|
+
emoji: '🐛',
|
|
832
|
+
},
|
|
833
|
+
docs: {
|
|
834
|
+
description: 'Documentation only changes',
|
|
835
|
+
title: 'Documentation',
|
|
836
|
+
emoji: '📚',
|
|
837
|
+
},
|
|
838
|
+
style: {
|
|
839
|
+
description:
|
|
840
|
+
'Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)',
|
|
841
|
+
title: 'Styles',
|
|
842
|
+
emoji: '💎',
|
|
843
|
+
},
|
|
844
|
+
refactor: {
|
|
845
|
+
description: 'A code change that neither fixes a bug nor adds a feature',
|
|
846
|
+
title: 'Code Refactoring',
|
|
847
|
+
emoji: '📦',
|
|
848
|
+
},
|
|
849
|
+
perf: {
|
|
850
|
+
description: 'A code change that improves performance',
|
|
851
|
+
title: 'Performance Improvements',
|
|
852
|
+
emoji: '⚡️',
|
|
853
|
+
},
|
|
854
|
+
cd: {
|
|
855
|
+
description:
|
|
856
|
+
'Changes to our Continuous Delivery configuration files and scripts (example scopes: Jenkins, Spinnaker, ArgoCD)',
|
|
857
|
+
title: 'Continuous Delivery',
|
|
858
|
+
emoji: '🚀',
|
|
859
|
+
},
|
|
860
|
+
test: {
|
|
861
|
+
description: 'Adding missing tests or correcting existing tests',
|
|
862
|
+
title: 'Tests',
|
|
863
|
+
emoji: '🚨',
|
|
864
|
+
},
|
|
865
|
+
build: {
|
|
866
|
+
description: 'Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)',
|
|
867
|
+
title: 'Builds',
|
|
868
|
+
emoji: '🛠',
|
|
869
|
+
},
|
|
870
|
+
ci: {
|
|
871
|
+
description:
|
|
872
|
+
'Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)',
|
|
873
|
+
title: 'Continuous Integrations',
|
|
874
|
+
emoji: '⚙️',
|
|
875
|
+
},
|
|
876
|
+
chore: {
|
|
877
|
+
description: "Other changes that don't modify src or test files",
|
|
878
|
+
title: 'Chores',
|
|
879
|
+
emoji: '♻️',
|
|
880
|
+
},
|
|
881
|
+
revert: {
|
|
882
|
+
description: 'Reverts a previous commit',
|
|
883
|
+
title: 'Reverts',
|
|
884
|
+
emoji: '🗑',
|
|
885
|
+
},
|
|
886
|
+
backup: {
|
|
887
|
+
description: 'Changes related to backups, including creation, restoration, and maintenance.',
|
|
888
|
+
title: 'Backups',
|
|
889
|
+
emoji: '💾',
|
|
890
|
+
},
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
const emotionsData = [
|
|
894
|
+
{
|
|
895
|
+
name: 'like',
|
|
896
|
+
ad_display: {
|
|
897
|
+
es: 'Me gusta',
|
|
898
|
+
en: 'Like',
|
|
899
|
+
},
|
|
900
|
+
emoji: '👍',
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
name: 'love',
|
|
904
|
+
ad_display: {
|
|
905
|
+
es: 'Me encanta',
|
|
906
|
+
en: 'Love',
|
|
907
|
+
},
|
|
908
|
+
emoji: '❤️',
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
name: 'haha',
|
|
912
|
+
ad_display: {
|
|
913
|
+
es: 'Me divierte',
|
|
914
|
+
en: 'Haha',
|
|
915
|
+
},
|
|
916
|
+
emoji: '😂',
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
name: 'wow',
|
|
920
|
+
ad_display: {
|
|
921
|
+
es: 'Me asombra',
|
|
922
|
+
en: 'Wow',
|
|
923
|
+
},
|
|
924
|
+
emoji: '😮',
|
|
925
|
+
},
|
|
926
|
+
{
|
|
927
|
+
name: 'sad',
|
|
928
|
+
ad_display: {
|
|
929
|
+
es: 'Me entristece',
|
|
930
|
+
en: 'Sad',
|
|
931
|
+
},
|
|
932
|
+
emoji: '😢',
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
name: 'angry',
|
|
936
|
+
ad_display: {
|
|
937
|
+
es: 'Me enoja',
|
|
938
|
+
en: 'Angry',
|
|
939
|
+
},
|
|
940
|
+
emoji: '😠',
|
|
941
|
+
},
|
|
942
|
+
];
|
|
943
|
+
|
|
944
|
+
const userRoleEnum = ['admin', 'moderator', 'user', 'guest'];
|
|
945
|
+
const commonAdminGuard = (role) => userRoleEnum.indexOf(role) === userRoleEnum.indexOf('admin');
|
|
946
|
+
const commonModeratorGuard = (role) => userRoleEnum.indexOf(role) <= userRoleEnum.indexOf('moderator');
|
|
947
|
+
|
|
692
948
|
export {
|
|
693
949
|
s4,
|
|
694
950
|
range,
|
|
@@ -727,10 +983,9 @@ export {
|
|
|
727
983
|
getSubpaths,
|
|
728
984
|
formatBytes,
|
|
729
985
|
getDirname,
|
|
730
|
-
isDayValid,
|
|
731
|
-
isMonthValid,
|
|
732
986
|
isValidDate,
|
|
733
987
|
isValidFormat,
|
|
988
|
+
strToDateUTC,
|
|
734
989
|
getTimezoneOffset,
|
|
735
990
|
cleanString,
|
|
736
991
|
splitEveryXChar,
|
|
@@ -742,4 +997,12 @@ export {
|
|
|
742
997
|
getCapVariableName,
|
|
743
998
|
hexToNumber,
|
|
744
999
|
numberToHex,
|
|
1000
|
+
generateRandomPasswordSelection,
|
|
1001
|
+
commonAdminGuard,
|
|
1002
|
+
commonModeratorGuard,
|
|
1003
|
+
isChileanIdentityDocument,
|
|
1004
|
+
getCurrentTrace,
|
|
1005
|
+
userRoleEnum,
|
|
1006
|
+
commitData,
|
|
1007
|
+
emotionsData,
|
|
745
1008
|
};
|
|
@@ -344,7 +344,7 @@ const renderBubbleDialog = async function (
|
|
|
344
344
|
}
|
|
345
345
|
if (options.trianglePositionCss) cssTrianglePosition = options.trianglePositionCss;
|
|
346
346
|
return html` <div
|
|
347
|
-
class="${options?.classSelectors ? options.classSelectors : '
|
|
347
|
+
class="${options?.classSelectors ? options.classSelectors : 'inl'} bubble-dialog bubble-dialog-${id}"
|
|
348
348
|
${options.bubbleCss ? `style='${options.bubbleCss}'` : ''}
|
|
349
349
|
>
|
|
350
350
|
<style class="style-bubble-dialog-triangle-${id}">
|
|
@@ -761,6 +761,7 @@ const renderWave = ({ id }) => {
|
|
|
761
761
|
const cssTokensEffect = {};
|
|
762
762
|
const cssTokensContainer = {};
|
|
763
763
|
const cssEffect = async (containerSelector, event) => {
|
|
764
|
+
return;
|
|
764
765
|
// Array.from(event.target.classList)
|
|
765
766
|
let offsetX, offsetY;
|
|
766
767
|
if (Array.from(event.srcElement.classList).includes('ripple') && cssTokensContainer[containerSelector]) {
|