@budibase/server 2.4.44-alpha.5 → 2.4.44-alpha.7
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.c2604f7a.js → index.8cb2f57a.js} +218 -218
- package/builder/index.html +1 -1
- package/dist/api/controllers/ops.js +40 -0
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/ops.js +52 -0
- package/dist/app.js +2 -11
- package/dist/environment.js +0 -1
- package/dist/migrations/functions/usageQuotas/syncApps.js +1 -1
- package/dist/migrations/functions/usageQuotas/syncRows.js +1 -2
- package/dist/package.json +7 -9
- package/dist/startup.js +0 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -10
- package/scripts/dev/manage.js +1 -0
- package/src/api/controllers/ops.ts +32 -0
- package/src/api/routes/index.ts +2 -0
- package/src/api/routes/ops.ts +30 -0
- package/src/app.ts +2 -13
- package/src/environment.ts +0 -1
- package/src/migrations/functions/usageQuotas/syncApps.ts +1 -1
- package/src/migrations/functions/usageQuotas/syncRows.ts +2 -3
- package/src/startup.ts +0 -3
- package/src/tests/jestEnv.ts +0 -1
- package/src/tests/jestSetup.ts +0 -1
- package/dist/elasticApm.js +0 -14
- package/src/elasticApm.ts +0 -10
- package/src/tests/logging.ts +0 -34
package/builder/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
|
10
10
|
rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.8cb2f57a.js"></script>
|
|
12
12
|
<link rel="stylesheet" href="/builder/assets/index.d013cac9.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.error = exports.alert = exports.log = void 0;
|
|
13
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
14
|
+
function log(ctx) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const body = ctx.request.body;
|
|
17
|
+
console.trace(body.message, body.data);
|
|
18
|
+
console.debug(body.message, body.data);
|
|
19
|
+
console.info(body.message, body.data);
|
|
20
|
+
console.warn(body.message, body.data);
|
|
21
|
+
console.error(body.message, body.data);
|
|
22
|
+
ctx.status = 204;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.log = log;
|
|
26
|
+
function alert(ctx) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const body = ctx.request.body;
|
|
29
|
+
backend_core_1.logging.logAlert(body.message, new Error(body.message));
|
|
30
|
+
ctx.status = 204;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
exports.alert = alert;
|
|
34
|
+
function error(ctx) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const body = ctx.request.body;
|
|
37
|
+
throw new Error(body.message);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.error = error;
|
package/dist/api/routes/index.js
CHANGED
|
@@ -31,6 +31,7 @@ const dev_1 = __importDefault(require("./dev"));
|
|
|
31
31
|
const cloud_1 = __importDefault(require("./cloud"));
|
|
32
32
|
const migrations_1 = __importDefault(require("./migrations"));
|
|
33
33
|
const plugin_1 = __importDefault(require("./plugin"));
|
|
34
|
+
const ops_1 = __importDefault(require("./ops"));
|
|
34
35
|
const pro_1 = require("@budibase/pro");
|
|
35
36
|
var static_1 = require("./static");
|
|
36
37
|
Object.defineProperty(exports, "staticRoutes", { enumerable: true, get: function () { return __importDefault(static_1).default; } });
|
|
@@ -67,6 +68,7 @@ exports.mainRoutes = [
|
|
|
67
68
|
row_1.default,
|
|
68
69
|
migrations_1.default,
|
|
69
70
|
plugin_1.default,
|
|
71
|
+
ops_1.default,
|
|
70
72
|
scheduleRoutes,
|
|
71
73
|
environmentVariableRoutes,
|
|
72
74
|
// these need to be handled last as they still use /api/:tableId
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.errorValidator = exports.logsValidator = void 0;
|
|
30
|
+
const router_1 = __importDefault(require("@koa/router"));
|
|
31
|
+
const controller = __importStar(require("../controllers/ops"));
|
|
32
|
+
const backend_core_1 = require("@budibase/backend-core");
|
|
33
|
+
const joi_1 = __importDefault(require("joi"));
|
|
34
|
+
function logsValidator() {
|
|
35
|
+
return backend_core_1.middleware.joiValidator.body(joi_1.default.object({
|
|
36
|
+
message: joi_1.default.string().required(),
|
|
37
|
+
data: joi_1.default.object(),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
exports.logsValidator = logsValidator;
|
|
41
|
+
function errorValidator() {
|
|
42
|
+
return backend_core_1.middleware.joiValidator.body(joi_1.default.object({
|
|
43
|
+
message: joi_1.default.string().required(),
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
exports.errorValidator = errorValidator;
|
|
47
|
+
const router = new router_1.default();
|
|
48
|
+
router
|
|
49
|
+
.post("/api/ops/log", logsValidator(), controller.log)
|
|
50
|
+
.post("/api/ops/error", errorValidator(), controller.error)
|
|
51
|
+
.post("/api/ops/alert", errorValidator(), controller.alert);
|
|
52
|
+
exports.default = router;
|
package/dist/app.js
CHANGED
|
@@ -38,18 +38,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
38
38
|
if (process.env.DD_APM_ENABLED) {
|
|
39
39
|
require("./ddApm");
|
|
40
40
|
}
|
|
41
|
-
if (process.env.ELASTIC_APM_ENABLED) {
|
|
42
|
-
require("./elasticApm");
|
|
43
|
-
}
|
|
44
41
|
// need to load environment first
|
|
45
42
|
const environment_1 = __importDefault(require("./environment"));
|
|
46
|
-
// enable APM if configured
|
|
47
|
-
if (process.env.ELASTIC_APM_ENABLED) {
|
|
48
|
-
const apm = require("elastic-apm-node").start({
|
|
49
|
-
serviceName: process.env.SERVICE,
|
|
50
|
-
environment: process.env.BUDIBASE_ENVIRONMENT,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
43
|
const db = __importStar(require("./db"));
|
|
54
44
|
db.init();
|
|
55
45
|
const koa_1 = __importDefault(require("koa"));
|
|
@@ -80,7 +70,8 @@ app.use((0, koa_body_1.default)({
|
|
|
80
70
|
enableTypes: ["json", "form", "text"],
|
|
81
71
|
parsedMethods: ["POST", "PUT", "PATCH", "DELETE"],
|
|
82
72
|
}));
|
|
83
|
-
app.use(backend_core_1.middleware.
|
|
73
|
+
app.use(backend_core_1.middleware.correlation);
|
|
74
|
+
app.use(backend_core_1.middleware.pino);
|
|
84
75
|
app.use(userAgent);
|
|
85
76
|
if (environment_1.default.isProd()) {
|
|
86
77
|
environment_1.default._set("NODE_ENV", "production");
|
package/dist/environment.js
CHANGED
|
@@ -54,7 +54,6 @@ const environment = {
|
|
|
54
54
|
// minor
|
|
55
55
|
SALT_ROUNDS: process.env.SALT_ROUNDS,
|
|
56
56
|
LOGGER: process.env.LOGGER,
|
|
57
|
-
LOG_LEVEL: process.env.LOG_LEVEL,
|
|
58
57
|
ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL,
|
|
59
58
|
AUTOMATION_MAX_ITERATIONS: parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200,
|
|
60
59
|
SENDGRID_API_KEY: process.env.SENDGRID_API_KEY,
|
|
@@ -19,7 +19,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
19
19
|
const appCount = devApps ? devApps.length : 0;
|
|
20
20
|
// sync app count
|
|
21
21
|
const tenantId = backend_core_1.tenancy.getTenantId();
|
|
22
|
-
console.log(`
|
|
22
|
+
console.log(`Syncing app count: ${appCount}`);
|
|
23
23
|
yield pro_1.quotas.setUsage(appCount, types_1.StaticQuotaName.APPS, types_1.QuotaUsageType.STATIC);
|
|
24
24
|
});
|
|
25
25
|
exports.run = run;
|
|
@@ -27,8 +27,7 @@ const run = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
27
27
|
rowCount += rows.length;
|
|
28
28
|
});
|
|
29
29
|
// sync row count
|
|
30
|
-
|
|
31
|
-
console.log(`[Tenant: ${tenantId}] Syncing row count: ${rowCount}`);
|
|
30
|
+
console.log(`Syncing row count: ${rowCount}`);
|
|
32
31
|
yield pro_1.quotas.setUsagePerApp(counts, types_1.StaticQuotaName.ROWS, types_1.QuotaUsageType.STATIC);
|
|
33
32
|
});
|
|
34
33
|
exports.run = run;
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.4.44-alpha.
|
|
4
|
+
"version": "2.4.44-alpha.6",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"license": "GPL-3.0",
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
47
|
-
"@budibase/backend-core": "2.4.44-alpha.
|
|
48
|
-
"@budibase/client": "2.4.44-alpha.
|
|
49
|
-
"@budibase/pro": "2.4.44-alpha.
|
|
50
|
-
"@budibase/shared-core": "2.4.44-alpha.
|
|
51
|
-
"@budibase/string-templates": "2.4.44-alpha.
|
|
52
|
-
"@budibase/types": "2.4.44-alpha.
|
|
47
|
+
"@budibase/backend-core": "2.4.44-alpha.6",
|
|
48
|
+
"@budibase/client": "2.4.44-alpha.6",
|
|
49
|
+
"@budibase/pro": "2.4.44-alpha.6",
|
|
50
|
+
"@budibase/shared-core": "2.4.44-alpha.6",
|
|
51
|
+
"@budibase/string-templates": "2.4.44-alpha.6",
|
|
52
|
+
"@budibase/types": "2.4.44-alpha.6",
|
|
53
53
|
"@bull-board/api": "3.7.0",
|
|
54
54
|
"@bull-board/koa": "3.9.4",
|
|
55
55
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"koa-body": "4.2.0",
|
|
86
86
|
"koa-compress": "4.0.1",
|
|
87
87
|
"koa-connect": "2.1.0",
|
|
88
|
-
"koa-pino-logger": "3.0.0",
|
|
89
88
|
"koa-send": "5.0.0",
|
|
90
89
|
"koa-session": "5.12.0",
|
|
91
90
|
"koa-static": "5.0.0",
|
|
@@ -99,7 +98,6 @@
|
|
|
99
98
|
"node-fetch": "2.6.7",
|
|
100
99
|
"open": "8.4.0",
|
|
101
100
|
"pg": "8.5.1",
|
|
102
|
-
"pino-pretty": "5.1.3",
|
|
103
101
|
"posthog-node": "1.3.0",
|
|
104
102
|
"pouchdb": "7.3.0",
|
|
105
103
|
"pouchdb-adapter-memory": "7.2.2",
|
package/dist/startup.js
CHANGED
|
@@ -50,11 +50,9 @@ const bullboard = __importStar(require("./automations/bullboard"));
|
|
|
50
50
|
const pro = __importStar(require("@budibase/pro"));
|
|
51
51
|
const api = __importStar(require("./api"));
|
|
52
52
|
const sdk_1 = __importDefault(require("./sdk"));
|
|
53
|
-
const pino = require("koa-pino-logger");
|
|
54
53
|
let STARTUP_RAN = false;
|
|
55
54
|
function initRoutes(app) {
|
|
56
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
app.use(pino(backend_core_1.logging.pinoSettings()));
|
|
58
56
|
if (!environment_1.default.isTest()) {
|
|
59
57
|
const plugin = yield bullboard.init();
|
|
60
58
|
app.use(plugin);
|