@opengis/admin 0.4.33 → 0.4.35
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/README.md +97 -97
 - package/dist/{add-page-OMFiDtpe.js → add-page-GMWte58m.js} +1 -1
 - package/dist/{admin-interface-CbuB55Fp.js → admin-interface-TLM61JNF.js} +23 -26
 - package/dist/{admin-view-CAmlI6sN.js → admin-view-BKD-rKqQ.js} +28 -33
 - package/dist/admin.js +1 -1
 - package/dist/admin.umd.cjs +54 -54
 - package/dist/assets/logo.svg +41 -41
 - package/dist/{card-view-DCL2Y7Hd.js → card-view-CwkJ9Qg2.js} +1 -1
 - package/dist/{edit-page-CEyRUTE5.js → edit-page-C_igWB2a.js} +1 -1
 - package/dist/{import-file-BLgU6k4_.js → import-file-2iB1izw1.js} +9654 -9556
 - package/dist/{profile-page-B82nN_fd.js → profile-page-Cuy6hkl8.js} +1 -1
 - package/dist/style.css +1 -1
 - package/module/settings/card/admin.accounts.table/index.yml +7 -7
 - package/module/settings/card/admin.accounts.table/rules.hbs +18 -18
 - package/module/settings/card/admin.accounts.table/users.hbs +13 -13
 - package/module/settings/card/admin.routes.table/groups.hbs +11 -11
 - package/module/settings/card/admin.routes.table/users.hbs +16 -16
 - package/module/settings/cls/core.actions.json +17 -17
 - package/module/settings/cls/core.scope.json +13 -13
 - package/module/settings/cls/properties.site_status.json +13 -13
 - package/module/settings/cls/properties.widget_status.json +13 -13
 - package/module/settings/cls/yes_no.json +11 -11
 - package/module/settings/form/admin.accounts.form.json +13 -13
 - package/module/settings/form/admin.properties.form.json +15 -15
 - package/module/settings/form/admin.roles.form.json +21 -21
 - package/module/settings/form/admin.user_properties.form.json +15 -15
 - package/module/settings/form/admin.user_roles_card.form.json +13 -13
 - package/module/settings/interface/admin.properties.json +4 -4
 - package/module/settings/interface/admin.roles.json +4 -4
 - package/module/settings/interface/admin.routes.json +4 -4
 - package/module/settings/interface/admin.users.json +4 -4
 - package/module/settings/select/core.routes.sql +1 -1
 - package/module/settings/select/core.user_mentioned.sql +1 -1
 - package/module/settings/select/core.user_uid.sql +1 -1
 - package/module/settings/table/admin.properties.table.json +39 -39
 - package/module/settings/table/admin.user_properties.table.json +34 -34
 - package/package.json +2 -2
 - package/server/helpers/core/coalesce.js +7 -7
 - package/server/helpers/core/select.js +48 -48
 - package/server/helpers/core/token.js +18 -18
 - package/server/helpers/list/buttonHelper.js +21 -21
 - package/server/helpers/list/utils/button.js +5 -5
 - package/server/helpers/temp/contentList.js +58 -58
 - package/server/helpers/temp/ifCond.js +101 -101
 - package/server/helpers/utils/button.js +5 -5
 - package/server/helpers/utils/mdToHTML.js +17 -17
 - package/server/plugins/cron.js +10 -10
 - package/server/plugins/docs.js +28 -28
 - package/server/plugins/hook.js +4 -4
 - package/server/routes/calendar/controllers/calendar.data.js +124 -124
 - package/server/routes/calendar/index.mjs +7 -7
 - package/server/routes/notifications/controllers/readNotifications.js +18 -18
 - package/server/routes/notifications/controllers/testEmail.js +35 -35
 - package/server/routes/notifications/controllers/userNotifications.js +53 -53
 - package/server/routes/notifications/hook/onWidgetSet.js +56 -56
 - package/server/routes/notifications/index.mjs +26 -26
 - package/server/routes/root.mjs +3 -3
 - package/server/routes/user/controllers/user.cls.id.js +14 -14
 - package/server/routes/user/controllers/user.cls.js +72 -72
 - package/server/routes/user/controllers/user.info.js +17 -17
 - package/server/templates/cls/itree.recrzone_category.json +73 -73
 - package/server/templates/cls/test.json +9 -9
 - package/server/templates/form/admin.user_cls.data.form.json +49 -49
 - package/server/templates/form/admin.user_group_rel.form.json +21 -21
 - package/server/templates/form/form-user-pass.json +10 -10
 - package/server/templates/form/form-user_group.json +39 -39
 - package/server/templates/form/form-users.json +156 -156
 - package/server/templates/form/user_group_access.form.json +22 -22
 - package/server/templates/select/account_id.json +2 -2
 - package/server/templates/table/gis.dataset.table.json +43 -43
 - package/server/templates/table/management.user_group.table.json +112 -112
 - package/server/templates/table/management.users.table.json +126 -126
 - package/server/utils/addNotification.js +21 -21
 - package/server/utils/sendNotification.js +89 -89
 
