@opengis/fastify-table 2.0.67 → 2.0.69

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.
Files changed (86) hide show
  1. package/dist/functions.d.ts +39 -0
  2. package/dist/functions.d.ts.map +1 -0
  3. package/dist/functions.js +412 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +18 -418
  6. package/dist/log/migration/dist-geoname-cls.json +1 -0
  7. package/dist/log/migration/dist-geoname-cls.sql +0 -0
  8. package/dist/server/migrations/crm.sql +14 -4
  9. package/dist/server/plugins/notifications/addNotification.d.ts +12 -0
  10. package/dist/server/plugins/notifications/addNotification.d.ts.map +1 -0
  11. package/dist/server/plugins/notifications/addNotification.js +18 -0
  12. package/dist/server/routes/access/index.d.ts +1 -1
  13. package/dist/server/routes/access/index.d.ts.map +1 -1
  14. package/dist/server/routes/access/index.js +1 -1
  15. package/dist/server/routes/auth/index.d.ts +1 -1
  16. package/dist/server/routes/auth/index.d.ts.map +1 -1
  17. package/dist/server/routes/auth/index.js +1 -1
  18. package/dist/server/routes/cron/index.d.ts +1 -1
  19. package/dist/server/routes/cron/index.d.ts.map +1 -1
  20. package/dist/server/routes/cron/index.js +1 -1
  21. package/dist/server/routes/crud/index.d.ts +1 -1
  22. package/dist/server/routes/crud/index.d.ts.map +1 -1
  23. package/dist/server/routes/crud/index.js +1 -1
  24. package/dist/server/routes/dblist/index.d.ts +1 -1
  25. package/dist/server/routes/dblist/index.d.ts.map +1 -1
  26. package/dist/server/routes/dblist/index.js +1 -1
  27. package/dist/server/routes/file/index.d.ts +1 -1
  28. package/dist/server/routes/file/index.d.ts.map +1 -1
  29. package/dist/server/routes/file/index.js +1 -1
  30. package/dist/server/routes/grpc/index.d.ts +1 -1
  31. package/dist/server/routes/grpc/index.d.ts.map +1 -1
  32. package/dist/server/routes/grpc/index.js +1 -1
  33. package/dist/server/routes/logger/index.d.ts +1 -1
  34. package/dist/server/routes/logger/index.d.ts.map +1 -1
  35. package/dist/server/routes/logger/index.js +1 -1
  36. package/dist/server/routes/menu/index.d.ts +1 -1
  37. package/dist/server/routes/menu/index.d.ts.map +1 -1
  38. package/dist/server/routes/menu/index.js +1 -1
  39. package/dist/server/routes/notifications/controllers/addUserNotification.d.ts +4 -0
  40. package/dist/server/routes/notifications/controllers/addUserNotification.d.ts.map +1 -0
  41. package/dist/server/routes/notifications/controllers/addUserNotification.js +22 -0
  42. package/dist/server/routes/notifications/controllers/deleteUserNotification.d.ts +4 -0
  43. package/dist/server/routes/notifications/controllers/deleteUserNotification.d.ts.map +1 -0
  44. package/dist/server/routes/notifications/controllers/deleteUserNotification.js +25 -0
  45. package/dist/server/routes/notifications/controllers/editUserNotification.d.ts +4 -0
  46. package/dist/server/routes/notifications/controllers/editUserNotification.d.ts.map +1 -0
  47. package/dist/server/routes/notifications/controllers/editUserNotification.js +31 -0
  48. package/dist/server/routes/notifications/controllers/readNotifications.d.ts +4 -0
  49. package/dist/server/routes/notifications/controllers/readNotifications.d.ts.map +1 -0
  50. package/dist/server/routes/notifications/controllers/readNotifications.js +17 -0
  51. package/dist/server/routes/notifications/controllers/userNotifications.d.ts +4 -0
  52. package/dist/server/routes/notifications/controllers/userNotifications.d.ts.map +1 -0
  53. package/dist/server/routes/notifications/controllers/userNotifications.js +33 -0
  54. package/dist/server/routes/notifications/index.d.ts +3 -0
  55. package/dist/server/routes/notifications/index.d.ts.map +1 -0
  56. package/dist/server/routes/notifications/index.js +23 -0
  57. package/dist/server/routes/properties/index.d.ts +1 -1
  58. package/dist/server/routes/properties/index.d.ts.map +1 -1
  59. package/dist/server/routes/properties/index.js +1 -1
  60. package/dist/server/routes/table/controllers/search.d.ts +2 -1
  61. package/dist/server/routes/table/controllers/search.d.ts.map +1 -1
  62. package/dist/server/routes/table/controllers/search.js +31 -12
  63. package/dist/server/routes/table/index.d.ts +1 -1
  64. package/dist/server/routes/table/index.d.ts.map +1 -1
  65. package/dist/server/routes/table/index.js +1 -1
  66. package/dist/server/routes/templates/index.d.ts +1 -1
  67. package/dist/server/routes/templates/index.d.ts.map +1 -1
  68. package/dist/server/routes/templates/index.js +1 -1
  69. package/dist/server/routes/util/index.d.ts +1 -1
  70. package/dist/server/routes/util/index.d.ts.map +1 -1
  71. package/dist/server/routes/util/index.js +1 -1
  72. package/dist/server/routes/widget/index.d.ts +1 -1
  73. package/dist/server/routes/widget/index.d.ts.map +1 -1
  74. package/dist/server/routes/widget/index.js +1 -1
  75. package/dist/utils.d.ts +1 -0
  76. package/dist/utils.d.ts.map +1 -1
  77. package/dist/utils.js +2 -1
  78. package/package.json +88 -88
  79. package/dist/server/plugins/grpc/utils/server/plugins/grpc/utils/convertp.proto +0 -137
  80. package/dist/server/plugins/grpc/utils/server/plugins/grpc/utils/office2pdf.proto +0 -14
  81. package/dist/server/plugins/hook/funcs/addHook.js +0 -7
  82. package/dist/server/plugins/hook/funcs/applyHook.js +0 -25
  83. package/dist/server/plugins/hook/funcs/applyHookSync.js +0 -7
  84. package/dist/server/plugins/hook/index.js +0 -7
  85. package/dist/server/routes/logger/controllers/utils/checkUserAccess.js +0 -22
  86. package/dist/server/routes/logger/controllers/utils/getRootDir.js +0 -25
