Merge remote-tracking branch 'origin/develop' into feature/portal-pending-users-section

This commit is contained in:
Dean 2023-05-03 10:33:22 +01:00
commit 6c361b50ee
18 changed files with 209 additions and 224 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"npmClient": "yarn", "npmClient": "yarn",
"useWorkspaces": true, "useWorkspaces": true,
"packages": ["packages/*"], "packages": ["packages/*"],

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"@budibase/nano": "10.1.2", "@budibase/nano": "10.1.2",
"@budibase/pouchdb-replication-stream": "1.2.10", "@budibase/pouchdb-replication-stream": "1.2.10",
"@budibase/types": "2.5.6-alpha.42", "@budibase/types": "2.5.6-alpha.44",
"@shopify/jest-koa-mocks": "5.0.1", "@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-cloudfront-sign": "2.2.0", "aws-cloudfront-sign": "2.2.0",

View File

@ -154,6 +154,7 @@ const environment = {
? process.env.ENABLE_SSO_MAINTENANCE_MODE ? process.env.ENABLE_SSO_MAINTENANCE_MODE
: false, : false,
VERSION: findVersion(), VERSION: findVersion(),
DISABLE_PINO_LOGGER: process.env.DISABLE_PINO_LOGGER,
_set(key: any, value: any) { _set(key: any, value: any) {
process.env[key] = value process.env[key] = value
// @ts-ignore // @ts-ignore

View File

@ -1,5 +1,5 @@
export * as correlation from "./correlation/correlation" export * as correlation from "./correlation/correlation"
export { logger, disableLogger } from "./pino/logger" export { logger } from "./pino/logger"
export * from "./alerts" export * from "./alerts"
// turn off or on context logging i.e. tenantId, appId etc // turn off or on context logging i.e. tenantId, appId etc

View File

@ -5,20 +5,11 @@ import * as correlation from "../correlation"
import { IdentityType } from "@budibase/types" import { IdentityType } from "@budibase/types"
import { LOG_CONTEXT } from "../index" import { LOG_CONTEXT } from "../index"
// CORE LOGGERS - for disabling
const BUILT_INS = {
log: console.log,
error: console.error,
info: console.info,
warn: console.warn,
trace: console.trace,
debug: console.debug,
}
// LOGGER // LOGGER
const pinoOptions: LoggerOptions = { let pinoInstance: pino.Logger | undefined
if (!env.DISABLE_PINO_LOGGER) {
const pinoOptions: LoggerOptions = {
level: env.LOG_LEVEL, level: env.LOG_LEVEL,
formatters: { formatters: {
level: label => { level: label => {
@ -29,31 +20,22 @@ const pinoOptions: LoggerOptions = {
}, },
}, },
timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`, timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`,
} }
if (env.isDev()) { if (env.isDev()) {
pinoOptions.transport = { pinoOptions.transport = {
target: "pino-pretty", target: "pino-pretty",
options: { options: {
singleLine: true, singleLine: true,
}, },
} }
} }
export const logger = pino(pinoOptions) pinoInstance = pino(pinoOptions)
export function disableLogger() { // CONSOLE OVERRIDES
console.log = BUILT_INS.log
console.error = BUILT_INS.error
console.info = BUILT_INS.info
console.warn = BUILT_INS.warn
console.trace = BUILT_INS.trace
console.debug = BUILT_INS.debug
}
// CONSOLE OVERRIDES interface MergingObject {
interface MergingObject {
objects?: any[] objects?: any[]
tenantId?: string tenantId?: string
appId?: string appId?: string
@ -61,25 +43,25 @@ interface MergingObject {
identityType?: IdentityType identityType?: IdentityType
correlationId?: string correlationId?: string
err?: Error err?: Error
} }
function isPlainObject(obj: any) { function isPlainObject(obj: any) {
return typeof obj === "object" && obj !== null && !(obj instanceof Error) return typeof obj === "object" && obj !== null && !(obj instanceof Error)
} }
function isError(obj: any) { function isError(obj: any) {
return obj instanceof Error return obj instanceof Error
} }
function isMessage(obj: any) { function isMessage(obj: any) {
return typeof obj === "string" return typeof obj === "string"
} }
/** /**
* Backwards compatibility between console logging statements * Backwards compatibility between console logging statements
* and pino logging requirements. * and pino logging requirements.
*/ */
function getLogParams(args: any[]): [MergingObject, string] { function getLogParams(args: any[]): [MergingObject, string] {
let error = undefined let error = undefined
let objects: any[] = [] let objects: any[] = []
let message = "" let message = ""
@ -117,47 +99,47 @@ function getLogParams(args: any[]): [MergingObject, string] {
} }
return [mergingObject, message] return [mergingObject, message]
} }
console.log = (...arg: any[]) => { console.log = (...arg: any[]) => {
const [obj, msg] = getLogParams(arg) const [obj, msg] = getLogParams(arg)
logger.info(obj, msg) pinoInstance?.info(obj, msg)
} }
console.info = (...arg: any[]) => { console.info = (...arg: any[]) => {
const [obj, msg] = getLogParams(arg) const [obj, msg] = getLogParams(arg)
logger.info(obj, msg) pinoInstance?.info(obj, msg)
} }
console.warn = (...arg: any[]) => { console.warn = (...arg: any[]) => {
const [obj, msg] = getLogParams(arg) const [obj, msg] = getLogParams(arg)
logger.warn(obj, msg) pinoInstance?.warn(obj, msg)
} }
console.error = (...arg: any[]) => { console.error = (...arg: any[]) => {
const [obj, msg] = getLogParams(arg) const [obj, msg] = getLogParams(arg)
logger.error(obj, msg) pinoInstance?.error(obj, msg)
} }
/** /**
* custom trace impl - this resembles the node trace behaviour rather * custom trace impl - this resembles the node trace behaviour rather
* than traditional trace logging * than traditional trace logging
* @param arg * @param arg
*/ */
console.trace = (...arg: any[]) => { console.trace = (...arg: any[]) => {
const [obj, msg] = getLogParams(arg) const [obj, msg] = getLogParams(arg)
if (!obj.err) { if (!obj.err) {
// to get stack trace // to get stack trace
obj.err = new Error() obj.err = new Error()
} }
logger.trace(obj, msg) pinoInstance?.trace(obj, msg)
} }
console.debug = (...arg: any) => { console.debug = (...arg: any) => {
const [obj, msg] = getLogParams(arg) const [obj, msg] = getLogParams(arg)
logger.debug(obj, msg) pinoInstance?.debug(obj, msg)
} }
// CONTEXT // CONTEXT
const getTenantId = () => { const getTenantId = () => {
let tenantId let tenantId
try { try {
tenantId = context.getTenantId() tenantId = context.getTenantId()
@ -165,9 +147,9 @@ const getTenantId = () => {
// do nothing // do nothing
} }
return tenantId return tenantId
} }
const getAppId = () => { const getAppId = () => {
let appId let appId
try { try {
appId = context.getAppId() appId = context.getAppId()
@ -175,9 +157,9 @@ const getAppId = () => {
// do nothing // do nothing
} }
return appId return appId
} }
const getIdentity = () => { const getIdentity = () => {
let identity let identity
try { try {
identity = context.getIdentity() identity = context.getIdentity()
@ -185,4 +167,7 @@ const getIdentity = () => {
// do nothing // do nothing
} }
return identity return identity
}
} }
export const logger = pinoInstance

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",
@ -38,8 +38,8 @@
], ],
"dependencies": { "dependencies": {
"@adobe/spectrum-css-workflow-icons": "1.2.1", "@adobe/spectrum-css-workflow-icons": "1.2.1",
"@budibase/shared-core": "2.5.6-alpha.42", "@budibase/shared-core": "2.5.6-alpha.44",
"@budibase/string-templates": "2.5.6-alpha.42", "@budibase/string-templates": "2.5.6-alpha.44",
"@spectrum-css/accordion": "3.0.24", "@spectrum-css/accordion": "3.0.24",
"@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actionbutton": "1.0.1",
"@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/actiongroup": "1.0.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -58,10 +58,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.5.6-alpha.42", "@budibase/bbui": "2.5.6-alpha.44",
"@budibase/frontend-core": "2.5.6-alpha.42", "@budibase/frontend-core": "2.5.6-alpha.44",
"@budibase/shared-core": "2.5.6-alpha.42", "@budibase/shared-core": "2.5.6-alpha.44",
"@budibase/string-templates": "2.5.6-alpha.42", "@budibase/string-templates": "2.5.6-alpha.44",
"@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/fontawesome-svg-core": "^6.2.1",
"@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1",
"@fortawesome/free-solid-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -29,14 +29,14 @@
"outputPath": "build" "outputPath": "build"
}, },
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.5.6-alpha.42", "@budibase/backend-core": "2.5.6-alpha.44",
"@budibase/string-templates": "2.5.6-alpha.42", "@budibase/string-templates": "2.5.6-alpha.44",
"@budibase/types": "2.5.6-alpha.42", "@budibase/types": "2.5.6-alpha.44",
"axios": "0.21.2", "axios": "0.21.2",
"chalk": "4.1.0", "chalk": "4.1.0",
"cli-progress": "3.11.2", "cli-progress": "3.11.2",
"commander": "7.1.0", "commander": "7.1.0",
"docker-compose": "0.23.12", "docker-compose": "0.24.0",
"dotenv": "16.0.1", "dotenv": "16.0.1",
"download": "8.0.0", "download": "8.0.0",
"find-free-port": "^2.0.0", "find-free-port": "^2.0.0",

View File

@ -1,6 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
import { logging } from "@budibase/backend-core" process.env.DISABLE_PINO_LOGGER = "1"
logging.disableLogger()
import "./prebuilds" import "./prebuilds"
import "./environment" import "./environment"
import { env } from "@budibase/backend-core" import { env } from "@budibase/backend-core"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,11 +19,11 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.5.6-alpha.42", "@budibase/bbui": "2.5.6-alpha.44",
"@budibase/frontend-core": "2.5.6-alpha.42", "@budibase/frontend-core": "2.5.6-alpha.44",
"@budibase/shared-core": "2.5.6-alpha.42", "@budibase/shared-core": "2.5.6-alpha.44",
"@budibase/string-templates": "2.5.6-alpha.42", "@budibase/string-templates": "2.5.6-alpha.44",
"@budibase/types": "2.5.6-alpha.42", "@budibase/types": "2.5.6-alpha.44",
"@spectrum-css/button": "^3.0.3", "@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",

View File

@ -1,13 +1,13 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase frontend core libraries used in builder and client", "description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"dependencies": { "dependencies": {
"@budibase/bbui": "2.5.6-alpha.42", "@budibase/bbui": "2.5.6-alpha.44",
"@budibase/shared-core": "2.5.6-alpha.42", "@budibase/shared-core": "2.5.6-alpha.44",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"socket.io-client": "^4.6.1", "socket.io-client": "^4.6.1",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/sdk", "name": "@budibase/sdk",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase Public API SDK", "description": "Budibase Public API SDK",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -45,12 +45,12 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "10.0.3", "@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.5.6-alpha.42", "@budibase/backend-core": "2.5.6-alpha.44",
"@budibase/client": "2.5.6-alpha.42", "@budibase/client": "2.5.6-alpha.44",
"@budibase/pro": "2.5.6-alpha.42", "@budibase/pro": "2.5.6-alpha.44",
"@budibase/shared-core": "2.5.6-alpha.42", "@budibase/shared-core": "2.5.6-alpha.44",
"@budibase/string-templates": "2.5.6-alpha.42", "@budibase/string-templates": "2.5.6-alpha.44",
"@budibase/types": "2.5.6-alpha.42", "@budibase/types": "2.5.6-alpha.44",
"@bull-board/api": "3.7.0", "@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4", "@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/shared-core", "name": "@budibase/shared-core",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Shared data utils", "description": "Shared data utils",
"main": "dist/cjs/src/index.js", "main": "dist/cjs/src/index.js",
"types": "dist/mjs/src/index.d.ts", "types": "dist/mjs/src/index.d.ts",
@ -20,7 +20,7 @@
"dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\"" "dev:builder": "yarn prebuild && concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc -p tsconfig-cjs.build.json --watch\""
}, },
"dependencies": { "dependencies": {
"@budibase/types": "2.5.6-alpha.42" "@budibase/types": "2.5.6-alpha.44"
}, },
"devDependencies": { "devDependencies": {
"concurrently": "^7.6.0", "concurrently": "^7.6.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/types", "name": "@budibase/types",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase types", "description": "Budibase types",
"main": "dist/cjs/index.js", "main": "dist/cjs/index.js",
"types": "dist/mjs/index.d.ts", "types": "dist/mjs/index.d.ts",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.5.6-alpha.42", "version": "2.5.6-alpha.44",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -37,10 +37,10 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.5.6-alpha.42", "@budibase/backend-core": "2.5.6-alpha.44",
"@budibase/pro": "2.5.6-alpha.42", "@budibase/pro": "2.5.6-alpha.44",
"@budibase/string-templates": "2.5.6-alpha.42", "@budibase/string-templates": "2.5.6-alpha.44",
"@budibase/types": "2.5.6-alpha.42", "@budibase/types": "2.5.6-alpha.44",
"@koa/router": "8.0.8", "@koa/router": "8.0.8",
"@sentry/node": "6.17.7", "@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",

View File

@ -1486,15 +1486,15 @@
pouchdb-promise "^6.0.4" pouchdb-promise "^6.0.4"
through2 "^2.0.0" through2 "^2.0.0"
"@budibase/pro@2.5.6-alpha.41": "@budibase/pro@2.5.6-alpha.43":
version "2.5.6-alpha.41" version "2.5.6-alpha.43"
resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.5.6-alpha.41.tgz#2632b398159211bf64bf6caff9753c877b6fc09d" resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.5.6-alpha.43.tgz#3273219bcb51c0dde75753d59b22698722aad673"
integrity sha512-8Zfm+RtcXY77gdXXHti8QT+Vt+1ApuVqYL3KCkxBVbpzgQci/F3mipNXUX8bEy/y+QYAdgn6psDTWAqyr9VALg== integrity sha512-xUU7wFLsRczmPoystg5PN4GPtks0leMrdQJpCA3hxGM09szSHEheGKRCH3fpXhwbYe8GRsJx+27xrVxkW4+9yQ==
dependencies: dependencies:
"@budibase/backend-core" "2.5.6-alpha.41" "@budibase/backend-core" "2.5.6-alpha.43"
"@budibase/shared-core" "2.4.44-alpha.1" "@budibase/shared-core" "2.4.44-alpha.1"
"@budibase/string-templates" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1"
"@budibase/types" "2.5.6-alpha.41" "@budibase/types" "2.5.6-alpha.43"
"@koa/router" "8.0.8" "@koa/router" "8.0.8"
bull "4.10.1" bull "4.10.1"
joi "17.6.0" joi "17.6.0"
@ -9545,13 +9545,6 @@ dir-glob@^3.0.1:
dependencies: dependencies:
path-type "^4.0.0" path-type "^4.0.0"
docker-compose@0.23.12:
version "0.23.12"
resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.12.tgz#fa883b98be08f6926143d06bf9e522ef7ed3210c"
integrity sha512-KFbSMqQBuHjTGZGmYDOCO0L4SaML3BsWTId5oSUyaBa22vALuFHNv+UdDWs3HcMylHWKsxCbLB7hnM/nCosWZw==
dependencies:
yaml "^1.10.2"
docker-compose@0.23.17: docker-compose@0.23.17:
version "0.23.17" version "0.23.17"
resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.17.tgz#8816bef82562d9417dc8c790aa4871350f93a2ba" resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.17.tgz#8816bef82562d9417dc8c790aa4871350f93a2ba"
@ -9559,6 +9552,13 @@ docker-compose@0.23.17:
dependencies: dependencies:
yaml "^1.10.2" yaml "^1.10.2"
docker-compose@0.24.0:
version "0.24.0"
resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.24.0.tgz#474cd38b05b3887a56ffb2c39f16a7ae4d7d5077"
integrity sha512-RN/oSPLPa6ZG5e4dHg8tD8EMpd1WJqomNMBQT+d2M5MwcmfrPW/xHTent4TVqX0zZvHemv7qhhNlzXjxCnFaQw==
dependencies:
yaml "^1.10.2"
docker-compose@^0.23.5: docker-compose@^0.23.5:
version "0.23.19" version "0.23.19"
resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.19.tgz#9947726e2fe67bdfa9e8efe1ff15aa0de2e10eb8" resolved "https://registry.yarnpkg.com/docker-compose/-/docker-compose-0.23.19.tgz#9947726e2fe67bdfa9e8efe1ff15aa0de2e10eb8"