| 
         @@ -1,89 +1,89 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            import { handlebars, pgClients, getTemplate, getRedis, logger } from '@opengis/fastify-table/utils.js';
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            import sendEmail from './sendEmail.js';
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            // eslint-disable-next-line max-len, no-control-regex
         
     | 
| 
       6 
     | 
    
         
            -
            const emailReg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            const rclient = getRedis();
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            async function generateNotificationContent({
         
     | 
| 
       11 
     | 
    
         
            -
              pg, table, template, id, message, data: data1,
         
     | 
| 
       12 
     | 
    
         
            -
            }) {
         
     | 
| 
       13 
     | 
    
         
            -
              if (template) {
         
     | 
| 
       14 
     | 
    
         
            -
                const data = table && id ? await pg.one(`select * from ${table} where ${pg.pk[table]}=$1`, [id]) : data1;
         
     | 
| 
       15 
     | 
    
         
            -
                // console.log(data);
         
     | 
| 
       16 
     | 
    
         
            -
                const body = await getTemplate('pt', template);
         
     | 
| 
       17 
     | 
    
         
            -
                // console.log(body);
         
     | 
| 
       18 
     | 
    
         
            -
                const html = handlebars.compile(body || template || 'template not found')(data || {});
         
     | 
| 
       19 
     | 
    
         
            -
                // console.log(html);
         
     | 
| 
       20 
     | 
    
         
            -
                return html;
         
     | 
| 
       21 
     | 
    
         
            -
              }
         
     | 
| 
       22 
     | 
    
         
            -
              return message;
         
     | 
| 
       23 
     | 
    
         
            -
            }
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            // to do: refactor fastify-file to remove funcs completely
         
     | 