package/dist/index.js CHANGED
@@ -1,18 +1,10 @@
1
1
  import fp from "fastify-plugin";
2
2
  import path from "node:path";
3
- import { existsSync, readdirSync, readFileSync, mkdirSync, writeFileSync, } from "node:fs";
4
- import { createHash } from "node:crypto";
5
3
  import { fileURLToPath } from "node:url";
6
4
  import proxy from "@fastify/http-proxy";
7
5
  import config from "./config.js";
8
- import getTemplatePath from "./server/plugins/table/funcs/getTemplatePath.js";
6
+ import { preForm, afterInsert, afterTable, afterTemplate, afterUpdate, preTemplate, onReady, onListen1, onListen2, } from "./functions.js";
9
7
  import addHook from "./server/plugins/hook/addHook.js";
10
- import getToken from "./server/plugins/crud/funcs/getToken.js";
11
- import getTemplate from "./server/plugins/table/funcs/getTemplate.js";
12
- import getRedis from "./server/plugins/redis/funcs/getRedis.js";
13
- import logger from "./server/plugins/logger/getLogger.js";
14
- import getMenu from "./server/routes/menu/controllers/getMenu.js";
15
- import getSelectVal from "./server/plugins/table/funcs/metaFormat/getSelectVal.js";
16
8
  const { maxFileSize = 512 } = config;
17
9
  const { name: execName } = path.parse(process.argv0);
18
10
  // helpers
@@ -26,6 +18,10 @@ import metricPlugin from "./server/plugins/metric/index.js";
26
18
  import redisPlugin from "./server/plugins/redis/index.js";
27
19
  import loggerPlugin from "./server/plugins/logger/index.js";
28
20
  import authPlugin from "./server/plugins/auth/index.js";
21
+ // utils
22
+ import addTemplateDir from "./server/plugins/table/funcs/addTemplateDir.js";
23
+ import execMigrations from "./server/plugins/migration/exec.migrations.js";
24
+ import pgClients from "./server/plugins/pg/pgClients.js";
29
25
  // routes
30
26
  import cronRoutes from "./server/routes/cron/index.js";
31
27
  import crudRoutes from "./server/routes/crud/index.js";
@@ -34,11 +30,6 @@ import propertiesRoutes from "./server/routes/properties/index.js";
34
30
  import tableRoutes from "./server/routes/table/index.js";
35
31
  import utilRoutes from "./server/routes/util/index.js";
36
32
  import accessRoutes from "./server/routes/access/index.js";
37
- // utils
38
- import addTemplateDir from "./server/plugins/table/funcs/addTemplateDir.js";
39
- import execMigrations from "./server/plugins/migration/exec.migrations.js";
40
- import locales from "./server/routes/table/controllers/utils/locales.js";
41
- import pgClients from "./server/plugins/pg/pgClients.js";
42
33
  import dblistRoutes from "./server/routes/dblist/index.js";
43
34
  import menuRoutes from "./server/routes/menu/index.js";
44
35
  import templatesRoutes from "./server/routes/templates/index.js";
@@ -46,219 +37,15 @@ import widgetRoutes from "./server/routes/widget/index.js";
46
37
  import authRoutes from "./server/routes/auth/index.js";
47
38
  import fileRoutes from "./server/routes/file/index.js";
48
39
  import grpcRoutes from "./server/routes/grpc/index.js";
49
- const { client } = pgClients;
50
- const rclient = getRedis();
51
- // core templates && cls
40
+ import notificationsRoutes from "./server/routes/notifications/index.js";
52
41
  const filename = fileURLToPath(import.meta.url);
53
42
  const cwd = path.dirname(filename);
