@budibase/server 2.7.16-alpha.0 → 2.7.18
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/builder/assets/{index.55a50076.js → index.8b4ed657.js} +342 -342
- package/builder/assets/{index.2e9069f3.css → index.d9b46807.css} +1 -1
- package/builder/bblogo.png +0 -0
- package/builder/fonts/remixicon.css +2317 -0
- package/builder/fonts/remixicon.eot +0 -0
- package/builder/fonts/remixicon.less +2319 -0
- package/builder/fonts/remixicon.svg +6835 -0
- package/builder/fonts/remixicon.symbol.svg +11356 -0
- package/builder/fonts/remixicon.ttf +0 -0
- package/builder/fonts/remixicon.woff +0 -0
- package/builder/fonts/remixicon.woff2 +0 -0
- package/builder/fonts/source-sans-pro/200-italic.css +69 -0
- package/builder/fonts/source-sans-pro/200.css +69 -0
- package/builder/fonts/source-sans-pro/300-italic.css +69 -0
- package/builder/fonts/source-sans-pro/300.css +69 -0
- package/builder/fonts/source-sans-pro/400-italic.css +69 -0
- package/builder/fonts/source-sans-pro/400.css +69 -0
- package/builder/fonts/source-sans-pro/600-italic.css +69 -0
- package/builder/fonts/source-sans-pro/600.css +69 -0
- package/builder/fonts/source-sans-pro/700-italic.css +69 -0
- package/builder/fonts/source-sans-pro/700.css +69 -0
- package/builder/fonts/source-sans-pro/900-italic.css +69 -0
- package/builder/fonts/source-sans-pro/900.css +69 -0
- package/builder/fonts/source-sans-pro/CHANGELOG.md +2 -0
- package/builder/fonts/source-sans-pro/LICENSE +93 -0
- package/builder/fonts/source-sans-pro/README.md +47 -0
- package/builder/fonts/source-sans-pro/cyrillic-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-200.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-300.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-400.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-600.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-700.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-900.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-200.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-300.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-400.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-600.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-700.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-900.css +8 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext-italic.css +53 -0
- package/builder/fonts/source-sans-pro/cyrillic-ext.css +53 -0
- package/builder/fonts/source-sans-pro/cyrillic-italic.css +53 -0
- package/builder/fonts/source-sans-pro/cyrillic.css +53 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-cyrillic-ext-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-greek-ext-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-latin-ext-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-200-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-200-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-200-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-200-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-300-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-300-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-300-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-300-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-400-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-400-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-400-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-400-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-600-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-600-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-600-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-600-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-700-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-700-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-700-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-700-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-900-italic.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-900-italic.woff2 +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-900-normal.woff +0 -0
- package/builder/fonts/source-sans-pro/files/source-sans-pro-vietnamese-900-normal.woff2 +0 -0
- package/builder/fonts/source-sans-pro/greek-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-200.css +8 -0
- package/builder/fonts/source-sans-pro/greek-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-300.css +8 -0
- package/builder/fonts/source-sans-pro/greek-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-400.css +8 -0
- package/builder/fonts/source-sans-pro/greek-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-600.css +8 -0
- package/builder/fonts/source-sans-pro/greek-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-700.css +8 -0
- package/builder/fonts/source-sans-pro/greek-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-900.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-200.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-300.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-400.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-600.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-700.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-900.css +8 -0
- package/builder/fonts/source-sans-pro/greek-ext-italic.css +53 -0
- package/builder/fonts/source-sans-pro/greek-ext.css +53 -0
- package/builder/fonts/source-sans-pro/greek-italic.css +53 -0
- package/builder/fonts/source-sans-pro/greek.css +53 -0
- package/builder/fonts/source-sans-pro/index.css +69 -0
- package/builder/fonts/source-sans-pro/latin-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-200.css +8 -0
- package/builder/fonts/source-sans-pro/latin-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-300.css +8 -0
- package/builder/fonts/source-sans-pro/latin-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-400.css +8 -0
- package/builder/fonts/source-sans-pro/latin-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-600.css +8 -0
- package/builder/fonts/source-sans-pro/latin-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-700.css +8 -0
- package/builder/fonts/source-sans-pro/latin-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-900.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-200.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-300.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-400.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-600.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-700.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-900.css +8 -0
- package/builder/fonts/source-sans-pro/latin-ext-italic.css +53 -0
- package/builder/fonts/source-sans-pro/latin-ext.css +53 -0
- package/builder/fonts/source-sans-pro/latin-italic.css +53 -0
- package/builder/fonts/source-sans-pro/latin.css +53 -0
- package/builder/fonts/source-sans-pro/metadata.json +27 -0
- package/builder/fonts/source-sans-pro/package.json +30 -0
- package/builder/fonts/source-sans-pro/scss/metadata.scss +22 -0
- package/builder/fonts/source-sans-pro/scss/mixins.scss +184 -0
- package/builder/fonts/source-sans-pro/unicode.json +9 -0
- package/builder/fonts/source-sans-pro/vietnamese-200-italic.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-200.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-300-italic.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-300.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-400-italic.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-400.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-600-italic.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-600.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-700-italic.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-700.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-900-italic.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-900.css +8 -0
- package/builder/fonts/source-sans-pro/vietnamese-italic.css +53 -0
- package/builder/fonts/source-sans-pro/vietnamese.css +53 -0
- package/builder/index.html +6 -5
- package/dist/{BudibaseApp-Y5NZEDTC.svelte → BudibaseApp-6SC4MY4W.svelte} +6 -11
- package/dist/automation.js +655 -862
- package/dist/automation.js.map +3 -3
- package/dist/index.js +970 -1185
- package/dist/index.js.map +3 -3
- package/dist/preview.hbs +4 -10
- package/dist/query.js +842 -998
- package/dist/query.js.map +3 -3
- package/package.json +11 -11
- package/src/api/controllers/backup.ts +8 -22
- package/src/api/controllers/datasource.ts +24 -41
- package/src/api/controllers/role.ts +5 -5
- package/src/api/controllers/routing.ts +3 -3
- package/src/api/controllers/row/ExternalRequest.ts +5 -1
- package/src/api/controllers/static/templates/BudibaseApp.svelte +6 -11
- package/src/api/controllers/static/templates/preview.hbs +4 -10
- package/src/api/routes/backup.ts +1 -1
- package/src/api/routes/tests/backup.spec.ts +2 -18
- package/src/automations/steps/sendSmtpEmail.ts +4 -55
- package/src/automations/tests/sendSmtpEmail.spec.js +71 -0
- package/src/events/docUpdates/syncUsers.ts +0 -4
- package/src/integrations/googlesheets.ts +18 -35
- package/src/integrations/mongodb.ts +2 -4
- package/src/integrations/mysql.ts +7 -2
- package/src/integrations/postgres.ts +1 -2
- package/src/integrations/tests/mysql.spec.ts +19 -1
- package/src/integrations/utils.ts +24 -0
- package/src/middleware/currentapp.ts +1 -1
- package/src/sdk/app/backups/exports.ts +5 -33
- package/src/sdk/app/backups/imports.ts +1 -21
- package/src/sdk/app/datasources/datasources.ts +0 -1
- package/src/utilities/workerRequests.ts +9 -20
- package/src/automations/tests/sendSmtpEmail.spec.ts +0 -74
package/dist/automation.js
CHANGED
|
@@ -11,8 +11,8 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
11
11
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
12
|
};
|
|
13
13
|
var __export = (target, all) => {
|
|
14
|
-
for (var
|
|
15
|
-
__defProp(target,
|
|
14
|
+
for (var name2 in all)
|
|
15
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
16
16
|
};
|
|
17
17
|
var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
@@ -671,13 +671,13 @@ var init_plan = __esm({
|
|
|
671
671
|
var isStaticQuota, isMonthlyQuota, isConstantQuota;
|
|
672
672
|
var init_quota = __esm({
|
|
673
673
|
"../types/src/sdk/licensing/quota.ts"() {
|
|
674
|
-
isStaticQuota = (quotaType, usageType,
|
|
674
|
+
isStaticQuota = (quotaType, usageType, name2) => {
|
|
675
675
|
return quotaType === "usage" /* USAGE */ && usageType === "static" /* STATIC */;
|
|
676
676
|
};
|
|
677
|
-
isMonthlyQuota = (quotaType, usageType,
|
|
677
|
+
isMonthlyQuota = (quotaType, usageType, name2) => {
|
|
678
678
|
return quotaType === "usage" /* USAGE */ && usageType === "monthly" /* MONTHLY */;
|
|
679
679
|
};
|
|
680
|
-
isConstantQuota = (quotaType,
|
|
680
|
+
isConstantQuota = (quotaType, name2) => {
|
|
681
681
|
return quotaType === "constant" /* CONSTANT */;
|
|
682
682
|
};
|
|
683
683
|
}
|
|
@@ -787,8 +787,8 @@ var init_locks = __esm({
|
|
|
787
787
|
var isDocument;
|
|
788
788
|
var init_db = __esm({
|
|
789
789
|
"../types/src/sdk/db.ts"() {
|
|
790
|
-
isDocument = (
|
|
791
|
-
return typeof
|
|
790
|
+
isDocument = (doc2) => {
|
|
791
|
+
return typeof doc2 === "object" && doc2._id && doc2._rev;
|
|
792
792
|
};
|
|
793
793
|
}
|
|
794
794
|
});
|
|
@@ -946,7 +946,6 @@ var init_automation2 = __esm({
|
|
|
946
946
|
AutomationIOType2["NUMBER"] = "number";
|
|
947
947
|
AutomationIOType2["ARRAY"] = "array";
|
|
948
948
|
AutomationIOType2["JSON"] = "json";
|
|
949
|
-
AutomationIOType2["DATE"] = "date";
|
|
950
949
|
return AutomationIOType2;
|
|
951
950
|
})(AutomationIOType || {});
|
|
952
951
|
AutomationCustomIOType = /* @__PURE__ */ ((AutomationCustomIOType2) => {
|
|
@@ -2065,12 +2064,12 @@ function getPouchDB(dbName, opts) {
|
|
|
2065
2064
|
checkInitialised();
|
|
2066
2065
|
const db2 = new Pouch(dbName, opts);
|
|
2067
2066
|
const dbPut = db2.put;
|
|
2068
|
-
db2.put = async (
|
|
2069
|
-
if (!
|
|
2070
|
-
|
|
2067
|
+
db2.put = async (doc2, options2 = {}) => {
|
|
2068
|
+
if (!doc2.createdAt) {
|
|
2069
|
+
doc2.createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2071
2070
|
}
|
|
2072
|
-
|
|
2073
|
-
return dbPut(
|
|
2071
|
+
doc2.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2072
|
+
return dbPut(doc2, options2);
|
|
2074
2073
|
};
|
|
2075
2074
|
db2.exists = async () => {
|
|
2076
2075
|
const info = await db2.info();
|
|
@@ -2240,7 +2239,7 @@ var init_DatabaseImpl = __esm({
|
|
|
2240
2239
|
}
|
|
2241
2240
|
return this.updateOutput(() => db2.get(id));
|
|
2242
2241
|
}
|
|
2243
|
-
async remove(idOrDoc,
|
|
2242
|
+
async remove(idOrDoc, rev2) {
|
|
2244
2243
|
const db2 = await this.checkSetup();
|
|
2245
2244
|
let _id;
|
|
2246
2245
|
let _rev;
|
|
@@ -2249,7 +2248,7 @@ var init_DatabaseImpl = __esm({
|
|
|
2249
2248
|
_rev = idOrDoc._rev;
|
|
2250
2249
|
} else {
|
|
2251
2250
|
_id = idOrDoc;
|
|
2252
|
-
_rev =
|
|
2251
|
+
_rev = rev2;
|
|
2253
2252
|
}
|
|
2254
2253
|
if (!_id || !_rev) {
|
|
2255
2254
|
throw new Error("Unable to remove doc without a valid _id and _rev.");
|
|
@@ -3513,18 +3512,18 @@ async function newRedlock(opts = {}) {
|
|
|
3513
3512
|
}
|
|
3514
3513
|
function getLockName(opts) {
|
|
3515
3514
|
const prefix = opts.systemLock ? "system" : getTenantId();
|
|
3516
|
-
let
|
|
3515
|
+
let name2 = `lock:${prefix}_${opts.name}`;
|
|
3517
3516
|
if (opts.resource) {
|
|
3518
|
-
|
|
3517
|
+
name2 = name2 + `_${opts.resource}`;
|
|
3519
3518
|
}
|
|
3520
|
-
return
|
|
3519
|
+
return name2;
|
|
3521
3520
|
}
|
|
3522
3521
|
async function doWithLock(opts, task) {
|
|
3523
3522
|
const redlock = await getClient(opts.type, opts.customOptions);
|
|
3524
3523
|
let lock;
|
|
3525
3524
|
try {
|
|
3526
|
-
const
|
|
3527
|
-
lock = await redlock.lock(
|
|
3525
|
+
const name2 = getLockName(opts);
|
|
3526
|
+
lock = await redlock.lock(name2, opts.ttl);
|
|
3528
3527
|
const result = await task();
|
|
3529
3528
|
return { executed: true, result };
|
|
3530
3529
|
} catch (e) {
|
|
@@ -4038,8 +4037,8 @@ var init_ids = __esm({
|
|
|
4038
4037
|
generateDevInfoID = (userId) => {
|
|
4039
4038
|
return `${"devinfo" /* DEV_INFO */}${SEPARATOR}${userId}`;
|
|
4040
4039
|
};
|
|
4041
|
-
generatePluginID = (
|
|
4042
|
-
return `${"plg" /* PLUGIN */}${SEPARATOR}${
|
|
4040
|
+
generatePluginID = (name2) => {
|
|
4041
|
+
return `${"plg" /* PLUGIN */}${SEPARATOR}${name2}`;
|
|
4043
4042
|
};
|
|
4044
4043
|
}
|
|
4045
4044
|
});
|
|
@@ -4129,8 +4128,8 @@ var init_params = __esm({
|
|
|
4129
4128
|
isDatasourceId = (id) => {
|
|
4130
4129
|
return id && id.startsWith(`${"datasource" /* DATASOURCE */}${SEPARATOR}`);
|
|
4131
4130
|
};
|
|
4132
|
-
getPluginParams = (
|
|
4133
|
-
return getDocParams("plg" /* PLUGIN */,
|
|
4131
|
+
getPluginParams = (pluginId2, otherProps = {}) => {
|
|
4132
|
+
return getDocParams("plg" /* PLUGIN */, pluginId2, otherProps);
|
|
4134
4133
|
};
|
|
4135
4134
|
}
|
|
4136
4135
|
});
|
|
@@ -4267,7 +4266,7 @@ function pagination(data2, pageSize, {
|
|
|
4267
4266
|
const hasNextPage = data2.length > pageSize;
|
|
4268
4267
|
let nextPage = void 0;
|
|
4269
4268
|
if (!getKey) {
|
|
4270
|
-
getKey = (
|
|
4269
|
+
getKey = (doc2) => property ? doc2 == null ? void 0 : doc2[property] : doc2 == null ? void 0 : doc2._id;
|
|
4271
4270
|
}
|
|
4272
4271
|
if (hasNextPage) {
|
|
4273
4272
|
nextPage = getKey(data2[pageSize]);
|
|
@@ -4485,8 +4484,8 @@ var init_Replication = __esm({
|
|
|
4485
4484
|
* @param {String} source - the DB you want to replicate or rollback to
|
|
4486
4485
|
* @param {String} target - the DB you want to replicate to, or rollback from
|
|
4487
4486
|
*/
|
|
4488
|
-
constructor({ source, target }) {
|
|
4489
|
-
this.source = getPouchDB(
|
|
4487
|
+
constructor({ source: source2, target }) {
|
|
4488
|
+
this.source = getPouchDB(source2);
|
|
4490
4489
|
this.target = getPouchDB(target);
|
|
4491
4490
|
}
|
|
4492
4491
|
close() {
|
|
@@ -4521,8 +4520,8 @@ var init_Replication = __esm({
|
|
|
4521
4520
|
}
|
|
4522
4521
|
appReplicateOpts() {
|
|
4523
4522
|
return {
|
|
4524
|
-
filter: (
|
|
4525
|
-
return
|
|
4523
|
+
filter: (doc2) => {
|
|
4524
|
+
return doc2._id !== "app_metadata" /* APP_METADATA */;
|
|
4526
4525
|
}
|
|
4527
4526
|
};
|
|
4528
4527
|
}
|
|
@@ -4703,9 +4702,9 @@ var init_lucene = __esm({
|
|
|
4703
4702
|
__privateSet(this, _indexBuilder, builderFn);
|
|
4704
4703
|
return this;
|
|
4705
4704
|
}
|
|
4706
|
-
setVersion(
|
|
4707
|
-
if (
|
|
4708
|
-
__privateSet(this, _version,
|
|
4705
|
+
setVersion(version2) {
|
|
4706
|
+
if (version2 != null) {
|
|
4707
|
+
__privateSet(this, _version, version2);
|
|
4709
4708
|
}
|
|
4710
4709
|
return this;
|
|
4711
4710
|
}
|
|
@@ -5289,36 +5288,36 @@ async function populateFromDB2(appId) {
|
|
|
5289
5288
|
{ skip_setup: true }
|
|
5290
5289
|
);
|
|
5291
5290
|
}
|
|
5292
|
-
function isInvalid(
|
|
5293
|
-
return !
|
|
5291
|
+
function isInvalid(metadata2) {
|
|
5292
|
+
return !metadata2 || metadata2.state === AppState.INVALID;
|
|
5294
5293
|
}
|
|
5295
5294
|
async function getAppMetadata(appId) {
|
|
5296
5295
|
const client3 = await getAppClient();
|
|
5297
|
-
let
|
|
5298
|
-
if (!
|
|
5296
|
+
let metadata2 = await client3.get(appId);
|
|
5297
|
+
if (!metadata2) {
|
|
5299
5298
|
let expiry = EXPIRY_SECONDS2;
|
|
5300
5299
|
try {
|
|
5301
|
-
|
|
5300
|
+
metadata2 = await populateFromDB2(appId);
|
|
5302
5301
|
} catch (err) {
|
|
5303
5302
|
if (err && err.status === 404) {
|
|
5304
|
-
|
|
5303
|
+
metadata2 = { state: AppState.INVALID };
|
|
5305
5304
|
expiry = void 0;
|
|
5306
5305
|
} else {
|
|
5307
5306
|
throw err;
|
|
5308
5307
|
}
|
|
5309
5308
|
}
|
|
5310
|
-
if (isInvalid(
|
|
5309
|
+
if (isInvalid(metadata2)) {
|
|
5311
5310
|
const temp = await client3.get(appId);
|
|
5312
5311
|
if (temp) {
|
|
5313
|
-
|
|
5312
|
+
metadata2 = temp;
|
|
5314
5313
|
}
|
|
5315
5314
|
}
|
|
5316
|
-
await client3.store(appId,
|
|
5315
|
+
await client3.store(appId, metadata2, expiry);
|
|
5317
5316
|
}
|
|
5318
|
-
if (isInvalid(
|
|
5317
|
+
if (isInvalid(metadata2)) {
|
|
5319
5318
|
throw { status: 404, message: "No app metadata found" };
|
|
5320
5319
|
}
|
|
5321
|
-
return
|
|
5320
|
+
return metadata2;
|
|
5322
5321
|
}
|
|
5323
5322
|
async function invalidateAppMetadata(appId, newMetadata) {
|
|
5324
5323
|
if (!appId) {
|
|
@@ -5357,18 +5356,18 @@ async function getCache() {
|
|
|
5357
5356
|
function makeCacheKey(db2, key) {
|
|
5358
5357
|
return db2.name + key;
|
|
5359
5358
|
}
|
|
5360
|
-
function makeCacheItem(
|
|
5361
|
-
return { doc, lastWrite: lastWrite || Date.now() };
|
|
5359
|
+
function makeCacheItem(doc2, lastWrite = null) {
|
|
5360
|
+
return { doc: doc2, lastWrite: lastWrite || Date.now() };
|
|
5362
5361
|
}
|
|
5363
|
-
async function put(db2,
|
|
5364
|
-
const
|
|
5365
|
-
const key =
|
|
5362
|
+
async function put(db2, doc2, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
5363
|
+
const cache2 = await getCache();
|
|
5364
|
+
const key = doc2._id;
|
|
5366
5365
|
let cacheItem;
|
|
5367
5366
|
if (key) {
|
|
5368
|
-
cacheItem = await
|
|
5367
|
+
cacheItem = await cache2.get(makeCacheKey(db2, key));
|
|
5369
5368
|
}
|
|
5370
5369
|
const updateDb = !cacheItem || cacheItem.lastWrite < Date.now() - writeRateMs;
|
|
5371
|
-
let output =
|
|
5370
|
+
let output = doc2;
|
|
5372
5371
|
if (updateDb) {
|
|
5373
5372
|
const lockResponse = await doWithLock(
|
|
5374
5373
|
{
|
|
@@ -5381,13 +5380,13 @@ async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
|
5381
5380
|
const writeDb = async (toWrite) => {
|
|
5382
5381
|
const response2 = await db2.put(toWrite, { force: true });
|
|
5383
5382
|
output = {
|
|
5384
|
-
...
|
|
5383
|
+
...doc2,
|
|
5385
5384
|
_id: response2.id,
|
|
5386
5385
|
_rev: response2.rev
|
|
5387
5386
|
};
|
|
5388
5387
|
};
|
|
5389
5388
|
try {
|
|
5390
|
-
await writeDb(
|
|
5389
|
+
await writeDb(doc2);
|
|
5391
5390
|
} catch (err) {
|
|
5392
5391
|
if (err.status !== 409) {
|
|
5393
5392
|
throw err;
|
|
@@ -5403,32 +5402,32 @@ async function put(db2, doc, writeRateMs = DEFAULT_WRITE_RATE_MS) {
|
|
|
5403
5402
|
}
|
|
5404
5403
|
cacheItem = makeCacheItem(output, updateDb ? null : cacheItem == null ? void 0 : cacheItem.lastWrite);
|
|
5405
5404
|
if (output._id) {
|
|
5406
|
-
await
|
|
5405
|
+
await cache2.store(makeCacheKey(db2, output._id), cacheItem);
|
|
5407
5406
|
}
|
|
5408
5407
|
return { ok: true, id: output._id, rev: output._rev };
|
|
5409
5408
|
}
|
|
5410
5409
|
async function get2(db2, id) {
|
|
5411
|
-
const
|
|
5410
|
+
const cache2 = await getCache();
|
|
5412
5411
|
const cacheKey = makeCacheKey(db2, id);
|
|
5413
|
-
let cacheItem = await
|
|
5412
|
+
let cacheItem = await cache2.get(cacheKey);
|
|
5414
5413
|
if (!cacheItem) {
|
|
5415
|
-
const
|
|
5416
|
-
cacheItem = makeCacheItem(
|
|
5417
|
-
await
|
|
5414
|
+
const doc2 = await db2.get(id);
|
|
5415
|
+
cacheItem = makeCacheItem(doc2);
|
|
5416
|
+
await cache2.store(cacheKey, cacheItem);
|
|
5418
5417
|
}
|
|
5419
5418
|
return cacheItem.doc;
|
|
5420
5419
|
}
|
|
5421
|
-
async function remove(db2, docOrId,
|
|
5422
|
-
const
|
|
5420
|
+
async function remove(db2, docOrId, rev2) {
|
|
5421
|
+
const cache2 = await getCache();
|
|
5423
5422
|
if (!docOrId) {
|
|
5424
5423
|
throw new Error("No ID/Rev provided.");
|
|
5425
5424
|
}
|
|
5426
5425
|
const id = typeof docOrId === "string" ? docOrId : docOrId._id;
|
|
5427
|
-
|
|
5426
|
+
rev2 = typeof docOrId === "string" ? rev2 : docOrId._rev;
|
|
5428
5427
|
try {
|
|
5429
|
-
await
|
|
5428
|
+
await cache2.delete(makeCacheKey(db2, id));
|
|
5430
5429
|
} finally {
|
|
5431
|
-
await db2.remove(id,
|
|
5430
|
+
await db2.remove(id, rev2);
|
|
5432
5431
|
}
|
|
5433
5432
|
}
|
|
5434
5433
|
var DEFAULT_WRITE_RATE_MS, CACHE, Writethrough;
|
|
@@ -5446,14 +5445,14 @@ var init_writethrough = __esm({
|
|
|
5446
5445
|
this.db = db2;
|
|
5447
5446
|
this.writeRateMs = writeRateMs;
|
|
5448
5447
|
}
|
|
5449
|
-
async put(
|
|
5450
|
-
return put(this.db,
|
|
5448
|
+
async put(doc2) {
|
|
5449
|
+
return put(this.db, doc2, this.writeRateMs);
|
|
5451
5450
|
}
|
|
5452
5451
|
async get(id) {
|
|
5453
5452
|
return get2(this.db, id);
|
|
5454
5453
|
}
|
|
5455
|
-
async remove(docOrId,
|
|
5456
|
-
return remove(this.db, docOrId,
|
|
5454
|
+
async remove(docOrId, rev2) {
|
|
5455
|
+
return remove(this.db, docOrId, rev2);
|
|
5457
5456
|
}
|
|
5458
5457
|
};
|
|
5459
5458
|
}
|
|
@@ -5952,7 +5951,7 @@ var init_LoggingProcessor = __esm({
|
|
|
5952
5951
|
});
|
|
5953
5952
|
|
|
5954
5953
|
// ../backend-core/src/utils/hashing.ts
|
|
5955
|
-
async function
|
|
5954
|
+
async function hash2(data2) {
|
|
5956
5955
|
const salt = await bcrypt.genSalt(SALT_ROUNDS);
|
|
5957
5956
|
return bcrypt.hash(data2, salt);
|
|
5958
5957
|
}
|
|
@@ -6066,14 +6065,14 @@ function isValidInternalAPIKey(apiKey) {
|
|
|
6066
6065
|
}
|
|
6067
6066
|
return false;
|
|
6068
6067
|
}
|
|
6069
|
-
function getCookie(ctx,
|
|
6070
|
-
const cookie = ctx.cookies.get(
|
|
6068
|
+
function getCookie(ctx, name2) {
|
|
6069
|
+
const cookie = ctx.cookies.get(name2);
|
|
6071
6070
|
if (!cookie) {
|
|
6072
6071
|
return cookie;
|
|
6073
6072
|
}
|
|
6074
6073
|
return openJwt(cookie);
|
|
6075
6074
|
}
|
|
6076
|
-
function setCookie(ctx, value,
|
|
6075
|
+
function setCookie(ctx, value, name2 = "builder", opts = { sign: true }) {
|
|
6077
6076
|
if (value && opts && opts.sign) {
|
|
6078
6077
|
value = jwt.sign(value, environment_default2.JWT_SECRET);
|
|
6079
6078
|
}
|
|
@@ -6086,10 +6085,10 @@ function setCookie(ctx, value, name = "builder", opts = { sign: true }) {
|
|
|
6086
6085
|
if (environment_default2.COOKIE_DOMAIN) {
|
|
6087
6086
|
config.domain = environment_default2.COOKIE_DOMAIN;
|
|
6088
6087
|
}
|
|
6089
|
-
ctx.cookies.set(
|
|
6088
|
+
ctx.cookies.set(name2, value, config);
|
|
6090
6089
|
}
|
|
6091
|
-
function clearCookie(ctx,
|
|
6092
|
-
setCookie(ctx, null,
|
|
6090
|
+
function clearCookie(ctx, name2) {
|
|
6091
|
+
setCookie(ctx, null, name2);
|
|
6093
6092
|
}
|
|
6094
6093
|
function isClient(ctx) {
|
|
6095
6094
|
return ctx.headers["x-budibase-type" /* TYPE */] === "client";
|
|
@@ -6137,7 +6136,7 @@ __export(utils_exports2, {
|
|
|
6137
6136
|
compare: () => compare,
|
|
6138
6137
|
getAppIdFromCtx: () => getAppIdFromCtx,
|
|
6139
6138
|
getCookie: () => getCookie,
|
|
6140
|
-
hash: () =>
|
|
6139
|
+
hash: () => hash2,
|
|
6141
6140
|
isAudited: () => isAudited,
|
|
6142
6141
|
isClient: () => isClient,
|
|
6143
6142
|
isPublicApiRequest: () => isPublicApiRequest,
|
|
@@ -6180,8 +6179,8 @@ var init_inMemoryQueue = __esm({
|
|
|
6180
6179
|
* @param {object|null} opts This is not used by the in memory queue as there is no real use
|
|
6181
6180
|
* case when in memory, but is the same API as Bull
|
|
6182
6181
|
*/
|
|
6183
|
-
constructor(
|
|
6184
|
-
this._name =
|
|
6182
|
+
constructor(name2, opts = null) {
|
|
6183
|
+
this._name = name2;
|
|
6185
6184
|
this._opts = opts;
|
|
6186
6185
|
this._messages = [];
|
|
6187
6186
|
this._emitter = new import_events2.default.EventEmitter();
|
|
@@ -6678,13 +6677,13 @@ var init_installation = __esm({
|
|
|
6678
6677
|
}
|
|
6679
6678
|
);
|
|
6680
6679
|
};
|
|
6681
|
-
updateVersion = async (
|
|
6680
|
+
updateVersion = async (version2) => {
|
|
6682
6681
|
try {
|
|
6683
6682
|
await doWithDB(
|
|
6684
6683
|
StaticDatabases.PLATFORM_INFO.name,
|
|
6685
6684
|
async (platformDb) => {
|
|
6686
6685
|
const install = await getInstall();
|
|
6687
|
-
install.version =
|
|
6686
|
+
install.version = version2;
|
|
6688
6687
|
await platformDb.put(install);
|
|
6689
6688
|
await bustCache("installation" /* INSTALLATION */);
|
|
6690
6689
|
}
|
|
@@ -6800,13 +6799,13 @@ var init_identification2 = __esm({
|
|
|
6800
6799
|
const id = installId;
|
|
6801
6800
|
const type = "installation" /* INSTALLATION */;
|
|
6802
6801
|
const hosting = getHostingFromEnv();
|
|
6803
|
-
const
|
|
6802
|
+
const version2 = environment_default2.VERSION;
|
|
6804
6803
|
const environment3 = getDeploymentEnvironment();
|
|
6805
6804
|
const group2 = {
|
|
6806
6805
|
id,
|
|
6807
6806
|
type,
|
|
6808
6807
|
hosting,
|
|
6809
|
-
version,
|
|
6808
|
+
version: version2,
|
|
6810
6809
|
environment: environment3
|
|
6811
6810
|
};
|
|
6812
6811
|
await identifyGroup(group2, timestamp);
|
|
@@ -6986,10 +6985,10 @@ var init_backfill2 = __esm({
|
|
|
6986
6985
|
init_generic();
|
|
6987
6986
|
init_generic();
|
|
6988
6987
|
start = async (events2) => {
|
|
6989
|
-
const
|
|
6988
|
+
const metadata2 = {
|
|
6990
6989
|
eventWhitelist: events2
|
|
6991
6990
|
};
|
|
6992
|
-
return saveBackfillMetadata(
|
|
6991
|
+
return saveBackfillMetadata(metadata2);
|
|
6993
6992
|
};
|
|
6994
6993
|
recordEvent2 = async (event, properties) => {
|
|
6995
6994
|
const eventKey2 = getEventKey(event, properties);
|
|
@@ -7339,11 +7338,11 @@ var init_app5 = __esm({
|
|
|
7339
7338
|
});
|
|
7340
7339
|
|
|
7341
7340
|
// ../backend-core/src/events/publishers/auth.ts
|
|
7342
|
-
async function login(
|
|
7341
|
+
async function login(source2, email) {
|
|
7343
7342
|
const identity = await identification_default.getCurrentIdentity();
|
|
7344
7343
|
const properties = {
|
|
7345
7344
|
userId: identity.id,
|
|
7346
|
-
source,
|
|
7345
|
+
source: source2,
|
|
7347
7346
|
audited: {
|
|
7348
7347
|
email
|
|
7349
7348
|
}
|
|
@@ -8223,9 +8222,9 @@ var init_view3 = __esm({
|
|
|
8223
8222
|
});
|
|
8224
8223
|
|
|
8225
8224
|
// ../backend-core/src/events/publishers/installation.ts
|
|
8226
|
-
async function versionChecked(
|
|
8225
|
+
async function versionChecked(version2) {
|
|
8227
8226
|
const properties = {
|
|
8228
|
-
currentVersion:
|
|
8227
|
+
currentVersion: version2
|
|
8229
8228
|
};
|
|
8230
8229
|
await publishEvent("installation:version:checked" /* INSTALLATION_VERSION_CHECKED */, properties);
|
|
8231
8230
|
}
|
|
@@ -8468,13 +8467,13 @@ async function appBackupRestored(backup) {
|
|
|
8468
8467
|
};
|
|
8469
8468
|
await publishEvent("app:backup:restored" /* APP_BACKUP_RESTORED */, properties);
|
|
8470
8469
|
}
|
|
8471
|
-
async function appBackupTriggered(appId, backupId, type, trigger,
|
|
8470
|
+
async function appBackupTriggered(appId, backupId, type, trigger, name2) {
|
|
8472
8471
|
const properties = {
|
|
8473
8472
|
appId,
|
|
8474
8473
|
backupId,
|
|
8475
8474
|
type,
|
|
8476
8475
|
trigger,
|
|
8477
|
-
name
|
|
8476
|
+
name: name2
|
|
8478
8477
|
};
|
|
8479
8478
|
await publishEvent("app:backup:triggered" /* APP_BACKUP_TRIGGERED */, properties);
|
|
8480
8479
|
}
|
|
@@ -8491,16 +8490,16 @@ var init_backup4 = __esm({
|
|
|
8491
8490
|
});
|
|
8492
8491
|
|
|
8493
8492
|
// ../backend-core/src/events/publishers/environmentVariable.ts
|
|
8494
|
-
async function created14(
|
|
8493
|
+
async function created14(name2, environments) {
|
|
8495
8494
|
const properties = {
|
|
8496
|
-
name,
|
|
8495
|
+
name: name2,
|
|
8497
8496
|
environments
|
|
8498
8497
|
};
|
|
8499
8498
|
await publishEvent("environment_variable:created" /* ENVIRONMENT_VARIABLE_CREATED */, properties);
|
|
8500
8499
|
}
|
|
8501
|
-
async function deleted14(
|
|
8500
|
+
async function deleted14(name2) {
|
|
8502
8501
|
const properties = {
|
|
8503
|
-
name
|
|
8502
|
+
name: name2
|
|
8504
8503
|
};
|
|
8505
8504
|
await publishEvent("environment_variable:deleted" /* ENVIRONMENT_VARIABLE_DELETED */, properties);
|
|
8506
8505
|
}
|
|
@@ -8879,7 +8878,7 @@ var init_users4 = __esm({
|
|
|
8879
8878
|
let userList, property = "_id", getKey;
|
|
8880
8879
|
if (appId) {
|
|
8881
8880
|
userList = await searchGlobalUsersByApp(appId, opts);
|
|
8882
|
-
getKey = (
|
|
8881
|
+
getKey = (doc2) => getGlobalUserByAppPage(appId, doc2);
|
|
8883
8882
|
} else if (email) {
|
|
8884
8883
|
userList = await searchGlobalUsersByEmail(email, opts);
|
|
8885
8884
|
property = "email";
|
|
@@ -9029,7 +9028,7 @@ function lowerBuiltinRoleID(roleId1, roleId2) {
|
|
|
9029
9028
|
}
|
|
9030
9029
|
return builtinRoleToNumber(roleId1) > builtinRoleToNumber(roleId2) ? roleId2 : roleId1;
|
|
9031
9030
|
}
|
|
9032
|
-
async function getRole(roleId
|
|
9031
|
+
async function getRole(roleId) {
|
|
9033
9032
|
if (!roleId) {
|
|
9034
9033
|
return void 0;
|
|
9035
9034
|
}
|
|
@@ -9045,9 +9044,6 @@ async function getRole(roleId, opts) {
|
|
|
9045
9044
|
role = Object.assign(role, dbRole);
|
|
9046
9045
|
role._id = getExternalRoleID(role._id);
|
|
9047
9046
|
} catch (err) {
|
|
9048
|
-
if (!isBuiltin(roleId) && (opts == null ? void 0 : opts.defaultPublic)) {
|
|
9049
|
-
return cloneDeep2(BUILTIN_ROLES.PUBLIC);
|
|
9050
|
-
}
|
|
9051
9047
|
if (Object.keys(role).length === 0) {
|
|
9052
9048
|
throw err;
|
|
9053
9049
|
}
|
|
@@ -9187,10 +9183,10 @@ var init_roles = __esm({
|
|
|
9187
9183
|
BUILTIN_IDS.PUBLIC
|
|
9188
9184
|
];
|
|
9189
9185
|
Role2 = class {
|
|
9190
|
-
constructor(id,
|
|
9186
|
+
constructor(id, name2, permissionId) {
|
|
9191
9187
|
this.permissions = {};
|
|
9192
9188
|
this._id = id;
|
|
9193
|
-
this.name =
|
|
9189
|
+
this.name = name2;
|
|
9194
9190
|
this.permissionId = permissionId;
|
|
9195
9191
|
}
|
|
9196
9192
|
addInheritance(inherits) {
|
|
@@ -9556,12 +9552,12 @@ async function syncUser(user, details) {
|
|
|
9556
9552
|
if (details.profile) {
|
|
9557
9553
|
const profile = details.profile;
|
|
9558
9554
|
if (profile.name) {
|
|
9559
|
-
const
|
|
9560
|
-
if (
|
|
9561
|
-
firstName =
|
|
9555
|
+
const name2 = profile.name;
|
|
9556
|
+
if (name2.givenName) {
|
|
9557
|
+
firstName = name2.givenName;
|
|
9562
9558
|
}
|
|
9563
|
-
if (
|
|
9564
|
-
lastName =
|
|
9559
|
+
if (name2.familyName) {
|
|
9560
|
+
lastName = name2.familyName;
|
|
9565
9561
|
}
|
|
9566
9562
|
}
|
|
9567
9563
|
pictureUrl = await getProfilePictureUrl(user, details);
|
|
@@ -9788,8 +9784,8 @@ async function preAuth(passport2, ctx, next) {
|
|
|
9788
9784
|
callbackUrl,
|
|
9789
9785
|
ssoSaveUserNoOp
|
|
9790
9786
|
);
|
|
9791
|
-
if (!ctx.query.appId) {
|
|
9792
|
-
ctx.throw(400, "appId query
|
|
9787
|
+
if (!ctx.query.appId || !ctx.query.datasourceId) {
|
|
9788
|
+
ctx.throw(400, "appId and datasourceId query params not present.");
|
|
9793
9789
|
}
|
|
9794
9790
|
return passport2.authenticate(strategy, {
|
|
9795
9791
|
scope: ["profile", "email", "https://www.googleapis.com/auth/spreadsheets"],
|
|
@@ -9809,7 +9805,7 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9809
9805
|
clientSecret: config.clientSecret,
|
|
9810
9806
|
callbackURL: callbackUrl
|
|
9811
9807
|
},
|
|
9812
|
-
(accessToken, refreshToken,
|
|
9808
|
+
(accessToken, refreshToken, profile, done) => {
|
|
9813
9809
|
clearCookie(ctx, "budibase:datasourceauth" /* DatasourceAuth */);
|
|
9814
9810
|
done(null, { accessToken, refreshToken });
|
|
9815
9811
|
}
|
|
@@ -9817,14 +9813,22 @@ async function postAuth(passport2, ctx, next) {
|
|
|
9817
9813
|
{ successRedirect: "/", failureRedirect: "/error" },
|
|
9818
9814
|
async (err, tokens) => {
|
|
9819
9815
|
const baseUrl = `/builder/app/${authStateCookie.appId}/data`;
|
|
9820
|
-
|
|
9821
|
-
|
|
9822
|
-
|
|
9823
|
-
|
|
9824
|
-
|
|
9816
|
+
await doWithDB(authStateCookie.appId, async (db2) => {
|
|
9817
|
+
let datasource2;
|
|
9818
|
+
try {
|
|
9819
|
+
datasource2 = await db2.get(authStateCookie.datasourceId);
|
|
9820
|
+
} catch (err2) {
|
|
9821
|
+
if (err2.status === 404) {
|
|
9822
|
+
ctx.redirect(baseUrl);
|
|
9823
|
+
}
|
|
9825
9824
|
}
|
|
9826
|
-
|
|
9827
|
-
|
|
9825
|
+
if (!datasource2.config) {
|
|
9826
|
+
datasource2.config = {};
|
|
9827
|
+
}
|
|
9828
|
+
datasource2.config.auth = { type: "google", ...tokens };
|
|
9829
|
+
await db2.put(datasource2);
|
|
9830
|
+
ctx.redirect(`${baseUrl}/datasource/${authStateCookie.datasourceId}`);
|
|
9831
|
+
});
|
|
9828
9832
|
}
|
|
9829
9833
|
)(ctx, next);
|
|
9830
9834
|
}
|
|
@@ -9833,9 +9837,9 @@ var init_google2 = __esm({
|
|
|
9833
9837
|
"../backend-core/src/middleware/passport/datasource/google.ts"() {
|
|
9834
9838
|
init_google();
|
|
9835
9839
|
init_constants2();
|
|
9836
|
-
init_configs3();
|
|
9837
|
-
init_cache();
|
|
9838
9840
|
init_utils5();
|
|
9841
|
+
init_db5();
|
|
9842
|
+
init_configs3();
|
|
9839
9843
|
init_sso2();
|
|
9840
9844
|
GoogleStrategy2 = require("passport-google-oauth").OAuth2Strategy;
|
|
9841
9845
|
}
|
|
@@ -9885,9 +9889,7 @@ var encryption_exports = {};
|
|
|
9885
9889
|
__export(encryption_exports, {
|
|
9886
9890
|
SecretOption: () => SecretOption,
|
|
9887
9891
|
decrypt: () => decrypt,
|
|
9888
|
-
decryptFile: () => decryptFile,
|
|
9889
9892
|
encrypt: () => encrypt,
|
|
9890
|
-
encryptFile: () => encryptFile,
|
|
9891
9893
|
getSecret: () => getSecret
|
|
9892
9894
|
});
|
|
9893
9895
|
function getSecret(secretOption) {
|
|
@@ -9908,11 +9910,11 @@ function getSecret(secretOption) {
|
|
|
9908
9910
|
}
|
|
9909
9911
|
return secret;
|
|
9910
9912
|
}
|
|
9911
|
-
function stretchString(
|
|
9912
|
-
return import_crypto.default.pbkdf2Sync(
|
|
9913
|
+
function stretchString(string, salt) {
|
|
9914
|
+
return import_crypto.default.pbkdf2Sync(string, salt, ITERATIONS, STRETCH_LENGTH, "sha512");
|
|
9913
9915
|
}
|
|
9914
9916
|
function encrypt(input, secretOption = "api" /* API */) {
|
|
9915
|
-
const salt = import_crypto.default.randomBytes(
|
|
9917
|
+
const salt = import_crypto.default.randomBytes(RANDOM_BYTES);
|
|
9916
9918
|
const stretched = stretchString(getSecret(secretOption), salt);
|
|
9917
9919
|
const cipher = import_crypto.default.createCipheriv(ALGO, stretched, salt);
|
|
9918
9920
|
const base = cipher.update(input);
|
|
@@ -9929,101 +9931,16 @@ function decrypt(input, secretOption = "api" /* API */) {
|
|
|
9929
9931
|
const final = decipher.final();
|
|
9930
9932
|
return Buffer.concat([base, final]).toString();
|
|
9931
9933
|
}
|
|
9932
|
-
|
|
9933
|
-
const outputFileName = `${filename}.enc`;
|
|
9934
|
-
const filePath = (0, import_path2.join)(dir, filename);
|
|
9935
|
-
const inputFile = import_fs2.default.createReadStream(filePath);
|
|
9936
|
-
const outputFile = import_fs2.default.createWriteStream((0, import_path2.join)(dir, outputFileName));
|
|
9937
|
-
const salt = import_crypto.default.randomBytes(SALT_LENGTH);
|
|
9938
|
-
const iv = import_crypto.default.randomBytes(IV_LENGTH);
|
|
9939
|
-
const stretched = stretchString(secret, salt);
|
|
9940
|
-
const cipher = import_crypto.default.createCipheriv(ALGO, stretched, iv);
|
|
9941
|
-
outputFile.write(salt);
|
|
9942
|
-
outputFile.write(iv);
|
|
9943
|
-
inputFile.pipe(import_zlib.default.createGzip()).pipe(cipher).pipe(outputFile);
|
|
9944
|
-
return new Promise((r) => {
|
|
9945
|
-
outputFile.on("finish", () => {
|
|
9946
|
-
r({
|
|
9947
|
-
filename: outputFileName,
|
|
9948
|
-
dir
|
|
9949
|
-
});
|
|
9950
|
-
});
|
|
9951
|
-
});
|
|
9952
|
-
}
|
|
9953
|
-
async function getSaltAndIV(path2) {
|
|
9954
|
-
const fileStream = import_fs2.default.createReadStream(path2);
|
|
9955
|
-
const salt = await readBytes(fileStream, SALT_LENGTH);
|
|
9956
|
-
const iv = await readBytes(fileStream, IV_LENGTH);
|
|
9957
|
-
fileStream.close();
|
|
9958
|
-
return { salt, iv };
|
|
9959
|
-
}
|
|
9960
|
-
async function decryptFile(inputPath, outputPath, secret) {
|
|
9961
|
-
const { salt, iv } = await getSaltAndIV(inputPath);
|
|
9962
|
-
const inputFile = import_fs2.default.createReadStream(inputPath, {
|
|
9963
|
-
start: SALT_LENGTH + IV_LENGTH
|
|
9964
|
-
});
|
|
9965
|
-
const outputFile = import_fs2.default.createWriteStream(outputPath);
|
|
9966
|
-
const stretched = stretchString(secret, salt);
|
|
9967
|
-
const decipher = import_crypto.default.createDecipheriv(ALGO, stretched, iv);
|
|
9968
|
-
const unzip = import_zlib.default.createGunzip();
|
|
9969
|
-
inputFile.pipe(decipher).pipe(unzip).pipe(outputFile);
|
|
9970
|
-
return new Promise((res, rej) => {
|
|
9971
|
-
outputFile.on("finish", () => {
|
|
9972
|
-
outputFile.close();
|
|
9973
|
-
res();
|
|
9974
|
-
});
|
|
9975
|
-
inputFile.on("error", (e) => {
|
|
9976
|
-
outputFile.close();
|
|
9977
|
-
rej(e);
|
|
9978
|
-
});
|
|
9979
|
-
decipher.on("error", (e) => {
|
|
9980
|
-
outputFile.close();
|
|
9981
|
-
rej(e);
|
|
9982
|
-
});
|
|
9983
|
-
unzip.on("error", (e) => {
|
|
9984
|
-
outputFile.close();
|
|
9985
|
-
rej(e);
|
|
9986
|
-
});
|
|
9987
|
-
outputFile.on("error", (e) => {
|
|
9988
|
-
outputFile.close();
|
|
9989
|
-
rej(e);
|
|
9990
|
-
});
|
|
9991
|
-
});
|
|
9992
|
-
}
|
|
9993
|
-
function readBytes(stream3, length) {
|
|
9994
|
-
return new Promise((resolve3, reject) => {
|
|
9995
|
-
let bytesRead = 0;
|
|
9996
|
-
const data2 = [];
|
|
9997
|
-
stream3.on("readable", () => {
|
|
9998
|
-
let chunk;
|
|
9999
|
-
while ((chunk = stream3.read(length - bytesRead)) !== null) {
|
|
10000
|
-
data2.push(chunk);
|
|
10001
|
-
bytesRead += chunk.length;
|
|
10002
|
-
}
|
|
10003
|
-
resolve3(Buffer.concat(data2));
|
|
10004
|
-
});
|
|
10005
|
-
stream3.on("end", () => {
|
|
10006
|
-
reject(new Error("Insufficient data in the stream."));
|
|
10007
|
-
});
|
|
10008
|
-
stream3.on("error", (error) => {
|
|
10009
|
-
reject(error);
|
|
10010
|
-
});
|
|
10011
|
-
});
|
|
10012
|
-
}
|
|
10013
|
-
var import_crypto, import_fs2, import_zlib, import_path2, ALGO, SEPARATOR3, ITERATIONS, STRETCH_LENGTH, SALT_LENGTH, IV_LENGTH, SecretOption;
|
|
9934
|
+
var import_crypto, ALGO, SEPARATOR3, ITERATIONS, RANDOM_BYTES, STRETCH_LENGTH, SecretOption;
|
|
10014
9935
|
var init_encryption = __esm({
|
|
10015
9936
|
"../backend-core/src/security/encryption.ts"() {
|
|
10016
9937
|
import_crypto = __toESM(require("crypto"));
|
|
10017
|
-
import_fs2 = __toESM(require("fs"));
|
|
10018
|
-
import_zlib = __toESM(require("zlib"));
|
|
10019
9938
|
init_environment3();
|
|
10020
|
-
import_path2 = require("path");
|
|
10021
9939
|
ALGO = "aes-256-ctr";
|
|
10022
9940
|
SEPARATOR3 = "-";
|
|
10023
9941
|
ITERATIONS = 1e4;
|
|
9942
|
+
RANDOM_BYTES = 16;
|
|
10024
9943
|
STRETCH_LENGTH = 32;
|
|
10025
|
-
SALT_LENGTH = 16;
|
|
10026
|
-
IV_LENGTH = 16;
|
|
10027
9944
|
SecretOption = /* @__PURE__ */ ((SecretOption2) => {
|
|
10028
9945
|
SecretOption2["API"] = "api";
|
|
10029
9946
|
SecretOption2["ENCRYPTION"] = "encryption";
|
|
@@ -10156,7 +10073,7 @@ function authenticated_default(noAuthPatterns = [], opts = {
|
|
|
10156
10073
|
const noAuthOptions = noAuthPatterns ? buildMatcherRegex(noAuthPatterns) : [];
|
|
10157
10074
|
return async (ctx, next) => {
|
|
10158
10075
|
let publicEndpoint = false;
|
|
10159
|
-
const
|
|
10076
|
+
const version2 = ctx.request.headers["x-budibase-api-version" /* API_VER */];
|
|
10160
10077
|
const found = matches(ctx, noAuthOptions);
|
|
10161
10078
|
if (found) {
|
|
10162
10079
|
publicEndpoint = true;
|
|
@@ -10219,7 +10136,7 @@ function authenticated_default(noAuthPatterns = [], opts = {
|
|
|
10219
10136
|
if (!authenticated) {
|
|
10220
10137
|
authenticated = false;
|
|
10221
10138
|
}
|
|
10222
|
-
finalise(ctx, { authenticated, user, internal, version, publicEndpoint });
|
|
10139
|
+
finalise(ctx, { authenticated, user, internal, version: version2, publicEndpoint });
|
|
10223
10140
|
if (user && user.email) {
|
|
10224
10141
|
return doInUserContext(user, ctx, next);
|
|
10225
10142
|
} else {
|
|
@@ -10234,7 +10151,7 @@ function authenticated_default(noAuthPatterns = [], opts = {
|
|
|
10234
10151
|
ctx.throw(403, err.message);
|
|
10235
10152
|
}
|
|
10236
10153
|
if (opts && opts.publicAllowed || publicEndpoint) {
|
|
10237
|
-
finalise(ctx, { authenticated: false, version, publicEndpoint });
|
|
10154
|
+
finalise(ctx, { authenticated: false, version: version2, publicEndpoint });
|
|
10238
10155
|
return next();
|
|
10239
10156
|
} else {
|
|
10240
10157
|
ctx.throw(err.status || 403, err);
|
|
@@ -10934,12 +10851,12 @@ var init_plugin4 = __esm({
|
|
|
10934
10851
|
function budibaseTempDir() {
|
|
10935
10852
|
return bbTmp;
|
|
10936
10853
|
}
|
|
10937
|
-
var
|
|
10854
|
+
var import_path2, import_os, import_fs2, ObjectStoreBuckets, bbTmp;
|
|
10938
10855
|
var init_utils8 = __esm({
|
|
10939
10856
|
"../backend-core/src/objectStore/utils.ts"() {
|
|
10940
|
-
|
|
10857
|
+
import_path2 = require("path");
|
|
10941
10858
|
import_os = require("os");
|
|
10942
|
-
|
|
10859
|
+
import_fs2 = __toESM(require("fs"));
|
|
10943
10860
|
init_environment3();
|
|
10944
10861
|
ObjectStoreBuckets = {
|
|
10945
10862
|
BACKUPS: environment_default2.BACKUPS_BUCKET_NAME,
|
|
@@ -10948,9 +10865,9 @@ var init_utils8 = __esm({
|
|
|
10948
10865
|
GLOBAL: environment_default2.GLOBAL_BUCKET_NAME,
|
|
10949
10866
|
PLUGINS: environment_default2.PLUGIN_BUCKET_NAME
|
|
10950
10867
|
};
|
|
10951
|
-
bbTmp = (0,
|
|
10952
|
-
if (!
|
|
10953
|
-
|
|
10868
|
+
bbTmp = (0, import_path2.join)((0, import_os.tmpdir)(), ".budibase");
|
|
10869
|
+
if (!import_fs2.default.existsSync(bbTmp)) {
|
|
10870
|
+
import_fs2.default.mkdirSync(bbTmp);
|
|
10954
10871
|
}
|
|
10955
10872
|
}
|
|
10956
10873
|
});
|
|
@@ -10962,17 +10879,17 @@ function sanitizeKey(input) {
|
|
|
10962
10879
|
function sanitizeBucket(input) {
|
|
10963
10880
|
return input.replace(new RegExp(APP_DEV_PREFIX, "g"), APP_PREFIX);
|
|
10964
10881
|
}
|
|
10965
|
-
var import_aws_sdk, import_stream, import_node_fetch6, import_tar_fs,
|
|
10882
|
+
var import_aws_sdk, import_stream, import_node_fetch6, import_tar_fs, import_zlib, import_util, import_path3, import_fs3, import_uuid3, sanitize, streamPipeline, STATE, CONTENT_TYPE_MAP, STRING_CONTENT_TYPES, ObjectStore, makeSureBucketExists, upload, streamUpload, retrieve, listAllObjects, getPresignedUrl, retrieveToTmp, retrieveDirectory, deleteFile, deleteFiles, deleteFolder, uploadDirectory, downloadTarballDirect, downloadTarball;
|
|
10966
10883
|
var init_objectStore = __esm({
|
|
10967
10884
|
"../backend-core/src/objectStore/objectStore.ts"() {
|
|
10968
10885
|
import_aws_sdk = __toESM(require("aws-sdk"));
|
|
10969
10886
|
import_stream = __toESM(require("stream"));
|
|
10970
10887
|
import_node_fetch6 = __toESM(require("node-fetch"));
|
|
10971
10888
|
import_tar_fs = __toESM(require("tar-fs"));
|
|
10972
|
-
|
|
10889
|
+
import_zlib = __toESM(require("zlib"));
|
|
10973
10890
|
import_util = require("util");
|
|
10974
|
-
|
|
10975
|
-
|
|
10891
|
+
import_path3 = require("path");
|
|
10892
|
+
import_fs3 = __toESM(require("fs"));
|
|
10976
10893
|
init_environment3();
|
|
10977
10894
|
init_utils8();
|
|
10978
10895
|
import_uuid3 = require("uuid");
|
|
@@ -11048,10 +10965,10 @@ var init_objectStore = __esm({
|
|
|
11048
10965
|
filename,
|
|
11049
10966
|
path: path2,
|
|
11050
10967
|
type,
|
|
11051
|
-
metadata
|
|
10968
|
+
metadata: metadata2
|
|
11052
10969
|
}) => {
|
|
11053
10970
|
const extension = filename.split(".").pop();
|
|
11054
|
-
const fileBytes =
|
|
10971
|
+
const fileBytes = import_fs3.default.readFileSync(path2);
|
|
11055
10972
|
const objectStore = ObjectStore(bucketName);
|
|
11056
10973
|
await makeSureBucketExists(objectStore, bucketName);
|
|
11057
10974
|
let contentType = type;
|
|
@@ -11064,13 +10981,13 @@ var init_objectStore = __esm({
|
|
|
11064
10981
|
Body: fileBytes,
|
|
11065
10982
|
ContentType: contentType
|
|
11066
10983
|
};
|
|
11067
|
-
if (
|
|
11068
|
-
for (let key of Object.keys(
|
|
11069
|
-
if (!
|
|
11070
|
-
delete
|
|
10984
|
+
if (metadata2 && typeof metadata2 === "object") {
|
|
10985
|
+
for (let key of Object.keys(metadata2)) {
|
|
10986
|
+
if (!metadata2[key] || typeof metadata2[key] !== "string") {
|
|
10987
|
+
delete metadata2[key];
|
|
11071
10988
|
}
|
|
11072
10989
|
}
|
|
11073
|
-
config.Metadata =
|
|
10990
|
+
config.Metadata = metadata2;
|
|
11074
10991
|
}
|
|
11075
10992
|
return objectStore.upload(config).promise();
|
|
11076
10993
|
};
|
|
@@ -11153,13 +11070,13 @@ var init_objectStore = __esm({
|
|
|
11153
11070
|
bucketName = sanitizeBucket(bucketName);
|
|
11154
11071
|
filepath = sanitizeKey(filepath);
|
|
11155
11072
|
const data2 = await retrieve(bucketName, filepath);
|
|
11156
|
-
const outputPath = (0,
|
|
11157
|
-
|
|
11073
|
+
const outputPath = (0, import_path3.join)(budibaseTempDir(), (0, import_uuid3.v4)());
|
|
11074
|
+
import_fs3.default.writeFileSync(outputPath, data2);
|
|
11158
11075
|
return outputPath;
|
|
11159
11076
|
};
|
|
11160
11077
|
retrieveDirectory = async (bucketName, path2) => {
|
|
11161
|
-
let writePath = (0,
|
|
11162
|
-
|
|
11078
|
+
let writePath = (0, import_path3.join)(budibaseTempDir(), (0, import_uuid3.v4)());
|
|
11079
|
+
import_fs3.default.mkdirSync(writePath);
|
|
11163
11080
|
const objects = await listAllObjects(bucketName, path2);
|
|
11164
11081
|
let fullObjects = await Promise.all(
|
|
11165
11082
|
objects.map((obj) => retrieve(bucketName, obj.Key))
|
|
@@ -11171,9 +11088,9 @@ var init_objectStore = __esm({
|
|
|
11171
11088
|
const possiblePath = filename.split("/");
|
|
11172
11089
|
if (possiblePath.length > 1) {
|
|
11173
11090
|
const dirs = possiblePath.slice(0, possiblePath.length - 1);
|
|
11174
|
-
|
|
11091
|
+
import_fs3.default.mkdirSync((0, import_path3.join)(writePath, ...dirs), { recursive: true });
|
|
11175
11092
|
}
|
|
11176
|
-
|
|
11093
|
+
import_fs3.default.writeFileSync((0, import_path3.join)(writePath, ...possiblePath), data2);
|
|
11177
11094
|
}
|
|
11178
11095
|
return writePath;
|
|
11179
11096
|
};
|
|
@@ -11224,21 +11141,21 @@ var init_objectStore = __esm({
|
|
|
11224
11141
|
return deleteFolder(bucketName, folder);
|
|
11225
11142
|
}
|
|
11226
11143
|
};
|
|
11227
|
-
uploadDirectory = async (bucketName, localPath,
|
|
11144
|
+
uploadDirectory = async (bucketName, localPath, bucketPath2) => {
|
|
11228
11145
|
bucketName = sanitizeBucket(bucketName);
|
|
11229
11146
|
let uploads = [];
|
|
11230
|
-
const
|
|
11231
|
-
for (let file of
|
|
11232
|
-
const path2 = sanitizeKey((0,
|
|
11233
|
-
const local = (0,
|
|
11147
|
+
const files2 = import_fs3.default.readdirSync(localPath, { withFileTypes: true });
|
|
11148
|
+
for (let file of files2) {
|
|
11149
|
+
const path2 = sanitizeKey((0, import_path3.join)(bucketPath2, file.name));
|
|
11150
|
+
const local = (0, import_path3.join)(localPath, file.name);
|
|
11234
11151
|
if (file.isDirectory()) {
|
|
11235
11152
|
uploads.push(uploadDirectory(bucketName, local, path2));
|
|
11236
11153
|
} else {
|
|
11237
|
-
uploads.push(streamUpload(bucketName, path2,
|
|
11154
|
+
uploads.push(streamUpload(bucketName, path2, import_fs3.default.createReadStream(local)));
|
|
11238
11155
|
}
|
|
11239
11156
|
}
|
|
11240
11157
|
await Promise.all(uploads);
|
|
11241
|
-
return
|
|
11158
|
+
return files2;
|
|
11242
11159
|
};
|
|
11243
11160
|
downloadTarballDirect = async (url, path2, headers = {}) => {
|
|
11244
11161
|
path2 = sanitizeKey(path2);
|
|
@@ -11246,7 +11163,7 @@ var init_objectStore = __esm({
|
|
|
11246
11163
|
if (!response2.ok) {
|
|
11247
11164
|
throw new Error(`unexpected response ${response2.statusText}`);
|
|
11248
11165
|
}
|
|
11249
|
-
await streamPipeline(response2.body,
|
|
11166
|
+
await streamPipeline(response2.body, import_zlib.default.createUnzip(), import_tar_fs.default.extract(path2));
|
|
11250
11167
|
};
|
|
11251
11168
|
downloadTarball = async (url, bucketName, path2) => {
|
|
11252
11169
|
bucketName = sanitizeBucket(bucketName);
|
|
@@ -11255,8 +11172,8 @@ var init_objectStore = __esm({
|
|
|
11255
11172
|
if (!response2.ok) {
|
|
11256
11173
|
throw new Error(`unexpected response ${response2.statusText}`);
|
|
11257
11174
|
}
|
|
11258
|
-
const tmpPath = (0,
|
|
11259
|
-
await streamPipeline(response2.body,
|
|
11175
|
+
const tmpPath = (0, import_path3.join)(budibaseTempDir(), path2);
|
|
11176
|
+
await streamPipeline(response2.body, import_zlib.default.createUnzip(), import_tar_fs.default.extract(tmpPath));
|
|
11260
11177
|
if (!environment_default2.isTest() && environment_default2.SELF_HOSTED) {
|
|
11261
11178
|
await uploadDirectory(bucketName, tmpPath, path2);
|
|
11262
11179
|
}
|
|
@@ -11312,12 +11229,12 @@ var init_app6 = __esm({
|
|
|
11312
11229
|
init_environment3();
|
|
11313
11230
|
init_objectStore();
|
|
11314
11231
|
init_cloudfront();
|
|
11315
|
-
clientLibraryUrl = (appId,
|
|
11232
|
+
clientLibraryUrl = (appId, version2) => {
|
|
11316
11233
|
if (environment_default2.isProd()) {
|
|
11317
11234
|
let file = `${sanitizeKey(appId)}/budibase-client.js`;
|
|
11318
11235
|
if (environment_default2.CLOUDFRONT_CDN) {
|
|
11319
|
-
if (
|
|
11320
|
-
file += `?v=${
|
|
11236
|
+
if (version2) {
|
|
11237
|
+
file += `?v=${version2}`;
|
|
11321
11238
|
}
|
|
11322
11239
|
return getUrl(file);
|
|
11323
11240
|
} else {
|
|
@@ -11345,8 +11262,8 @@ var init_global3 = __esm({
|
|
|
11345
11262
|
init_context2();
|
|
11346
11263
|
init_objectStore();
|
|
11347
11264
|
init_cloudfront();
|
|
11348
|
-
getGlobalFileUrl = (type,
|
|
11349
|
-
let file = getGlobalFileS3Key(type,
|
|
11265
|
+
getGlobalFileUrl = (type, name2, etag) => {
|
|
11266
|
+
let file = getGlobalFileS3Key(type, name2);
|
|
11350
11267
|
if (environment_default2.CLOUDFRONT_CDN) {
|
|
11351
11268
|
if (etag) {
|
|
11352
11269
|
file = `${file}?etag=${etag}`;
|
|
@@ -11356,8 +11273,8 @@ var init_global3 = __esm({
|
|
|
11356
11273
|
return getPresignedUrl(environment_default2.GLOBAL_BUCKET_NAME, file);
|
|
11357
11274
|
}
|
|
11358
11275
|
};
|
|
11359
|
-
getGlobalFileS3Key = (type,
|
|
11360
|
-
let file = `${type}/${
|
|
11276
|
+
getGlobalFileS3Key = (type, name2) => {
|
|
11277
|
+
let file = `${type}/${name2}`;
|
|
11361
11278
|
if (environment_default2.MULTI_TENANCY) {
|
|
11362
11279
|
const tenantId = getTenantId();
|
|
11363
11280
|
file = `${tenantId}/${file}`;
|
|
@@ -11407,11 +11324,11 @@ var init_plugins = __esm({
|
|
|
11407
11324
|
return getPluginS3Key(plugin, "plugin.min.js");
|
|
11408
11325
|
};
|
|
11409
11326
|
getPluginIconKey = (plugin) => {
|
|
11410
|
-
const
|
|
11411
|
-
if (!
|
|
11327
|
+
const iconFileName2 = plugin.iconUrl ? "icon.svg" : plugin.iconFileName;
|
|
11328
|
+
if (!iconFileName2) {
|
|
11412
11329
|
return;
|
|
11413
11330
|
}
|
|
11414
|
-
return getPluginS3Key(plugin,
|
|
11331
|
+
return getPluginS3Key(plugin, iconFileName2);
|
|
11415
11332
|
};
|
|
11416
11333
|
getPluginS3Key = (plugin, fileName) => {
|
|
11417
11334
|
const s3Key = getPluginS3Dir(plugin.name);
|
|
@@ -11842,11 +11759,11 @@ var init_utils9 = __esm({
|
|
|
11842
11759
|
}
|
|
11843
11760
|
usage.monthly.current = usage.monthly[currentMonth];
|
|
11844
11761
|
};
|
|
11845
|
-
getBreakdownName = (
|
|
11846
|
-
if (!id || !
|
|
11762
|
+
getBreakdownName = (name2, id) => {
|
|
11763
|
+
if (!id || !name2) {
|
|
11847
11764
|
return;
|
|
11848
11765
|
}
|
|
11849
|
-
switch (
|
|
11766
|
+
switch (name2) {
|
|
11850
11767
|
case "automations" /* AUTOMATIONS */:
|
|
11851
11768
|
return "automations" /* AUTOMATIONS */;
|
|
11852
11769
|
case "queries" /* QUERIES */:
|
|
@@ -11908,17 +11825,17 @@ var init_quotas2 = __esm({
|
|
|
11908
11825
|
delete usage.usageQuota.developers;
|
|
11909
11826
|
return usage;
|
|
11910
11827
|
};
|
|
11911
|
-
setUsage = async (value,
|
|
11912
|
-
return setAllUsage(
|
|
11828
|
+
setUsage = async (value, name2, type) => {
|
|
11829
|
+
return setAllUsage(name2, type, { total: value });
|
|
11913
11830
|
};
|
|
11914
|
-
setUsagePerApp = async (appValues,
|
|
11831
|
+
setUsagePerApp = async (appValues, name2, type) => {
|
|
11915
11832
|
const db2 = getDB2();
|
|
11916
11833
|
let quotaUsage = await getQuotaUsage();
|
|
11917
11834
|
const total = Object.values(appValues).reduce((sum, num) => sum + num, 0);
|
|
11918
11835
|
for (let [appId, value] of Object.entries(appValues)) {
|
|
11919
11836
|
quotaUsage = coreUsageUpdate(
|
|
11920
11837
|
quotaUsage,
|
|
11921
|
-
|
|
11838
|
+
name2,
|
|
11922
11839
|
type,
|
|
11923
11840
|
{
|
|
11924
11841
|
total,
|
|
@@ -11933,8 +11850,8 @@ var init_quotas2 = __esm({
|
|
|
11933
11850
|
quotaUsage._rev = response2.rev;
|
|
11934
11851
|
return quotaUsage;
|
|
11935
11852
|
};
|
|
11936
|
-
setBreakdown = (monthUsage,
|
|
11937
|
-
const breakdownName = getBreakdownName(
|
|
11853
|
+
setBreakdown = (monthUsage, name2, id, values) => {
|
|
11854
|
+
const breakdownName = getBreakdownName(name2, id);
|
|
11938
11855
|
if (!breakdownName || !(values == null ? void 0 : values.breakdown)) {
|
|
11939
11856
|
return monthUsage;
|
|
11940
11857
|
}
|
|
@@ -11943,7 +11860,7 @@ var init_quotas2 = __esm({
|
|
|
11943
11860
|
}
|
|
11944
11861
|
if (!monthUsage.breakdown[breakdownName]) {
|
|
11945
11862
|
monthUsage.breakdown[breakdownName] = {
|
|
11946
|
-
parent:
|
|
11863
|
+
parent: name2,
|
|
11947
11864
|
values: {}
|
|
11948
11865
|
};
|
|
11949
11866
|
}
|
|
@@ -11951,14 +11868,14 @@ var init_quotas2 = __esm({
|
|
|
11951
11868
|
breakdown.values[id] = values.breakdown;
|
|
11952
11869
|
return monthUsage;
|
|
11953
11870
|
};
|
|
11954
|
-
setAppUsageValue = (quotaUsage,
|
|
11871
|
+
setAppUsageValue = (quotaUsage, name2, type, opts = {}, values) => {
|
|
11955
11872
|
var _a;
|
|
11956
11873
|
let appId;
|
|
11957
11874
|
try {
|
|
11958
11875
|
appId = db_exports.getProdAppID((opts == null ? void 0 : opts.appId) || context_exports.getAppId());
|
|
11959
11876
|
} catch (err) {
|
|
11960
11877
|
}
|
|
11961
|
-
if (!appId || !values.app || !APP_QUOTA_NAMES.includes(
|
|
11878
|
+
if (!appId || !values.app || !APP_QUOTA_NAMES.includes(name2)) {
|
|
11962
11879
|
return quotaUsage;
|
|
11963
11880
|
}
|
|
11964
11881
|
if (!((_a = quotaUsage.apps) == null ? void 0 : _a[appId])) {
|
|
@@ -11970,11 +11887,11 @@ var init_quotas2 = __esm({
|
|
|
11970
11887
|
const appUsage = quotaUsage.apps[appId];
|
|
11971
11888
|
switch (type) {
|
|
11972
11889
|
case "static" /* STATIC */:
|
|
11973
|
-
appUsage.usageQuota[
|
|
11890
|
+
appUsage.usageQuota[name2] = values.app;
|
|
11974
11891
|
break;
|
|
11975
11892
|
case "monthly" /* MONTHLY */:
|
|
11976
11893
|
const currentMonth = getCurrentMonthString();
|
|
11977
|
-
const monthlyName =
|
|
11894
|
+
const monthlyName = name2;
|
|
11978
11895
|
let monthUsage = appUsage.monthly[currentMonth];
|
|
11979
11896
|
if (!monthUsage) {
|
|
11980
11897
|
appUsage.monthly[currentMonth] = generateNewMonthlyQuotas();
|
|
@@ -11988,9 +11905,9 @@ var init_quotas2 = __esm({
|
|
|
11988
11905
|
}
|
|
11989
11906
|
return quotaUsage;
|
|
11990
11907
|
};
|
|
11991
|
-
getAppUsageValue = (quotaUsage, type,
|
|
11908
|
+
getAppUsageValue = (quotaUsage, type, name2, id) => {
|
|
11992
11909
|
var _a, _b, _c, _d, _e;
|
|
11993
|
-
if (!APP_QUOTA_NAMES.includes(
|
|
11910
|
+
if (!APP_QUOTA_NAMES.includes(name2)) {
|
|
11994
11911
|
return {};
|
|
11995
11912
|
}
|
|
11996
11913
|
let appId;
|
|
@@ -12004,13 +11921,13 @@ var init_quotas2 = __esm({
|
|
|
12004
11921
|
const appUsage = quotaUsage.apps[appId];
|
|
12005
11922
|
switch (type) {
|
|
12006
11923
|
case "static" /* STATIC */:
|
|
12007
|
-
if ((_a = appUsage.usageQuota) == null ? void 0 : _a[
|
|
12008
|
-
return { app: appUsage.usageQuota[
|
|
11924
|
+
if ((_a = appUsage.usageQuota) == null ? void 0 : _a[name2]) {
|
|
11925
|
+
return { app: appUsage.usageQuota[name2] };
|
|
12009
11926
|
}
|
|
12010
11927
|
break;
|
|
12011
11928
|
case "monthly" /* MONTHLY */:
|
|
12012
11929
|
const currentMonth = getCurrentMonthString();
|
|
12013
|
-
const monthlyName =
|
|
11930
|
+
const monthlyName = name2;
|
|
12014
11931
|
if (!((_c = (_b = appUsage.monthly) == null ? void 0 : _b[currentMonth]) == null ? void 0 : _c[monthlyName])) {
|
|
12015
11932
|
break;
|
|
12016
11933
|
}
|
|
@@ -12025,68 +11942,68 @@ var init_quotas2 = __esm({
|
|
|
12025
11942
|
}
|
|
12026
11943
|
return { app: 0 };
|
|
12027
11944
|
};
|
|
12028
|
-
setStaticTriggers = (
|
|
11945
|
+
setStaticTriggers = (name2, quotaUsage, triggers) => {
|
|
12029
11946
|
if (!quotaUsage.usageQuota.triggers) {
|
|
12030
11947
|
quotaUsage.usageQuota.triggers = {};
|
|
12031
11948
|
}
|
|
12032
11949
|
if (triggers) {
|
|
12033
|
-
quotaUsage.usageQuota.triggers[
|
|
11950
|
+
quotaUsage.usageQuota.triggers[name2] = triggers;
|
|
12034
11951
|
}
|
|
12035
11952
|
};
|
|
12036
|
-
setMonthlyTriggers = (
|
|
11953
|
+
setMonthlyTriggers = (name2, currentMonth, quotaUsage, triggers) => {
|
|
12037
11954
|
if (!quotaUsage.monthly[currentMonth].triggers) {
|
|
12038
11955
|
quotaUsage.monthly[currentMonth].triggers = {};
|
|
12039
11956
|
}
|
|
12040
11957
|
if (triggers) {
|
|
12041
|
-
quotaUsage.monthly[currentMonth].triggers[
|
|
11958
|
+
quotaUsage.monthly[currentMonth].triggers[name2] = triggers;
|
|
12042
11959
|
}
|
|
12043
11960
|
};
|
|
12044
|
-
coreUsageUpdate = (quotaUsage,
|
|
11961
|
+
coreUsageUpdate = (quotaUsage, name2, type, values, opts = {}) => {
|
|
12045
11962
|
if (type === "static" /* STATIC */) {
|
|
12046
|
-
|
|
12047
|
-
quotaUsage.usageQuota[
|
|
12048
|
-
setStaticTriggers(
|
|
11963
|
+
name2 = name2;
|
|
11964
|
+
quotaUsage.usageQuota[name2] = values.total;
|
|
11965
|
+
setStaticTriggers(name2, quotaUsage, values.triggers);
|
|
12049
11966
|
} else if (type === "monthly" /* MONTHLY */) {
|
|
12050
|
-
|
|
11967
|
+
name2 = name2;
|
|
12051
11968
|
const currentMonth = getCurrentMonthString();
|
|
12052
|
-
quotaUsage.monthly[currentMonth][
|
|
12053
|
-
setMonthlyTriggers(
|
|
11969
|
+
quotaUsage.monthly[currentMonth][name2] = values.total;
|
|
11970
|
+
setMonthlyTriggers(name2, currentMonth, quotaUsage, values.triggers);
|
|
12054
11971
|
} else {
|
|
12055
11972
|
throw new Error(`Invalid usage type: ${type}`);
|
|
12056
11973
|
}
|
|
12057
|
-
return setAppUsageValue(quotaUsage,
|
|
11974
|
+
return setAppUsageValue(quotaUsage, name2, type, opts, values);
|
|
12058
11975
|
};
|
|
12059
|
-
setAllUsage = async (
|
|
11976
|
+
setAllUsage = async (name2, type, values, opts = {}) => {
|
|
12060
11977
|
const db2 = getDB2();
|
|
12061
11978
|
let quotaUsage = await getQuotaUsage();
|
|
12062
|
-
quotaUsage = coreUsageUpdate(quotaUsage,
|
|
11979
|
+
quotaUsage = coreUsageUpdate(quotaUsage, name2, type, values, opts);
|
|
12063
11980
|
const response2 = await db2.put(quotaUsage);
|
|
12064
11981
|
quotaUsage._rev = response2.rev;
|
|
12065
11982
|
return quotaUsage;
|
|
12066
11983
|
};
|
|
12067
|
-
getCurrentUsageValues = async (type,
|
|
11984
|
+
getCurrentUsageValues = async (type, name2, id) => {
|
|
12068
11985
|
const quotaUsage = await getQuotaUsage();
|
|
12069
11986
|
let total = 0, appValues = {};
|
|
12070
11987
|
switch (type) {
|
|
12071
11988
|
case "static" /* STATIC */:
|
|
12072
|
-
if (quotaUsage.usageQuota[
|
|
12073
|
-
const staticName =
|
|
11989
|
+
if (quotaUsage.usageQuota[name2]) {
|
|
11990
|
+
const staticName = name2;
|
|
12074
11991
|
total = quotaUsage.usageQuota[staticName];
|
|
12075
|
-
appValues = getAppUsageValue(quotaUsage, type,
|
|
11992
|
+
appValues = getAppUsageValue(quotaUsage, type, name2, id);
|
|
12076
11993
|
}
|
|
12077
11994
|
break;
|
|
12078
11995
|
case "monthly" /* MONTHLY */:
|
|
12079
11996
|
const currentMonth = getCurrentMonthString();
|
|
12080
|
-
const monthlyName =
|
|
11997
|
+
const monthlyName = name2;
|
|
12081
11998
|
if (quotaUsage.monthly[currentMonth][monthlyName]) {
|
|
12082
11999
|
total = quotaUsage.monthly[currentMonth][monthlyName];
|
|
12083
|
-
appValues = getAppUsageValue(quotaUsage, type,
|
|
12000
|
+
appValues = getAppUsageValue(quotaUsage, type, name2, id);
|
|
12084
12001
|
}
|
|
12085
12002
|
break;
|
|
12086
12003
|
default:
|
|
12087
12004
|
throw new Error(`Invalid usage type: ${type}`);
|
|
12088
12005
|
}
|
|
12089
|
-
if (APP_QUOTA_NAMES.includes(
|
|
12006
|
+
if (APP_QUOTA_NAMES.includes(name2) && !(appValues.app || appValues.breakdown)) {
|
|
12090
12007
|
appValues.app = appValues.app || 0;
|
|
12091
12008
|
appValues.breakdown = appValues.breakdown || 0;
|
|
12092
12009
|
}
|
|
@@ -12308,9 +12225,9 @@ async function getGroupUsers(groupId, params2) {
|
|
|
12308
12225
|
createGroupUserLookupView,
|
|
12309
12226
|
{ arrayResponse: true }
|
|
12310
12227
|
);
|
|
12311
|
-
const users2 = userDocs.map((
|
|
12312
|
-
_id:
|
|
12313
|
-
email:
|
|
12228
|
+
const users2 = userDocs.map((doc2) => ({
|
|
12229
|
+
_id: doc2.userId,
|
|
12230
|
+
email: doc2.email
|
|
12314
12231
|
})) || [];
|
|
12315
12232
|
return users2;
|
|
12316
12233
|
}
|
|
@@ -12399,12 +12316,12 @@ async function destroy3(groupId, revision) {
|
|
|
12399
12316
|
await cleanupUsers(group2);
|
|
12400
12317
|
return resp;
|
|
12401
12318
|
}
|
|
12402
|
-
async function getByName(
|
|
12319
|
+
async function getByName(name2) {
|
|
12403
12320
|
try {
|
|
12404
12321
|
const groups = await db_exports.directCouchFind(tenancy.getGlobalDBName(), {
|
|
12405
12322
|
selector: {
|
|
12406
12323
|
name: {
|
|
12407
|
-
$regex: `^(?i)${
|
|
12324
|
+
$regex: `^(?i)${name2}$`
|
|
12408
12325
|
}
|
|
12409
12326
|
},
|
|
12410
12327
|
limit: 1
|
|
@@ -12709,21 +12626,21 @@ __export(version_exports, {
|
|
|
12709
12626
|
getLicenseVersion: () => getLicenseVersion,
|
|
12710
12627
|
getProVersion: () => getProVersion
|
|
12711
12628
|
});
|
|
12712
|
-
var
|
|
12629
|
+
var import_fs4, import_path4, getLicenseVersion, getProVersion;
|
|
12713
12630
|
var init_version2 = __esm({
|
|
12714
12631
|
"../pro/packages/pro/src/constants/version.ts"() {
|
|
12715
12632
|
init_src2();
|
|
12716
|
-
|
|
12717
|
-
|
|
12633
|
+
import_fs4 = __toESM(require("fs"));
|
|
12634
|
+
import_path4 = __toESM(require("path"));
|
|
12718
12635
|
getLicenseVersion = () => {
|
|
12719
12636
|
if (environment_default2.isDev()) {
|
|
12720
12637
|
const DEV_VER_FILENAME = "dev-version.txt";
|
|
12721
|
-
const verFile =
|
|
12722
|
-
if (
|
|
12723
|
-
return
|
|
12638
|
+
const verFile = import_path4.default.join(objectStore_exports2.budibaseTempDir(), DEV_VER_FILENAME);
|
|
12639
|
+
if (import_fs4.default.existsSync(verFile)) {
|
|
12640
|
+
return import_fs4.default.readFileSync(verFile, "utf8");
|
|
12724
12641
|
} else {
|
|
12725
12642
|
const devVer = utils_exports2.newid();
|
|
12726
|
-
|
|
12643
|
+
import_fs4.default.writeFileSync(verFile, devVer);
|
|
12727
12644
|
return devVer;
|
|
12728
12645
|
}
|
|
12729
12646
|
} else {
|
|
@@ -12731,11 +12648,11 @@ var init_version2 = __esm({
|
|
|
12731
12648
|
}
|
|
12732
12649
|
};
|
|
12733
12650
|
getProVersion = () => {
|
|
12734
|
-
const
|
|
12735
|
-
if (!
|
|
12651
|
+
const version2 = environment_default2.VERSION;
|
|
12652
|
+
if (!version2) {
|
|
12736
12653
|
throw new Error("No budibase pro version was specified");
|
|
12737
12654
|
}
|
|
12738
|
-
return
|
|
12655
|
+
return version2;
|
|
12739
12656
|
};
|
|
12740
12657
|
}
|
|
12741
12658
|
});
|
|
@@ -12879,15 +12796,15 @@ async function fetchAppBackups(appId, opts = {}) {
|
|
|
12879
12796
|
}
|
|
12880
12797
|
return pageData;
|
|
12881
12798
|
}
|
|
12882
|
-
async function storeAppBackupMetadata(
|
|
12799
|
+
async function storeAppBackupMetadata(metadata2, opts = {}) {
|
|
12883
12800
|
const db2 = tenancy.getGlobalDB();
|
|
12884
|
-
const prodAppId = db_exports.getProdAppID(
|
|
12885
|
-
let _id = generateAppBackupID(prodAppId,
|
|
12801
|
+
const prodAppId = db_exports.getProdAppID(metadata2.appId);
|
|
12802
|
+
let _id = generateAppBackupID(prodAppId, metadata2.timestamp);
|
|
12886
12803
|
const appBackupDoc = {
|
|
12887
|
-
...
|
|
12804
|
+
...metadata2,
|
|
12888
12805
|
_id,
|
|
12889
12806
|
appId: prodAppId,
|
|
12890
|
-
name:
|
|
12807
|
+
name: metadata2.name
|
|
12891
12808
|
};
|
|
12892
12809
|
if (opts.filename) {
|
|
12893
12810
|
appBackupDoc.filename = opts.filename;
|
|
@@ -12896,18 +12813,18 @@ async function storeAppBackupMetadata(metadata, opts = {}) {
|
|
|
12896
12813
|
appBackupDoc._id = opts.docId;
|
|
12897
12814
|
appBackupDoc._rev = opts.docRev;
|
|
12898
12815
|
}
|
|
12899
|
-
if (
|
|
12816
|
+
if (metadata2.createdBy) {
|
|
12900
12817
|
appBackupDoc.createdBy = db_exports.getGlobalIDFromUserMetadataID(
|
|
12901
|
-
|
|
12818
|
+
metadata2.createdBy
|
|
12902
12819
|
);
|
|
12903
12820
|
}
|
|
12904
12821
|
return await db2.put(appBackupDoc);
|
|
12905
12822
|
}
|
|
12906
|
-
async function updateAppBackupMetadata(backupId,
|
|
12823
|
+
async function updateAppBackupMetadata(backupId, name2) {
|
|
12907
12824
|
const db2 = tenancy.getGlobalDB();
|
|
12908
|
-
const
|
|
12909
|
-
|
|
12910
|
-
return await db2.put(
|
|
12825
|
+
const metadata2 = await db2.get(backupId);
|
|
12826
|
+
metadata2.name = name2;
|
|
12827
|
+
return await db2.put(metadata2);
|
|
12911
12828
|
}
|
|
12912
12829
|
async function deleteAppBackupMetadata(backupId) {
|
|
12913
12830
|
const db2 = tenancy.getGlobalDB();
|
|
@@ -12942,9 +12859,9 @@ __export(environmentVariables_exports, {
|
|
|
12942
12859
|
function getEnvVarID() {
|
|
12943
12860
|
return StaticDatabases.GLOBAL.docs.environmentVariables;
|
|
12944
12861
|
}
|
|
12945
|
-
function getCacheEnvVarID(
|
|
12862
|
+
function getCacheEnvVarID(rev2) {
|
|
12946
12863
|
const tenantId = tenancy.getTenantId();
|
|
12947
|
-
return `${tenantId}/${getEnvVarID()}/${
|
|
12864
|
+
return `${tenantId}/${getEnvVarID()}/${rev2 || ""}`;
|
|
12948
12865
|
}
|
|
12949
12866
|
async function get5() {
|
|
12950
12867
|
const id = getEnvVarID();
|
|
@@ -12984,14 +12901,14 @@ async function get5() {
|
|
|
12984
12901
|
cache.set(cacheKey, finalDoc);
|
|
12985
12902
|
return finalDoc;
|
|
12986
12903
|
}
|
|
12987
|
-
async function update(
|
|
12904
|
+
async function update(doc2) {
|
|
12988
12905
|
const id = getEnvVarID();
|
|
12989
12906
|
const db2 = tenancy.getGlobalDB();
|
|
12990
12907
|
return await db2.put({
|
|
12991
|
-
_id:
|
|
12992
|
-
_rev:
|
|
12908
|
+
_id: doc2._id || id,
|
|
12909
|
+
_rev: doc2._rev || void 0,
|
|
12993
12910
|
variables: encryption_exports.encrypt(
|
|
12994
|
-
JSON.stringify(
|
|
12911
|
+
JSON.stringify(doc2.variables),
|
|
12995
12912
|
encryption_exports.SecretOption.ENCRYPTION
|
|
12996
12913
|
)
|
|
12997
12914
|
});
|
|
@@ -13169,31 +13086,31 @@ function getOfflineLicense() {
|
|
|
13169
13086
|
}
|
|
13170
13087
|
}
|
|
13171
13088
|
function getOfflineLicenseFromDisk() {
|
|
13172
|
-
if (
|
|
13173
|
-
const token =
|
|
13089
|
+
if (import_fs5.default.existsSync(LICENSE_FILE_PATH)) {
|
|
13090
|
+
const token = import_fs5.default.readFileSync(LICENSE_FILE_PATH, { encoding: "utf-8" });
|
|
13174
13091
|
return import_jsonwebtoken.default.verify(token, PUBLIC_KEY, { algorithms: ["RS256"] });
|
|
13175
13092
|
}
|
|
13176
13093
|
}
|
|
13177
13094
|
function writeOfflineLicenseToDisk(signedLicense) {
|
|
13178
|
-
|
|
13095
|
+
import_fs5.default.writeFileSync(LICENSE_FILE_PATH, signedLicense, { encoding: "utf-8" });
|
|
13179
13096
|
}
|
|
13180
13097
|
function deleteOfflineLicense() {
|
|
13181
|
-
|
|
13098
|
+
import_fs5.default.rmSync(LICENSE_FILE_PATH, { force: true });
|
|
13182
13099
|
}
|
|
13183
|
-
var
|
|
13100
|
+
var import_fs5, import_path5, import_os2, import_jsonwebtoken, SUB_DIRECTORY, DIRECTORY, OFFLINE_LICENSE_FILE, LICENSE_FILE_PATH, PUBLIC_KEY;
|
|
13184
13101
|
var init_offline = __esm({
|
|
13185
13102
|
"../pro/packages/pro/src/sdk/licensing/licenses/offline.ts"() {
|
|
13186
|
-
|
|
13187
|
-
|
|
13103
|
+
import_fs5 = __toESM(require("fs"));
|
|
13104
|
+
import_path5 = require("path");
|
|
13188
13105
|
import_os2 = require("os");
|
|
13189
13106
|
import_jsonwebtoken = __toESM(require("jsonwebtoken"));
|
|
13190
13107
|
init_src2();
|
|
13191
13108
|
SUB_DIRECTORY = environment_default2.isTest() ? ".budibase-test" : ".budibase";
|
|
13192
|
-
DIRECTORY = (0,
|
|
13109
|
+
DIRECTORY = (0, import_path5.join)((0, import_os2.tmpdir)(), SUB_DIRECTORY);
|
|
13193
13110
|
OFFLINE_LICENSE_FILE = "offline_license.txt";
|
|
13194
|
-
LICENSE_FILE_PATH = (0,
|
|
13195
|
-
if (!
|
|
13196
|
-
|
|
13111
|
+
LICENSE_FILE_PATH = (0, import_path5.join)(DIRECTORY, OFFLINE_LICENSE_FILE);
|
|
13112
|
+
if (!import_fs5.default.existsSync(DIRECTORY)) {
|
|
13113
|
+
import_fs5.default.mkdirSync(DIRECTORY);
|
|
13197
13114
|
}
|
|
13198
13115
|
PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvz3jePLCFBXZ19c8Dpkv\nXtSgOhKFOcvQdo/LV0KJRUzQWDPWuO4ILtBtnqhjtIzZH4CH0qCYBet5L6Qr4CM1\nl2HXiAD1Q2rlHNW9wDaYyKb1F5f+v4RyqCAyzlkwRdksmkLeECTboojNnmRCrE3C\n8suunQP5bEScqEY2kclqzSf8e6xqMzPUg3mL/pNa1iEv7TuLbU9nJfgR36l0WmZY\n94fWnSaT8OSXSqcxsaByf06gfS3HAoTJNc7eqz1Hf9fUORQGPUAnFK8cT3SfdA36\nd/o3ZWE1TTj1zYwlCLN5qRKr3hU8nC3xEYNEbkB9SfTRaOq9Q7P8WmfLkoCPm3pR\nmwIDAQAB\n-----END PUBLIC KEY-----\n";
|
|
13199
13116
|
}
|
|
@@ -13474,14 +13391,14 @@ var init_quotas5 = __esm({
|
|
|
13474
13391
|
init_db6();
|
|
13475
13392
|
init_src2();
|
|
13476
13393
|
init_quotas3();
|
|
13477
|
-
increment = (
|
|
13478
|
-
return tryIncrement(1,
|
|
13394
|
+
increment = (name2, type, opts) => {
|
|
13395
|
+
return tryIncrement(1, name2, type, opts);
|
|
13479
13396
|
};
|
|
13480
|
-
incrementMany = (change,
|
|
13481
|
-
return tryIncrement(change,
|
|
13397
|
+
incrementMany = (change, name2, type, opts) => {
|
|
13398
|
+
return tryIncrement(change, name2, type, opts);
|
|
13482
13399
|
};
|
|
13483
|
-
tryIncrement = async (change,
|
|
13484
|
-
await updateUsage(change,
|
|
13400
|
+
tryIncrement = async (change, name2, type, opts = {}) => {
|
|
13401
|
+
await updateUsage(change, name2, type, {
|
|
13485
13402
|
dryRun: true,
|
|
13486
13403
|
suppressErrorLog: opts.suppressErrorLog,
|
|
13487
13404
|
id: opts.id
|
|
@@ -13490,7 +13407,7 @@ var init_quotas5 = __esm({
|
|
|
13490
13407
|
if (opts.fn) {
|
|
13491
13408
|
result = await opts.fn();
|
|
13492
13409
|
}
|
|
13493
|
-
await updateUsage(change,
|
|
13410
|
+
await updateUsage(change, name2, type, {
|
|
13494
13411
|
dryRun: false,
|
|
13495
13412
|
valueFn: opts.valueFn,
|
|
13496
13413
|
suppressErrorLog: opts.suppressErrorLog,
|
|
@@ -13498,32 +13415,32 @@ var init_quotas5 = __esm({
|
|
|
13498
13415
|
});
|
|
13499
13416
|
return result;
|
|
13500
13417
|
};
|
|
13501
|
-
decrement = (
|
|
13502
|
-
return updateUsage(-1,
|
|
13418
|
+
decrement = (name2, type, opts = {}) => {
|
|
13419
|
+
return updateUsage(-1, name2, type, opts);
|
|
13503
13420
|
};
|
|
13504
|
-
decrementMany = (change,
|
|
13505
|
-
return updateUsage(-change,
|
|
13421
|
+
decrementMany = (change, name2, type, opts = {}) => {
|
|
13422
|
+
return updateUsage(-change, name2, type, opts);
|
|
13506
13423
|
};
|
|
13507
|
-
set2 = async (
|
|
13508
|
-
return quotas_exports.setUsage(value,
|
|
13424
|
+
set2 = async (name2, type, value) => {
|
|
13425
|
+
return quotas_exports.setUsage(value, name2, type);
|
|
13509
13426
|
};
|
|
13510
|
-
getExistingTriggers = (type,
|
|
13427
|
+
getExistingTriggers = (type, name2, quotaUsage) => {
|
|
13511
13428
|
if (type == "static" /* STATIC */) {
|
|
13512
13429
|
const triggers = quotaUsage.usageQuota.triggers;
|
|
13513
|
-
return triggers ? triggers[
|
|
13430
|
+
return triggers ? triggers[name2] || {} : {};
|
|
13514
13431
|
} else {
|
|
13515
13432
|
const currentMonthString = quotas_exports.utils.getCurrentMonthString();
|
|
13516
13433
|
const triggers = quotaUsage.monthly[currentMonthString].triggers;
|
|
13517
|
-
return triggers ? triggers[
|
|
13434
|
+
return triggers ? triggers[name2] || {} : {};
|
|
13518
13435
|
}
|
|
13519
13436
|
};
|
|
13520
|
-
triggerQuota2 = async (
|
|
13437
|
+
triggerQuota2 = async (name2, quota, percentage, resetDate) => {
|
|
13521
13438
|
try {
|
|
13522
13439
|
await redlockImpl_exports.doWithLock(
|
|
13523
13440
|
{
|
|
13524
13441
|
type: "try_once" /* TRY_ONCE */,
|
|
13525
13442
|
name: "trigger_quota" /* TRIGGER_QUOTA */,
|
|
13526
|
-
resource:
|
|
13443
|
+
resource: name2,
|
|
13527
13444
|
// use the quota name for extra uniqueness on the lock
|
|
13528
13445
|
ttl: 1e4
|
|
13529
13446
|
// auto expire after 10 seconds
|
|
@@ -13543,10 +13460,10 @@ var init_quotas5 = __esm({
|
|
|
13543
13460
|
logging_exports.logAlert("Error triggering quota", e);
|
|
13544
13461
|
}
|
|
13545
13462
|
};
|
|
13546
|
-
checkTriggers = async (type,
|
|
13463
|
+
checkTriggers = async (type, name2, totalValue, quota) => {
|
|
13547
13464
|
const usage = await getQuotaUsage();
|
|
13548
13465
|
const resetDate = type === "monthly" /* MONTHLY */ ? usage.quotaReset : void 0;
|
|
13549
|
-
const triggers = await getExistingTriggers(type,
|
|
13466
|
+
const triggers = await getExistingTriggers(type, name2, usage);
|
|
13550
13467
|
const quotaTriggers = quota.triggers;
|
|
13551
13468
|
let percentage = totalValue / quota.value * 100;
|
|
13552
13469
|
if (percentage > 100) {
|
|
@@ -13562,7 +13479,7 @@ var init_quotas5 = __esm({
|
|
|
13562
13479
|
const isAtTrigger = percentage === triggerPercentage;
|
|
13563
13480
|
const sendNotification = !nextIsTriggered || isAtTrigger;
|
|
13564
13481
|
if (sendNotification) {
|
|
13565
|
-
await triggerQuota2(
|
|
13482
|
+
await triggerQuota2(name2, quota, percentage, resetDate);
|
|
13566
13483
|
}
|
|
13567
13484
|
}
|
|
13568
13485
|
} else {
|
|
@@ -13571,23 +13488,23 @@ var init_quotas5 = __esm({
|
|
|
13571
13488
|
}
|
|
13572
13489
|
return triggers;
|
|
13573
13490
|
};
|
|
13574
|
-
updateUsage = async (usageChange,
|
|
13491
|
+
updateUsage = async (usageChange, name2, type, opts = {}) => {
|
|
13575
13492
|
let appId = null;
|
|
13576
13493
|
try {
|
|
13577
13494
|
appId = context_exports.getAppId();
|
|
13578
13495
|
} catch (err) {
|
|
13579
13496
|
}
|
|
13580
|
-
const isAppQuota = APP_QUOTA_NAMES.includes(
|
|
13497
|
+
const isAppQuota = APP_QUOTA_NAMES.includes(name2);
|
|
13581
13498
|
if (isAppQuota && !appId) {
|
|
13582
13499
|
throw new Error("App context required for quota update");
|
|
13583
13500
|
}
|
|
13584
13501
|
try {
|
|
13585
|
-
const licensedQuota = await getLicensedQuota("usage" /* USAGE */,
|
|
13502
|
+
const licensedQuota = await getLicensedQuota("usage" /* USAGE */, name2, type);
|
|
13586
13503
|
let {
|
|
13587
13504
|
total: totalValue,
|
|
13588
13505
|
app: appValue,
|
|
13589
13506
|
breakdown: breakdownValue
|
|
13590
|
-
} = await quotas_exports.getCurrentUsageValues(type,
|
|
13507
|
+
} = await quotas_exports.getCurrentUsageValues(type, name2, opts.id);
|
|
13591
13508
|
totalValue += usageChange;
|
|
13592
13509
|
if (appValue != null) {
|
|
13593
13510
|
appValue += usageChange;
|
|
@@ -13597,7 +13514,7 @@ var init_quotas5 = __esm({
|
|
|
13597
13514
|
}
|
|
13598
13515
|
let triggers = {};
|
|
13599
13516
|
if (!opts.dryRun) {
|
|
13600
|
-
triggers = await checkTriggers(type,
|
|
13517
|
+
triggers = await checkTriggers(type, name2, totalValue, licensedQuota);
|
|
13601
13518
|
}
|
|
13602
13519
|
if (licensedQuota.value !== quotas_exports2.UNLIMITED && totalValue > licensedQuota.value && usageChange > 0) {
|
|
13603
13520
|
throw new UsageLimitError(
|
|
@@ -13620,7 +13537,7 @@ var init_quotas5 = __esm({
|
|
|
13620
13537
|
appValue = totalValue;
|
|
13621
13538
|
}
|
|
13622
13539
|
await quotas_exports.setAllUsage(
|
|
13623
|
-
|
|
13540
|
+
name2,
|
|
13624
13541
|
type,
|
|
13625
13542
|
{
|
|
13626
13543
|
total: totalValue,
|
|
@@ -13632,30 +13549,30 @@ var init_quotas5 = __esm({
|
|
|
13632
13549
|
);
|
|
13633
13550
|
} catch (err) {
|
|
13634
13551
|
if (!opts.suppressErrorLog) {
|
|
13635
|
-
console.error(`Error updating usage quotas for ${
|
|
13552
|
+
console.error(`Error updating usage quotas for ${name2}`, err);
|
|
13636
13553
|
}
|
|
13637
13554
|
throw err;
|
|
13638
13555
|
}
|
|
13639
13556
|
};
|
|
13640
|
-
getLicensedQuota = async (quotaType,
|
|
13557
|
+
getLicensedQuota = async (quotaType, name2, usageType) => {
|
|
13641
13558
|
const license = await cache_exports2.getCachedLicense();
|
|
13642
13559
|
if (!license) {
|
|
13643
13560
|
const tenantId = tenancy.getTenantId();
|
|
13644
13561
|
throw new Error("License not found for tenant id " + tenantId);
|
|
13645
13562
|
}
|
|
13646
|
-
if (usageType && isStaticQuota(quotaType, usageType,
|
|
13647
|
-
return license.quotas[quotaType][usageType][
|
|
13648
|
-
} else if (usageType && isMonthlyQuota(quotaType, usageType,
|
|
13649
|
-
return license.quotas[quotaType][usageType][
|
|
13650
|
-
} else if (isConstantQuota(quotaType,
|
|
13651
|
-
return license.quotas[quotaType][
|
|
13563
|
+
if (usageType && isStaticQuota(quotaType, usageType, name2)) {
|
|
13564
|
+
return license.quotas[quotaType][usageType][name2];
|
|
13565
|
+
} else if (usageType && isMonthlyQuota(quotaType, usageType, name2)) {
|
|
13566
|
+
return license.quotas[quotaType][usageType][name2];
|
|
13567
|
+
} else if (isConstantQuota(quotaType, name2)) {
|
|
13568
|
+
return license.quotas[quotaType][name2];
|
|
13652
13569
|
} else {
|
|
13653
13570
|
throw new Error("Invalid quota type");
|
|
13654
13571
|
}
|
|
13655
13572
|
};
|
|
13656
|
-
usageLimitIsExceeded = async (
|
|
13573
|
+
usageLimitIsExceeded = async (name2, type) => {
|
|
13657
13574
|
try {
|
|
13658
|
-
await updateUsage(1,
|
|
13575
|
+
await updateUsage(1, name2, type, { dryRun: true });
|
|
13659
13576
|
return false;
|
|
13660
13577
|
} catch (e) {
|
|
13661
13578
|
if (e.code === "usage_limit_exceeded" /* USAGE_LIMIT_EXCEEDED */) {
|
|
@@ -14194,7 +14111,7 @@ async function getLogsByView(startDate, endDate, viewParams = {}) {
|
|
|
14194
14111
|
async function writeLog(automation, results) {
|
|
14195
14112
|
const db2 = context_exports.getProdAppDB();
|
|
14196
14113
|
const automationId = automation._id;
|
|
14197
|
-
const
|
|
14114
|
+
const name2 = automation.name;
|
|
14198
14115
|
const status2 = getStatus(results);
|
|
14199
14116
|
const isoDate = (/* @__PURE__ */ new Date()).toISOString();
|
|
14200
14117
|
const id = generateAutomationLogID(isoDate, status2, automationId);
|
|
@@ -14203,7 +14120,7 @@ async function writeLog(automation, results) {
|
|
|
14203
14120
|
...results,
|
|
14204
14121
|
automationId,
|
|
14205
14122
|
status: status2,
|
|
14206
|
-
automationName:
|
|
14123
|
+
automationName: name2,
|
|
14207
14124
|
createdAt: isoDate,
|
|
14208
14125
|
_id: id
|
|
14209
14126
|
};
|
|
@@ -14213,13 +14130,13 @@ async function writeLog(automation, results) {
|
|
|
14213
14130
|
async function updateAppMetadataWithErrors(logIds, { clearing } = { clearing: false }) {
|
|
14214
14131
|
const db2 = context_exports.getProdAppDB();
|
|
14215
14132
|
await backOff(async () => {
|
|
14216
|
-
const
|
|
14133
|
+
const metadata2 = await db2.get(db_exports.DocumentType.APP_METADATA);
|
|
14217
14134
|
for (let logId of logIds) {
|
|
14218
14135
|
const parts = logId.split(db_exports.SEPARATOR);
|
|
14219
14136
|
const autoId = `${parts[parts.length - 3]}${db_exports.SEPARATOR}${parts[parts.length - 2]}`;
|
|
14220
14137
|
let errors = {};
|
|
14221
|
-
if (
|
|
14222
|
-
errors =
|
|
14138
|
+
if (metadata2.automationErrors) {
|
|
14139
|
+
errors = metadata2.automationErrors;
|
|
14223
14140
|
}
|
|
14224
14141
|
if (!Array.isArray(errors[autoId])) {
|
|
14225
14142
|
errors[autoId] = [];
|
|
@@ -14233,10 +14150,10 @@ async function updateAppMetadataWithErrors(logIds, { clearing } = { clearing: fa
|
|
|
14233
14150
|
if (errors[autoId].length === 0) {
|
|
14234
14151
|
delete errors[autoId];
|
|
14235
14152
|
}
|
|
14236
|
-
|
|
14153
|
+
metadata2.automationErrors = errors;
|
|
14237
14154
|
}
|
|
14238
|
-
await db2.put(
|
|
14239
|
-
await cache_exports.app.invalidateAppMetadata(
|
|
14155
|
+
await db2.put(metadata2);
|
|
14156
|
+
await cache_exports.app.invalidateAppMetadata(metadata2.appId, metadata2);
|
|
14240
14157
|
}, "Failed to update app metadata with automation log error");
|
|
14241
14158
|
}
|
|
14242
14159
|
async function getExpiredLogs() {
|
|
@@ -14258,16 +14175,16 @@ async function clearOldHistory() {
|
|
|
14258
14175
|
if (!expired.data || expired.data.length === 0) {
|
|
14259
14176
|
return;
|
|
14260
14177
|
}
|
|
14261
|
-
const toDelete = expired.data.map((
|
|
14262
|
-
_id:
|
|
14263
|
-
_rev:
|
|
14178
|
+
const toDelete = expired.data.map((doc2) => ({
|
|
14179
|
+
_id: doc2.id,
|
|
14180
|
+
_rev: doc2.value.rev,
|
|
14264
14181
|
_deleted: true
|
|
14265
14182
|
}));
|
|
14266
|
-
const errorLogIds = expired.data.filter((
|
|
14267
|
-
const parts =
|
|
14183
|
+
const errorLogIds = expired.data.filter((doc2) => {
|
|
14184
|
+
const parts = doc2.id.split(db_exports.SEPARATOR);
|
|
14268
14185
|
const status2 = parts[parts.length - 1];
|
|
14269
14186
|
return status2 === "error" /* ERROR */;
|
|
14270
|
-
}).map((
|
|
14187
|
+
}).map((doc2) => doc2.id);
|
|
14271
14188
|
await db2.bulkDocs(toDelete);
|
|
14272
14189
|
if (errorLogIds.length) {
|
|
14273
14190
|
await updateAppMetadataWithErrors(errorLogIds, { clearing: true });
|
|
@@ -14487,10 +14404,10 @@ async function get6(id) {
|
|
|
14487
14404
|
async function getBulk2(ids, opts = { enriched: true }) {
|
|
14488
14405
|
return await groups_exports.getBulk(ids, opts);
|
|
14489
14406
|
}
|
|
14490
|
-
async function guardNameAvailility(
|
|
14491
|
-
const existingGroup = await groups_exports.getByName(
|
|
14407
|
+
async function guardNameAvailility(name2) {
|
|
14408
|
+
const existingGroup = await groups_exports.getByName(name2);
|
|
14492
14409
|
if (existingGroup) {
|
|
14493
|
-
throw new GroupNameUnavailableError(
|
|
14410
|
+
throw new GroupNameUnavailableError(name2);
|
|
14494
14411
|
}
|
|
14495
14412
|
}
|
|
14496
14413
|
async function save4(group2) {
|
|
@@ -14649,14 +14566,14 @@ var init_groups6 = __esm({
|
|
|
14649
14566
|
});
|
|
14650
14567
|
|
|
14651
14568
|
// ../pro/packages/pro/src/utilities/fileSystem.ts
|
|
14652
|
-
function loadJSFile(
|
|
14653
|
-
return
|
|
14569
|
+
function loadJSFile(directory2, name2) {
|
|
14570
|
+
return import_fs6.default.readFileSync((0, import_path6.join)(directory2, name2), "utf8");
|
|
14654
14571
|
}
|
|
14655
|
-
var
|
|
14572
|
+
var import_fs6, import_path6;
|
|
14656
14573
|
var init_fileSystem = __esm({
|
|
14657
14574
|
"../pro/packages/pro/src/utilities/fileSystem.ts"() {
|
|
14658
|
-
|
|
14659
|
-
|
|
14575
|
+
import_fs6 = __toESM(require("fs"));
|
|
14576
|
+
import_path6 = require("path");
|
|
14660
14577
|
}
|
|
14661
14578
|
});
|
|
14662
14579
|
|
|
@@ -14668,8 +14585,8 @@ __export(plugins_exports, {
|
|
|
14668
14585
|
storePlugin: () => storePlugin
|
|
14669
14586
|
});
|
|
14670
14587
|
async function storePlugin(metadata, directory, source) {
|
|
14671
|
-
const
|
|
14672
|
-
const version = metadata.package.version, name = metadata.package.name, description = metadata.package.description,
|
|
14588
|
+
const db = tenancy.getGlobalDB();
|
|
14589
|
+
const version = metadata.package.version, name = metadata.package.name, description = metadata.package.description, hash = metadata.schema.hash;
|
|
14673
14590
|
const bucketPath = objectStore_exports2.getPluginS3Dir(name);
|
|
14674
14591
|
const files = await objectStore_exports2.uploadDirectory(
|
|
14675
14592
|
objectStore_exports2.ObjectStoreBuckets.PLUGINS,
|
|
@@ -14684,8 +14601,7 @@ async function storePlugin(metadata, directory, source) {
|
|
|
14684
14601
|
if (metadata.schema.type === "datasource" /* DATASOURCE */) {
|
|
14685
14602
|
const js = loadJSFile(directory, jsFile.name);
|
|
14686
14603
|
try {
|
|
14687
|
-
;
|
|
14688
|
-
(0, eval)(js);
|
|
14604
|
+
eval(js);
|
|
14689
14605
|
} catch (err) {
|
|
14690
14606
|
const message = (err == null ? void 0 : err.message) ? err.message : JSON.stringify(err);
|
|
14691
14607
|
throw new Error(`JS invalid: ${message}`);
|
|
@@ -14695,7 +14611,7 @@ async function storePlugin(metadata, directory, source) {
|
|
|
14695
14611
|
const pluginId = db_exports.generatePluginID(name);
|
|
14696
14612
|
let rev;
|
|
14697
14613
|
try {
|
|
14698
|
-
const existing = await
|
|
14614
|
+
const existing = await db.get(pluginId);
|
|
14699
14615
|
rev = existing._rev;
|
|
14700
14616
|
} catch (err) {
|
|
14701
14617
|
rev = void 0;
|
|
@@ -14706,7 +14622,7 @@ async function storePlugin(metadata, directory, source) {
|
|
|
14706
14622
|
...metadata,
|
|
14707
14623
|
name,
|
|
14708
14624
|
version,
|
|
14709
|
-
hash
|
|
14625
|
+
hash,
|
|
14710
14626
|
description
|
|
14711
14627
|
};
|
|
14712
14628
|
if (iconFileName) {
|
|
@@ -14718,8 +14634,8 @@ async function storePlugin(metadata, directory, source) {
|
|
|
14718
14634
|
source
|
|
14719
14635
|
};
|
|
14720
14636
|
}
|
|
14721
|
-
const
|
|
14722
|
-
const response2 = await
|
|
14637
|
+
const write = async () => {
|
|
14638
|
+
const response2 = await db.put(doc);
|
|
14723
14639
|
await events_exports.plugin.imported(doc);
|
|
14724
14640
|
return {
|
|
14725
14641
|
...doc,
|
|
@@ -14727,21 +14643,21 @@ async function storePlugin(metadata, directory, source) {
|
|
|
14727
14643
|
};
|
|
14728
14644
|
};
|
|
14729
14645
|
if (!rev) {
|
|
14730
|
-
return await addPlugin(
|
|
14646
|
+
return await addPlugin(write);
|
|
14731
14647
|
} else {
|
|
14732
|
-
return await
|
|
14648
|
+
return await write();
|
|
14733
14649
|
}
|
|
14734
14650
|
}
|
|
14735
|
-
async function deletePlugin(
|
|
14651
|
+
async function deletePlugin(pluginId2) {
|
|
14736
14652
|
const db2 = tenancy.getGlobalDB();
|
|
14737
14653
|
try {
|
|
14738
|
-
const plugin = await db2.get(
|
|
14739
|
-
const
|
|
14654
|
+
const plugin = await db2.get(pluginId2);
|
|
14655
|
+
const bucketPath2 = objectStore_exports2.getPluginS3Dir(plugin.name);
|
|
14740
14656
|
await objectStore_exports2.deleteFolder(
|
|
14741
14657
|
objectStore_exports2.ObjectStoreBuckets.PLUGINS,
|
|
14742
|
-
|
|
14658
|
+
bucketPath2
|
|
14743
14659
|
);
|
|
14744
|
-
await db2.remove(
|
|
14660
|
+
await db2.remove(pluginId2, plugin._rev);
|
|
14745
14661
|
await events_exports.plugin.deleted(plugin);
|
|
14746
14662
|
await removePlugin();
|
|
14747
14663
|
} catch (err) {
|
|
@@ -14775,12 +14691,12 @@ function isEncryptionKeyAvailable() {
|
|
|
14775
14691
|
return !!environment_default2.ENCRYPTION_KEY;
|
|
14776
14692
|
}
|
|
14777
14693
|
async function fetch10() {
|
|
14778
|
-
const
|
|
14779
|
-
return Object.keys(
|
|
14694
|
+
const doc2 = await environmentVariables_exports.get();
|
|
14695
|
+
return Object.keys(doc2.variables);
|
|
14780
14696
|
}
|
|
14781
14697
|
async function fetchValues(environment3) {
|
|
14782
|
-
const
|
|
14783
|
-
const decrypted =
|
|
14698
|
+
const doc2 = await environmentVariables_exports.get();
|
|
14699
|
+
const decrypted = doc2.variables;
|
|
14784
14700
|
const output = {};
|
|
14785
14701
|
for (let [key, value] of Object.entries(decrypted)) {
|
|
14786
14702
|
switch (environment3) {
|
|
@@ -14802,9 +14718,9 @@ async function changeValues(cb) {
|
|
|
14802
14718
|
"User does not have access to environment variables feature."
|
|
14803
14719
|
);
|
|
14804
14720
|
}
|
|
14805
|
-
const
|
|
14806
|
-
|
|
14807
|
-
await environmentVariables_exports.update(
|
|
14721
|
+
const doc2 = await environmentVariables_exports.get();
|
|
14722
|
+
doc2.variables = cb(doc2.variables);
|
|
14723
|
+
await environmentVariables_exports.update(doc2);
|
|
14808
14724
|
}
|
|
14809
14725
|
async function update2(varName, value) {
|
|
14810
14726
|
const checkName = isValid(varName);
|
|
@@ -14855,15 +14771,15 @@ var init_environmentVariables6 = __esm({
|
|
|
14855
14771
|
function generateAuditLogID(timestamp) {
|
|
14856
14772
|
return `${"al" /* AUDIT_LOG */}${SEPARATOR}${timestamp}${SEPARATOR}${utils_exports2.newid()}`;
|
|
14857
14773
|
}
|
|
14858
|
-
async function save5(
|
|
14859
|
-
if (!
|
|
14860
|
-
|
|
14774
|
+
async function save5(doc2) {
|
|
14775
|
+
if (!doc2._id) {
|
|
14776
|
+
doc2._id = generateAuditLogID(doc2.timestamp);
|
|
14861
14777
|
}
|
|
14862
14778
|
try {
|
|
14863
14779
|
const db2 = context_exports.getAuditLogsDB();
|
|
14864
|
-
const response2 = await db2.put(
|
|
14780
|
+
const response2 = await db2.put(doc2);
|
|
14865
14781
|
return {
|
|
14866
|
-
...
|
|
14782
|
+
...doc2,
|
|
14867
14783
|
_rev: response2.rev
|
|
14868
14784
|
};
|
|
14869
14785
|
} catch (err) {
|
|
@@ -14891,9 +14807,9 @@ function dump(params2) {
|
|
|
14891
14807
|
const db2 = context_exports.getAuditLogsDB();
|
|
14892
14808
|
const stream3 = new MemoryStream();
|
|
14893
14809
|
const promise = db2.dump(stream3, {
|
|
14894
|
-
filter: (
|
|
14810
|
+
filter: (doc2) => {
|
|
14895
14811
|
var _a;
|
|
14896
|
-
const auditLog =
|
|
14812
|
+
const auditLog = doc2;
|
|
14897
14813
|
if (!((_a = auditLog._id) == null ? void 0 : _a.startsWith("al" /* AUDIT_LOG */))) {
|
|
14898
14814
|
return false;
|
|
14899
14815
|
}
|
|
@@ -14911,7 +14827,7 @@ function dump(params2) {
|
|
|
14911
14827
|
allMatched = allMatched && auditLog.timestamp >= params2.startDate && auditLog.timestamp <= params2.endDate;
|
|
14912
14828
|
}
|
|
14913
14829
|
if (params2.fullSearch) {
|
|
14914
|
-
const json2 = JSON.stringify(
|
|
14830
|
+
const json2 = JSON.stringify(doc2);
|
|
14915
14831
|
allMatched = allMatched && json2.includes(params2.fullSearch);
|
|
14916
14832
|
}
|
|
14917
14833
|
return allMatched;
|
|
@@ -14922,8 +14838,8 @@ function dump(params2) {
|
|
|
14922
14838
|
const json2 = JSON.parse(Buffer.from(data2).toString());
|
|
14923
14839
|
if (Array.isArray(json2.docs)) {
|
|
14924
14840
|
let str = "";
|
|
14925
|
-
for (let
|
|
14926
|
-
str += JSON.stringify(
|
|
14841
|
+
for (let doc2 of json2.docs) {
|
|
14842
|
+
str += JSON.stringify(doc2) + "\n";
|
|
14927
14843
|
}
|
|
14928
14844
|
returnStream.write(str);
|
|
14929
14845
|
}
|
|
@@ -14948,8 +14864,8 @@ var init_auditLogs4 = __esm({
|
|
|
14948
14864
|
var require_Helper = __commonJS({
|
|
14949
14865
|
"../string-templates/src/helpers/Helper.js"(exports2, module2) {
|
|
14950
14866
|
var Helper = class {
|
|
14951
|
-
constructor(
|
|
14952
|
-
this.name =
|
|
14867
|
+
constructor(name2, fn2, useValueFallback = true) {
|
|
14868
|
+
this.name = name2;
|
|
14953
14869
|
this.fn = fn2;
|
|
14954
14870
|
this.useValueFallback = useValueFallback;
|
|
14955
14871
|
}
|
|
@@ -15118,18 +15034,18 @@ var require_external = __commonJS({
|
|
|
15118
15034
|
exports2.externalCollections = EXTERNAL_FUNCTION_COLLECTIONS;
|
|
15119
15035
|
exports2.addedHelpers = ADDED_HELPERS;
|
|
15120
15036
|
exports2.registerAll = (handlebars) => {
|
|
15121
|
-
for (let [
|
|
15122
|
-
handlebars.registerHelper(
|
|
15037
|
+
for (let [name2, helper] of Object.entries(ADDED_HELPERS)) {
|
|
15038
|
+
handlebars.registerHelper(name2, helper);
|
|
15123
15039
|
}
|
|
15124
15040
|
let externalNames = [];
|
|
15125
15041
|
for (let collection of EXTERNAL_FUNCTION_COLLECTIONS) {
|
|
15126
15042
|
let hbsHelperInfo = helpers[collection]();
|
|
15127
15043
|
for (let entry of Object.entries(hbsHelperInfo)) {
|
|
15128
|
-
const
|
|
15129
|
-
if (HelperFunctionBuiltin.indexOf(
|
|
15044
|
+
const name2 = entry[0];
|
|
15045
|
+
if (HelperFunctionBuiltin.indexOf(name2) !== -1 || externalNames.indexOf(name2) !== -1) {
|
|
15130
15046
|
continue;
|
|
15131
15047
|
}
|
|
15132
|
-
externalNames.push(
|
|
15048
|
+
externalNames.push(name2);
|
|
15133
15049
|
}
|
|
15134
15050
|
helpers[collection]({
|
|
15135
15051
|
handlebars
|
|
@@ -15138,11 +15054,11 @@ var require_external = __commonJS({
|
|
|
15138
15054
|
exports2.externalHelperNames = externalNames.concat(Object.keys(ADDED_HELPERS));
|
|
15139
15055
|
};
|
|
15140
15056
|
exports2.unregisterAll = (handlebars) => {
|
|
15141
|
-
for (let
|
|
15142
|
-
handlebars.unregisterHelper(
|
|
15057
|
+
for (let name2 of Object.keys(ADDED_HELPERS)) {
|
|
15058
|
+
handlebars.unregisterHelper(name2);
|
|
15143
15059
|
}
|
|
15144
|
-
for (let
|
|
15145
|
-
handlebars.unregisterHelper(
|
|
15060
|
+
for (let name2 of module2.exports.externalHelperNames) {
|
|
15061
|
+
handlebars.unregisterHelper(name2);
|
|
15146
15062
|
}
|
|
15147
15063
|
exports2.externalHelperNames = [];
|
|
15148
15064
|
};
|
|
@@ -15256,12 +15172,12 @@ var require_javascript = __commonJS({
|
|
|
15256
15172
|
throw new Error("JS disabled in environment.");
|
|
15257
15173
|
}
|
|
15258
15174
|
try {
|
|
15259
|
-
const
|
|
15175
|
+
const js2 = `function run(){${atob(handlebars)}};run();`;
|
|
15260
15176
|
const sandboxContext = {
|
|
15261
15177
|
$: (path2) => getContextValue(path2, cloneDeep16(context)),
|
|
15262
15178
|
helpers: getHelperList()
|
|
15263
15179
|
};
|
|
15264
|
-
const res = { data: runJS(
|
|
15180
|
+
const res = { data: runJS(js2, sandboxContext) };
|
|
15265
15181
|
return `{{${LITERAL_MARKER} js_result-${JSON.stringify(res)}}}`;
|
|
15266
15182
|
} catch (error) {
|
|
15267
15183
|
return "Error while executing JS";
|
|
@@ -15374,8 +15290,8 @@ var require_preprocessor = __commonJS({
|
|
|
15374
15290
|
FINALISE: "finalise"
|
|
15375
15291
|
};
|
|
15376
15292
|
var Preprocessor = class {
|
|
15377
|
-
constructor(
|
|
15378
|
-
this.name =
|
|
15293
|
+
constructor(name2, fn2) {
|
|
15294
|
+
this.name = name2;
|
|
15379
15295
|
this.fn = fn2;
|
|
15380
15296
|
}
|
|
15381
15297
|
process(fullString, statement, opts) {
|
|
@@ -15439,8 +15355,8 @@ var require_postprocessor = __commonJS({
|
|
|
15439
15355
|
CONVERT_LITERALS: "convert-literals"
|
|
15440
15356
|
};
|
|
15441
15357
|
var Postprocessor = class {
|
|
15442
|
-
constructor(
|
|
15443
|
-
this.name =
|
|
15358
|
+
constructor(name2, fn2) {
|
|
15359
|
+
this.name = name2;
|
|
15444
15360
|
this.fn = fn2;
|
|
15445
15361
|
}
|
|
15446
15362
|
process(statement) {
|
|
@@ -17082,10 +16998,10 @@ var require_src = __commonJS({
|
|
|
17082
16998
|
};
|
|
17083
16999
|
module2.exports.convertToJS = (hbs) => {
|
|
17084
17000
|
const blocks = exports2.findHBSBlocks(hbs);
|
|
17085
|
-
let
|
|
17001
|
+
let js2 = "return `", prevBlock = null;
|
|
17086
17002
|
const variables = {};
|
|
17087
17003
|
if (blocks.length === 0) {
|
|
17088
|
-
|
|
17004
|
+
js2 += hbs;
|
|
17089
17005
|
}
|
|
17090
17006
|
let count = 1;
|
|
17091
17007
|
for (let block of blocks) {
|
|
@@ -17097,15 +17013,15 @@ var require_src = __commonJS({
|
|
|
17097
17013
|
prevBlock = block;
|
|
17098
17014
|
const { variable, value } = convertHBSBlock(block, count++);
|
|
17099
17015
|
variables[variable] = value;
|
|
17100
|
-
|
|
17016
|
+
js2 += `${stringPart.split()}\${${variable}}`;
|
|
17101
17017
|
}
|
|
17102
17018
|
let varBlock = "";
|
|
17103
17019
|
for (let [variable, value] of Object.entries(variables)) {
|
|
17104
17020
|
varBlock += `const ${variable} = ${value};
|
|
17105
17021
|
`;
|
|
17106
17022
|
}
|
|
17107
|
-
|
|
17108
|
-
return `${varBlock}${
|
|
17023
|
+
js2 += "`;";
|
|
17024
|
+
return `${varBlock}${js2}`;
|
|
17109
17025
|
};
|
|
17110
17026
|
}
|
|
17111
17027
|
});
|
|
@@ -17132,12 +17048,12 @@ var require_src2 = __commonJS({
|
|
|
17132
17048
|
if (!process.env.NO_JS) {
|
|
17133
17049
|
const { VM: VM2 } = require("vm2");
|
|
17134
17050
|
const { setJSRunner } = require_javascript();
|
|
17135
|
-
setJSRunner((
|
|
17051
|
+
setJSRunner((js2, context) => {
|
|
17136
17052
|
const vm = new VM2({
|
|
17137
17053
|
sandbox: context,
|
|
17138
17054
|
timeout: 1e3
|
|
17139
17055
|
});
|
|
17140
|
-
return vm.run(
|
|
17056
|
+
return vm.run(js2);
|
|
17141
17057
|
});
|
|
17142
17058
|
}
|
|
17143
17059
|
}
|
|
@@ -17231,12 +17147,12 @@ async function auditLogsEnabled() {
|
|
|
17231
17147
|
const license = await licensing_exports.cache.getCachedLicense();
|
|
17232
17148
|
return license.features.includes("auditLogs" /* AUDIT_LOGS */);
|
|
17233
17149
|
}
|
|
17234
|
-
function getEventFriendlyName(event,
|
|
17150
|
+
function getEventFriendlyName(event, metadata2) {
|
|
17235
17151
|
const friendly = AuditedEventFriendlyName[event];
|
|
17236
17152
|
if (!friendly) {
|
|
17237
17153
|
throw new Error("No friendly name found.");
|
|
17238
17154
|
}
|
|
17239
|
-
let processed = processStringSync(friendly,
|
|
17155
|
+
let processed = processStringSync(friendly, metadata2);
|
|
17240
17156
|
if (processed.includes(`""`)) {
|
|
17241
17157
|
processed = removeTemplateStrings(friendly);
|
|
17242
17158
|
}
|
|
@@ -17258,29 +17174,29 @@ var init_utils10 = __esm({
|
|
|
17258
17174
|
});
|
|
17259
17175
|
|
|
17260
17176
|
// ../pro/packages/pro/src/sdk/auditLogs/auditLogs.ts
|
|
17261
|
-
async function
|
|
17177
|
+
async function write2(event, metadata2, opts) {
|
|
17262
17178
|
if (!await auditLogsEnabled() || !utils_exports2.isAudited(event)) {
|
|
17263
17179
|
return;
|
|
17264
17180
|
}
|
|
17265
|
-
const friendly = getEventFriendlyName(event,
|
|
17181
|
+
const friendly = getEventFriendlyName(event, metadata2);
|
|
17266
17182
|
let date = /* @__PURE__ */ new Date();
|
|
17267
17183
|
if (opts == null ? void 0 : opts.timestamp) {
|
|
17268
17184
|
date = new Date(opts.timestamp);
|
|
17269
17185
|
}
|
|
17270
|
-
const
|
|
17186
|
+
const doc2 = {
|
|
17271
17187
|
timestamp: date.toISOString(),
|
|
17272
17188
|
event,
|
|
17273
17189
|
name: friendly,
|
|
17274
17190
|
userId: (opts == null ? void 0 : opts.userId) || AuditLogSystemUser,
|
|
17275
17191
|
metadata: {
|
|
17276
|
-
...
|
|
17192
|
+
...metadata2,
|
|
17277
17193
|
...opts == null ? void 0 : opts.hostInfo
|
|
17278
17194
|
}
|
|
17279
17195
|
};
|
|
17280
17196
|
const fallback = {};
|
|
17281
17197
|
try {
|
|
17282
17198
|
if (opts == null ? void 0 : opts.appId) {
|
|
17283
|
-
|
|
17199
|
+
doc2.appId = db_exports.getProdAppID(opts.appId);
|
|
17284
17200
|
const appMetadata = await cache_exports.app.getAppMetadata(opts.appId);
|
|
17285
17201
|
fallback.appName = appMetadata.name;
|
|
17286
17202
|
}
|
|
@@ -17294,8 +17210,8 @@ async function write(event, metadata, opts) {
|
|
|
17294
17210
|
err
|
|
17295
17211
|
);
|
|
17296
17212
|
}
|
|
17297
|
-
|
|
17298
|
-
return await save5(
|
|
17213
|
+
doc2.fallback = fallback;
|
|
17214
|
+
return await save5(doc2);
|
|
17299
17215
|
}
|
|
17300
17216
|
async function enrich(logs) {
|
|
17301
17217
|
const allUserIds = logs.map((log) => log.userId);
|
|
@@ -17367,7 +17283,7 @@ __export(auditLogs_exports2, {
|
|
|
17367
17283
|
definitions: () => definitions2,
|
|
17368
17284
|
download: () => download,
|
|
17369
17285
|
fetch: () => fetch11,
|
|
17370
|
-
write: () =>
|
|
17286
|
+
write: () => write2
|
|
17371
17287
|
});
|
|
17372
17288
|
var init_auditLogs6 = __esm({
|
|
17373
17289
|
"../pro/packages/pro/src/sdk/auditLogs/index.ts"() {
|
|
@@ -17390,8 +17306,8 @@ var init_queue4 = __esm({
|
|
|
17390
17306
|
});
|
|
17391
17307
|
|
|
17392
17308
|
// ../pro/packages/pro/src/sdk/backups/backup.ts
|
|
17393
|
-
async function storeAppBackupMetadata2(
|
|
17394
|
-
return backups_exports.storeAppBackupMetadata(
|
|
17309
|
+
async function storeAppBackupMetadata2(metadata2, opts = {}) {
|
|
17310
|
+
return backups_exports.storeAppBackupMetadata(metadata2, opts);
|
|
17395
17311
|
}
|
|
17396
17312
|
function getTimestamps(status2) {
|
|
17397
17313
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -17405,7 +17321,7 @@ function getTimestamps(status2) {
|
|
|
17405
17321
|
return { timestamp, createdAt: timestamp };
|
|
17406
17322
|
}
|
|
17407
17323
|
}
|
|
17408
|
-
async function updateBackupStatus(id,
|
|
17324
|
+
async function updateBackupStatus(id, rev2, status2, contents, filename) {
|
|
17409
17325
|
const backup = await getAppBackup(id);
|
|
17410
17326
|
return await backups_exports.storeAppBackupMetadata(
|
|
17411
17327
|
{
|
|
@@ -17415,10 +17331,10 @@ async function updateBackupStatus(id, rev, status2, contents, filename) {
|
|
|
17415
17331
|
status: status2,
|
|
17416
17332
|
type: "backup" /* BACKUP */
|
|
17417
17333
|
},
|
|
17418
|
-
{ filename, docId: id, docRev:
|
|
17334
|
+
{ filename, docId: id, docRev: rev2 }
|
|
17419
17335
|
);
|
|
17420
17336
|
}
|
|
17421
|
-
async function updateRestoreStatus(id,
|
|
17337
|
+
async function updateRestoreStatus(id, rev2, status2) {
|
|
17422
17338
|
const restore = await getAppBackup(id);
|
|
17423
17339
|
return await backups_exports.storeAppBackupMetadata(
|
|
17424
17340
|
{
|
|
@@ -17428,7 +17344,7 @@ async function updateRestoreStatus(id, rev, status2) {
|
|
|
17428
17344
|
type: "restore" /* RESTORE */,
|
|
17429
17345
|
trigger: "manual" /* MANUAL */
|
|
17430
17346
|
},
|
|
17431
|
-
{ docId: id, docRev:
|
|
17347
|
+
{ docId: id, docRev: rev2 }
|
|
17432
17348
|
);
|
|
17433
17349
|
}
|
|
17434
17350
|
async function getAppBackup(backupId) {
|
|
@@ -17438,11 +17354,11 @@ async function updateAppBackup(backupId, backupName) {
|
|
|
17438
17354
|
return backups_exports.updateAppBackupMetadata(backupId, backupName);
|
|
17439
17355
|
}
|
|
17440
17356
|
async function deleteAppBackup(backupId) {
|
|
17441
|
-
const
|
|
17442
|
-
if (
|
|
17357
|
+
const metadata2 = await backups_exports.getAppBackupMetadata(backupId);
|
|
17358
|
+
if (metadata2.filename) {
|
|
17443
17359
|
await objectStore_exports2.deleteFile(
|
|
17444
17360
|
objectStore_exports2.ObjectStoreBuckets.BACKUPS,
|
|
17445
|
-
|
|
17361
|
+
metadata2.filename
|
|
17446
17362
|
);
|
|
17447
17363
|
}
|
|
17448
17364
|
return backups_exports.deleteAppBackupMetadata(backupId);
|
|
@@ -17451,15 +17367,15 @@ async function fetchAppBackups2(appId, opts) {
|
|
|
17451
17367
|
return backups_exports.fetchAppBackups(appId, opts);
|
|
17452
17368
|
}
|
|
17453
17369
|
async function downloadAppBackup(backupId) {
|
|
17454
|
-
const
|
|
17455
|
-
if (!
|
|
17370
|
+
const metadata2 = await backups_exports.getAppBackupMetadata(backupId);
|
|
17371
|
+
if (!metadata2.filename) {
|
|
17456
17372
|
throw new Error("Backup incomplete - cannot download.");
|
|
17457
17373
|
}
|
|
17458
17374
|
const path2 = await objectStore_exports2.retrieveToTmp(
|
|
17459
17375
|
objectStore_exports2.ObjectStoreBuckets.BACKUPS,
|
|
17460
|
-
|
|
17376
|
+
metadata2.filename
|
|
17461
17377
|
);
|
|
17462
|
-
return { metadata, path: path2 };
|
|
17378
|
+
return { metadata: metadata2, path: path2 };
|
|
17463
17379
|
}
|
|
17464
17380
|
async function triggerAppBackup(appId, trigger, opts = {}) {
|
|
17465
17381
|
let backup;
|
|
@@ -17498,7 +17414,7 @@ async function triggerAppBackup(appId, trigger, opts = {}) {
|
|
|
17498
17414
|
return backup.id;
|
|
17499
17415
|
}
|
|
17500
17416
|
async function triggerAppRestore(appId, backupId, nameForBackup, createdBy) {
|
|
17501
|
-
const
|
|
17417
|
+
const metadata2 = await getAppBackup(backupId);
|
|
17502
17418
|
let restore;
|
|
17503
17419
|
try {
|
|
17504
17420
|
restore = await storeAppBackupMetadata2({
|
|
@@ -17525,7 +17441,7 @@ async function triggerAppRestore(appId, backupId, nameForBackup, createdBy) {
|
|
|
17525
17441
|
createdBy
|
|
17526
17442
|
}
|
|
17527
17443
|
});
|
|
17528
|
-
return { restoreId: restore.id, metadata };
|
|
17444
|
+
return { restoreId: restore.id, metadata: metadata2 };
|
|
17529
17445
|
}
|
|
17530
17446
|
var pkg, backup_default2;
|
|
17531
17447
|
var init_backup5 = __esm({
|
|
@@ -17624,8 +17540,8 @@ async function runBackup(trigger, tenantId, appId, opts) {
|
|
|
17624
17540
|
}
|
|
17625
17541
|
});
|
|
17626
17542
|
await updateMetadata2("complete" /* COMPLETE */, { filename, contents });
|
|
17627
|
-
if (
|
|
17628
|
-
|
|
17543
|
+
if (import_fs7.default.existsSync(tarPath)) {
|
|
17544
|
+
import_fs7.default.rmSync(tarPath);
|
|
17629
17545
|
}
|
|
17630
17546
|
} catch (err) {
|
|
17631
17547
|
logging_exports.logAlert("App backup error", err);
|
|
@@ -17638,7 +17554,7 @@ async function importProcessor(job, opts) {
|
|
|
17638
17554
|
const tenantId = tenancy.getTenantIDFromAppID(appId);
|
|
17639
17555
|
return tenancy.doInTenant(tenantId, async () => {
|
|
17640
17556
|
const devAppId = db_exports.getDevAppID(appId);
|
|
17641
|
-
const { rev } = await backup_default2.updateRestoreStatus(
|
|
17557
|
+
const { rev: rev2 } = await backup_default2.updateRestoreStatus(
|
|
17642
17558
|
data2.docId,
|
|
17643
17559
|
data2.docRev,
|
|
17644
17560
|
"started" /* STARTED */
|
|
@@ -17663,34 +17579,34 @@ async function importProcessor(job, opts) {
|
|
|
17663
17579
|
logging_exports.logAlert("App restore error", err);
|
|
17664
17580
|
status2 = "failed" /* FAILED */;
|
|
17665
17581
|
}
|
|
17666
|
-
await backup_default2.updateRestoreStatus(data2.docId,
|
|
17582
|
+
await backup_default2.updateRestoreStatus(data2.docId, rev2, status2);
|
|
17667
17583
|
});
|
|
17668
17584
|
}
|
|
17669
17585
|
async function exportProcessor(job, opts) {
|
|
17670
17586
|
const data2 = job.data;
|
|
17671
|
-
const appId = data2.appId, trigger = data2.export.trigger,
|
|
17587
|
+
const appId = data2.appId, trigger = data2.export.trigger, name2 = data2.export.name;
|
|
17672
17588
|
const tenantId = tenancy.getTenantIDFromAppID(appId);
|
|
17673
17589
|
await tenancy.doInTenant(tenantId, async () => {
|
|
17674
|
-
const { rev } = await backup_default2.updateBackupStatus(
|
|
17590
|
+
const { rev: rev2 } = await backup_default2.updateBackupStatus(
|
|
17675
17591
|
data2.docId,
|
|
17676
17592
|
data2.docRev,
|
|
17677
17593
|
"started" /* STARTED */
|
|
17678
17594
|
);
|
|
17679
17595
|
return runBackup(trigger, tenantId, appId, {
|
|
17680
17596
|
processing: opts,
|
|
17681
|
-
doc: { id: data2.docId, rev },
|
|
17682
|
-
name
|
|
17597
|
+
doc: { id: data2.docId, rev: rev2 },
|
|
17598
|
+
name: name2
|
|
17683
17599
|
});
|
|
17684
17600
|
});
|
|
17685
17601
|
}
|
|
17686
|
-
var
|
|
17602
|
+
var import_fs7;
|
|
17687
17603
|
var init_processing = __esm({
|
|
17688
17604
|
"../pro/packages/pro/src/sdk/backups/processing.ts"() {
|
|
17689
17605
|
init_src2();
|
|
17690
17606
|
init_backup5();
|
|
17691
17607
|
init_src();
|
|
17692
17608
|
init_queue4();
|
|
17693
|
-
|
|
17609
|
+
import_fs7 = __toESM(require("fs"));
|
|
17694
17610
|
}
|
|
17695
17611
|
});
|
|
17696
17612
|
|
|
@@ -17988,9 +17904,9 @@ var init_groups7 = __esm({
|
|
|
17988
17904
|
ctx.body = { data: await fetch9() };
|
|
17989
17905
|
};
|
|
17990
17906
|
destroy4 = async (ctx) => {
|
|
17991
|
-
const { id, rev } = ctx.params;
|
|
17907
|
+
const { id, rev: rev2 } = ctx.params;
|
|
17992
17908
|
try {
|
|
17993
|
-
await remove2(id,
|
|
17909
|
+
await remove2(id, rev2);
|
|
17994
17910
|
ctx.body = { message: "Group deleted successfully" };
|
|
17995
17911
|
} catch (err) {
|
|
17996
17912
|
ctx.throw(err.status, err);
|
|
@@ -18036,13 +17952,13 @@ async function fetch13(ctx) {
|
|
|
18036
17952
|
};
|
|
18037
17953
|
}
|
|
18038
17954
|
async function create3(ctx) {
|
|
18039
|
-
const { name, production, development } = ctx.request.body;
|
|
18040
|
-
await environmentVariables_exports2.update(
|
|
17955
|
+
const { name: name2, production, development } = ctx.request.body;
|
|
17956
|
+
await environmentVariables_exports2.update(name2, { production, development });
|
|
18041
17957
|
const environments = ["production" /* PRODUCTION */];
|
|
18042
17958
|
if (production !== development) {
|
|
18043
17959
|
environments.push("development" /* DEVELOPMENT */);
|
|
18044
17960
|
}
|
|
18045
|
-
await events_exports.environmentVariable.created(
|
|
17961
|
+
await events_exports.environmentVariable.created(name2, environments);
|
|
18046
17962
|
ctx.status = 200;
|
|
18047
17963
|
}
|
|
18048
17964
|
async function update4(ctx) {
|
|
@@ -18329,17 +18245,17 @@ async function downloadBackup(ctx) {
|
|
|
18329
18245
|
const appId = ctx.params.appId;
|
|
18330
18246
|
await checkAppID(ctx, appId);
|
|
18331
18247
|
const backupId = ctx.params.backupId;
|
|
18332
|
-
const { metadata, path: path2 } = await backups_default.downloadAppBackup(backupId);
|
|
18333
|
-
ctx.attachment(`backup-${
|
|
18334
|
-
ctx.body =
|
|
18248
|
+
const { metadata: metadata2, path: path2 } = await backups_default.downloadAppBackup(backupId);
|
|
18249
|
+
ctx.attachment(`backup-${metadata2.timestamp}.tar.gz`);
|
|
18250
|
+
ctx.body = import_fs8.default.createReadStream(path2);
|
|
18335
18251
|
}
|
|
18336
|
-
var
|
|
18252
|
+
var import_fs8;
|
|
18337
18253
|
var init_backups3 = __esm({
|
|
18338
18254
|
"../pro/packages/pro/src/api/controllers/apps/backups.ts"() {
|
|
18339
18255
|
init_src();
|
|
18340
18256
|
init_sdk2();
|
|
18341
18257
|
init_src2();
|
|
18342
|
-
|
|
18258
|
+
import_fs8 = __toESM(require("fs"));
|
|
18343
18259
|
}
|
|
18344
18260
|
});
|
|
18345
18261
|
|
|
@@ -18470,8 +18386,8 @@ var init_schedules2 = __esm({
|
|
|
18470
18386
|
});
|
|
18471
18387
|
|
|
18472
18388
|
// ../pro/packages/pro/src/api/controllers/global/scim/users.ts
|
|
18473
|
-
function tryGetQueryAsNumber(ctx,
|
|
18474
|
-
const value = ctx.request.query[
|
|
18389
|
+
function tryGetQueryAsNumber(ctx, name2) {
|
|
18390
|
+
const value = ctx.request.query[name2];
|
|
18475
18391
|
if (value === void 0) {
|
|
18476
18392
|
return void 0;
|
|
18477
18393
|
}
|
|
@@ -18862,11 +18778,11 @@ var init_filters = __esm({
|
|
|
18862
18778
|
return docs;
|
|
18863
18779
|
}
|
|
18864
18780
|
query = cleanupQuery(query);
|
|
18865
|
-
const match = (type, failFn) => (
|
|
18781
|
+
const match = (type, failFn) => (doc2) => {
|
|
18866
18782
|
const filters = Object.entries(query[type] || {});
|
|
18867
18783
|
for (let i = 0; i < filters.length; i++) {
|
|
18868
18784
|
const [key, testValue] = filters[i];
|
|
18869
|
-
const docValue = deepGet(
|
|
18785
|
+
const docValue = deepGet(doc2, removeKeyNumbering2(key));
|
|
18870
18786
|
if (failFn(docValue, testValue)) {
|
|
18871
18787
|
return false;
|
|
18872
18788
|
}
|
|
@@ -18927,8 +18843,8 @@ var init_filters = __esm({
|
|
|
18927
18843
|
return testValue == null ? void 0 : testValue.every((item) => docValue == null ? void 0 : docValue.includes(item));
|
|
18928
18844
|
}
|
|
18929
18845
|
);
|
|
18930
|
-
const docMatch = (
|
|
18931
|
-
return stringMatch(
|
|
18846
|
+
const docMatch = (doc2) => {
|
|
18847
|
+
return stringMatch(doc2) && fuzzyMatch(doc2) && rangeMatch(doc2) && equalMatch(doc2) && notEqualMatch(doc2) && emptyMatch(doc2) && notEmptyMatch(doc2) && oneOf(doc2) && contains(doc2) && containsAny(doc2) && notContains(doc2);
|
|
18932
18848
|
};
|
|
18933
18849
|
return docs.filter(docMatch);
|
|
18934
18850
|
};
|
|
@@ -18975,39 +18891,11 @@ var init_filters = __esm({
|
|
|
18975
18891
|
// ../shared-core/src/utils.ts
|
|
18976
18892
|
var utils_exports5 = {};
|
|
18977
18893
|
__export(utils_exports5, {
|
|
18978
|
-
parallelForeach: () => parallelForeach,
|
|
18979
18894
|
unreachable: () => unreachable
|
|
18980
18895
|
});
|
|
18981
18896
|
function unreachable(value, message = `No such case in exhaustive switch: ${value}`) {
|
|
18982
18897
|
throw new Error(message);
|
|
18983
18898
|
}
|
|
18984
|
-
async function parallelForeach(items, task, maxConcurrency) {
|
|
18985
|
-
const promises = [];
|
|
18986
|
-
let index2 = 0;
|
|
18987
|
-
const processItem = async (item) => {
|
|
18988
|
-
try {
|
|
18989
|
-
await task(item);
|
|
18990
|
-
} finally {
|
|
18991
|
-
processNext();
|
|
18992
|
-
}
|
|
18993
|
-
};
|
|
18994
|
-
const processNext = () => {
|
|
18995
|
-
if (index2 >= items.length) {
|
|
18996
|
-
return;
|
|
18997
|
-
}
|
|
18998
|
-
const item = items[index2];
|
|
18999
|
-
index2++;
|
|
19000
|
-
const promise = processItem(item);
|
|
19001
|
-
promises.push(promise);
|
|
19002
|
-
if (promises.length >= maxConcurrency) {
|
|
19003
|
-
Promise.race(promises).then(processNext);
|
|
19004
|
-
} else {
|
|
19005
|
-
processNext();
|
|
19006
|
-
}
|
|
19007
|
-
};
|
|
19008
|
-
processNext();
|
|
19009
|
-
await Promise.all(promises);
|
|
19010
|
-
}
|
|
19011
18899
|
var init_utils12 = __esm({
|
|
19012
18900
|
"../shared-core/src/utils.ts"() {
|
|
19013
18901
|
}
|
|
@@ -19631,32 +19519,32 @@ var init_centralPath = __esm({
|
|
|
19631
19519
|
});
|
|
19632
19520
|
|
|
19633
19521
|
// src/utilities/fileSystem/filesystem.ts
|
|
19634
|
-
var
|
|
19522
|
+
var import_fs9, import_path7, import_tar, uuid2, TOP_LEVEL_PATH, apiFileReturn, streamFile, createTempFolder, extractTarball;
|
|
19635
19523
|
var init_filesystem = __esm({
|
|
19636
19524
|
"src/utilities/fileSystem/filesystem.ts"() {
|
|
19637
|
-
|
|
19525
|
+
import_fs9 = __toESM(require("fs"));
|
|
19638
19526
|
init_budibaseDir();
|
|
19639
|
-
|
|
19527
|
+
import_path7 = require("path");
|
|
19640
19528
|
init_environment();
|
|
19641
19529
|
import_tar = __toESM(require("tar"));
|
|
19642
19530
|
init_environment();
|
|
19643
19531
|
uuid2 = require("uuid/v4");
|
|
19644
|
-
TOP_LEVEL_PATH = environment_default.TOP_LEVEL_PATH || (0,
|
|
19532
|
+
TOP_LEVEL_PATH = environment_default.TOP_LEVEL_PATH || (0, import_path7.resolve)((0, import_path7.join)(__dirname, "..", "..", ".."));
|
|
19645
19533
|
apiFileReturn = (contents) => {
|
|
19646
|
-
const path2 = (0,
|
|
19647
|
-
|
|
19648
|
-
return
|
|
19534
|
+
const path2 = (0, import_path7.join)(budibaseTempDir2(), uuid2());
|
|
19535
|
+
import_fs9.default.writeFileSync(path2, contents);
|
|
19536
|
+
return import_fs9.default.createReadStream(path2);
|
|
19649
19537
|
};
|
|
19650
19538
|
streamFile = (path2) => {
|
|
19651
|
-
return
|
|
19539
|
+
return import_fs9.default.createReadStream(path2);
|
|
19652
19540
|
};
|
|
19653
19541
|
createTempFolder = (item) => {
|
|
19654
|
-
const path2 = (0,
|
|
19542
|
+
const path2 = (0, import_path7.join)(budibaseTempDir2(), item);
|
|
19655
19543
|
try {
|
|
19656
|
-
if (
|
|
19657
|
-
|
|
19544
|
+
if (import_fs9.default.existsSync(path2)) {
|
|
19545
|
+
import_fs9.default.rmSync(path2, { recursive: true, force: true });
|
|
19658
19546
|
}
|
|
19659
|
-
|
|
19547
|
+
import_fs9.default.mkdirSync(path2);
|
|
19660
19548
|
} catch (err) {
|
|
19661
19549
|
throw new Error(`Path cannot be created: ${err.message}`);
|
|
19662
19550
|
}
|
|
@@ -19683,37 +19571,37 @@ var init_clientLibrary = __esm({
|
|
|
19683
19571
|
});
|
|
19684
19572
|
|
|
19685
19573
|
// src/utilities/fileSystem/app.ts
|
|
19686
|
-
var
|
|
19574
|
+
var import_path8, NODE_MODULES_PATH;
|
|
19687
19575
|
var init_app7 = __esm({
|
|
19688
19576
|
"src/utilities/fileSystem/app.ts"() {
|
|
19689
19577
|
init_budibaseDir();
|
|
19690
|
-
|
|
19578
|
+
import_path8 = require("path");
|
|
19691
19579
|
init_constants6();
|
|
19692
19580
|
init_clientLibrary();
|
|
19693
19581
|
init_environment();
|
|
19694
19582
|
init_src2();
|
|
19695
19583
|
init_filesystem();
|
|
19696
|
-
NODE_MODULES_PATH = (0,
|
|
19584
|
+
NODE_MODULES_PATH = (0, import_path8.join)(TOP_LEVEL_PATH, "node_modules");
|
|
19697
19585
|
}
|
|
19698
19586
|
});
|
|
19699
19587
|
|
|
19700
19588
|
// src/utilities/fileSystem/plugin.ts
|
|
19701
19589
|
async function getPluginImpl(path2, plugin) {
|
|
19702
19590
|
var _a;
|
|
19703
|
-
const
|
|
19704
|
-
if (!
|
|
19705
|
-
|
|
19591
|
+
const hash3 = (_a = plugin.schema) == null ? void 0 : _a.hash;
|
|
19592
|
+
if (!import_fs10.default.existsSync(path2)) {
|
|
19593
|
+
import_fs10.default.mkdirSync(path2);
|
|
19706
19594
|
}
|
|
19707
|
-
const filename = (0,
|
|
19595
|
+
const filename = (0, import_path9.join)(path2, plugin.name);
|
|
19708
19596
|
const metadataName = `${filename}.bbmetadata`;
|
|
19709
|
-
if (
|
|
19710
|
-
const currentHash =
|
|
19711
|
-
if (currentHash ===
|
|
19597
|
+
if (import_fs10.default.existsSync(filename)) {
|
|
19598
|
+
const currentHash = import_fs10.default.readFileSync(metadataName, "utf8");
|
|
19599
|
+
if (currentHash === hash3) {
|
|
19712
19600
|
return require(filename);
|
|
19713
19601
|
} else {
|
|
19714
19602
|
console.log(`Updating plugin: ${plugin.name}`);
|
|
19715
19603
|
delete require.cache[require.resolve(filename)];
|
|
19716
|
-
|
|
19604
|
+
import_fs10.default.unlinkSync(filename);
|
|
19717
19605
|
}
|
|
19718
19606
|
}
|
|
19719
19607
|
const pluginKey = objectStore_exports2.getPluginJSKey(plugin);
|
|
@@ -19721,27 +19609,27 @@ async function getPluginImpl(path2, plugin) {
|
|
|
19721
19609
|
objectStore_exports2.ObjectStoreBuckets.PLUGINS,
|
|
19722
19610
|
pluginKey
|
|
19723
19611
|
);
|
|
19724
|
-
|
|
19725
|
-
|
|
19612
|
+
import_fs10.default.writeFileSync(filename, pluginJs);
|
|
19613
|
+
import_fs10.default.writeFileSync(metadataName, hash3);
|
|
19726
19614
|
return require(filename);
|
|
19727
19615
|
}
|
|
19728
|
-
var
|
|
19616
|
+
var import_fs10, import_path9, DATASOURCE_PATH, AUTOMATION_PATH, getPluginMetadata, getDatasourcePlugin, getAutomationPlugin;
|
|
19729
19617
|
var init_plugin5 = __esm({
|
|
19730
19618
|
"src/utilities/fileSystem/plugin.ts"() {
|
|
19731
19619
|
init_budibaseDir();
|
|
19732
|
-
|
|
19733
|
-
|
|
19620
|
+
import_fs10 = __toESM(require("fs"));
|
|
19621
|
+
import_path9 = require("path");
|
|
19734
19622
|
init_src2();
|
|
19735
|
-
DATASOURCE_PATH = (0,
|
|
19736
|
-
AUTOMATION_PATH = (0,
|
|
19623
|
+
DATASOURCE_PATH = (0, import_path9.join)(budibaseTempDir2(), "datasource");
|
|
19624
|
+
AUTOMATION_PATH = (0, import_path9.join)(budibaseTempDir2(), "automation");
|
|
19737
19625
|
getPluginMetadata = async (path2) => {
|
|
19738
|
-
let
|
|
19626
|
+
let metadata2 = {};
|
|
19739
19627
|
try {
|
|
19740
|
-
const pkg2 =
|
|
19741
|
-
const schema =
|
|
19742
|
-
|
|
19743
|
-
|
|
19744
|
-
if (!
|
|
19628
|
+
const pkg2 = import_fs10.default.readFileSync((0, import_path9.join)(path2, "package.json"), "utf8");
|
|
19629
|
+
const schema = import_fs10.default.readFileSync((0, import_path9.join)(path2, "schema.json"), "utf8");
|
|
19630
|
+
metadata2.schema = JSON.parse(schema);
|
|
19631
|
+
metadata2.package = JSON.parse(pkg2);
|
|
19632
|
+
if (!metadata2.package.name || !metadata2.package.version || !metadata2.package.description) {
|
|
19745
19633
|
throw new Error(
|
|
19746
19634
|
"package.json is missing one of 'name', 'version' or 'description'."
|
|
19747
19635
|
);
|
|
@@ -19751,7 +19639,7 @@ var init_plugin5 = __esm({
|
|
|
19751
19639
|
`Unable to process schema.json/package.json in plugin. ${err.message}`
|
|
19752
19640
|
);
|
|
19753
19641
|
}
|
|
19754
|
-
return { metadata, directory: path2 };
|
|
19642
|
+
return { metadata: metadata2, directory: path2 };
|
|
19755
19643
|
};
|
|
19756
19644
|
getDatasourcePlugin = async (plugin) => {
|
|
19757
19645
|
return getPluginImpl(DATASOURCE_PATH, plugin);
|
|
@@ -19768,9 +19656,9 @@ var init_template = __esm({
|
|
|
19768
19656
|
"src/utilities/fileSystem/template.ts"() {
|
|
19769
19657
|
init_constants6();
|
|
19770
19658
|
init_src2();
|
|
19771
|
-
downloadTemplate = async (type,
|
|
19659
|
+
downloadTemplate = async (type, name2) => {
|
|
19772
19660
|
const DEFAULT_TEMPLATES_BUCKET = "prod-budi-templates.s3-eu-west-1.amazonaws.com";
|
|
19773
|
-
const templateUrl = `https://${DEFAULT_TEMPLATES_BUCKET}/templates/${type}/${
|
|
19661
|
+
const templateUrl = `https://${DEFAULT_TEMPLATES_BUCKET}/templates/${type}/${name2}.tar.gz`;
|
|
19774
19662
|
return objectStore_exports2.downloadTarball(
|
|
19775
19663
|
templateUrl,
|
|
19776
19664
|
ObjectStoreBuckets2.TEMPLATES,
|
|
@@ -19808,18 +19696,17 @@ __export(exports_exports, {
|
|
|
19808
19696
|
exportDB: () => exportDB,
|
|
19809
19697
|
streamExportApp: () => streamExportApp
|
|
19810
19698
|
});
|
|
19811
|
-
function tarFilesToTmp(tmpDir,
|
|
19812
|
-
const
|
|
19813
|
-
|
|
19814
|
-
import_tar2.default.create(
|
|
19699
|
+
function tarFilesToTmp(tmpDir, files2) {
|
|
19700
|
+
const exportFile = (0, import_path10.join)(budibaseTempDir2(), `${uuid3()}.tar.gz`);
|
|
19701
|
+
tar3.create(
|
|
19815
19702
|
{
|
|
19816
19703
|
sync: true,
|
|
19817
19704
|
gzip: true,
|
|
19818
19705
|
file: exportFile,
|
|
19819
|
-
|
|
19706
|
+
recursive: true,
|
|
19820
19707
|
cwd: tmpDir
|
|
19821
19708
|
},
|
|
19822
|
-
|
|
19709
|
+
files2
|
|
19823
19710
|
);
|
|
19824
19711
|
return exportFile;
|
|
19825
19712
|
}
|
|
@@ -19833,7 +19720,7 @@ async function exportDB(dbName, opts = {}) {
|
|
|
19833
19720
|
return db_exports.doWithDB(dbName, async (db2) => {
|
|
19834
19721
|
if (opts == null ? void 0 : opts.exportPath) {
|
|
19835
19722
|
const path2 = opts == null ? void 0 : opts.exportPath;
|
|
19836
|
-
const writeStream =
|
|
19723
|
+
const writeStream = import_fs11.default.createWriteStream(path2);
|
|
19837
19724
|
await db2.dump(writeStream, exportOpts);
|
|
19838
19725
|
return path2;
|
|
19839
19726
|
} else {
|
|
@@ -19855,7 +19742,7 @@ function defineFilter(excludeRows, excludeLogs) {
|
|
|
19855
19742
|
if (excludeLogs) {
|
|
19856
19743
|
ids.push(AUTOMATION_LOG_PREFIX);
|
|
19857
19744
|
}
|
|
19858
|
-
return (
|
|
19745
|
+
return (doc2) => !ids.map((key) => doc2._id.includes(key)).reduce((prev, curr) => prev || curr);
|
|
19859
19746
|
}
|
|
19860
19747
|
async function exportApp(appId, config) {
|
|
19861
19748
|
const prodAppId = db_exports.getProdAppID(appId);
|
|
@@ -19866,9 +19753,9 @@ async function exportApp(appId, config) {
|
|
|
19866
19753
|
for (let path2 of STATIC_APP_FILES) {
|
|
19867
19754
|
const contents = await objectStore_exports2.retrieve(
|
|
19868
19755
|
ObjectStoreBuckets2.APPS,
|
|
19869
|
-
(0,
|
|
19756
|
+
(0, import_path10.join)(appPath, path2)
|
|
19870
19757
|
);
|
|
19871
|
-
|
|
19758
|
+
import_fs11.default.writeFileSync((0, import_path10.join)(tmpPath, path2), contents);
|
|
19872
19759
|
}
|
|
19873
19760
|
} else {
|
|
19874
19761
|
tmpPath = await objectStore_exports2.retrieveDirectory(
|
|
@@ -19877,52 +19764,37 @@ async function exportApp(appId, config) {
|
|
|
19877
19764
|
);
|
|
19878
19765
|
}
|
|
19879
19766
|
}
|
|
19880
|
-
const downloadedPath = (0,
|
|
19881
|
-
if (
|
|
19882
|
-
const allFiles =
|
|
19767
|
+
const downloadedPath = (0, import_path10.join)(tmpPath, appPath);
|
|
19768
|
+
if (import_fs11.default.existsSync(downloadedPath)) {
|
|
19769
|
+
const allFiles = import_fs11.default.readdirSync(downloadedPath);
|
|
19883
19770
|
for (let file of allFiles) {
|
|
19884
|
-
const path2 = (0,
|
|
19885
|
-
|
|
19771
|
+
const path2 = (0, import_path10.join)(downloadedPath, file);
|
|
19772
|
+
import_fs11.default.renameSync(path2, (0, import_path10.join)(downloadedPath, "..", file));
|
|
19886
19773
|
}
|
|
19887
|
-
|
|
19774
|
+
import_fs11.default.rmdirSync(downloadedPath);
|
|
19888
19775
|
}
|
|
19889
|
-
const dbPath = (0,
|
|
19776
|
+
const dbPath = (0, import_path10.join)(tmpPath, DB_EXPORT_FILE);
|
|
19890
19777
|
await exportDB(appId, {
|
|
19891
19778
|
filter: defineFilter(config == null ? void 0 : config.excludeRows, config == null ? void 0 : config.excludeLogs),
|
|
19892
19779
|
exportPath: dbPath
|
|
19893
19780
|
});
|
|
19894
|
-
if (config == null ? void 0 : config.encryptPassword) {
|
|
19895
|
-
for (let file of import_fs12.default.readdirSync(tmpPath)) {
|
|
19896
|
-
const path2 = (0, import_path11.join)(tmpPath, file);
|
|
19897
|
-
await encryption_exports.encryptFile(
|
|
19898
|
-
{ dir: tmpPath, filename: file },
|
|
19899
|
-
config.encryptPassword
|
|
19900
|
-
);
|
|
19901
|
-
import_fs12.default.rmSync(path2);
|
|
19902
|
-
}
|
|
19903
|
-
}
|
|
19904
19781
|
if (config == null ? void 0 : config.tar) {
|
|
19905
|
-
const tarPath = tarFilesToTmp(tmpPath,
|
|
19906
|
-
|
|
19782
|
+
const tarPath = tarFilesToTmp(tmpPath, import_fs11.default.readdirSync(tmpPath));
|
|
19783
|
+
import_fs11.default.rmSync(tmpPath, { recursive: true, force: true });
|
|
19907
19784
|
return tarPath;
|
|
19908
19785
|
} else {
|
|
19909
19786
|
return tmpPath;
|
|
19910
19787
|
}
|
|
19911
19788
|
}
|
|
19912
|
-
async function streamExportApp({
|
|
19913
|
-
appId,
|
|
19914
|
-
excludeRows,
|
|
19915
|
-
encryptPassword
|
|
19916
|
-
}) {
|
|
19789
|
+
async function streamExportApp(appId, excludeRows) {
|
|
19917
19790
|
const tmpPath = await exportApp(appId, {
|
|
19918
19791
|
excludeRows,
|
|
19919
19792
|
excludeLogs: true,
|
|
19920
|
-
tar: true
|
|
19921
|
-
encryptPassword
|
|
19793
|
+
tar: true
|
|
19922
19794
|
});
|
|
19923
19795
|
return streamFile(tmpPath);
|
|
19924
19796
|
}
|
|
19925
|
-
var
|
|
19797
|
+
var import_fs11, import_path10, uuid3, tar3, MemoryStream2;
|
|
19926
19798
|
var init_exports2 = __esm({
|
|
19927
19799
|
"src/sdk/app/backups/exports.ts"() {
|
|
19928
19800
|
init_src2();
|
|
@@ -19931,11 +19803,11 @@ var init_exports2 = __esm({
|
|
|
19931
19803
|
init_constants6();
|
|
19932
19804
|
init_utils13();
|
|
19933
19805
|
init_constants7();
|
|
19934
|
-
|
|
19935
|
-
|
|
19806
|
+
import_fs11 = __toESM(require("fs"));
|
|
19807
|
+
import_path10 = require("path");
|
|
19936
19808
|
init_environment();
|
|
19937
|
-
import_tar2 = __toESM(require("tar"));
|
|
19938
19809
|
uuid3 = require("uuid/v4");
|
|
19810
|
+
tar3 = require("tar");
|
|
19939
19811
|
MemoryStream2 = require("memorystream");
|
|
19940
19812
|
}
|
|
19941
19813
|
});
|
|
@@ -20012,16 +19884,16 @@ async function getTemplateStream(template) {
|
|
|
20012
19884
|
throw new Error("Cannot import a non-text based file.");
|
|
20013
19885
|
}
|
|
20014
19886
|
if (template.file) {
|
|
20015
|
-
return
|
|
19887
|
+
return import_fs12.default.createReadStream(template.file.path);
|
|
20016
19888
|
} else if (template.key) {
|
|
20017
|
-
const [type,
|
|
20018
|
-
const tmpPath = await downloadTemplate(type,
|
|
20019
|
-
return
|
|
19889
|
+
const [type, name2] = template.key.split("/");
|
|
19890
|
+
const tmpPath = await downloadTemplate(type, name2);
|
|
19891
|
+
return import_fs12.default.createReadStream((0, import_path11.join)(tmpPath, name2, "db", "dump.txt"));
|
|
20020
19892
|
}
|
|
20021
19893
|
}
|
|
20022
19894
|
function untarFile(file) {
|
|
20023
|
-
const tmpPath = (0,
|
|
20024
|
-
|
|
19895
|
+
const tmpPath = (0, import_path11.join)(budibaseTempDir2(), uuid4());
|
|
19896
|
+
import_fs12.default.mkdirSync(tmpPath);
|
|
20025
19897
|
tar4.extract({
|
|
20026
19898
|
sync: true,
|
|
20027
19899
|
cwd: tmpPath,
|
|
@@ -20029,49 +19901,31 @@ function untarFile(file) {
|
|
|
20029
19901
|
});
|
|
20030
19902
|
return tmpPath;
|
|
20031
19903
|
}
|
|
20032
|
-
async function decryptFiles(path2, password) {
|
|
20033
|
-
try {
|
|
20034
|
-
for (let file of import_fs13.default.readdirSync(path2)) {
|
|
20035
|
-
const inputPath = (0, import_path12.join)(path2, file);
|
|
20036
|
-
const outputPath = inputPath.replace(/\.enc$/, "");
|
|
20037
|
-
await encryption_exports.decryptFile(inputPath, outputPath, password);
|
|
20038
|
-
import_fs13.default.rmSync(inputPath);
|
|
20039
|
-
}
|
|
20040
|
-
} catch (err) {
|
|
20041
|
-
if (err.message === "incorrect header check") {
|
|
20042
|
-
throw new Error("File cannot be imported");
|
|
20043
|
-
}
|
|
20044
|
-
throw err;
|
|
20045
|
-
}
|
|
20046
|
-
}
|
|
20047
19904
|
function getGlobalDBFile(tmpPath) {
|
|
20048
|
-
return
|
|
19905
|
+
return import_fs12.default.readFileSync((0, import_path11.join)(tmpPath, GLOBAL_DB_EXPORT_FILE), "utf8");
|
|
20049
19906
|
}
|
|
20050
19907
|
function getListOfAppsInMulti(tmpPath) {
|
|
20051
|
-
return
|
|
19908
|
+
return import_fs12.default.readdirSync(tmpPath).filter((dir) => dir !== GLOBAL_DB_EXPORT_FILE);
|
|
20052
19909
|
}
|
|
20053
19910
|
async function importApp(appId, db2, template) {
|
|
20054
19911
|
var _a, _b;
|
|
20055
19912
|
let prodAppId = db_exports.getProdAppID(appId);
|
|
20056
19913
|
let dbStream;
|
|
20057
19914
|
const isTar = template.file && ((_b = (_a = template == null ? void 0 : template.file) == null ? void 0 : _a.type) == null ? void 0 : _b.endsWith("gzip"));
|
|
20058
|
-
const isDirectory = template.file &&
|
|
19915
|
+
const isDirectory = template.file && import_fs12.default.lstatSync(template.file.path).isDirectory();
|
|
20059
19916
|
if (template.file && (isTar || isDirectory)) {
|
|
20060
19917
|
const tmpPath = isTar ? untarFile(template.file) : template.file.path;
|
|
20061
|
-
|
|
20062
|
-
await decryptFiles(tmpPath, template.file.password);
|
|
20063
|
-
}
|
|
20064
|
-
const contents = import_fs13.default.readdirSync(tmpPath);
|
|
19918
|
+
const contents = import_fs12.default.readdirSync(tmpPath);
|
|
20065
19919
|
if (contents.length) {
|
|
20066
19920
|
let promises = [];
|
|
20067
19921
|
let excludedFiles = [GLOBAL_DB_EXPORT_FILE, DB_EXPORT_FILE];
|
|
20068
19922
|
for (let filename of contents) {
|
|
20069
|
-
const path2 = (0,
|
|
19923
|
+
const path2 = (0, import_path11.join)(tmpPath, filename);
|
|
20070
19924
|
if (excludedFiles.includes(filename)) {
|
|
20071
19925
|
continue;
|
|
20072
19926
|
}
|
|
20073
|
-
filename = (0,
|
|
20074
|
-
if (
|
|
19927
|
+
filename = (0, import_path11.join)(prodAppId, filename);
|
|
19928
|
+
if (import_fs12.default.lstatSync(path2).isDirectory()) {
|
|
20075
19929
|
promises.push(
|
|
20076
19930
|
objectStore_exports2.uploadDirectory(ObjectStoreBuckets2.APPS, path2, filename)
|
|
20077
19931
|
);
|
|
@@ -20087,7 +19941,7 @@ async function importApp(appId, db2, template) {
|
|
|
20087
19941
|
}
|
|
20088
19942
|
await Promise.all(promises);
|
|
20089
19943
|
}
|
|
20090
|
-
dbStream =
|
|
19944
|
+
dbStream = import_fs12.default.createReadStream((0, import_path11.join)(tmpPath, DB_EXPORT_FILE));
|
|
20091
19945
|
} else {
|
|
20092
19946
|
dbStream = await getTemplateStream(template);
|
|
20093
19947
|
}
|
|
@@ -20099,7 +19953,7 @@ async function importApp(appId, db2, template) {
|
|
|
20099
19953
|
await updateAutomations(prodAppId, db2);
|
|
20100
19954
|
return ok;
|
|
20101
19955
|
}
|
|
20102
|
-
var
|
|
19956
|
+
var import_path11, import_fs12, uuid4, tar4;
|
|
20103
19957
|
var init_imports = __esm({
|
|
20104
19958
|
"src/sdk/app/backups/imports.ts"() {
|
|
20105
19959
|
init_src2();
|
|
@@ -20108,8 +19962,8 @@ var init_imports = __esm({
|
|
|
20108
19962
|
init_constants7();
|
|
20109
19963
|
init_fileSystem2();
|
|
20110
19964
|
init_constants6();
|
|
20111
|
-
|
|
20112
|
-
|
|
19965
|
+
import_path11 = require("path");
|
|
19966
|
+
import_fs12 = __toESM(require("fs"));
|
|
20113
19967
|
init_sdk3();
|
|
20114
19968
|
init_src();
|
|
20115
19969
|
uuid4 = require("uuid/v4");
|
|
@@ -20347,22 +20201,34 @@ function finaliseExternalTables(tables, entities) {
|
|
|
20347
20201
|
let finalTables = {};
|
|
20348
20202
|
const errors = {};
|
|
20349
20203
|
const tableIds = Object.values(tables).map((table) => table._id);
|
|
20350
|
-
for (let [
|
|
20204
|
+
for (let [name2, table] of Object.entries(tables)) {
|
|
20351
20205
|
const schemaFields = Object.keys(table.schema);
|
|
20352
20206
|
if (table.primary == null || table.primary.length === 0) {
|
|
20353
|
-
errors[
|
|
20207
|
+
errors[name2] = "no_key" /* NO_KEY */;
|
|
20354
20208
|
continue;
|
|
20355
20209
|
} else if (schemaFields.find(
|
|
20356
20210
|
(field) => invalidColumns.includes(field)
|
|
20357
20211
|
)) {
|
|
20358
|
-
errors[
|
|
20212
|
+
errors[name2] = "invalid_column" /* INVALID_COLUMN */;
|
|
20359
20213
|
continue;
|
|
20360
20214
|
}
|
|
20361
|
-
finalTables[
|
|
20215
|
+
finalTables[name2] = copyExistingPropsOver(name2, table, entities, tableIds);
|
|
20362
20216
|
}
|
|
20363
20217
|
finalTables = Object.entries(finalTables).sort(([a], [b]) => a.localeCompare(b)).reduce((r, [k, v]) => ({ ...r, [k]: v }), {});
|
|
20364
20218
|
return { tables: finalTables, errors };
|
|
20365
20219
|
}
|
|
20220
|
+
function getPrimaryDisplay(testValue) {
|
|
20221
|
+
if (testValue instanceof Date) {
|
|
20222
|
+
return testValue.toISOString();
|
|
20223
|
+
}
|
|
20224
|
+
if (Array.isArray(testValue) && testValue[0] && typeof testValue[0] !== "object") {
|
|
20225
|
+
return testValue.join(", ");
|
|
20226
|
+
}
|
|
20227
|
+
if (typeof testValue === "object") {
|
|
20228
|
+
return void 0;
|
|
20229
|
+
}
|
|
20230
|
+
return testValue;
|
|
20231
|
+
}
|
|
20366
20232
|
var DOUBLE_SEPARATOR, ROW_ID_REGEX, ENCODED_SPACE, SQL_NUMBER_TYPE_MAP, SQL_DATE_TYPE_MAP, SQL_DATE_ONLY_TYPES, SQL_TIME_ONLY_TYPES, SQL_STRING_TYPE_MAP, SQL_BOOLEAN_TYPE_MAP, SQL_MISC_TYPE_MAP, SQL_TYPE_MAP;
|
|
20367
20233
|
var init_utils14 = __esm({
|
|
20368
20234
|
"src/integrations/utils.ts"() {
|
|
@@ -21404,8 +21270,7 @@ var init_postgres = __esm({
|
|
|
21404
21270
|
try {
|
|
21405
21271
|
await this.openConnection();
|
|
21406
21272
|
const columnsResponse = await this.client.query(this.COLUMNS_SQL);
|
|
21407
|
-
|
|
21408
|
-
return [...new Set(names)];
|
|
21273
|
+
return columnsResponse.rows.map((row) => row.table_name);
|
|
21409
21274
|
} finally {
|
|
21410
21275
|
await this.closeConnection();
|
|
21411
21276
|
}
|
|
@@ -22034,8 +21899,6 @@ var init_mongodb = __esm({
|
|
|
22034
21899
|
response2.connected = true;
|
|
22035
21900
|
} catch (e) {
|
|
22036
21901
|
response2.error = e.message;
|
|
22037
|
-
} finally {
|
|
22038
|
-
await this.client.close();
|
|
22039
21902
|
}
|
|
22040
21903
|
return response2;
|
|
22041
21904
|
}
|
|
@@ -22256,21 +22119,21 @@ var init_mongodb = __esm({
|
|
|
22256
22119
|
const collection = db2.collection(query.extra.collection);
|
|
22257
22120
|
let response2 = [];
|
|
22258
22121
|
if (((_a = query.extra) == null ? void 0 : _a.actionType) === "pipeline") {
|
|
22259
|
-
for await (const
|
|
22122
|
+
for await (const doc2 of collection.aggregate(
|
|
22260
22123
|
query.steps.map(({ key, value }) => {
|
|
22261
22124
|
let temp = {};
|
|
22262
22125
|
temp[key] = JSON.parse(value.value);
|
|
22263
22126
|
return this.createObjectIds(temp);
|
|
22264
22127
|
})
|
|
22265
22128
|
)) {
|
|
22266
|
-
response2.push(
|
|
22129
|
+
response2.push(doc2);
|
|
22267
22130
|
}
|
|
22268
22131
|
} else {
|
|
22269
22132
|
const stages = query.json;
|
|
22270
|
-
for await (const
|
|
22133
|
+
for await (const doc2 of collection.aggregate(
|
|
22271
22134
|
stages ? this.createObjectIds(stages) : []
|
|
22272
22135
|
)) {
|
|
22273
|
-
response2.push(
|
|
22136
|
+
response2.push(doc2);
|
|
22274
22137
|
}
|
|
22275
22138
|
}
|
|
22276
22139
|
return response2;
|
|
@@ -22581,9 +22444,9 @@ var init_couchdb = __esm({
|
|
|
22581
22444
|
});
|
|
22582
22445
|
}
|
|
22583
22446
|
async delete(query) {
|
|
22584
|
-
const
|
|
22447
|
+
const doc2 = await this.query("get", "Cannot find doc to be deleted", query);
|
|
22585
22448
|
return this.query("remove", "Error deleting couchDB document", {
|
|
22586
|
-
json:
|
|
22449
|
+
json: doc2
|
|
22587
22450
|
});
|
|
22588
22451
|
}
|
|
22589
22452
|
};
|
|
@@ -22769,7 +22632,7 @@ var init_microsoftSqlServer = __esm({
|
|
|
22769
22632
|
throw "Unable to get list of tables in database";
|
|
22770
22633
|
}
|
|
22771
22634
|
const schema = this.config.schema || DEFAULT_SCHEMA;
|
|
22772
|
-
const tableNames = tableInfo.filter((record) => record.TABLE_SCHEMA === schema).map((record) => record.TABLE_NAME).filter((
|
|
22635
|
+
const tableNames = tableInfo.filter((record) => record.TABLE_SCHEMA === schema).map((record) => record.TABLE_NAME).filter((name2) => this.MASTER_TABLES.indexOf(name2) === -1);
|
|
22773
22636
|
const tables = {};
|
|
22774
22637
|
for (let tableName of tableNames) {
|
|
22775
22638
|
const definition26 = await this.runSQL(this.getDefinitionSQL(tableName));
|
|
@@ -22784,16 +22647,16 @@ var init_microsoftSqlServer = __esm({
|
|
|
22784
22647
|
const requiredColumns = columns.filter((col) => col.IS_NULLABLE === "NO").map((col) => col.COLUMN_NAME);
|
|
22785
22648
|
let schema2 = {};
|
|
22786
22649
|
for (let def of definition26) {
|
|
22787
|
-
const
|
|
22788
|
-
if (typeof
|
|
22650
|
+
const name2 = def.COLUMN_NAME;
|
|
22651
|
+
if (typeof name2 !== "string") {
|
|
22789
22652
|
continue;
|
|
22790
22653
|
}
|
|
22791
22654
|
const hasDefault = def.COLUMN_DEFAULT;
|
|
22792
|
-
const isAuto = !!autoColumns.find((col) => col ===
|
|
22793
|
-
const required = !!requiredColumns.find((col) => col ===
|
|
22794
|
-
schema2[
|
|
22655
|
+
const isAuto = !!autoColumns.find((col) => col === name2);
|
|
22656
|
+
const required = !!requiredColumns.find((col) => col === name2);
|
|
22657
|
+
schema2[name2] = {
|
|
22795
22658
|
autocolumn: isAuto,
|
|
22796
|
-
name,
|
|
22659
|
+
name: name2,
|
|
22797
22660
|
constraints: {
|
|
22798
22661
|
presence: required && !isAuto && !hasDefault
|
|
22799
22662
|
},
|
|
@@ -22815,7 +22678,7 @@ var init_microsoftSqlServer = __esm({
|
|
|
22815
22678
|
async queryTableNames() {
|
|
22816
22679
|
let tableInfo = await this.runSQL(this.TABLES_SQL);
|
|
22817
22680
|
const schema = this.config.schema || DEFAULT_SCHEMA;
|
|
22818
|
-
return tableInfo.filter((record) => record.TABLE_SCHEMA === schema).map((record) => record.TABLE_NAME).filter((
|
|
22681
|
+
return tableInfo.filter((record) => record.TABLE_SCHEMA === schema).map((record) => record.TABLE_NAME).filter((name2) => this.MASTER_TABLES.indexOf(name2) === -1);
|
|
22819
22682
|
}
|
|
22820
22683
|
async getTableNames() {
|
|
22821
22684
|
await this.connect();
|
|
@@ -23249,7 +23112,12 @@ function bindingTypeCoerce(bindings) {
|
|
|
23249
23112
|
if (matches2 && matches2[0] !== "" && !isNaN(Number(matches2[0]))) {
|
|
23250
23113
|
bindings[i] = parseFloat(binding);
|
|
23251
23114
|
} else if (/^\d/.test(binding) && (0, import_dayjs.default)(binding).isValid() && !binding.includes(",")) {
|
|
23252
|
-
|
|
23115
|
+
let value;
|
|
23116
|
+
value = new Date(binding);
|
|
23117
|
+
if (isNaN(value)) {
|
|
23118
|
+
value = binding;
|
|
23119
|
+
}
|
|
23120
|
+
bindings[i] = value;
|
|
23253
23121
|
}
|
|
23254
23122
|
}
|
|
23255
23123
|
return bindings;
|
|
@@ -23962,16 +23830,6 @@ var init_rest = __esm({
|
|
|
23962
23830
|
});
|
|
23963
23831
|
|
|
23964
23832
|
// src/integrations/googlesheets.ts
|
|
23965
|
-
async function setupCreationAuth(datasouce) {
|
|
23966
|
-
if (datasouce.continueSetupId) {
|
|
23967
|
-
const appId = context_exports.getAppId();
|
|
23968
|
-
const tokens = await cache_exports.get(
|
|
23969
|
-
`datasource:creation:${appId}:google:${datasouce.continueSetupId}`
|
|
23970
|
-
);
|
|
23971
|
-
datasouce.auth = tokens.tokens;
|
|
23972
|
-
delete datasouce.continueSetupId;
|
|
23973
|
-
}
|
|
23974
|
-
}
|
|
23975
23833
|
var import_google_auth_library, import_google_spreadsheet, import_node_fetch9, ALLOWED_TYPES, SCHEMA12, GoogleSheetsIntegration, googlesheets_default;
|
|
23976
23834
|
var init_googlesheets = __esm({
|
|
23977
23835
|
"src/integrations/googlesheets.ts"() {
|
|
@@ -24009,7 +23867,7 @@ var init_googlesheets = __esm({
|
|
|
24009
23867
|
},
|
|
24010
23868
|
datasource: {
|
|
24011
23869
|
spreadsheetId: {
|
|
24012
|
-
display: "
|
|
23870
|
+
display: "Google Sheet URL",
|
|
24013
23871
|
type: "string" /* STRING */,
|
|
24014
23872
|
required: true
|
|
24015
23873
|
}
|
|
@@ -24130,7 +23988,6 @@ var init_googlesheets = __esm({
|
|
|
24130
23988
|
async connect() {
|
|
24131
23989
|
var _a;
|
|
24132
23990
|
try {
|
|
24133
|
-
await setupCreationAuth(this.config);
|
|
24134
23991
|
let googleConfig = await configs_exports.getGoogleDatasourceConfig();
|
|
24135
23992
|
if (!googleConfig) {
|
|
24136
23993
|
throw new HTTPError("Google config not found", 400);
|
|
@@ -24181,22 +24038,21 @@ var init_googlesheets = __esm({
|
|
|
24181
24038
|
return table;
|
|
24182
24039
|
}
|
|
24183
24040
|
async buildSchema(datasourceId, entities) {
|
|
24041
|
+
if (!this.config.auth) {
|
|
24042
|
+
return;
|
|
24043
|
+
}
|
|
24184
24044
|
await this.connect();
|
|
24185
24045
|
const sheets = this.client.sheetsByIndex;
|
|
24186
24046
|
const tables = {};
|
|
24187
|
-
|
|
24188
|
-
|
|
24189
|
-
|
|
24190
|
-
|
|
24191
|
-
|
|
24192
|
-
|
|
24193
|
-
|
|
24194
|
-
|
|
24195
|
-
|
|
24196
|
-
);
|
|
24197
|
-
},
|
|
24198
|
-
10
|
|
24199
|
-
);
|
|
24047
|
+
for (let sheet of sheets) {
|
|
24048
|
+
await sheet.getRows();
|
|
24049
|
+
const id = buildExternalTableId(datasourceId, sheet.title);
|
|
24050
|
+
tables[sheet.title] = this.getTableSchema(
|
|
24051
|
+
sheet.title,
|
|
24052
|
+
sheet.headerValues,
|
|
24053
|
+
id
|
|
24054
|
+
);
|
|
24055
|
+
}
|
|
24200
24056
|
const final = finaliseExternalTables(tables, entities);
|
|
24201
24057
|
this.tables = final.tables;
|
|
24202
24058
|
this.schemaErrors = final.errors;
|
|
@@ -24244,13 +24100,13 @@ var init_googlesheets = __esm({
|
|
|
24244
24100
|
}
|
|
24245
24101
|
return rowObject;
|
|
24246
24102
|
}
|
|
24247
|
-
async createTable(
|
|
24248
|
-
if (!
|
|
24103
|
+
async createTable(name2) {
|
|
24104
|
+
if (!name2) {
|
|
24249
24105
|
throw new Error("Must provide name for new sheet.");
|
|
24250
24106
|
}
|
|
24251
24107
|
try {
|
|
24252
24108
|
await this.connect();
|
|
24253
|
-
return await this.client.addSheet({ title:
|
|
24109
|
+
return await this.client.addSheet({ title: name2, headerValues: [name2] });
|
|
24254
24110
|
} catch (err) {
|
|
24255
24111
|
console.error("Error creating new table in google sheets", err);
|
|
24256
24112
|
throw err;
|
|
@@ -24576,7 +24432,7 @@ var init_firebase = __esm({
|
|
|
24576
24432
|
snapshot = await collectionRef.get();
|
|
24577
24433
|
}
|
|
24578
24434
|
const result = [];
|
|
24579
|
-
snapshot.forEach((
|
|
24435
|
+
snapshot.forEach((doc2) => result.push(doc2.data()));
|
|
24580
24436
|
return result;
|
|
24581
24437
|
} catch (err) {
|
|
24582
24438
|
console.error("Error querying Firestore", err);
|
|
@@ -25238,13 +25094,13 @@ var init_oracle = __esm({
|
|
|
25238
25094
|
});
|
|
25239
25095
|
|
|
25240
25096
|
// src/integrations/index.ts
|
|
25241
|
-
async function getDefinition(
|
|
25242
|
-
const definition26 = DEFINITIONS2[
|
|
25097
|
+
async function getDefinition(source2) {
|
|
25098
|
+
const definition26 = DEFINITIONS2[source2];
|
|
25243
25099
|
if (definition26) {
|
|
25244
25100
|
return definition26;
|
|
25245
25101
|
}
|
|
25246
25102
|
const allDefinitions = await getDefinitions();
|
|
25247
|
-
return allDefinitions[
|
|
25103
|
+
return allDefinitions[source2];
|
|
25248
25104
|
}
|
|
25249
25105
|
async function getDefinitions() {
|
|
25250
25106
|
const pluginSchemas = {};
|
|
@@ -25580,10 +25436,10 @@ __export(webhook_exports2, {
|
|
|
25580
25436
|
function isWebhookID(id) {
|
|
25581
25437
|
return id.startsWith(db_exports.DocumentType.WEBHOOK);
|
|
25582
25438
|
}
|
|
25583
|
-
function newDoc(
|
|
25439
|
+
function newDoc(name2, type, target) {
|
|
25584
25440
|
return {
|
|
25585
25441
|
live: true,
|
|
25586
|
-
name,
|
|
25442
|
+
name: name2,
|
|
25587
25443
|
action: {
|
|
25588
25444
|
type,
|
|
25589
25445
|
target
|
|
@@ -25601,12 +25457,12 @@ async function save7(webhook) {
|
|
|
25601
25457
|
webhook._rev = response2.rev;
|
|
25602
25458
|
return webhook;
|
|
25603
25459
|
}
|
|
25604
|
-
async function destroy6(id,
|
|
25460
|
+
async function destroy6(id, rev2) {
|
|
25605
25461
|
const db2 = context_exports.getAppDB();
|
|
25606
25462
|
if (!id || !isWebhookID(id)) {
|
|
25607
25463
|
throw new Error("Provided webhook ID is not valid.");
|
|
25608
25464
|
}
|
|
25609
|
-
return await db2.remove(id,
|
|
25465
|
+
return await db2.remove(id, rev2);
|
|
25610
25466
|
}
|
|
25611
25467
|
var init_webhook2 = __esm({
|
|
25612
25468
|
"src/sdk/app/automations/webhook.ts"() {
|
|
@@ -25783,9 +25639,9 @@ async function syncUsersToApp(appId, users2, groups) {
|
|
|
25783
25639
|
if (roleId === roles_exports.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
25784
25640
|
roleId = void 0;
|
|
25785
25641
|
}
|
|
25786
|
-
let
|
|
25642
|
+
let metadata2;
|
|
25787
25643
|
try {
|
|
25788
|
-
|
|
25644
|
+
metadata2 = await db2.get(metadataId);
|
|
25789
25645
|
} catch (err) {
|
|
25790
25646
|
if (err.status !== 404) {
|
|
25791
25647
|
throw err;
|
|
@@ -25793,19 +25649,19 @@ async function syncUsersToApp(appId, users2, groups) {
|
|
|
25793
25649
|
if (!roleId) {
|
|
25794
25650
|
continue;
|
|
25795
25651
|
} else if (!deletedUser) {
|
|
25796
|
-
|
|
25652
|
+
metadata2 = {
|
|
25797
25653
|
tableId: InternalTables.USER_METADATA
|
|
25798
25654
|
};
|
|
25799
25655
|
}
|
|
25800
25656
|
}
|
|
25801
25657
|
if (deletedUser || !roleId) {
|
|
25802
|
-
await db2.remove(
|
|
25658
|
+
await db2.remove(metadata2);
|
|
25803
25659
|
continue;
|
|
25804
25660
|
}
|
|
25805
25661
|
if (roleId) {
|
|
25806
|
-
|
|
25662
|
+
metadata2.roleId = roleId;
|
|
25807
25663
|
}
|
|
25808
|
-
let combined = sdk_default.users.combineMetadataAndUser(ctxUser,
|
|
25664
|
+
let combined = sdk_default.users.combineMetadataAndUser(ctxUser, metadata2);
|
|
25809
25665
|
if (combined) {
|
|
25810
25666
|
await db2.put(combined);
|
|
25811
25667
|
}
|
|
@@ -25862,7 +25718,7 @@ async function syncApp(appId, opts) {
|
|
|
25862
25718
|
try {
|
|
25863
25719
|
const replOpts = replication.appReplicateOpts();
|
|
25864
25720
|
if (opts == null ? void 0 : opts.automationOnly) {
|
|
25865
|
-
replOpts.filter = (
|
|
25721
|
+
replOpts.filter = (doc2) => doc2._id.startsWith(db_exports.DocumentType.AUTOMATION);
|
|
25866
25722
|
}
|
|
25867
25723
|
await replication.replicate(replOpts);
|
|
25868
25724
|
} catch (err) {
|
|
@@ -26089,9 +25945,9 @@ __export(utils_exports8, {
|
|
|
26089
25945
|
rawUserMetadata: () => rawUserMetadata,
|
|
26090
25946
|
syncGlobalUsers: () => syncGlobalUsers
|
|
26091
25947
|
});
|
|
26092
|
-
function combineMetadataAndUser(user,
|
|
25948
|
+
function combineMetadataAndUser(user, metadata2) {
|
|
26093
25949
|
const metadataId = generateUserMetadataID2(user._id);
|
|
26094
|
-
const found = Array.isArray(
|
|
25950
|
+
const found = Array.isArray(metadata2) ? metadata2.find((doc2) => doc2._id === metadataId) : metadata2;
|
|
26095
25951
|
if (user.roleId == null || user.roleId === roles_exports.BUILTIN_ROLE_IDS.PUBLIC) {
|
|
26096
25952
|
if (found == null ? void 0 : found._id) {
|
|
26097
25953
|
return { ...found, _deleted: true };
|
|
@@ -26136,16 +25992,16 @@ async function syncGlobalUsers() {
|
|
|
26136
25992
|
}
|
|
26137
25993
|
const resp = await Promise.all([getGlobalUsers(), rawUserMetadata(db2)]);
|
|
26138
25994
|
const users2 = resp[0];
|
|
26139
|
-
const
|
|
25995
|
+
const metadata2 = resp[1];
|
|
26140
25996
|
const toWrite = [];
|
|
26141
25997
|
for (let user of users2) {
|
|
26142
|
-
const combined = combineMetadataAndUser(user,
|
|
25998
|
+
const combined = combineMetadataAndUser(user, metadata2);
|
|
26143
25999
|
if (combined) {
|
|
26144
26000
|
toWrite.push(combined);
|
|
26145
26001
|
}
|
|
26146
26002
|
}
|
|
26147
26003
|
let foundEmails = [];
|
|
26148
|
-
for (let data2 of
|
|
26004
|
+
for (let data2 of metadata2) {
|
|
26149
26005
|
if (!data2._id) {
|
|
26150
26006
|
continue;
|
|
26151
26007
|
}
|
|
@@ -26274,17 +26130,17 @@ var init_client2 = __esm({
|
|
|
26274
26130
|
// src/utilities/users.ts
|
|
26275
26131
|
async function getFullUser(ctx, userId) {
|
|
26276
26132
|
const global = await getGlobalUser(userId);
|
|
26277
|
-
let
|
|
26133
|
+
let metadata2 = {};
|
|
26278
26134
|
delete global._id;
|
|
26279
26135
|
delete global._rev;
|
|
26280
26136
|
try {
|
|
26281
26137
|
const db2 = context_exports.getAppDB();
|
|
26282
|
-
|
|
26138
|
+
metadata2 = await db2.get(userId);
|
|
26283
26139
|
} catch (err) {
|
|
26284
26140
|
}
|
|
26285
|
-
delete
|
|
26141
|
+
delete metadata2.csrfToken;
|
|
26286
26142
|
return {
|
|
26287
|
-
...
|
|
26143
|
+
...metadata2,
|
|
26288
26144
|
...global,
|
|
26289
26145
|
roleId: global.roleId || roles_exports.BUILTIN_ROLE_IDS.PUBLIC,
|
|
26290
26146
|
tableId: InternalTables.USER_METADATA,
|
|
@@ -26303,10 +26159,10 @@ var init_users12 = __esm({
|
|
|
26303
26159
|
// src/api/controllers/user.ts
|
|
26304
26160
|
async function fetchMetadata(ctx) {
|
|
26305
26161
|
const global = await getGlobalUsers();
|
|
26306
|
-
const
|
|
26162
|
+
const metadata2 = await sdk_default.users.rawUserMetadata();
|
|
26307
26163
|
const users2 = [];
|
|
26308
26164
|
for (let user of global) {
|
|
26309
|
-
const info =
|
|
26165
|
+
const info = metadata2.find((meta) => meta._id.includes(user._id));
|
|
26310
26166
|
users2.push({
|
|
26311
26167
|
...user,
|
|
26312
26168
|
...info,
|
|
@@ -26321,11 +26177,11 @@ async function updateMetadata(ctx) {
|
|
|
26321
26177
|
const db2 = context_exports.getAppDB();
|
|
26322
26178
|
const user = ctx.request.body;
|
|
26323
26179
|
delete user.roles;
|
|
26324
|
-
const
|
|
26180
|
+
const metadata2 = {
|
|
26325
26181
|
tableId: InternalTables.USER_METADATA,
|
|
26326
26182
|
...user
|
|
26327
26183
|
};
|
|
26328
|
-
ctx.body = await db2.put(
|
|
26184
|
+
ctx.body = await db2.put(metadata2);
|
|
26329
26185
|
}
|
|
26330
26186
|
async function destroyMetadata(ctx) {
|
|
26331
26187
|
const db2 = context_exports.getAppDB();
|
|
@@ -26623,16 +26479,16 @@ async function fetch16(type) {
|
|
|
26623
26479
|
return plugins2;
|
|
26624
26480
|
}
|
|
26625
26481
|
}
|
|
26626
|
-
async function processUploaded(plugin,
|
|
26482
|
+
async function processUploaded(plugin, source2) {
|
|
26627
26483
|
var _a, _b;
|
|
26628
|
-
const { metadata, directory } = await fileUpload(plugin);
|
|
26629
|
-
plugin_exports.validate(
|
|
26630
|
-
if (!environment_default.SELF_HOSTED && ((_a =
|
|
26484
|
+
const { metadata: metadata2, directory: directory2 } = await fileUpload(plugin);
|
|
26485
|
+
plugin_exports.validate(metadata2 == null ? void 0 : metadata2.schema);
|
|
26486
|
+
if (!environment_default.SELF_HOSTED && ((_a = metadata2 == null ? void 0 : metadata2.schema) == null ? void 0 : _a.type) !== "component" /* COMPONENT */) {
|
|
26631
26487
|
throw new Error("Only component plugins are supported outside of self-host");
|
|
26632
26488
|
}
|
|
26633
|
-
const
|
|
26634
|
-
(_b = clientAppSocket) == null ? void 0 : _b.emit("plugin-update", { name:
|
|
26635
|
-
return
|
|
26489
|
+
const doc2 = await sdk_exports.plugins.storePlugin(metadata2, directory2, source2);
|
|
26490
|
+
(_b = clientAppSocket) == null ? void 0 : _b.emit("plugin-update", { name: doc2.name, hash: doc2.hash });
|
|
26491
|
+
return doc2;
|
|
26636
26492
|
}
|
|
26637
26493
|
var init_plugins4 = __esm({
|
|
26638
26494
|
"src/sdk/plugins/plugins.ts"() {
|
|
@@ -27052,22 +26908,22 @@ function threadSetup() {
|
|
|
27052
26908
|
init8();
|
|
27053
26909
|
}
|
|
27054
26910
|
async function checkCacheForDynamicVariable(queryId, variable) {
|
|
27055
|
-
const
|
|
27056
|
-
return
|
|
26911
|
+
const cache2 = await getClient2();
|
|
26912
|
+
return cache2.get(makeVariableKey(queryId, variable));
|
|
27057
26913
|
}
|
|
27058
26914
|
async function invalidateDynamicVariables(cachedVars) {
|
|
27059
|
-
const
|
|
26915
|
+
const cache2 = await getClient2();
|
|
27060
26916
|
let promises = [];
|
|
27061
26917
|
for (let variable of cachedVars) {
|
|
27062
26918
|
promises.push(
|
|
27063
|
-
|
|
26919
|
+
cache2.delete(makeVariableKey(variable.queryId, variable.name))
|
|
27064
26920
|
);
|
|
27065
26921
|
}
|
|
27066
26922
|
await Promise.all(promises);
|
|
27067
26923
|
}
|
|
27068
26924
|
async function storeDynamicVariable(queryId, variable, value) {
|
|
27069
|
-
const
|
|
27070
|
-
await
|
|
26925
|
+
const cache2 = await getClient2();
|
|
26926
|
+
await cache2.store(
|
|
27071
26927
|
makeVariableKey(queryId, variable),
|
|
27072
26928
|
value,
|
|
27073
26929
|
VARIABLE_TTL_SECONDS
|
|
@@ -27535,16 +27391,7 @@ async function checkResponse(response2, errorMsg, { ctx } = {}) {
|
|
|
27535
27391
|
}
|
|
27536
27392
|
return response2.json();
|
|
27537
27393
|
}
|
|
27538
|
-
async function sendSmtpEmail({
|
|
27539
|
-
to,
|
|
27540
|
-
from,
|
|
27541
|
-
subject,
|
|
27542
|
-
contents,
|
|
27543
|
-
cc,
|
|
27544
|
-
bcc,
|
|
27545
|
-
automation,
|
|
27546
|
-
invite
|
|
27547
|
-
}) {
|
|
27394
|
+
async function sendSmtpEmail(to, from, subject, contents, cc, bcc, automation) {
|
|
27548
27395
|
const response2 = await (0, import_node_fetch10.default)(
|
|
27549
27396
|
checkSlashesInUrl2(environment_default.WORKER_URL + `/api/global/email/send`),
|
|
27550
27397
|
request(void 0, {
|
|
@@ -27557,8 +27404,7 @@ async function sendSmtpEmail({
|
|
|
27557
27404
|
cc,
|
|
27558
27405
|
bcc,
|
|
27559
27406
|
purpose: "custom",
|
|
27560
|
-
automation
|
|
27561
|
-
invite
|
|
27407
|
+
automation
|
|
27562
27408
|
}
|
|
27563
27409
|
})
|
|
27564
27410
|
);
|
|
@@ -27606,35 +27452,6 @@ var definition7 = {
|
|
|
27606
27452
|
contents: {
|
|
27607
27453
|
type: "string" /* STRING */,
|
|
27608
27454
|
title: "HTML Contents"
|
|
27609
|
-
},
|
|
27610
|
-
addInvite: {
|
|
27611
|
-
type: "boolean" /* BOOLEAN */,
|
|
27612
|
-
title: "Add calendar invite"
|
|
27613
|
-
},
|
|
27614
|
-
startTime: {
|
|
27615
|
-
type: "date" /* DATE */,
|
|
27616
|
-
title: "Start Time",
|
|
27617
|
-
dependsOn: "addInvite"
|
|
27618
|
-
},
|
|
27619
|
-
endTime: {
|
|
27620
|
-
type: "date" /* DATE */,
|
|
27621
|
-
title: "End Time",
|
|
27622
|
-
dependsOn: "addInvite"
|
|
27623
|
-
},
|
|
27624
|
-
summary: {
|
|
27625
|
-
type: "string" /* STRING */,
|
|
27626
|
-
title: "Meeting Summary",
|
|
27627
|
-
dependsOn: "addInvite"
|
|
27628
|
-
},
|
|
27629
|
-
location: {
|
|
27630
|
-
type: "string" /* STRING */,
|
|
27631
|
-
title: "Location",
|
|
27632
|
-
dependsOn: "addInvite"
|
|
27633
|
-
},
|
|
27634
|
-
url: {
|
|
27635
|
-
type: "string" /* STRING */,
|
|
27636
|
-
title: "URL",
|
|
27637
|
-
dependsOn: "addInvite"
|
|
27638
27455
|
}
|
|
27639
27456
|
},
|
|
27640
27457
|
required: ["to", "from", "subject", "contents"]
|
|
@@ -27655,41 +27472,21 @@ var definition7 = {
|
|
|
27655
27472
|
}
|
|
27656
27473
|
};
|
|
27657
27474
|
async function run3({ inputs }) {
|
|
27658
|
-
let {
|
|
27659
|
-
to,
|
|
27660
|
-
from,
|
|
27661
|
-
subject,
|
|
27662
|
-
contents,
|
|
27663
|
-
cc,
|
|
27664
|
-
bcc,
|
|
27665
|
-
addInvite,
|
|
27666
|
-
startTime,
|
|
27667
|
-
endTime,
|
|
27668
|
-
summary,
|
|
27669
|
-
location,
|
|
27670
|
-
url
|
|
27671
|
-
} = inputs;
|
|
27475
|
+
let { to, from, subject, contents, cc, bcc } = inputs;
|
|
27672
27476
|
if (!contents) {
|
|
27673
27477
|
contents = "<h1>No content</h1>";
|
|
27674
27478
|
}
|
|
27675
27479
|
to = to || void 0;
|
|
27676
27480
|
try {
|
|
27677
|
-
let response2 = await sendSmtpEmail(
|
|
27481
|
+
let response2 = await sendSmtpEmail(
|
|
27678
27482
|
to,
|
|
27679
27483
|
from,
|
|
27680
27484
|
subject,
|
|
27681
27485
|
contents,
|
|
27682
27486
|
cc,
|
|
27683
27487
|
bcc,
|
|
27684
|
-
|
|
27685
|
-
|
|
27686
|
-
startTime,
|
|
27687
|
-
endTime,
|
|
27688
|
-
summary,
|
|
27689
|
-
location,
|
|
27690
|
-
url
|
|
27691
|
-
} : void 0
|
|
27692
|
-
});
|
|
27488
|
+
true
|
|
27489
|
+
);
|
|
27693
27490
|
return {
|
|
27694
27491
|
success: true,
|
|
27695
27492
|
response: response2
|
|
@@ -27733,20 +27530,20 @@ async function createLinkView() {
|
|
|
27733
27530
|
const db2 = context_exports.getAppDB();
|
|
27734
27531
|
const designDoc = await db2.get("_design/database");
|
|
27735
27532
|
const view2 = {
|
|
27736
|
-
map: function(
|
|
27737
|
-
if (
|
|
27738
|
-
let doc1 =
|
|
27739
|
-
let
|
|
27533
|
+
map: function(doc2) {
|
|
27534
|
+
if (doc2.type === "link") {
|
|
27535
|
+
let doc1 = doc2.doc1;
|
|
27536
|
+
let doc22 = doc2.doc2;
|
|
27740
27537
|
emit([doc1.tableId, doc1.rowId], {
|
|
27741
|
-
id:
|
|
27538
|
+
id: doc22.rowId,
|
|
27742
27539
|
thisId: doc1.rowId,
|
|
27743
27540
|
fieldName: doc1.fieldName
|
|
27744
27541
|
});
|
|
27745
|
-
if (doc1.tableId !==
|
|
27746
|
-
emit([
|
|
27542
|
+
if (doc1.tableId !== doc22.tableId) {
|
|
27543
|
+
emit([doc22.tableId, doc22.rowId], {
|
|
27747
27544
|
id: doc1.rowId,
|
|
27748
|
-
thisId:
|
|
27749
|
-
fieldName:
|
|
27545
|
+
thisId: doc22.rowId,
|
|
27546
|
+
fieldName: doc22.fieldName
|
|
27750
27547
|
});
|
|
27751
27548
|
}
|
|
27752
27549
|
}
|
|
@@ -28048,11 +27845,11 @@ var LinkController = class {
|
|
|
28048
27845
|
);
|
|
28049
27846
|
}
|
|
28050
27847
|
}
|
|
28051
|
-
let toDeleteDocs = thisFieldLinkDocs.filter((
|
|
28052
|
-
let correctDoc =
|
|
27848
|
+
let toDeleteDocs = thisFieldLinkDocs.filter((doc2) => {
|
|
27849
|
+
let correctDoc = doc2.doc1.fieldName === fieldName ? doc2.doc2 : doc2.doc1;
|
|
28053
27850
|
return rowField.indexOf(correctDoc.rowId) === -1;
|
|
28054
|
-
}).map((
|
|
28055
|
-
return { ...
|
|
27851
|
+
}).map((doc2) => {
|
|
27852
|
+
return { ...doc2, _deleted: true };
|
|
28056
27853
|
});
|
|
28057
27854
|
operations.push(...toDeleteDocs);
|
|
28058
27855
|
delete row[fieldName];
|
|
@@ -28073,9 +27870,9 @@ var LinkController = class {
|
|
|
28073
27870
|
if (linkDocs.length === 0) {
|
|
28074
27871
|
return null;
|
|
28075
27872
|
}
|
|
28076
|
-
const toDelete = linkDocs.map((
|
|
27873
|
+
const toDelete = linkDocs.map((doc2) => {
|
|
28077
27874
|
return {
|
|
28078
|
-
...
|
|
27875
|
+
...doc2,
|
|
28079
27876
|
_deleted: true
|
|
28080
27877
|
};
|
|
28081
27878
|
});
|
|
@@ -28096,9 +27893,9 @@ var LinkController = class {
|
|
|
28096
27893
|
return correctFieldName === fieldName;
|
|
28097
27894
|
});
|
|
28098
27895
|
await this._db.bulkDocs(
|
|
28099
|
-
toDelete.map((
|
|
27896
|
+
toDelete.map((doc2) => {
|
|
28100
27897
|
return {
|
|
28101
|
-
...
|
|
27898
|
+
...doc2,
|
|
28102
27899
|
_deleted: true
|
|
28103
27900
|
};
|
|
28104
27901
|
})
|
|
@@ -28196,9 +27993,9 @@ var LinkController = class {
|
|
|
28196
27993
|
if (linkDocs.length === 0) {
|
|
28197
27994
|
return null;
|
|
28198
27995
|
}
|
|
28199
|
-
const toDelete = linkDocs.map((
|
|
27996
|
+
const toDelete = linkDocs.map((doc2) => {
|
|
28200
27997
|
return {
|
|
28201
|
-
...
|
|
27998
|
+
...doc2,
|
|
28202
27999
|
_deleted: true
|
|
28203
28000
|
};
|
|
28204
28001
|
});
|
|
@@ -28537,10 +28334,10 @@ async function cleanupAttachments(table, {
|
|
|
28537
28334
|
return;
|
|
28538
28335
|
}
|
|
28539
28336
|
}
|
|
28540
|
-
let
|
|
28337
|
+
let files2 = [];
|
|
28541
28338
|
function addFiles(row2, key) {
|
|
28542
28339
|
if (row2[key]) {
|
|
28543
|
-
|
|
28340
|
+
files2 = files2.concat(row2[key].map((attachment) => attachment.key));
|
|
28544
28341
|
}
|
|
28545
28342
|
}
|
|
28546
28343
|
const schemaToUse = oldTable ? oldTable.schema : table.schema;
|
|
@@ -28551,15 +28348,15 @@ async function cleanupAttachments(table, {
|
|
|
28551
28348
|
if (rows2 && oldTable && !table.schema[key]) {
|
|
28552
28349
|
rows2.forEach((row2) => addFiles(row2, key));
|
|
28553
28350
|
} else if (oldRow && row) {
|
|
28554
|
-
|
|
28351
|
+
files2 = files2.concat(getRemovedAttachmentKeys(oldRow, row, key));
|
|
28555
28352
|
} else if (row) {
|
|
28556
28353
|
addFiles(row, key);
|
|
28557
28354
|
} else if (rows2) {
|
|
28558
28355
|
rows2.forEach((row2) => addFiles(row2, key));
|
|
28559
28356
|
}
|
|
28560
28357
|
}
|
|
28561
|
-
if (
|
|
28562
|
-
await objectStore_exports2.deleteFiles(ObjectStoreBuckets2.APPS,
|
|
28358
|
+
if (files2.length > 0) {
|
|
28359
|
+
await objectStore_exports2.deleteFiles(ObjectStoreBuckets2.APPS, files2);
|
|
28563
28360
|
}
|
|
28564
28361
|
}
|
|
28565
28362
|
|
|
@@ -28734,7 +28531,7 @@ async function runView(view, calculation, group, data) {
|
|
|
28734
28531
|
_rev: void 0
|
|
28735
28532
|
}))
|
|
28736
28533
|
);
|
|
28737
|
-
let fn = (
|
|
28534
|
+
let fn = (doc2, emit2) => emit2(doc2._id);
|
|
28738
28535
|
eval("fn = " + ((_a = view == null ? void 0 : view.map) == null ? void 0 : _a.replace("function (doc)", "function (doc, emit)")));
|
|
28739
28536
|
const queryFns = {
|
|
28740
28537
|
meta: view.meta,
|
|
@@ -29500,7 +29297,7 @@ function cleanupConfig(config, table) {
|
|
|
29500
29297
|
const fieldNames = Object.entries(table.schema).filter((schema) => primaryOptions.find((val) => val === schema[1].type)).map(([fieldName]) => fieldName);
|
|
29501
29298
|
const iterateObject = (obj) => {
|
|
29502
29299
|
for (let [field, value] of Object.entries(obj)) {
|
|
29503
|
-
if (fieldNames.find((
|
|
29300
|
+
if (fieldNames.find((name2) => name2 === field) && isRowId(value)) {
|
|
29504
29301
|
obj[field] = convertRowId(value);
|
|
29505
29302
|
}
|
|
29506
29303
|
}
|
|
@@ -29699,7 +29496,10 @@ var ExternalRequest = class {
|
|
|
29699
29496
|
}
|
|
29700
29497
|
}
|
|
29701
29498
|
relatedRow = processFormulas(linkedTable, relatedRow);
|
|
29702
|
-
|
|
29499
|
+
let relatedDisplay;
|
|
29500
|
+
if (display) {
|
|
29501
|
+
relatedDisplay = getPrimaryDisplay(relatedRow[display]);
|
|
29502
|
+
}
|
|
29703
29503
|
row[relationship.column][key] = {
|
|
29704
29504
|
primaryDisplay: relatedDisplay || "Invalid display column",
|
|
29705
29505
|
_id: relatedRow._id
|
|
@@ -30910,15 +30710,8 @@ init_constants6();
|
|
|
30910
30710
|
init_integrations2();
|
|
30911
30711
|
init_utils20();
|
|
30912
30712
|
init_src2();
|
|
30913
|
-
init_src();
|
|
30914
30713
|
init_sdk3();
|
|
30915
30714
|
init_websockets();
|
|
30916
|
-
init_googlesheets();
|
|
30917
|
-
var preSaveAction = {
|
|
30918
|
-
["GOOGLE_SHEETS" /* GOOGLE_SHEETS */]: async (datasource2) => {
|
|
30919
|
-
await setupCreationAuth(datasource2.config);
|
|
30920
|
-
}
|
|
30921
|
-
};
|
|
30922
30715
|
|
|
30923
30716
|
// src/api/controllers/query/validation.ts
|
|
30924
30717
|
init_src2();
|
|
@@ -32213,7 +32006,7 @@ function rowEmission({
|
|
|
32213
32006
|
appId,
|
|
32214
32007
|
row,
|
|
32215
32008
|
table,
|
|
32216
|
-
metadata
|
|
32009
|
+
metadata: metadata2
|
|
32217
32010
|
}) {
|
|
32218
32011
|
let event = {
|
|
32219
32012
|
row,
|
|
@@ -32227,8 +32020,8 @@ function rowEmission({
|
|
|
32227
32020
|
if (row == null ? void 0 : row._rev) {
|
|
32228
32021
|
event.revision = row._rev;
|
|
32229
32022
|
}
|
|
32230
|
-
if (
|
|
32231
|
-
event.metadata =
|
|
32023
|
+
if (metadata2) {
|
|
32024
|
+
event.metadata = metadata2;
|
|
32232
32025
|
}
|
|
32233
32026
|
emitter2.emit(eventName, event);
|
|
32234
32027
|
}
|
|
@@ -32237,7 +32030,7 @@ function tableEmission({
|
|
|
32237
32030
|
eventName,
|
|
32238
32031
|
appId,
|
|
32239
32032
|
table,
|
|
32240
|
-
metadata
|
|
32033
|
+
metadata: metadata2
|
|
32241
32034
|
}) {
|
|
32242
32035
|
const tableId = table == null ? void 0 : table._id;
|
|
32243
32036
|
const inputTable = table;
|
|
@@ -32253,8 +32046,8 @@ function tableEmission({
|
|
|
32253
32046
|
if (table == null ? void 0 : table._rev) {
|
|
32254
32047
|
event.revision = table._rev;
|
|
32255
32048
|
}
|
|
32256
|
-
if (
|
|
32257
|
-
event.metadata =
|
|
32049
|
+
if (metadata2) {
|
|
32050
|
+
event.metadata = metadata2;
|
|
32258
32051
|
}
|
|
32259
32052
|
emitter2.emit(eventName, event);
|
|
32260
32053
|
}
|
|
@@ -32396,8 +32189,8 @@ var Orchestrator = class {
|
|
|
32396
32189
|
constructor(job) {
|
|
32397
32190
|
let automation = job.data.automation;
|
|
32398
32191
|
let triggerOutput = job.data.event;
|
|
32399
|
-
const
|
|
32400
|
-
this._chainCount =
|
|
32192
|
+
const metadata2 = triggerOutput.metadata;
|
|
32193
|
+
this._chainCount = metadata2 ? metadata2.automationChainCount : 0;
|
|
32401
32194
|
this._appId = triggerOutput.appId;
|
|
32402
32195
|
this._job = job;
|
|
32403
32196
|
const triggerStepId = automation.definition.trigger.stepId;
|
|
@@ -32427,16 +32220,16 @@ var Orchestrator = class {
|
|
|
32427
32220
|
async getMetadata() {
|
|
32428
32221
|
const metadataId = generateAutomationMetadataID(this._automation._id);
|
|
32429
32222
|
const db2 = context_exports.getAppDB();
|
|
32430
|
-
let
|
|
32223
|
+
let metadata2;
|
|
32431
32224
|
try {
|
|
32432
|
-
|
|
32225
|
+
metadata2 = await db2.get(metadataId);
|
|
32433
32226
|
} catch (err) {
|
|
32434
|
-
|
|
32227
|
+
metadata2 = {
|
|
32435
32228
|
_id: metadataId,
|
|
32436
32229
|
errorCount: 0
|
|
32437
32230
|
};
|
|
32438
32231
|
}
|
|
32439
|
-
return
|
|
32232
|
+
return metadata2;
|
|
32440
32233
|
}
|
|
32441
32234
|
async stopCron(reason) {
|
|
32442
32235
|
if (!this._job.opts.repeat) {
|
|
@@ -32459,34 +32252,34 @@ var Orchestrator = class {
|
|
|
32459
32252
|
);
|
|
32460
32253
|
await storeLog2(automation, this.executionOutput);
|
|
32461
32254
|
}
|
|
32462
|
-
async checkIfShouldStop(
|
|
32463
|
-
if (!
|
|
32255
|
+
async checkIfShouldStop(metadata2) {
|
|
32256
|
+
if (!metadata2.errorCount || !this._job.opts.repeat) {
|
|
32464
32257
|
return false;
|
|
32465
32258
|
}
|
|
32466
|
-
if (
|
|
32259
|
+
if (metadata2.errorCount >= MAX_AUTOMATION_RECURRING_ERRORS) {
|
|
32467
32260
|
await this.stopCron("errors");
|
|
32468
32261
|
return true;
|
|
32469
32262
|
}
|
|
32470
32263
|
return false;
|
|
32471
32264
|
}
|
|
32472
|
-
async updateMetadata(
|
|
32265
|
+
async updateMetadata(metadata2) {
|
|
32473
32266
|
const output = this.executionOutput, automation = this._automation;
|
|
32474
32267
|
if (!output || !isRecurring(automation)) {
|
|
32475
32268
|
return;
|
|
32476
32269
|
}
|
|
32477
|
-
const count =
|
|
32270
|
+
const count = metadata2.errorCount;
|
|
32478
32271
|
const isError = isErrorInOutput(output);
|
|
32479
32272
|
if (!count && !isError) {
|
|
32480
32273
|
return;
|
|
32481
32274
|
}
|
|
32482
32275
|
if (isError) {
|
|
32483
|
-
|
|
32276
|
+
metadata2.errorCount = count ? count + 1 : 1;
|
|
32484
32277
|
} else {
|
|
32485
|
-
|
|
32278
|
+
metadata2.errorCount = 0;
|
|
32486
32279
|
}
|
|
32487
32280
|
const db2 = context_exports.getAppDB();
|
|
32488
32281
|
try {
|
|
32489
|
-
await db2.put(
|
|
32282
|
+
await db2.put(metadata2);
|
|
32490
32283
|
} catch (err) {
|
|
32491
32284
|
logging_exports.logAlertWithInfo(
|
|
32492
32285
|
"Failed to write automation metadata",
|
|
@@ -32537,13 +32330,13 @@ var Orchestrator = class {
|
|
|
32537
32330
|
let stepCount = 0;
|
|
32538
32331
|
let loopStepNumber = void 0;
|
|
32539
32332
|
let loopSteps = [];
|
|
32540
|
-
let
|
|
32333
|
+
let metadata2;
|
|
32541
32334
|
let timeoutFlag = false;
|
|
32542
32335
|
let wasLoopStep = false;
|
|
32543
32336
|
let timeout2 = this._job.data.event.timeout;
|
|
32544
32337
|
if (isProdAppID2(this._appId) && isRecurring(automation)) {
|
|
32545
|
-
|
|
32546
|
-
const shouldStop = await this.checkIfShouldStop(
|
|
32338
|
+
metadata2 = await this.getMetadata();
|
|
32339
|
+
const shouldStop = await this.checkIfShouldStop(metadata2);
|
|
32547
32340
|
if (shouldStop) {
|
|
32548
32341
|
return;
|
|
32549
32342
|
}
|
|
@@ -32747,8 +32540,8 @@ var Orchestrator = class {
|
|
|
32747
32540
|
}
|
|
32748
32541
|
logging_exports.logAlert("Error writing automation log", e);
|
|
32749
32542
|
}
|
|
32750
|
-
if (isProdAppID2(this._appId) && isRecurring(automation) &&
|
|
32751
|
-
await this.updateMetadata(
|
|
32543
|
+
if (isProdAppID2(this._appId) && isRecurring(automation) && metadata2) {
|
|
32544
|
+
await this.updateMetadata(metadata2);
|
|
32752
32545
|
}
|
|
32753
32546
|
return this.executionOutput;
|
|
32754
32547
|
}
|