| 
       26 
     | 
    
         
            -
            export default async function notification({
         
     | 
| 
       27 
     | 
    
         
            -
              pg = pgClients.client,
         
     | 
| 
       28 
     | 
    
         
            -
              provider = ['email'],
         
     | 
| 
       29 
     | 
    
         
            -
              from,
         
     | 
| 
       30 
     | 
    
         
            -
              to,
         
     | 
| 
       31 
     | 
    
         
            -
              template,
         
     | 
| 
       32 
     | 
    
         
            -
              table,
         
     | 
| 
       33 
     | 
    
         
            -
              message,
         
     | 
| 
       34 
     | 
    
         
            -
              title,
         
     | 
| 
       35 
     | 
    
         
            -
              file,
         
     | 
| 
       36 
     | 
    
         
            -
              data,
         
     | 
| 
       37 
     | 
    
         
            -
              id,
         
     | 
| 
       38 
     | 
    
         
            -
              nocache,
         
     | 
| 
       39 
     | 
    
         
            -
            }) {
         
     | 
| 
       40 
     | 
    
         
            -
              if (pg?.readonly) {
         
     | 
| 
       41 
     | 
    
         
            -
                return null;
         
     | 
| 
       42 
     | 
    
         
            -
              }
         
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
              const keyTo = `${pg.options?.database}:mail:${provider[0]}:${to || ''}${id || ''}${table || ''}${title || ''}`;
         
     | 
| 
       45 
     | 
    
         
            -
              const uniqueTo = await rclient.setnx(keyTo, 1);
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
              if (!uniqueTo && !nocache) {
         
     | 
| 
       48 
     | 
    
         
            -
                logger.file('notification/sent', { keyTo, send: uniqueTo, nocache });
         
     | 
| 
       49 
     | 
    
         
            -
                return `already sent: ${keyTo}`;
         
     | 
| 
       50 
     | 
    
         
            -
              }
         
     | 
| 
       51 
     | 
    
         
            -
              await rclient.expire(keyTo, 1000 * 600);
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
              if (!to.length) {
         
     | 
| 
       54 
     | 
    
         
            -
                return null;
         
     | 
| 
       55 
     | 
    
         
            -
              }
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
              if (!(Array.isArray(provider) && provider.length)) {
         
     | 
| 
       58 
     | 
    
         
            -
                return 'notification provider - must be array and not empty';
         
     | 
| 
       59 
     | 
    
         
            -
              }
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
              const html = await generateNotificationContent({
         
     | 
| 
       62 
     | 
    
         
            -
                pg, table, template, id, message, data,
         
     | 
| 
       63 
     | 
    
         
            -
              });
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
              if (provider.includes('email')) {
         
     | 
| 
       66 
     | 
    
         
            -
                const files = Array.isArray(file) ? file : [file];
         
     | 
| 
       67 
     | 
    
         
            -
                const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
         
     | 
| 
       68 
     | 
    
         
            -
                  /* const content = await downloadFile(el, { buffer: true }); // ?
         
     | 
| 
       69 
     | 
    
         
            -
                  return {
         
     | 
| 
       70 
     | 
    
         
            -
                    filename: el.split('/').pop(),
         
     | 
| 
       71 
     | 
    
         
            -
                    encoding: 'base64',
         
     | 
| 
       72 
     | 
    
         
            -
                    content,
         
     | 
| 
       73 
     | 
    
         
            -
                  }; */
         
     | 
| 
       74 
     | 
    
         
            -
                })) : [];
         
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                const toEmail = Array.isArray(to) ? to.map((emails) => emails.match(emailReg)?.join(',')) : to;
         
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
                const result = await sendEmail({
         
     | 
| 
       79 
     | 
    
         
            -
                  attachments,
         
     | 
| 
       80 
     | 
    
         
            -
                  html,
         
     | 
| 
       81 
     | 
    
         
            -
                  subject: title,
         
     | 
| 
       82 
     | 
    
         
            -
                  from,
         
     | 
| 
       83 
     | 
    
         
            -
                  to: toEmail,
         
     | 
| 
       84 
     | 
    
         
            -
                });
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                return result;
         
     | 
| 
       87 
     | 
    
         
            -
              }
         
     | 
| 
       88 
     | 
    
         
            -
              return null;
         
     | 
| 
       89 
     | 
    
         
            -
            }
         
     | 
| 
      
 1 
     | 
    
         
            +
            import { handlebars, pgClients, getTemplate, getRedis, logger } from '@opengis/fastify-table/utils.js';
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            import sendEmail from './sendEmail.js';
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            // eslint-disable-next-line max-len, no-control-regex
         
     | 