54
- addHook("preForm", async ({ form, user }) => {
55
- if (!user?.uid)
56
- return null;
57
- const opt = await getToken({
58
- mode: "w",
59
- token: form,
60
- uid: user.uid,
61
- json: 1,
62
- });
63
- return opt;
64
- });
65
- addHook("afterTable", async ({ table, res = {}, payload: rows = [], user = {}, }) => {
66
- const loadTable = await getTemplate("table", table);
67
- const { uid } = config?.auth?.disable || process.env.NODE_ENV !== "admin"
68
- ? { uid: "1" }
69
- : user;
70
- if (!uid ||
71
- !table ||
72
- !client?.pk?.[table] ||
73
- !rows.length ||
74
- !loadTable?.table ||
75
- !client?.pk?.["crm.extra_data"] ||
76
- !client?.pk?.["admin.custom_column"])
77
- return;
78
- // admin.custom_column - user column data
79
- const { rows: properties = [] } = await client.query(`select column_id, name, title, format, data from admin.custom_column
80
- where _table and entity=$1 and uid=$2`, [table, uid]);
81
- const extraColumnList = properties.map((row) => ({
82
- id: row.column_id,
83
- name: row.name,
84
- title: row.title,
85
- format: row.format,
86
- data: row.data,
87
- }));
88
- if (!extraColumnList?.length)
89
- return;
90
- if (Array.isArray(res?.columns) && res?.columns?.length) {
91
- extraColumnList.forEach((col) => res.columns.push(col));
92
- }
93
- const { rows: extraData = [] } = await client.query(`select object_id, json_object_agg( property_id, coalesce(value_date::text,value_text) ) as extra from crm.extra_data
94
- where property_entity=$1 and property_id=any($2) and object_id=any($3) group by object_id`, [
95
- table,
96
- extraColumnList?.map((el) => el.id),
97
- rows.map((el) => el.id),
98
- ]);
99
- if (!extraData?.length) {
100
- // Object.assign(rows?.[0] || {}, { ...extraColumnList.reduce((acc, curr) => Object.assign(acc, { [curr.name]: null }), {}) });
101
- return;
102
- }
103
- rows
104
- .filter((row) => extraData.map((el) => el?.object_id).includes(row.id))
105
- .forEach((row) => {
106
- const { extra = {} } = extraData.find((el) => el.object_id === row.id);
107
- Object.assign(row, {
108
- ...Object.fromEntries(Object.entries(extra).map((el) => [
109
- extraColumnList.find((col) => col.id === el[0]).name,
110
- el[1],
111
- ])),
112
- });
113
- });
114
- // admin.custom_column - metaFormat
115
- await Promise.all(extraColumnList
116
- .filter((el) => el?.data)
117
- .map(async (attr) => {
118
- const values = [
119
- ...new Set(rows?.map((el) => el[attr.name]).flat()),
120
- ].filter((el) => el);
121
- if (!values.length)
122
- return;
123
- const cls = await getSelectVal({ name: attr.data, values });
124
- if (!cls)
125
- return;
126
- rows.forEach((el) => {
127
- const val = el[attr.name]?.map?.((c) => cls[c] || c) ||
128
- cls[el[attr.name]] ||
129
- el[attr.name];
130
- if (!val)
131
- return;
132
- Object.assign(el, {
133
- [val?.color ? `${attr.name}_data` : `${attr.name}_text`]: val.color ? val : val.text || val,
134
- });
135
- });
136
- }));
137
- });
138
- // extract table from form token for user columns - p.2 - read (refactor to global token)
139
- addHook("preTemplate", async ({ name, type, user = {}, }) => {
140
- if (!name || !type)
141
- return;
142
- const { uid } = config?.auth?.disable || process.env.NODE_ENV !== "admin"
143
- ? { uid: "1" }
144
- : user;
145
- const tokenData = (await getToken({
146
- uid,
147
- token: name,
148
- mode: "w",
149
- json: 1,
150
- })) || // edit?
151
- (await getToken({
152
- uid,
153
- token: name,
154
- mode: "a",
155
- json: 1,
156
- })) ||
157
- {}; // add?
158
- return { name: tokenData?.[type] };
159
- });
160
- addHook("afterTemplate", async ({ name, type, payload: data = {}, user = {}, }) => {
161
- const { uid } = config?.auth?.disable || process.env.NODE_ENV !== "admin"
162
- ? { uid: "1" }
163
- : user;
164
- // extract table from form token for user columns - p.1 - assign (refactor to global token)
165
- if (!uid ||
166
- !data ||
167
- type !== "form" ||
168
- !name ||
169
- !client?.pk?.["admin.custom_column"])
170
- return null;
171
- const { form, id, table } = (await getToken({
172
- uid,
173
- token: name,
174
- mode: "w",
175
- json: 1,
176
- })) || // edit?
177
- (await getToken({
178
- uid,
179
- token: name,
180
- mode: "a",
181
- json: 1,
182
- })) ||
183
- {}; // add?
184
- const { rows: properties = [] } = await client.query(`select name, title, format, data from admin.custom_column
185
- where entity=$1 and uid=$2`, [table || name, uid]);
186
- await Promise.all(properties.map(async (el) => {
187
- const clsData = el.data
188
- ? await getTemplate(["cls", "select"], el.data)
189
- : undefined;
190
- const type = clsData
191
- ? "Select"
192
- : { date: "DatePicker" }[el.format || ""] || "Text";
193
- Object.assign(data?.schema || data || {}, {
194
- [el.name]: {
195
- type,
196
- ua: el.title,
197
- data: el.data,
198
- options: type === "Select" && Array.isArray(clsData) && clsData?.length
199
- ? clsData
200
- : undefined,
201
- extra: 1,
202
- },
203
- });
204
- }));
205
- });
206
- addHook("afterUpdate", async ({ table, body = {}, payload: res = {}, user = {}, }) => {
207
- const { uid } = config?.auth?.disable || process.env.NODE_ENV !== "admin"
208
- ? { uid: "1" }
209
- : user;
210
- if (!uid ||
211
- !table ||
212
- !Object.keys(body)?.length ||
213
- !client?.pk?.["crm.extra_data"] ||
214
- !client?.pk?.["admin.custom_column"])
215
- return null;
216
- const loadTable = await getTemplate("table", table);
217
- if (!client?.pk?.[loadTable?.table || table])
218
- return null;
219
- const pk = client?.pk?.[loadTable?.table || table];
220
- const id = res[pk];
221
- const { rows: properties = [] } = await client.query(`select column_id, name, title, format, data from admin.custom_column
222
- where entity=$1 and uid=$2`, [table, uid]);
223
- if (!id || !properties?.length || !client.pk?.["crm.extra_data"])
224
- return null;
225
- const q = `delete from crm.extra_data where property_entity='${table}' and object_id='${id}';${properties
226
- .filter((el) => Object.keys(body).includes(el.name))
227
- .map((el) => `insert into crm.extra_data(property_id,property_key,property_entity,object_id,${el.format?.toLowerCase() === "date" ? "value_date" : "value_text"})
228
- select '${el.column_id}', '${el.name}', '${table}', '${id}', ${el.format?.toLowerCase() === "date"
229
- ? `'${body[el.name]}'::timestamp without time zone`
230
- : `'${body[el.name]}'::text`}`)
231
- .join(";\n") || ""}`;
232
- return client.query(q);
233
- });
234
- addHook("afterInsert", async ({ table, body, payload: res = {}, user = {}, }) => {
235
- const { uid } = config?.auth?.disable || process.env.NODE_ENV !== "admin"
236
- ? { uid: "1" }
237
- : user;
238
- if (!uid ||
239
- !table ||
240
- !Object.keys(body)?.length ||
241
- !client?.pk?.["crm.extra_data"] ||
242
- !client?.pk?.["admin.custom_column"])
243
- return null;
244
- const loadTable = await getTemplate("table", table);
245
- if (!client?.pk?.[loadTable?.table || table])
246
- return null;
247
- const pk = client?.pk?.[loadTable?.table || table];
248
- const id = res.rows?.[0]?.[pk];
249
- const { rows: properties = [] } = await client.query(`select column_id, name, title, format, data from admin.custom_column
250
- where entity=$1 and uid=$2`, [table, uid]);
251
- if (!id || !properties?.length)
252
- return null;
253
- const q = properties
254
- .filter((el) => Object.keys(body).includes(el.name))
255
- .map((el) => `insert into crm.extra_data(property_id,property_key,property_entity,object_id,${el.format?.toLowerCase() === "date" ? "value_date" : "value_text"})
256
- select '${el.column_id}', '${el.name}', '${table}', '${id}', ${el.format?.toLowerCase() === "date"
257
- ? `'${body[el.name]}'::timestamp without time zone`
258
- : `'${body[el.name]}'::text`}`)
259
- .join(";\n");
260
- return client.query(q);
261
- });
43
+ addHook("preForm", preForm);
44
+ addHook("afterTable", afterTable);
45
+ addHook("preTemplate", preTemplate);
46
+ addHook("afterTemplate", afterTemplate);
47
+ addHook("afterUpdate", afterUpdate);
48
+ addHook("afterInsert", afterInsert);
262
49
  function plugin(fastify) {
263
50
  const opt = { prefix: "/api" };
264
51
  if (config.disableCors) {
@@ -266,30 +53,11 @@ function plugin(fastify) {
266
53
  reply.header("Access-Control-Allow-Origin", "*");
267
54
  });
268
55
  }
269
- fastify.addHook("onReady", async () => {
270
- if (existsSync("locales")) {
271
- const subdirs = readdirSync("locales", { withFileTypes: true }).filter((el) => el.isDirectory());
272
- const res = subdirs.reduce((acc, curr) => {
273
- const content = readdirSync(`locales/${curr.name}`, {
274
- withFileTypes: true,
275
- });
276
- const obj = content
277
- .filter((el) => el.isFile())
278
- .reduce((acc1, file) => ({
279
- ...acc1,
280
- ...JSON.parse(readFileSync(`locales/${curr.name}/${file.name}`, "utf-8").replace(/[\u200B-\u200D\uFEFF]/g, "")),
281
- }), {});
282
- Object.keys(obj).reduce((acc1, curr1) => Object.assign(acc, {
283
- [curr1]: { ...acc[curr1], [curr.name]: obj?.[curr1] },
284
- }), {});
285
- return acc;
286
- }, {});
287
- Object.assign(locales, res);
288
- console.log("locales loaded");
289
- }
290
- });
56
+ fastify.addHook("onListen", onListen1);
57
+ fastify.addHook("onListen", onListen2);
58
+ fastify.addHook("onReady", onReady);
291
59
  // core migrations (second argument for core only)
292
- execMigrations(path.join(cwd, "server/migrations"), pgClients.client, true).catch((err) => console.log(err));
60
+ execMigrations(path.join(cwd, "server/migrations"), pgClients.client, true).catch((err) => console.warn(err.toString()));
293
61
  // core templates && cls
294
62
  config.templates?.forEach((el) => addTemplateDir(el));
295
63
  addTemplateDir(path.join(cwd, "module/core"));