| 
      
 6 
     | 
    
         
            +
            const emailReg = /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/g;
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            const rclient = getRedis();
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            async function generateNotificationContent({
         
     | 
| 
      
 11 
     | 
    
         
            +
              pg, table, template, id, message, data: data1,
         
     | 
| 
      
 12 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 13 
     | 
    
         
            +
              if (template) {
         
     | 
| 
      
 14 
     | 
    
         
            +
                const data = table && id ? await pg.one(`select * from ${table} where ${pg.pk[table]}=$1`, [id]) : data1;
         
     | 
| 
      
 15 
     | 
    
         
            +
                // console.log(data);
         
     | 
| 
      
 16 
     | 
    
         
            +
                const body = await getTemplate('pt', template);
         
     | 
| 
      
 17 
     | 
    
         
            +
                // console.log(body);
         
     | 
| 
      
 18 
     | 
    
         
            +
                const html = handlebars.compile(body || template || 'template not found')(data || {});
         
     | 
| 
      
 19 
     | 
    
         
            +
                // console.log(html);
         
     | 
| 
      
 20 
     | 
    
         
            +
                return html;
         
     | 
| 
      
 21 
     | 
    
         
            +
              }
         
     | 
| 
      
 22 
     | 
    
         
            +
              return message;
         
     | 
| 
      
 23 
     | 
    
         
            +
            }
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            // to do: refactor fastify-file to remove funcs completely
         
     | 
| 
      
 26 
     | 
    
         
            +
            export default async function notification({
         
     | 
| 
      
 27 
     | 
    
         
            +
              pg = pgClients.client,
         
     | 
| 
      
 28 
     | 
    
         
            +
              provider = ['email'],
         
     | 
| 
      
 29 
     | 
    
         
            +
              from,
         
     | 
| 
      
 30 
     | 
    
         
            +
              to,
         
     | 
| 
      
 31 
     | 
    
         
            +
              template,
         
     | 
| 
      
 32 
     | 
    
         
            +
              table,
         
     | 
| 
      
 33 
     | 
    
         
            +
              message,
         
     | 
| 
      
 34 
     | 
    
         
            +
              title,
         
     | 
| 
      
 35 
     | 
    
         
            +
              file,
         
     | 
| 
      
 36 
     | 
    
         
            +
              data,
         
     | 
| 
      
 37 
     | 
    
         
            +
              id,
         
     | 
| 
      
 38 
     | 
    
         
            +
              nocache,
         
     | 
| 
      
 39 
     | 
    
         
            +
            }) {
         
     | 
| 
      
 40 
     | 
    
         
            +
              if (pg?.readonly) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                return null;
         
     | 
| 
      
 42 
     | 
    
         
            +
              }
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
              const keyTo = `${pg.options?.database}:mail:${provider[0]}:${to || ''}${id || ''}${table || ''}${title || ''}`;
         
     | 
| 
      
 45 
     | 
    
         
            +
              const uniqueTo = await rclient.setnx(keyTo, 1);
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
              if (!uniqueTo && !nocache) {
         
     | 
| 
      
 48 
     | 
    
         
            +
                logger.file('notification/sent', { keyTo, send: uniqueTo, nocache });
         
     | 
| 
      
 49 
     | 
    
         
            +
                return `already sent: ${keyTo}`;
         
     | 
| 
      
 50 
     | 
    
         
            +
              }
         
     | 
| 
      
 51 
     | 
    
         
            +
              await rclient.expire(keyTo, 1000 * 600);
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
              if (!to.length) {
         
     | 
| 
      
 54 
     | 
    
         
            +
                return null;
         
     | 
| 
      
 55 
     | 
    
         
            +
              }
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
              if (!(Array.isArray(provider) && provider.length)) {
         
     | 
| 
      
 58 
     | 
    
         
            +
                return 'notification provider - must be array and not empty';
         
     | 
| 
      
 59 
     | 
    
         
            +
              }
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
              const html = await generateNotificationContent({
         
     | 
| 
      
 62 
     | 
    
         
            +
                pg, table, template, id, message, data,
         
     | 
| 
      
 63 
     | 
    
         
            +
              });
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
              if (provider.includes('email')) {
         
     | 
| 
      
 66 
     | 
    
         
            +
                const files = Array.isArray(file) ? file : [file];
         
     | 
| 
      
 67 
     | 
    
         
            +
                const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
         
     | 
| 
      
 68 
     | 
    
         
            +
                  /* const content = await downloadFile(el, { buffer: true }); // ?
         
     | 
| 
      
 69 
     | 
    
         
            +
                  return {
         
     | 
| 
      
 70 
     | 
    
         
            +
                    filename: el.split('/').pop(),
         
     | 
| 
      
 71 
     | 
    
         
            +
                    encoding: 'base64',
         
     | 
| 
      
 72 
     | 
    
         
            +
                    content,
         
     | 
| 
      
 73 
     | 
    
         
            +
                  }; */
         
     | 
| 
      
 74 
     | 
    
         
            +
                })) : [];
         
     | 
| 
      
 75 
     | 
    
         
            +
             
     | 
| 
      
 76 
     | 
    
         
            +
                const toEmail = Array.isArray(to) ? to.map((emails) => emails.match(emailReg)?.join(',')) : to;
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                const result = await sendEmail({
         
     | 
| 
      
 79 
     | 
    
         
            +
                  attachments,
         
     | 
| 
      
 80 
     | 
    
         
            +
                  html,
         
     | 
| 
      
 81 
     | 
    
         
            +
                  subject: title,
         
     | 
| 
      
 82 
     | 
    
         
            +
                  from,
         
     | 
| 
      
 83 
     | 
    
         
            +
                  to: toEmail,
         
     | 
| 
      
 84 
     | 
    
         
            +
                });
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                return result;
         
     | 
| 
      
 87 
     | 
    
         
            +
              }
         
     | 
| 
      
 88 
     | 
    
         
            +
              return null;
         
     | 
| 
      
 89 
     | 
    
         
            +
            }
         
     |