@@ -335,6 +103,8 @@ function plugin(fastify) {
335
103
  // from fastify-file
336
104
  fastify.register(fileRoutes);
337
105
  fastify.register(grpcRoutes, opt);
106
+ // from admin
107
+ fastify.register(notificationsRoutes, opt);
338
108
  config.proxy?.forEach?.((el) => {
339
109
  if (execName === "bun") {
340
110
  fastify.all(`${el.source}/*`, async (req, reply) => {
@@ -379,175 +149,5 @@ function plugin(fastify) {
379
149
  });
380
150
  }
381
151
  });
382
- // from opengis/admin
383
- const user1 = config?.auth?.disable || process.env.NODE_ENV !== "admin"
384
- ? { uid: "1" }
385
- : null;
386
- fastify.addHook("onListen", async () => {
387
- const json = await getMenu({ user: { uid: "1" }, pg: client }, null);
388
- // insert interface list to db (user access management)
389
- if (client?.pk?.["admin.routes"] && json?.menus?.length) {
390
- const menuList = json?.menus?.filter?.((el) => el?.table ||
391
- el?.component ||
392
- el?.menu?.length /*&& el?.ua || el?.en || el?.name*/) || [];
393
- // skip dupes
394
- //admin_route_menu_id_fkey
395
- menuList.forEach((el) => Object.assign(el, { ua: el?.ua || el?.en || el?.name }));
396
- const uniqueList = menuList.filter((el, idx, arr) => el?.ua &&
397
- arr.map((item) => item?.ua).indexOf(el?.ua) ===
398
- idx);
399
- const q = `insert into admin.menu(name, ord) values${uniqueList
400
- .map((el, i) => `('${el?.ua.replace(/'/g, "''")}', ${i}) `)
401
- .join(",")}
402
- on conflict (name) do update set ord=excluded.ord, enabled=true returning name, menu_id`;
403
- const { rows = [] } = uniqueList.length ? await client.query(q) : {};
404
- const menus = rows.reduce((acc, curr) => Object.assign(acc, {
405
- [curr.menu_id]: uniqueList.find((item) => item?.ua === curr.name),
406
- }), {});
407
- const values = Object.entries(menus).reduce((acc, curr) => {
408
- if (curr[1]?.table || curr[1]?.component) {
409
- acc.push({ ...curr[1], menuId: curr[0] });
410
- }
411
- curr[1]?.menu?.forEach?.((el) => acc.push({ ...el, menuId: curr[0] }));
412
- return acc;
413
- }, []);
414
- await Promise.all(values
415
- .filter((el) => el?.table)
416
- .map(async (el) => {
417
- const loadTable = await getTemplate("table", el.table);
418
- Object.assign(el, {
419
- table1: loadTable?.table || el.table,
420
- actions: loadTable?.actions,
421
- access: loadTable?.access,
422
- });
423
- }));
424
- // console.log(values)
425
- const q1 = `insert into admin.routes(route_id, alias, title, menu_id, table_name, actions, access, query)
426
- values ${values
427
- .filter((el) => el?.path)
428
- .map((el) => `('${el.path}', ${el.table ? `'${el.table}'` : null},
429
- ${el.title || el.ua
430
- ? `'${(el.title || el.ua).replace(/'/g, "''")}'`
431
- : null},
432
- ${el.menuId ? `'${el.menuId}'` : null}, ${el.table1 ? `'${el.table1}'` : null},
433
- ${el.actions?.length ? `'{ ${el.actions} }'::text[]` : null}, ${el.access ? `'${el.access}'` : null},
434
- ${el.query ? `'${el.query.replace(/'/g, "''")}'` : "'1=1'"})`)
435
- .join(",")}
436
- on conflict (route_id) do update set menu_id=excluded.menu_id, alias=excluded.alias, title=excluded.title, enabled=true, query=excluded.query,
437
- table_name=excluded.table_name, actions=excluded.actions, access=excluded.access returning route_id, table_name`;
438
- try {
439
- console.log("admin/hook routes sql start");
440
- const { rowCount: menuCount } = await client.query(`delete from admin.menu
441
- where not array[menu_id] <@ $1::text[] and menu_id not in (select menu_id from admin.routes)`, [rows.map((el) => el.menu_id)]);
442
- console.log("delete deprecated menus ok", menuCount);
443
- const { rowCount: interfaceCount } = await client.query(`delete from admin.routes
444
- where not array[route_id] <@ $1::text[] and route_id not in (select route_id from admin.role_access)`, [values.filter((el) => el?.path)]);
445
- console.log("delete deprecated interfaces ok", interfaceCount);
446
- const { rowCount } = values?.length ? await client.query(q1) : {};
447
- console.log("insert interfaces ok", rowCount);
448
- }
449
- catch (err) {
450
- console.log("admin/hook routes sql error", values, q1, err);
451
- }
452
- }
453
- });
454
- fastify.addHook("onListen", async () => {
455
- const clsQuery = [];
456
- if (!client?.pk && client?.init) {
457
- await client.init();
458
- }
459
- if (!client?.pk?.["admin.cls"])
460
- return;
461
- const selectList = getTemplatePath("select");
462
- const clsList = getTemplatePath("cls")?.filter((el) => !(selectList?.map((el) => el?.[0]) || []).includes(el[0]));
463
- const cls = (selectList || []).concat(clsList || [])?.map((el) => ({
464
- name: el[0],
465
- module: path.basename(path.dirname(path.dirname(el[1]))),
466
- type: { json: "cls", sql: "select" }[el[2]],
467
- }));
468
- if (!cls?.length)
469
- return;
470
- try {
471
- const hashes = await rclient
472
- .hgetall("cls-insert-hashes")
473
- .then((obj) => Object.keys(obj));
474
- const dbdata = await client
475
- .query(`select json_object_agg(name, hash) from admin.cls where parent is null`)
476
- .then((el) => el.rows?.[0]?.json_object_agg || {});
477
- const names = Object.keys(dbdata);
478
- console.log("admin/hook cls promise start");
479
- const qHashes = await Promise.all(cls
480
- .filter((el, idx, arr) => arr.map((item) => item.name).indexOf(el.name) === idx)
481
- .map(async (el) => {
482
- const { name, module, type } = el;
483
- const loadTemplate = await getTemplate(type, name);
484
- el.hash = createHash("md5")
485
- .update(type === "cls"
486
- ? JSON.stringify(loadTemplate)
487
- : loadTemplate?.sql || loadTemplate || "")
488
- .digest("hex");
489
- el.dbhash = dbdata[name];
490
- // check for changes by redis hash / dropped from db / changed at git project
491
- el.update =
492
- !hashes.includes(el.hash) ||
493
- !names.includes(name) ||
494
- el.hash !== el.dbhash;
495
- if (type === "select" &&
496
- (loadTemplate?.sql || loadTemplate) &&
497
- el.update) {
498
- clsQuery.push(`insert into admin.cls(name,type,data,module,hash) values('${name}','sql','${(loadTemplate?.sql || loadTemplate)?.replace(/'/g, "''")}', '${module?.replace(/'/g, "''")}','${el.hash}')`);
499
- if (config.trace)
500
- console.log(name, type, "insert fresh select");
501
- return el.hash;
502
- }
503
- else if (type === "cls" && loadTemplate?.length && el.update) {
504
- clsQuery.push(`insert into admin.cls(name,type, module,hash) values('${name}','json', '${module?.replace(/'/g, "''")}','${el.hash}');
505
- insert into admin.cls(code,name,parent,icon,color,data)
506
- select value->>'id',value->>'text','${name}',value->>'icon',value->>'color',value->>'data'
507
- from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json) on conflict (code,parent) do update set color=excluded.color;`);
508
- if (config.trace)
509
- console.log(name, type, "insert fresh cls");
510
- return el.hash;
511
- }
512
- else if (hashes.includes(el.hash)) {
513
- if (config.trace)
514
- console.log(name, type, names.includes(name)
515
- ? "skip equal hash"
516
- : "insert missing cls");
517
- return el.hash;
518
- }
519
- else {
520
- if (config.trace)
521
- console.log(name, type, "empty");
522
- return el.hash;
523
- }
524
- }));
525
- // debug
526
- const logDir = path.join(cwd, "log/migration");
527
- mkdirSync(logDir, { recursive: true });
528
- writeFileSync(path.join(logDir, `${path.basename(cwd)}-${client.options?.database}-cls.sql`), clsQuery.filter(Boolean).join(";"));
529
- writeFileSync(path.join(logDir, `${path.basename(cwd)}-${client.options?.database}-cls.json`), JSON.stringify(cls));
530
- const { rowCount = 0 } = await client.query("delete from admin.cls where $1::text[] && array[name,parent]", [
531
- cls
532
- .filter((el) => el.update)
533
- .map((el) => el.name),
534
- ]);
535
- console.log("fastify-table/hook old cls deleted", rowCount);
536
- if (clsQuery.filter((el) => el).length) {
537
- console.log("fastify-table cls sql start", clsQuery?.length);
538
- await client.query(clsQuery.filter((el) => el).join(";"));
539
- await Promise.all(qHashes
540
- .filter(Boolean)
541
- .map(async (el) => rclient.hset("cls-insert-hashes", el, 1)));
542
- logger.file("migration/hash", { list: qHashes.filter(Boolean) });
543
- console.log("fastify-table/hook cls sql finish", clsQuery?.length);
544
- }
545
- console.log("fastify-table/hook cls promise finish", rowCount);
546
- }
547
- catch (err) {
548
- console.error("fastify-table/hook cls sql error", err.toString());
549
- console.trace(err);
550
- }
551
- });
552
152
  }
553
153
  export default fp(plugin);
@@ -0,0 +1 @@
1
+ [{"name":"admin.user_id","module":"data","type":"select","hash":"29f728fe5e89fed0f2bec41657fae26e","dbhash":"29f728fe5e89fed0f2bec41657fae26e","update":false},{"name":"data.admin_statistic","module":"data","type":"select","hash":"8f0689a8995711c7693379a177ea4e92","dbhash":"8f0689a8995711c7693379a177ea4e92","update":false},{"name":"data.last_objects_all","module":"data","type":"select","hash":"f942c95781b420a837ae38c324cca7a9","dbhash":"f942c95781b420a837ae38c324cca7a9","update":false},{"name":"data.object_id","module":"data","type":"select","hash":"f5b4f8e86d5b3bf5da599b4e7d126ea2","dbhash":"f5b4f8e86d5b3bf5da599b4e7d126ea2","update":false},{"name":"data.site_statistic","module":"data","type":"select","hash":"fbc3b42fee3ef287b3a576bb1a0b43b4","dbhash":"fbc3b42fee3ef287b3a576bb1a0b43b4","update":false},{"name":"data_addition.change_status.parent","module":"data_addition","type":"select","hash":"517f0390a98a5642b94a62dbbd058441","dbhash":"517f0390a98a5642b94a62dbbd058441","update":false},{"name":"data_addition.deregistration.parent","module":"data_addition","type":"select","hash":"1dbbd6e0a48e52a9c23dedad368f06c3","dbhash":"1dbbd6e0a48e52a9c23dedad368f06c3","update":false},{"name":"data_addition.historical_name.parent","module":"data_addition","type":"select","hash":"3d42dee53b639fb594e9961492f577cc","dbhash":"3d42dee53b639fb594e9961492f577cc","update":false},{"name":"data_addition.national_lang_name.parent","module":"data_addition","type":"select","hash":"c3a9ac90dd38c02736503d003a0ca012","dbhash":"c3a9ac90dd38c02736503d003a0ca012","update":false},{"name":"data_addition.objects_atu.parent","module":"data_addition","type":"select","hash":"1629be10ba3bd71280621dc7e6737092","dbhash":"1629be10ba3bd71280621dc7e6737092","update":false},{"name":"data_addition.objects_countries.parent","module":"data_addition","type":"select","hash":"b389f543053bf35a5469580333cc1b0b","dbhash":"b389f543053bf35a5469580333cc1b0b","update":false},{"name":"data_addition.options_name.parent","module":"data_addition","type":"select","hash":"e5d02b5f8d64a18cf21b1daa448fe54e","dbhash":"e5d02b5f8d64a18cf21b1daa448fe54e","update":false},{"name":"data_addition.options_type.parent","module":"data_addition","type":"select","hash":"fb41e8f7b9cf18786611d8e880ff4051","dbhash":"fb41e8f7b9cf18786611d8e880ff4051","update":false},{"name":"data_addition.rename.parent","module":"data_addition","type":"select","hash":"c883a3baf1beb4a7d3d5bdb28062be69","dbhash":"c883a3baf1beb4a7d3d5bdb28062be69","update":false},{"name":"data_countries.object_id","module":"data_countries","type":"select","hash":"a6f120bea7bd0df1afcdb1b56484e516","dbhash":"a6f120bea7bd0df1afcdb1b56484e516","update":false},{"name":"dict.admin_status","module":"dict","type":"select","hash":"10452051e966f3051456226b78d1e11b","dbhash":"10452051e966f3051456226b78d1e11b","update":false},{"name":"dict.atu_countries","module":"dict","type":"select","hash":"c7368a1b9c10350e5709872d933a6ffb","dbhash":"c7368a1b9c10350e5709872d933a6ffb","update":false},{"name":"dict.atu_type","module":"dict","type":"select","hash":"376a4e7a7e77d5f9ee865b8a1fb25e07","dbhash":"376a4e7a7e77d5f9ee865b8a1fb25e07","update":false},{"name":"dict.community","module":"dict","type":"select","hash":"deb128826eb03dbca6762f058f49e980","dbhash":"deb128826eb03dbca6762f058f49e980","update":false},{"name":"dict.country_location","module":"dict","type":"select","hash":"333f3f56fc1a9f79f176f509d8aeca53","dbhash":"333f3f56fc1a9f79f176f509d8aeca53","update":false},{"name":"dict.district","module":"dict","type":"select","hash":"0d3a18d3fe4e6329567f5ba5cc360d53","dbhash":"0d3a18d3fe4e6329567f5ba5cc360d53","update":false},{"name":"dict.existence","module":"dict","type":"select","hash":"781bb2394e4f5eee87cbaf6ff1cc358e","dbhash":"781bb2394e4f5eee87cbaf6ff1cc358e","update":false},{"name":"dict.foreign_country","module":"dict","type":"select","hash":"dd4d5c31a9eea9abd538acdb952e99e9","dbhash":"dd4d5c31a9eea9abd538acdb952e99e9","update":false},{"name":"dict.info_source","module":"dict","type":"select","hash":"0ae17d8e43740078dea206cc7949151f","dbhash":"0ae17d8e43740078dea206cc7949151f","update":false},{"name":"dict.language","module":"dict","type":"select","hash":"fd1826c9ca150ef93bd251b923d6094e","dbhash":"fd1826c9ca150ef93bd251b923d6094e","update":false},{"name":"dict.object_type.adm","module":"dict","type":"select","hash":"0faeff4dc1c1f60996efe614d44a6e5f","dbhash":"0faeff4dc1c1f60996efe614d44a6e5f","update":false},{"name":"dict.object_type.geo","module":"dict","type":"select","hash":"34b82095969396e8a8497f93cda3dcc5","dbhash":"34b82095969396e8a8497f93cda3dcc5","update":false},{"name":"dict.object_type.pzf","module":"dict","type":"select","hash":"df2c1ced6405602aa8f262e437ac5062","dbhash":"df2c1ced6405602aa8f262e437ac5062","update":false},{"name":"dict.object_type.soc","module":"dict","type":"select","hash":"d60d3f993acb76e5782e4a3046756858","dbhash":"d60d3f993acb76e5782e4a3046756858","update":false},{"name":"dict.object_type","module":"dict","type":"select","hash":"9630e32f344f33580d5a90e305bf5cf2","dbhash":"9630e32f344f33580d5a90e305bf5cf2","update":false},{"name":"dict.region","module":"dict","type":"select","hash":"c1e0b38f520a004726694109398d5544","dbhash":"c1e0b38f520a004726694109398d5544","update":false},{"name":"dict.settlement_type","module":"dict","type":"select","hash":"49261c87bf6cd01e4ab32f65c94b5dbf","dbhash":"49261c87bf6cd01e4ab32f65c94b5dbf","update":false},{"name":"dict.source","module":"dict","type":"select","hash":"ac2bf8aca5c819e42b6529c73a7e1cb5","dbhash":"ac2bf8aca5c819e42b6529c73a7e1cb5","update":false},{"name":"dict.source_name","module":"dict","type":"select","hash":"9550cb3ad87783d7528c3c440be50a89","dbhash":"9550cb3ad87783d7528c3c440be50a89","update":false},{"name":"dict.source_type","module":"dict","type":"select","hash":"fee4eb12cd50344d2de7c49290238501","dbhash":"fee4eb12cd50344d2de7c49290238501","update":false},{"name":"core.accounts","module":"settings","type":"select","hash":"36eef3856f46bc0eecb61a6f911ced2e","dbhash":"36eef3856f46bc0eecb61a6f911ced2e","update":false},{"name":"core.menu_id","module":"settings","type":"select","hash":"3b08d360628afa15339f364f5e2ff211","dbhash":"3b08d360628afa15339f364f5e2ff211","update":false},{"name":"core.roles","module":"settings","type":"select","hash":"ed1290380ea5e5e7e48bd08b41cb7793","dbhash":"ed1290380ea5e5e7e48bd08b41cb7793","update":false},{"name":"core.routes.alias","module":"settings","type":"select","hash":"ac6afe9a8ebaf0b26236c4bae5297709","dbhash":"ac6afe9a8ebaf0b26236c4bae5297709","update":false},{"name":"core.routes","module":"settings","type":"select","hash":"306bddbe5b73b0628728a60f5335aaee","dbhash":"306bddbe5b73b0628728a60f5335aaee","update":false},{"name":"core.rules","module":"settings","type":"select","hash":"a86085f579f4abff5cf09e775e034ed3","dbhash":"a86085f579f4abff5cf09e775e034ed3","update":false},{"name":"core.user_mentioned","module":"settings","type":"select","hash":"6687f073de73a3ec4b6e0811d9310e7e","dbhash":"6687f073de73a3ec4b6e0811d9310e7e","update":false},{"name":"core.user_uid","module":"settings","type":"select","hash":"45f7d8a57ecbca5b433be7937be51d5c","dbhash":"45f7d8a57ecbca5b433be7937be51d5c","update":false},{"name":"data.exist_flag","module":"data","type":"cls","hash":"4cc57ff8d055dd194b51a6937d70f04c","dbhash":"4cc57ff8d055dd194b51a6937d70f04c","update":false},{"name":"data.latitude_dir","module":"data","type":"cls","hash":"542cd461818ff655002fec7bf23dcdb1","dbhash":"542cd461818ff655002fec7bf23dcdb1","update":false},{"name":"data.longitude_dir","module":"data","type":"cls","hash":"39f5c0554eab4f34ae25312d8dfafa78","dbhash":"39f5c0554eab4f34ae25312d8dfafa78","update":false},{"name":"data._type","module":"data","type":"cls","hash":"588c9b704054165dc6977f1262bbfee7","dbhash":"588c9b704054165dc6977f1262bbfee7","update":false},{"name":"access_type","module":"settings","type":"cls","hash":"e02065dbaed2ccb437a1722c00ed3fab","dbhash":"e02065dbaed2ccb437a1722c00ed3fab","update":false},{"name":"change_type","module":"settings","type":"cls","hash":"0fcaac1864fc81b9760075836c1bb2ac","dbhash":"0fcaac1864fc81b9760075836c1bb2ac","update":false},{"name":"core.actions","module":"settings","type":"cls","hash":"17862ea92ef5ad846a284fd68b4ff1f7","dbhash":"17862ea92ef5ad846a284fd68b4ff1f7","update":false},{"name":"core.column_type","module":"settings","type":"cls","hash":"8004d1fc1876e6f5a096b4f40a7f3775","dbhash":"8004d1fc1876e6f5a096b4f40a7f3775","update":false},{"name":"core.scope","module":"settings","type":"cls","hash":"c274693f6c7e9849704bbf4c46334871","dbhash":"c274693f6c7e9849704bbf4c46334871","update":false},{"name":"properties.site_status","module":"settings","type":"cls","hash":"2c2980706c5afe8808000d971b304cc9","dbhash":"2c2980706c5afe8808000d971b304cc9","update":false},{"name":"properties.widget_status","module":"settings","type":"cls","hash":"232f321af15895a9b33953c9bd500043","dbhash":"232f321af15895a9b33953c9bd500043","update":false},{"name":"users.user_type","module":"settings","type":"cls","hash":"9f6a303d48d2d33c68dbcd8e72ad0e83","dbhash":"9f6a303d48d2d33c68dbcd8e72ad0e83","update":false},{"name":"yes_no","module":"settings","type":"cls","hash":"50c527053426248c20b0a2f112ff9046","dbhash":"50c527053426248c20b0a2f112ff9046","update":false}]
File without changes
@@ -21,13 +21,23 @@ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS link text;
21
21
  ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS author_id text;
22
22
  ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS entity_id text;
23
23
 
24
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS uid text;
25
24
  ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS files json;
26
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS cdate timestamp without time zone DEFAULT (now())::timestamp without time zone;
27
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_id text;
28
- ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS editor_date timestamp without time zone;
29
25
  ALTER TABLE crm.notifications ADD CONSTRAINT crm_notifications_pkey PRIMARY KEY (notification_id);
30
26
 
27
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS type text;
28
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS created_at timestamp without time zone DEFAULT (now())::timestamp without time zone;
29
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS updated_at timestamp without time zone DEFAULT (now())::timestamp without time zone;
30
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS created_by text;
31
+ ALTER TABLE crm.notifications ADD COLUMN IF NOT EXISTS updated_by text;
32
+
33
+ ALTER TABLE crm.notifications DROP COLUMN IF EXISTS cdate;
34
+ ALTER TABLE crm.notifications DROP COLUMN IF EXISTS editor_date;
35
+ ALTER TABLE crm.notifications DROP COLUMN IF EXISTS uid;
36
+ ALTER TABLE crm.notifications DROP COLUMN IF EXISTS editor_id;
37
+
38
+ ALTER TABLE crm.notifications ALTER COLUMN addressee_id SET NOT NULL;
39
+ ALTER TABLE crm.notifications ALTER COLUMN body SET NOT NULL;
40
+
31
41
  COMMENT ON COLUMN crm.notifications.addressee_id is 'ID користувача отримувача повідомлення';
32
42
  COMMENT ON COLUMN crm.notifications.read is 'Чи було повідомлення прочитане';
33
43
  COMMENT ON COLUMN crm.notifications.sent is 'Чи було повідомлення відправлене';
@@ -0,0 +1,12 @@
1
+ import { ExtendedPG } from "../../types/core.js";
2
+ export default function addUserNotification({ subject, body, link, addressee, author, entity, type, pg, }: {
3
+ subject?: string;
4
+ body: string;
5
+ link?: string;
6
+ addressee: string | number;
7
+ author: string | number;
8
+ entity?: string;
9
+ type?: string;
10
+ pg?: ExtendedPG;
11
+ }): Promise<any>;
12
+ //# sourceMappingURL=addNotification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addNotification.d.ts","sourceRoot":"","sources":["../../../../server/plugins/notifications/addNotification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAgB,MAAM,qBAAqB,CAAC;AAK/D,wBAA8B,mBAAmB,CAAC,EAChD,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,MAAM,EACN,MAAM,EACN,IAAI,EACJ,EAAqB,GACtB,EAAE;IACD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,UAAU,CAAC;CACjB,gBAgBA"}
@@ -0,0 +1,18 @@
1
+ import pgClients from "../pg/pgClients.js";
2
+ import dataInsert from "../crud/funcs/dataInsert.js";
3
+ export default async function addUserNotification({ subject, body, link, addressee, author, entity, type, pg = pgClients.client, }) {
4
+ const res = await dataInsert({
5
+ pg,
6
+ table: "crm.notifications",
7
+ data: {
8
+ subject,
9
+ body,
10
+ link,
11
+ addressee_id: addressee,
12
+ author_id: author,
13
+ entity_id: entity,
14
+ type,
15
+ },
16
+ });
17
+ return res?.rows?.[0] || {};
18
+ }
@@ -1,2 +1,2 @@
1
- export default function route(fastify: any, opt?: any): Promise<void>;
1
+ export default function route(fastify: any, opt?: any): void;
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/access/index.ts"],"names":[],"mappings":"AAUA,wBAA8B,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,iBAY9D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/access/index.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QAYxD"}
@@ -2,7 +2,7 @@ import accessGroup from "./controllers/access.group.js";
2
2
  import accessGroupPost from "./controllers/access.group.post.js";
3
3
  import accessInterface from "./controllers/access.interface.js";
4
4
  import { accessGroupPostSchema, accessGroupSchema, accessInterfaceSchema, } from "./schema.js";
5
- export default async function route(fastify, opt = {}) {
5
+ export default function route(fastify, opt = {}) {
6
6
  fastify.get("/access-group/:id", { schema: accessGroupSchema }, accessGroup);
7
7
  fastify.post("/access-group/:id", { schema: accessGroupPostSchema }, accessGroupPost);
8
8
  fastify.get("/access-interface/:name", { schema: accessInterfaceSchema }, accessInterface);
@@ -1,4 +1,4 @@
1
1
  import { FastifyInstance } from "fastify";
2
- declare function plugin(app: FastifyInstance, opt?: any): Promise<void>;
2
+ declare function plugin(app: FastifyInstance, opt?: any): void;
3
3
  export default plugin;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkC1C,iBAAe,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,GAAE,GAAQ,iBA8ExD;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkC1C,iBAAS,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,GAAE,GAAQ,QA8ElD;AAED,eAAe,MAAM,CAAC"}
@@ -20,7 +20,7 @@ import oauthAuthorize from "./controllers/jwt/authorize.js";
20
20
  import oauthToken from "./controllers/jwt/token.js";
21
21
  import qrCode from "./controllers/2factor/qrcode.js";
22
22
  const params = { config: { policy: "L0" } };
23
- async function plugin(app, opt = {}) {
23
+ function plugin(app, opt = {}) {
24
24
  if (opt.routes === false || config.auth?.customRoutes) {
25
25
  return;
26
26
  }
@@ -1,3 +1,3 @@
1
- declare function plugin(app: any, opt?: any): Promise<void>;
1
+ declare function plugin(app: any, opt?: any): void;
2
2
  export default plugin;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/cron/index.ts"],"names":[],"mappings":"AAUA,iBAAe,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,iBAM5C;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/cron/index.ts"],"names":[],"mappings":"AAUA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QAMtC;AAED,eAAe,MAAM,CAAC"}