From 976b3a55ca38b76b8fa88d9779adb6267b2ddf9b Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 4 Apr 2023 15:08:46 +0100 Subject: [PATCH 01/13] Update logging to support dd trace attributes (#10086) * Update logging middleware to integrate with pino for console logging * Remove elastic apm references, use updated core middlewares * Remove redundant LOG_LEVEL definitions * Remove no longer needed jest logging overrides * lint * Backwards compat between console log helpers and pino * Configurable DISABLE_HTTP_LOGGING * Don't log 4xx as errors * Remove redundant ENABLE_4XX_HTTP_LOGGING * Cleanup migrations and event logging * Improve bb-alert logging * Add DISABLE_HTTP_LOGGING to helm chart * Add ops endpoints for testing * Disable http logging in dev * Backwards compatible tracing implementation * Naming update on http logging env var * lint * Update packages/backend-core/src/environment.ts Co-authored-by: Adria Navarro * Merge * Lint * Fix console.warn failing mock by replacing with alerts mock instead * Lint --------- Co-authored-by: Adria Navarro --- .../templates/app-service-deployment.yaml | 16 +- .../templates/worker-service-deployment.yaml | 16 +- charts/budibase/values.yaml | 7 +- packages/backend-core/package.json | 4 +- .../src/cache/tests/writethrough.spec.ts | 5 +- packages/backend-core/src/environment.ts | 13 +- .../src/events/processors/LoggingProcessor.ts | 25 +-- packages/backend-core/src/logging.ts | 60 ------ packages/backend-core/src/logging/alerts.ts | 26 +++ .../src/logging/correlation/correlation.ts | 13 ++ .../src/logging/correlation/index.ts | 1 + .../src/logging/correlation/middleware.ts | 17 ++ packages/backend-core/src/logging/index.ts | 3 + .../backend-core/src/logging/pino/logger.ts | 161 +++++++++++++++ .../src/logging/pino/middleware.ts | 45 ++++ .../src/middleware/errorHandling.ts | 8 +- packages/backend-core/src/middleware/index.ts | 3 +- .../backend-core/src/middleware/logging.ts | 90 -------- .../backend-core/src/migrations/migrations.ts | 12 +- packages/backend-core/tests/jestEnv.ts | 1 - packages/backend-core/tests/jestSetup.ts | 1 - packages/backend-core/tests/logging.ts | 34 --- .../tests/utilities/mocks/alerts.ts | 3 + .../tests/utilities/mocks/index.ts | 1 + packages/backend-core/yarn.lock | 193 ++++++++++-------- packages/server/package.json | 2 - packages/server/scripts/dev/manage.js | 1 + packages/server/src/api/controllers/ops.ts | 32 +++ packages/server/src/api/routes/index.ts | 2 + packages/server/src/api/routes/ops.ts | 30 +++ packages/server/src/app.ts | 15 +- packages/server/src/elasticApm.ts | 10 - packages/server/src/environment.ts | 1 - .../functions/usageQuotas/syncApps.ts | 2 +- .../functions/usageQuotas/syncRows.ts | 5 +- packages/server/src/startup.ts | 3 - packages/server/src/tests/jestEnv.ts | 1 - packages/server/src/tests/jestSetup.ts | 1 - packages/server/src/tests/logging.ts | 34 --- packages/server/yarn.lock | 105 +--------- packages/worker/package.json | 2 - packages/worker/scripts/dev/manage.js | 1 + packages/worker/src/elasticApm.ts | 10 - packages/worker/src/environment.ts | 1 - packages/worker/src/index.ts | 9 +- packages/worker/src/tests/jestEnv.ts | 1 - packages/worker/src/tests/jestSetup.ts | 2 - packages/worker/src/tests/logging.ts | 34 --- packages/worker/yarn.lock | 108 +--------- 49 files changed, 496 insertions(+), 674 deletions(-) delete mode 100644 packages/backend-core/src/logging.ts create mode 100644 packages/backend-core/src/logging/alerts.ts create mode 100644 packages/backend-core/src/logging/correlation/correlation.ts create mode 100644 packages/backend-core/src/logging/correlation/index.ts create mode 100644 packages/backend-core/src/logging/correlation/middleware.ts create mode 100644 packages/backend-core/src/logging/index.ts create mode 100644 packages/backend-core/src/logging/pino/logger.ts create mode 100644 packages/backend-core/src/logging/pino/middleware.ts delete mode 100644 packages/backend-core/src/middleware/logging.ts delete mode 100644 packages/backend-core/tests/logging.ts create mode 100644 packages/backend-core/tests/utilities/mocks/alerts.ts create mode 100644 packages/server/src/api/controllers/ops.ts create mode 100644 packages/server/src/api/routes/ops.ts delete mode 100644 packages/server/src/elasticApm.ts delete mode 100644 packages/server/src/tests/logging.ts delete mode 100644 packages/worker/src/elasticApm.ts delete mode 100644 packages/worker/src/tests/logging.ts diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index df4070806f..4d73b75ae7 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -64,6 +64,8 @@ spec: value: {{ .Values.globals.enableAnalytics | quote }} - name: API_ENCRYPTION_KEY value: {{ .Values.globals.apiEncryptionKey | quote }} + - name: HTTP_LOGGING + value: {{ .Values.services.apps.httpLogging }} - name: INTERNAL_API_KEY valueFrom: secretKeyRef: @@ -119,7 +121,7 @@ spec: - name: MULTI_TENANCY value: {{ .Values.globals.multiTenancy | quote }} - name: LOG_LEVEL - value: {{ default "info" .Values.services.apps.logLevel | quote }} + value: {{ .Values.services.apps.logLevel | quote }} - name: REDIS_PASSWORD value: {{ .Values.services.redis.password }} - name: REDIS_URL @@ -180,18 +182,6 @@ spec: - name: DD_APM_DD_URL value: https://trace.agent.datadoghq.eu {{ end }} - {{ if .Values.globals.elasticApmEnabled }} - - name: ELASTIC_APM_ENABLED - value: {{ .Values.globals.elasticApmEnabled | quote }} - {{ end }} - {{ if .Values.globals.elasticApmSecretToken }} - - name: ELASTIC_APM_SECRET_TOKEN - value: {{ .Values.globals.elasticApmSecretToken | quote }} - {{ end }} - {{ if .Values.globals.elasticApmServerUrl }} - - name: ELASTIC_APM_SERVER_URL - value: {{ .Values.globals.elasticApmServerUrl | quote }} - {{ end }} {{ if .Values.globals.globalAgentHttpProxy }} - name: GLOBAL_AGENT_HTTP_PROXY value: {{ .Values.globals.globalAgentHttpProxy | quote }} diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index f48d19689b..d12be421dc 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -64,6 +64,8 @@ spec: {{ end }} - name: API_ENCRYPTION_KEY value: {{ .Values.globals.apiEncryptionKey | quote }} + - name: HTTP_LOGGING + value: {{ .Values.services.worker.httpLogging }} - name: INTERNAL_API_KEY valueFrom: secretKeyRef: @@ -115,7 +117,7 @@ spec: - name: MULTI_TENANCY value: {{ .Values.globals.multiTenancy | quote }} - name: LOG_LEVEL - value: {{ default "info" .Values.services.worker.logLevel | quote }} + value: {{ .Values.services.worker.logLevel | quote }} - name: REDIS_PASSWORD value: {{ .Values.services.redis.password | quote }} - name: REDIS_URL @@ -170,18 +172,6 @@ spec: - name: DD_APM_DD_URL value: https://trace.agent.datadoghq.eu {{ end }} - {{ if .Values.globals.elasticApmEnabled }} - - name: ELASTIC_APM_ENABLED - value: {{ .Values.globals.elasticApmEnabled | quote }} - {{ end }} - {{ if .Values.globals.elasticApmSecretToken }} - - name: ELASTIC_APM_SECRET_TOKEN - value: {{ .Values.globals.elasticApmSecretToken | quote }} - {{ end }} - {{ if .Values.globals.elasticApmServerUrl }} - - name: ELASTIC_APM_SERVER_URL - value: {{ .Values.globals.elasticApmServerUrl | quote }} - {{ end }} {{ if .Values.globals.globalAgentHttpProxy }} - name: GLOBAL_AGENT_HTTP_PROXY value: {{ .Values.globals.globalAgentHttpProxy | quote }} diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index ccbbf9878e..dbf6b6b46e 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -80,7 +80,6 @@ globals: enableAnalytics: "1" sentryDSN: "" posthogToken: "phc_bIjZL7oh2GEUd2vqvTBH8WvrX0fWTFQMs6H5KQxiUxU" - logLevel: info selfHosted: "1" # set to 0 for budibase cloud environment, set to 1 for self-hosted setup multiTenancy: "0" # set to 0 to disable multiple orgs, set to 1 to enable multiple orgs accountPortalUrl: "" @@ -107,9 +106,6 @@ globals: smtp: enabled: false -# elasticApmEnabled: -# elasticApmSecretToken: -# elasticApmServerUrl: # globalAgentHttpProxy: # globalAgentHttpsProxy: # globalAgentNoProxy: @@ -137,6 +133,7 @@ services: port: 4002 replicaCount: 1 logLevel: info + httpLogging: 1 resources: {} # nodeDebug: "" # set the value of NODE_DEBUG # annotations: @@ -147,6 +144,8 @@ services: worker: port: 4003 replicaCount: 1 + logLevel: info + httpLogging: 1 resources: {} # annotations: # co.elastic.logs/multiline.type: pattern diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 951af6b063..47657eac46 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -39,6 +39,7 @@ "joi": "17.6.0", "jsonwebtoken": "9.0.0", "koa-passport": "4.1.4", + "koa-pino-logger": "4.0.0", "lodash": "4.17.21", "lodash.isarguments": "3.1.0", "node-fetch": "2.6.7", @@ -64,11 +65,9 @@ "@types/ioredis": "4.28.0", "@types/jest": "28.1.1", "@types/koa": "2.13.4", - "@types/koa-pino-logger": "3.0.0", "@types/lodash": "4.14.180", "@types/node": "14.18.20", "@types/node-fetch": "2.6.1", - "@types/pino-http": "5.8.1", "@types/pouchdb": "6.4.0", "@types/redlock": "4.0.3", "@types/semver": "7.3.7", @@ -81,6 +80,7 @@ "koa": "2.13.4", "nodemon": "2.0.16", "pouchdb-adapter-memory": "7.2.2", + "pino-pretty": "10.0.0", "timekeeper": "2.2.0", "ts-jest": "28.0.4", "ts-node": "10.8.1", diff --git a/packages/backend-core/src/cache/tests/writethrough.spec.ts b/packages/backend-core/src/cache/tests/writethrough.spec.ts index a34f05e881..363344c84d 100644 --- a/packages/backend-core/src/cache/tests/writethrough.spec.ts +++ b/packages/backend-core/src/cache/tests/writethrough.spec.ts @@ -2,6 +2,7 @@ import { structures, DBTestConfiguration, expectFunctionWasCalledTimesWith, + mocks, } from "../../../tests" import { Writethrough } from "../writethrough" import { getDB } from "../../db" @@ -77,9 +78,9 @@ describe("writethrough", () => { expect.arrayContaining([current._rev, current._rev, newRev]) ) expectFunctionWasCalledTimesWith( - console.warn, + mocks.alerts.logWarn, 2, - "bb-warn: Ignoring redlock conflict in write-through cache" + "Ignoring redlock conflict in write-through cache" ) const output = await db.get(current._id) diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 5718494fc4..68f056c80c 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -36,6 +36,15 @@ function getAPIEncryptionKey() { : process.env.JWT_SECRET // fallback to the JWT_SECRET used historically } +function httpLogging() { + if (process.env.HTTP_LOGGING === undefined) { + // on by default unless otherwise specified + return true + } + + return process.env.HTTP_LOGGING +} + const environment = { isTest, isJest, @@ -90,11 +99,11 @@ const environment = { USE_COUCH: process.env.USE_COUCH || true, DEFAULT_LICENSE: process.env.DEFAULT_LICENSE, SERVICE: process.env.SERVICE || "budibase", - LOG_LEVEL: process.env.LOG_LEVEL, + LOG_LEVEL: process.env.LOG_LEVEL || "info", SESSION_UPDATE_PERIOD: process.env.SESSION_UPDATE_PERIOD, DEPLOYMENT_ENVIRONMENT: process.env.DEPLOYMENT_ENVIRONMENT || "docker-compose", - ENABLE_4XX_HTTP_LOGGING: process.env.ENABLE_4XX_HTTP_LOGGING || true, + HTTP_LOGGING: httpLogging(), ENABLE_AUDIT_LOG_IP_ADDR: process.env.ENABLE_AUDIT_LOG_IP_ADDR, // smtp SMTP_FALLBACK_ENABLED: process.env.SMTP_FALLBACK_ENABLED, diff --git a/packages/backend-core/src/events/processors/LoggingProcessor.ts b/packages/backend-core/src/events/processors/LoggingProcessor.ts index 6bb691a83a..0f4d02b99c 100644 --- a/packages/backend-core/src/events/processors/LoggingProcessor.ts +++ b/packages/backend-core/src/events/processors/LoggingProcessor.ts @@ -2,14 +2,6 @@ import { Event, Identity, Group } from "@budibase/types" import { EventProcessor } from "./types" import env from "../../environment" -const getTimestampString = (timestamp?: string | number) => { - let timestampString = "" - if (timestamp) { - timestampString = `[timestamp=${new Date(timestamp).toISOString()}]` - } - return timestampString -} - const skipLogging = env.SELF_HOSTED && !env.isDev() export default class LoggingProcessor implements EventProcessor { @@ -22,32 +14,21 @@ export default class LoggingProcessor implements EventProcessor { if (skipLogging) { return } - let timestampString = getTimestampString(timestamp) - let message = `[audit] [identityType=${identity.type}] ${timestampString} ${event} ` - if (env.isDev()) { - message = message + `[debug: [properties=${JSON.stringify(properties)}] ]` - } - console.log(message) + console.log(`[audit] [identityType=${identity.type}] ${event}`, properties) } async identify(identity: Identity, timestamp?: string | number) { if (skipLogging) { return } - let timestampString = getTimestampString(timestamp) - console.log( - `[audit] [${JSON.stringify(identity)}] ${timestampString} identified` - ) + console.log(`[audit] identified`, identity) } async identifyGroup(group: Group, timestamp?: string | number) { if (skipLogging) { return } - let timestampString = getTimestampString(timestamp) - console.log( - `[audit] [${JSON.stringify(group)}] ${timestampString} group identified` - ) + console.log(`[audit] group identified`, group) } shutdown(): void { diff --git a/packages/backend-core/src/logging.ts b/packages/backend-core/src/logging.ts deleted file mode 100644 index 8f2ae6e619..0000000000 --- a/packages/backend-core/src/logging.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Header } from "./constants" -import env from "./environment" -const correlator = require("correlation-id") -import { Options } from "pino-http" -import { IncomingMessage } from "http" - -const NonErrors = ["AccountError"] - -function isSuppressed(e?: any) { - return e && e["suppressAlert"] -} - -export function logAlert(message: string, e?: any) { - if (e && NonErrors.includes(e.name) && isSuppressed(e)) { - return - } - let errorJson = "" - if (e) { - errorJson = ": " + JSON.stringify(e, Object.getOwnPropertyNames(e)) - } - console.error(`bb-alert: ${message} ${errorJson}`) -} - -export function logAlertWithInfo( - message: string, - db: string, - id: string, - error: any -) { - message = `${message} - db: ${db} - doc: ${id} - error: ` - logAlert(message, error) -} - -export function logWarn(message: string) { - console.warn(`bb-warn: ${message}`) -} - -export function pinoSettings(): Options { - return { - prettyPrint: { - levelFirst: true, - }, - genReqId: correlator.getId, - level: env.LOG_LEVEL || "error", - autoLogging: { - ignore: (req: IncomingMessage) => !!req.url?.includes("/health"), - }, - } -} - -const setCorrelationHeader = (headers: any) => { - const correlationId = correlator.getId() - if (correlationId) { - headers[Header.CORRELATION_ID] = correlationId - } -} - -export const correlation = { - setHeader: setCorrelationHeader, -} diff --git a/packages/backend-core/src/logging/alerts.ts b/packages/backend-core/src/logging/alerts.ts new file mode 100644 index 0000000000..625ecfcf15 --- /dev/null +++ b/packages/backend-core/src/logging/alerts.ts @@ -0,0 +1,26 @@ +const NonErrors = ["AccountError"] + +function isSuppressed(e?: any) { + return e && e["suppressAlert"] +} + +export function logAlert(message: string, e?: any) { + if (e && NonErrors.includes(e.name) && isSuppressed(e)) { + return + } + console.error(`bb-alert: ${message}`, e) +} + +export function logAlertWithInfo( + message: string, + db: string, + id: string, + error: any +) { + message = `${message} - db: ${db} - doc: ${id} - error: ` + logAlert(message, error) +} + +export function logWarn(message: string) { + console.warn(`bb-warn: ${message}`) +} diff --git a/packages/backend-core/src/logging/correlation/correlation.ts b/packages/backend-core/src/logging/correlation/correlation.ts new file mode 100644 index 0000000000..b5b47df9c6 --- /dev/null +++ b/packages/backend-core/src/logging/correlation/correlation.ts @@ -0,0 +1,13 @@ +import { Header } from "../../constants" +const correlator = require("correlation-id") + +export const setHeader = (headers: any) => { + const correlationId = correlator.getId() + if (correlationId) { + headers[Header.CORRELATION_ID] = correlationId + } +} + +export function getId() { + return correlator.getId() +} diff --git a/packages/backend-core/src/logging/correlation/index.ts b/packages/backend-core/src/logging/correlation/index.ts new file mode 100644 index 0000000000..a6d8b920fb --- /dev/null +++ b/packages/backend-core/src/logging/correlation/index.ts @@ -0,0 +1 @@ +export * from "./correlation" diff --git a/packages/backend-core/src/logging/correlation/middleware.ts b/packages/backend-core/src/logging/correlation/middleware.ts new file mode 100644 index 0000000000..f77714a5ae --- /dev/null +++ b/packages/backend-core/src/logging/correlation/middleware.ts @@ -0,0 +1,17 @@ +import { Header } from "../../constants" +import { v4 as uuid } from "uuid" +const correlator = require("correlation-id") + +const correlation = (ctx: any, next: any) => { + // use the provided correlation id header if present + let correlationId = ctx.headers[Header.CORRELATION_ID] + if (!correlationId) { + correlationId = uuid() + } + + return correlator.withId(correlationId, () => { + return next() + }) +} + +export default correlation diff --git a/packages/backend-core/src/logging/index.ts b/packages/backend-core/src/logging/index.ts new file mode 100644 index 0000000000..137a943deb --- /dev/null +++ b/packages/backend-core/src/logging/index.ts @@ -0,0 +1,3 @@ +export * as correlation from "./correlation/correlation" +export { default as logger } from "./pino/logger" +export * from "./alerts" diff --git a/packages/backend-core/src/logging/pino/logger.ts b/packages/backend-core/src/logging/pino/logger.ts new file mode 100644 index 0000000000..0b73a00f4d --- /dev/null +++ b/packages/backend-core/src/logging/pino/logger.ts @@ -0,0 +1,161 @@ +import env from "../../environment" +import pino, { LoggerOptions } from "pino" +import * as context from "../../context" +import * as correlation from "../correlation" +import { IdentityType } from "@budibase/types" + +// LOGGER + +const pinoOptions: LoggerOptions = { + level: env.LOG_LEVEL, + formatters: { + level: label => { + return { level: label.toUpperCase() } + }, + bindings: () => { + return {} + }, + }, + timestamp: () => `,"timestamp":"${new Date(Date.now()).toISOString()}"`, +} + +if (env.isDev()) { + pinoOptions.transport = { + target: "pino-pretty", + options: { + singleLine: true, + }, + } +} + +export const logger = pino(pinoOptions) + +// CONSOLE OVERRIDES + +interface MergingObject { + objects?: any[] + tenantId?: string + appId?: string + identityId?: string + identityType?: IdentityType + correlationId?: string + err?: Error +} + +function isPlainObject(obj: any) { + return typeof obj === "object" && obj !== null && !(obj instanceof Error) +} + +function isError(obj: any) { + return obj instanceof Error +} + +function isMessage(obj: any) { + return typeof obj === "string" +} + +/** + * Backwards compatibility between console logging statements + * and pino logging requirements. + */ +function getLogParams(args: any[]): [MergingObject, string] { + let error = undefined + let objects: any[] = [] + let message = "" + + args.forEach(arg => { + if (isMessage(arg)) { + message = `${message} ${arg}`.trimStart() + } + if (isPlainObject(arg)) { + objects.push(arg) + } + if (isError(arg)) { + error = arg + } + }) + + const identity = getIdentity() + + const mergingObject = { + objects: objects.length ? objects : undefined, + tenantId: getTenantId(), + appId: getAppId(), + identityId: identity?._id, + identityType: identity?.type, + correlationId: correlation.getId(), + err: error, + } + + return [mergingObject, message] +} + +console.log = (...arg: any[]) => { + const [obj, msg] = getLogParams(arg) + logger.info(obj, msg) +} +console.info = (...arg: any[]) => { + const [obj, msg] = getLogParams(arg) + logger.info(obj, msg) +} +console.warn = (...arg: any[]) => { + const [obj, msg] = getLogParams(arg) + logger.warn(obj, msg) +} +console.error = (...arg: any[]) => { + const [obj, msg] = getLogParams(arg) + logger.error(obj, msg) +} + +/** + * custom trace impl - this resembles the node trace behaviour rather + * than traditional trace logging + * @param arg + */ +console.trace = (...arg: any[]) => { + const [obj, msg] = getLogParams(arg) + if (!obj.err) { + // to get stack trace + obj.err = new Error() + } + logger.trace(obj, msg) +} + +console.debug = (...arg: any) => { + const [obj, msg] = getLogParams(arg) + logger.debug(obj, msg) +} + +// CONTEXT + +const getTenantId = () => { + let tenantId + try { + tenantId = context.getTenantId() + } catch (e: any) { + // do nothing + } + return tenantId +} + +const getAppId = () => { + let appId + try { + appId = context.getAppId() + } catch (e) { + // do nothing + } + return appId +} + +const getIdentity = () => { + let identity + try { + identity = context.getIdentity() + } catch (e) { + // do nothing + } + return identity +} + +export default logger diff --git a/packages/backend-core/src/logging/pino/middleware.ts b/packages/backend-core/src/logging/pino/middleware.ts new file mode 100644 index 0000000000..e9d37ab692 --- /dev/null +++ b/packages/backend-core/src/logging/pino/middleware.ts @@ -0,0 +1,45 @@ +import env from "../../environment" +import logger from "./logger" +import { IncomingMessage } from "http" +const pino = require("koa-pino-logger") +import { Options } from "pino-http" +import { Ctx } from "@budibase/types" +const correlator = require("correlation-id") + +export function pinoSettings(): Options { + return { + logger, + genReqId: correlator.getId, + autoLogging: { + ignore: (req: IncomingMessage) => !!req.url?.includes("/health"), + }, + serializers: { + req: req => { + return { + method: req.method, + url: req.url, + correlationId: req.id, + } + }, + res: res => { + return { + status: res.statusCode, + } + }, + }, + } +} + +function getMiddleware() { + if (env.HTTP_LOGGING) { + return pino(pinoSettings()) + } else { + return (ctx: Ctx, next: any) => { + return next() + } + } +} + +const pinoMiddleware = getMiddleware() + +export default pinoMiddleware diff --git a/packages/backend-core/src/middleware/errorHandling.ts b/packages/backend-core/src/middleware/errorHandling.ts index 36aff2cdbc..ebdd4107e9 100644 --- a/packages/backend-core/src/middleware/errorHandling.ts +++ b/packages/backend-core/src/middleware/errorHandling.ts @@ -1,6 +1,5 @@ import { APIError } from "@budibase/types" import * as errors from "../errors" -import env from "../environment" export async function errorHandling(ctx: any, next: any) { try { @@ -9,9 +8,10 @@ export async function errorHandling(ctx: any, next: any) { const status = err.status || err.statusCode || 500 ctx.status = status - if (status > 499 || env.ENABLE_4XX_HTTP_LOGGING) { - ctx.log.error(err) - console.trace(err) + if (status >= 400 && status < 500) { + console.warn(err) + } else { + console.error(err) } const error = errors.getPublicError(err) diff --git a/packages/backend-core/src/middleware/index.ts b/packages/backend-core/src/middleware/index.ts index dce07168d4..980bf06b00 100644 --- a/packages/backend-core/src/middleware/index.ts +++ b/packages/backend-core/src/middleware/index.ts @@ -14,7 +14,8 @@ export { default as csrf } from "./csrf" export { default as adminOnly } from "./adminOnly" export { default as builderOrAdmin } from "./builderOrAdmin" export { default as builderOnly } from "./builderOnly" -export { default as logging } from "./logging" +export { default as pino } from "../logging/pino/middleware" +export { default as correlation } from "../logging/correlation/middleware" export { default as errorHandling } from "./errorHandling" export { default as querystringToBody } from "./querystringToBody" export * as joiValidator from "./joi-validator" diff --git a/packages/backend-core/src/middleware/logging.ts b/packages/backend-core/src/middleware/logging.ts deleted file mode 100644 index db9b64b883..0000000000 --- a/packages/backend-core/src/middleware/logging.ts +++ /dev/null @@ -1,90 +0,0 @@ -const correlator = require("correlation-id") -import { Header } from "../constants" -import { v4 as uuid } from "uuid" -import * as context from "../context" - -const debug = console.warn -const trace = console.trace -const log = console.log -const info = console.info -const warn = console.warn -const error = console.error - -const getTenantId = () => { - let tenantId - try { - tenantId = context.getTenantId() - } catch (e: any) { - // do nothing - } - return tenantId -} - -const getAppId = () => { - let appId - try { - appId = context.getAppId() - } catch (e) { - // do nothing - } - return appId -} - -const getIdentityId = () => { - let identityId - try { - const identity = context.getIdentity() - identityId = identity?._id - } catch (e) { - // do nothing - } - return identityId -} - -const print = (fn: any, data: any[]) => { - let message = "" - - const correlationId = correlator.getId() - if (correlationId) { - message = message + `[correlationId=${correlator.getId()}]` - } - - const tenantId = getTenantId() - if (tenantId) { - message = message + ` [tenantId=${tenantId}]` - } - - const appId = getAppId() - if (appId) { - message = message + ` [appId=${appId}]` - } - - const identityId = getIdentityId() - if (identityId) { - message = message + ` [identityId=${identityId}]` - } - - if (!process.env.CI) { - fn(message, data) - } -} - -const logging = (ctx: any, next: any) => { - // use the provided correlation id header if present - let correlationId = ctx.headers[Header.CORRELATION_ID] - if (!correlationId) { - correlationId = uuid() - } - - return correlator.withId(correlationId, () => { - console.debug = data => print(debug, data) - console.trace = data => print(trace, data) - console.log = data => print(log, data) - console.info = data => print(info, data) - console.warn = data => print(warn, data) - console.error = data => print(error, data) - return next() - }) -} - -export default logging diff --git a/packages/backend-core/src/migrations/migrations.ts b/packages/backend-core/src/migrations/migrations.ts index ab72091d56..c750bc4882 100644 --- a/packages/backend-core/src/migrations/migrations.ts +++ b/packages/backend-core/src/migrations/migrations.ts @@ -99,9 +99,7 @@ export const runMigration = async ( options.force[migrationType] && options.force[migrationType].includes(migrationName) ) { - log( - `[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Forcing` - ) + log(`[Migration: ${migrationName}] [DB: ${dbName}] Forcing`) } else { // no force, exit return @@ -111,7 +109,7 @@ export const runMigration = async ( // check if the migration is not a no-op if (!options.noOp) { log( - `[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Running ${lengthStatement}` + `[Migration: ${migrationName}] [DB: ${dbName}] Running ${lengthStatement}` ) if (migration.preventRetry) { @@ -131,9 +129,7 @@ export const runMigration = async ( await migration.fn(db) } - log( - `[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Complete` - ) + log(`[Migration: ${migrationName}] [DB: ${dbName}] Complete`) } // mark as complete @@ -141,7 +137,7 @@ export const runMigration = async ( await db.put(doc) } catch (err) { console.error( - `[Tenant: ${tenantId}] [Migration: ${migrationName}] [DB: ${dbName}] Error: `, + `[Migration: ${migrationName}] [DB: ${dbName}] Error: `, err ) throw err diff --git a/packages/backend-core/tests/jestEnv.ts b/packages/backend-core/tests/jestEnv.ts index 3555973928..c2047118ec 100644 --- a/packages/backend-core/tests/jestEnv.ts +++ b/packages/backend-core/tests/jestEnv.ts @@ -3,5 +3,4 @@ process.env.MULTI_TENANCY = "1" process.env.NODE_ENV = "jest" process.env.MOCK_REDIS = "1" process.env.LOG_LEVEL = process.env.LOG_LEVEL || "error" -process.env.ENABLE_4XX_HTTP_LOGGING = "0" process.env.REDIS_PASSWORD = "budibase" diff --git a/packages/backend-core/tests/jestSetup.ts b/packages/backend-core/tests/jestSetup.ts index be81fbff75..f5542e8fdd 100644 --- a/packages/backend-core/tests/jestSetup.ts +++ b/packages/backend-core/tests/jestSetup.ts @@ -1,4 +1,3 @@ -import "./logging" import env from "../src/environment" import { cleanup } from "../src/timers" import { mocks, testContainerUtils } from "./utilities" diff --git a/packages/backend-core/tests/logging.ts b/packages/backend-core/tests/logging.ts deleted file mode 100644 index 271f4d62ff..0000000000 --- a/packages/backend-core/tests/logging.ts +++ /dev/null @@ -1,34 +0,0 @@ -export enum LogLevel { - TRACE = "trace", - DEBUG = "debug", - INFO = "info", - WARN = "warn", - ERROR = "error", -} - -const LOG_INDEX: { [key in LogLevel]: number } = { - [LogLevel.TRACE]: 1, - [LogLevel.DEBUG]: 2, - [LogLevel.INFO]: 3, - [LogLevel.WARN]: 4, - [LogLevel.ERROR]: 5, -} - -const setIndex = LOG_INDEX[process.env.LOG_LEVEL as LogLevel] - -if (setIndex > LOG_INDEX.trace) { - global.console.trace = jest.fn() -} - -if (setIndex > LOG_INDEX.debug) { - global.console.debug = jest.fn() -} - -if (setIndex > LOG_INDEX.info) { - global.console.info = jest.fn() - global.console.log = jest.fn() -} - -if (setIndex > LOG_INDEX.warn) { - global.console.warn = jest.fn() -} diff --git a/packages/backend-core/tests/utilities/mocks/alerts.ts b/packages/backend-core/tests/utilities/mocks/alerts.ts new file mode 100644 index 0000000000..501c543671 --- /dev/null +++ b/packages/backend-core/tests/utilities/mocks/alerts.ts @@ -0,0 +1,3 @@ +jest.mock("../../../src/logging/alerts") +import * as _alerts from "../../../src/logging/alerts" +export const alerts = jest.mocked(_alerts) diff --git a/packages/backend-core/tests/utilities/mocks/index.ts b/packages/backend-core/tests/utilities/mocks/index.ts index f5f45c0342..915021cecf 100644 --- a/packages/backend-core/tests/utilities/mocks/index.ts +++ b/packages/backend-core/tests/utilities/mocks/index.ts @@ -5,5 +5,6 @@ export const accounts = jest.mocked(_accounts) export * as date from "./date" export * as licenses from "./licenses" export { default as fetch } from "./fetch" +export * from "./alerts" import "./posthog" import "./events" diff --git a/packages/backend-core/yarn.lock b/packages/backend-core/yarn.lock index 91c5c6c9f3..b7ac2a859b 100644 --- a/packages/backend-core/yarn.lock +++ b/packages/backend-core/yarn.lock @@ -1217,15 +1217,6 @@ dependencies: "@types/koa" "*" -"@types/koa-pino-logger@3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/koa-pino-logger/-/koa-pino-logger-3.0.0.tgz#275d4b000abc14b1928dc2e9ab476c8296a64b6a" - integrity sha512-sP+12JNX01q+nHpCRqkVIuLjaRemQEfDoFg0evpTnjUEI3jUI2ZrOkhQ5coxn3yVm2tedui/2YhlaPn/XrYNWA== - dependencies: - "@types/koa" "*" - "@types/pino" "*" - "@types/pino-http" "*" - "@types/koa@*", "@types/koa@2.13.4": version "2.13.4" resolved "https://registry.yarnpkg.com/@types/koa/-/koa-2.13.4.tgz#10620b3f24a8027ef5cbae88b393d1b31205726b" @@ -1273,44 +1264,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.18.20.tgz#268f028b36eaf51181c3300252f605488c4f0650" integrity sha512-Q8KKwm9YqEmUBRsqJ2GWJDtXltBDxTdC4m5vTdXBolu2PeQh8LX+f6BTwU+OuXPu37fLxoN6gidqBmnky36FXA== -"@types/pino-http@*", "@types/pino-http@5.8.1": - version "5.8.1" - resolved "https://registry.yarnpkg.com/@types/pino-http/-/pino-http-5.8.1.tgz#ebb194750ad2f9245c3028b5d2c4e6d64f685ba9" - integrity sha512-A9MW6VCnx5ii7s+Fs5aFIw+aSZcBCpsZ/atpxamu8tTsvWFacxSf2Hrn1Ohn1jkVRB/LiPGOapRXcFawDBnDnA== - dependencies: - "@types/pino" "6.3" - -"@types/pino-pretty@*": - version "5.0.0" - resolved "https://registry.yarnpkg.com/@types/pino-pretty/-/pino-pretty-5.0.0.tgz#aa7a61cfd553b051764acfa0a49872f7a09a1722" - integrity sha512-N1uzqSzioqz8R3AkDbSJwcfDWeI3YMPNapSQQhnB2ISU4NYgUIcAh+hYT5ygqBM+klX4htpEhXMmoJv3J7GrdA== - dependencies: - pino-pretty "*" - -"@types/pino-std-serializers@*": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@types/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1e28b80b554c8222858e99a4e0fc77fd070e10e8" - integrity sha512-gXfUZx2xIBbFYozGms53fT0nvkacx/+62c8iTxrEqH5PkIGAQvDbXg2774VWOycMPbqn5YJBQ3BMsg4Li3dWbg== - dependencies: - pino-std-serializers "*" - -"@types/pino@*": - version "7.0.5" - resolved "https://registry.yarnpkg.com/@types/pino/-/pino-7.0.5.tgz#1c84a81b924a6a9e263dbb581dffdbad7a3c60c4" - integrity sha512-wKoab31pknvILkxAF8ss+v9iNyhw5Iu/0jLtRkUD74cNfOOLJNnqfFKAv0r7wVaTQxRZtWrMpGfShwwBjOcgcg== - dependencies: - pino "*" - -"@types/pino@6.3": - version "6.3.12" - resolved "https://registry.yarnpkg.com/@types/pino/-/pino-6.3.12.tgz#4425db6ced806109c3df957100cba9dfcd73c228" - integrity sha512-dsLRTq8/4UtVSpJgl9aeqHvbh6pzdmjYD3C092SYgLD2TyoCqHpTJk6vp8DvCTGGc7iowZ2MoiYiVUUCcu7muw== - dependencies: - "@types/node" "*" - "@types/pino-pretty" "*" - "@types/pino-std-serializers" "*" - sonic-boom "^2.1.0" - "@types/pouchdb-adapter-cordova-sqlite@*": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/pouchdb-adapter-cordova-sqlite/-/pouchdb-adapter-cordova-sqlite-1.0.1.tgz#49e5ee6df7cc0c23196fcb340f43a560e74eb1d6" @@ -2539,6 +2492,16 @@ duplexer3@^0.1.4: resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" integrity sha512-CEj8FwwNA4cVH2uFCoHUrmojhYh1vmCdOaneKJXwkeY1i9jnlslVo9dx+hQ5Hl9GnH/Bwy/IjxAyOePyPKYnzA== +duplexify@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.2.tgz#18b4f8d28289132fa0b9573c898d9f903f81c7b0" + integrity sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.0" + ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" @@ -2728,9 +2691,9 @@ extsprintf@^1.2.0: integrity sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA== fast-copy@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/fast-copy/-/fast-copy-3.0.0.tgz#875ebf33b13948ae012b6e51d33da5e6e7571ab8" - integrity sha512-4HzS+9pQ5Yxtv13Lhs1Z1unMXamBdn5nA4bEi1abYpDNSpSp7ODYQ1KPMF6nTatfEzgH6/zPvXKU1zvHiUjWlA== + version "3.0.1" + resolved "https://registry.yarnpkg.com/fast-copy/-/fast-copy-3.0.1.tgz#9e89ef498b8c04c1cd76b33b8e14271658a732aa" + integrity sha512-Knr7NOtK3HWRYGtHoJrjkaWepqT8thIVGAwt0p0aUs1zqkAzXZV4vo9fFNwyb5fcqK1GKYFYxldQdIDVKhUAfA== fast-deep-equal@^3.1.1: version "3.1.3" @@ -2742,7 +2705,7 @@ fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== -fast-redact@^3.1.1: +fast-redact@^3.0.0: version "3.1.2" resolved "https://registry.yarnpkg.com/fast-redact/-/fast-redact-3.1.2.tgz#d58e69e9084ce9fa4c1a6fa98a3e1ecf5d7839aa" integrity sha512-+0em+Iya9fKGfEQGcd62Yv6onjBmmhV1uh86XVfOU8VwAe6kaFdQCWI9s0/Nnugx5Vd9tdbZ7e6gE2tR9dzXdw== @@ -2752,6 +2715,13 @@ fast-safe-stringify@^2.1.1: resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz#c406a83b6e70d9e35ce3b30a81141df30aeba884" integrity sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA== +fast-url-parser@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" + integrity sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ== + dependencies: + punycode "^1.3.2" + fb-watchman@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/fb-watchman/-/fb-watchman-2.0.1.tgz#fc84fb39d2709cf3ff6d743706157bb5708a8a85" @@ -4027,6 +3997,13 @@ koa-passport@4.1.4: dependencies: passport "^0.4.0" +koa-pino-logger@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/koa-pino-logger/-/koa-pino-logger-4.0.0.tgz#a45c9fd0a39e9cd84ac23da502055054ee51b80d" + integrity sha512-YI/LB9ajyLPpjvf6e+7Ewmn+OQkCJpu/Y9eI1n7fnipu5Y1NchuNlke0mqh3/2z+5oDYr7pijjOWruEDIfua2A== + dependencies: + pino-http "^6.5.0" + koa@2.13.4, koa@^2.13.4: version "2.13.4" resolved "https://registry.yarnpkg.com/koa/-/koa-2.13.4.tgz#ee5b0cb39e0b8069c38d115139c774833d32462e" @@ -4623,6 +4600,11 @@ object-inspect@^1.9.0: resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ== +on-exit-leak-free@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz#b39c9e3bf7690d890f4861558b0d7b90a442d209" + integrity sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg== + on-exit-leak-free@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-2.1.0.tgz#5c703c968f7e7f851885f6459bf8a8a57edc9cc4" @@ -4857,7 +4839,7 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== -pino-abstract-transport@^1.0.0, pino-abstract-transport@v1.0.0: +pino-abstract-transport@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-1.0.0.tgz#cc0d6955fffcadb91b7b49ef220a6cc111d48bb3" integrity sha512-c7vo5OpW4wIS42hUVcT5REsL8ZljsUfBjqV/e2sFxmFEFZiq1XLUp5EYLtuDH6PEHq9W1egWqRbnLUP5FuZmOA== @@ -4865,10 +4847,28 @@ pino-abstract-transport@^1.0.0, pino-abstract-transport@v1.0.0: readable-stream "^4.0.0" split2 "^4.0.0" -pino-pretty@*: - version "9.1.1" - resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-9.1.1.tgz#e7d64c1db98266ca428ab56567b844ba780cd0e1" - integrity sha512-iJrnjgR4FWQIXZkUF48oNgoRI9BpyMhaEmihonHeCnZ6F50ZHAS4YGfGBT/ZVNsPmd+hzkIPGzjKdY08+/yAXw== +pino-abstract-transport@v0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz#4b54348d8f73713bfd14e3dc44228739aa13d9c0" + integrity sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ== + dependencies: + duplexify "^4.1.2" + split2 "^4.0.0" + +pino-http@^6.5.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-6.6.0.tgz#d0a1deacada8c93327fdaa48f5bdc94bc43d3407" + integrity sha512-PlItaK2MLpoIMLEcClhfb1VQk/o6fKppINl5s6sPE/4rvufkdO3kCSs/92EwrBsB1yssRCQqDV+w1xpYuPVnjg== + dependencies: + fast-url-parser "^1.1.3" + get-caller-file "^2.0.5" + pino "^7.5.0" + pino-std-serializers "^5.0.0" + +pino-pretty@10.0.0: + version "10.0.0" + resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-10.0.0.tgz#fd2f307ee897289f63d09b0b804ac2ecc9a18516" + integrity sha512-zKFjYXBzLaLTEAN1ayKpHXtL5UeRQC7R3lvhKe7fWs7hIVEjKGG/qIXwQt9HmeUp71ogUd/YcW+LmMwRp4KT6Q== dependencies: colorette "^2.0.7" dateformat "^4.6.3" @@ -4885,27 +4885,32 @@ pino-pretty@*: sonic-boom "^3.0.0" strip-json-comments "^3.1.1" -pino-std-serializers@*, pino-std-serializers@^6.0.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-6.1.0.tgz#307490fd426eefc95e06067e85d8558603e8e844" - integrity sha512-KO0m2f1HkrPe9S0ldjx7za9BJjeHqBku5Ch8JyxETxT8dEFGz1PwgrHaOQupVYitpzbFSYm7nnljxD8dik2c+g== +pino-std-serializers@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" + integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== -pino@*: - version "8.8.0" - resolved "https://registry.yarnpkg.com/pino/-/pino-8.8.0.tgz#1f0d6695a224aa06afc7ad60f2ccc4772d3b9233" - integrity sha512-cF8iGYeu2ODg2gIwgAHcPrtR63ILJz3f7gkogaHC/TXVVXxZgInmNYiIpDYEwgEkxZti2Se6P2W2DxlBIZe6eQ== +pino-std-serializers@^5.0.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-5.6.0.tgz#31b141155d6520967c5ec72944d08fb45c490fd3" + integrity sha512-VdUXCw8gO+xhir7sFuoYSjTnzB+TMDGxhAC/ph3YS3sdHnXNdsK0wMtADNUltfeGkn2KDxEM21fnjF3RwXyC8A== + +pino@^7.5.0: + version "7.11.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-7.11.0.tgz#0f0ea5c4683dc91388081d44bff10c83125066f6" + integrity sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg== dependencies: atomic-sleep "^1.0.0" - fast-redact "^3.1.1" - on-exit-leak-free "^2.1.0" - pino-abstract-transport v1.0.0 - pino-std-serializers "^6.0.0" - process-warning "^2.0.0" + fast-redact "^3.0.0" + on-exit-leak-free "^0.2.0" + pino-abstract-transport v0.5.0 + pino-std-serializers "^4.0.0" + process-warning "^1.0.0" quick-format-unescaped "^4.0.3" - real-require "^0.2.0" - safe-stable-stringify "^2.3.1" - sonic-boom "^3.1.0" - thread-stream "^2.0.0" + real-require "^0.1.0" + safe-stable-stringify "^2.1.0" + sonic-boom "^2.2.1" + thread-stream "^0.15.1" pirates@^4.0.4: version "4.0.5" @@ -5156,10 +5161,10 @@ process-nextick-args@~2.0.0: resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" integrity sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag== -process-warning@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-2.1.0.tgz#1e60e3bfe8183033bbc1e702c2da74f099422d1a" - integrity sha512-9C20RLxrZU/rFnxWncDkuF6O999NdIf3E1ws4B0ZeY3sRVPzWBMsYDE2lxjxhiXxg464cQTgKUGm8/i6y2YGXg== +process-warning@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/process-warning/-/process-warning-1.0.0.tgz#980a0b25dc38cd6034181be4b7726d89066b4616" + integrity sha512-du4wfLyj4yCZq1VupnVSZmRsPJsNuxoDQFdCFHLaYiEbFBD7QE0a+I4D7hOxrVnh78QE/YipFAj9lXHiXocV+Q== process@^0.11.10: version "0.11.10" @@ -5207,6 +5212,11 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== +punycode@^1.3.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== + punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -5330,10 +5340,10 @@ readline-sync@^1.4.9: resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b" integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw== -real-require@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.2.0.tgz#209632dea1810be2ae063a6ac084fee7e33fba78" - integrity sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg== +real-require@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.1.0.tgz#736ac214caa20632847b7ca8c1056a0767df9381" + integrity sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg== redis-commands@1.7.0: version "1.7.0" @@ -5477,7 +5487,7 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-stable-stringify@^2.3.1: +safe-stable-stringify@^2.1.0: version "2.4.2" resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.2.tgz#ec7b037768098bf65310d1d64370de0dc02353aa" integrity sha512-gMxvPJYhP0O9n2pvcfYfIuYgbledAOJFcqRThtPRmjscaipiwcwPPKLytpVzMkG2HAN87Qmo2d4PtGiri1dSLA== @@ -5589,14 +5599,14 @@ slash@^3.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== -sonic-boom@^2.1.0: +sonic-boom@^2.2.1: version "2.8.0" resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-2.8.0.tgz#c1def62a77425090e6ad7516aad8eb402e047611" integrity sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg== dependencies: atomic-sleep "^1.0.0" -sonic-boom@^3.0.0, sonic-boom@^3.1.0: +sonic-boom@^3.0.0: version "3.2.1" resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-3.2.1.tgz#972ceab831b5840a08a002fa95a672008bda1c38" integrity sha512-iITeTHxy3B9FGu8aVdiDXUVAcHMF9Ss0cCsAOo2HfCrmVGT3/DT5oYaeu0M/YKZDlKTvChEyPq0zI9Hf33EX6A== @@ -5701,6 +5711,11 @@ step@0.0.x: resolved "https://registry.yarnpkg.com/step/-/step-0.0.6.tgz#143e7849a5d7d3f4a088fe29af94915216eeede2" integrity sha512-qSSeQinUJk2w38vUFobjFoE307GqsozMC8VisOCkJLpklvKPT0ptPHwWOrENoag8rgLudvTkfP3bancwP93/Jw== +stream-shift@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" + integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== + stream-to-array@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/stream-to-array/-/stream-to-array-2.3.0.tgz#bbf6b39f5f43ec30bc71babcb37557acecf34353" @@ -5897,12 +5912,12 @@ testcontainers@4.7.0: stream-to-array "^2.3.0" tar-fs "^2.1.0" -thread-stream@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-2.3.0.tgz#4fc07fb39eff32ae7bad803cb7dd9598349fed33" - integrity sha512-kaDqm1DET9pp3NXwR8382WHbnpXnRkN9xGN9dQt3B2+dmXiW8X1SOwmFOxAErEQ47ObhZ96J6yhZNXuyCOL7KA== +thread-stream@^0.15.1: + version "0.15.2" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-0.15.2.tgz#fb95ad87d2f1e28f07116eb23d85aba3bc0425f4" + integrity sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA== dependencies: - real-require "^0.2.0" + real-require "^0.1.0" through2@3.0.2: version "3.0.2" diff --git a/packages/server/package.json b/packages/server/package.json index 3e9778e7e1..24168df926 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -85,7 +85,6 @@ "koa-body": "4.2.0", "koa-compress": "4.0.1", "koa-connect": "2.1.0", - "koa-pino-logger": "3.0.0", "koa-send": "5.0.0", "koa-session": "5.12.0", "koa-static": "5.0.0", @@ -99,7 +98,6 @@ "node-fetch": "2.6.7", "open": "8.4.0", "pg": "8.5.1", - "pino-pretty": "5.1.3", "posthog-node": "1.3.0", "pouchdb": "7.3.0", "pouchdb-adapter-memory": "7.2.2", diff --git a/packages/server/scripts/dev/manage.js b/packages/server/scripts/dev/manage.js index 543e00ac59..c5043895cb 100644 --- a/packages/server/scripts/dev/manage.js +++ b/packages/server/scripts/dev/manage.js @@ -45,6 +45,7 @@ async function init() { BB_ADMIN_USER_PASSWORD: "", PLUGINS_DIR: "", TENANT_FEATURE_FLAGS: "*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR", + HTTP_LOGGING: 0, } let envFile = "" Object.keys(envFileJson).forEach(key => { diff --git a/packages/server/src/api/controllers/ops.ts b/packages/server/src/api/controllers/ops.ts new file mode 100644 index 0000000000..89ad0ac97b --- /dev/null +++ b/packages/server/src/api/controllers/ops.ts @@ -0,0 +1,32 @@ +import { Ctx } from "@budibase/types" +import { logging } from "@budibase/backend-core" + +interface LogRequest { + message: string + data?: any +} + +interface ErrorRequest { + message: string +} + +export async function log(ctx: Ctx) { + const body = ctx.request.body + console.trace(body.message, body.data) + console.debug(body.message, body.data) + console.info(body.message, body.data) + console.warn(body.message, body.data) + console.error(body.message, body.data) + ctx.status = 204 +} + +export async function alert(ctx: Ctx) { + const body = ctx.request.body + logging.logAlert(body.message, new Error(body.message)) + ctx.status = 204 +} + +export async function error(ctx: Ctx) { + const body = ctx.request.body + throw new Error(body.message) +} diff --git a/packages/server/src/api/routes/index.ts b/packages/server/src/api/routes/index.ts index 9dc119ec83..e15e8aa92b 100644 --- a/packages/server/src/api/routes/index.ts +++ b/packages/server/src/api/routes/index.ts @@ -25,6 +25,7 @@ import devRoutes from "./dev" import cloudRoutes from "./cloud" import migrationRoutes from "./migrations" import pluginRoutes from "./plugin" +import opsRoutes from "./ops" import Router from "@koa/router" import { api as pro } from "@budibase/pro" @@ -63,6 +64,7 @@ export const mainRoutes: Router[] = [ rowRoutes, migrationRoutes, pluginRoutes, + opsRoutes, scheduleRoutes, environmentVariableRoutes, // these need to be handled last as they still use /api/:tableId diff --git a/packages/server/src/api/routes/ops.ts b/packages/server/src/api/routes/ops.ts new file mode 100644 index 0000000000..8ff1ca995f --- /dev/null +++ b/packages/server/src/api/routes/ops.ts @@ -0,0 +1,30 @@ +import Router from "@koa/router" +import * as controller from "../controllers/ops" +import { middleware } from "@budibase/backend-core" +import Joi from "joi" + +export function logsValidator() { + return middleware.joiValidator.body( + Joi.object({ + message: Joi.string().required(), + data: Joi.object(), + }) + ) +} + +export function errorValidator() { + return middleware.joiValidator.body( + Joi.object({ + message: Joi.string().required(), + }) + ) +} + +const router: Router = new Router() + +router + .post("/api/ops/log", logsValidator(), controller.log) + .post("/api/ops/error", errorValidator(), controller.error) + .post("/api/ops/alert", errorValidator(), controller.alert) + +export default router diff --git a/packages/server/src/app.ts b/packages/server/src/app.ts index a7070b3c19..230904f405 100644 --- a/packages/server/src/app.ts +++ b/packages/server/src/app.ts @@ -2,21 +2,9 @@ if (process.env.DD_APM_ENABLED) { require("./ddApm") } -if (process.env.ELASTIC_APM_ENABLED) { - require("./elasticApm") -} - // need to load environment first import env from "./environment" -// enable APM if configured -if (process.env.ELASTIC_APM_ENABLED) { - const apm = require("elastic-apm-node").start({ - serviceName: process.env.SERVICE, - environment: process.env.BUDIBASE_ENVIRONMENT, - }) -} - import { ExtendableContext } from "koa" import * as db from "./db" db.init() @@ -53,7 +41,8 @@ app.use( }) ) -app.use(middleware.logging) +app.use(middleware.correlation) +app.use(middleware.pino) app.use(userAgent) if (env.isProd()) { diff --git a/packages/server/src/elasticApm.ts b/packages/server/src/elasticApm.ts deleted file mode 100644 index 5581b9dd4b..0000000000 --- a/packages/server/src/elasticApm.ts +++ /dev/null @@ -1,10 +0,0 @@ -import apm from "elastic-apm-node" - -// enable APM if configured -if (process.env.ELASTIC_APM_ENABLED) { - console.log("Starting elastic-apm-node") - apm.start({ - serviceName: process.env.SERVICE, - environment: process.env.BUDIBASE_ENVIRONMENT, - }) -} diff --git a/packages/server/src/environment.ts b/packages/server/src/environment.ts index 058e8bdff8..1bd5a6486c 100644 --- a/packages/server/src/environment.ts +++ b/packages/server/src/environment.ts @@ -62,7 +62,6 @@ const environment = { // minor SALT_ROUNDS: process.env.SALT_ROUNDS, LOGGER: process.env.LOGGER, - LOG_LEVEL: process.env.LOG_LEVEL, ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL, AUTOMATION_MAX_ITERATIONS: parseIntSafe(process.env.AUTOMATION_MAX_ITERATIONS) || 200, diff --git a/packages/server/src/migrations/functions/usageQuotas/syncApps.ts b/packages/server/src/migrations/functions/usageQuotas/syncApps.ts index 351154dccc..39b8efe335 100644 --- a/packages/server/src/migrations/functions/usageQuotas/syncApps.ts +++ b/packages/server/src/migrations/functions/usageQuotas/syncApps.ts @@ -9,6 +9,6 @@ export const run = async () => { // sync app count const tenantId = tenancy.getTenantId() - console.log(`[Tenant: ${tenantId}] Syncing app count: ${appCount}`) + console.log(`Syncing app count: ${appCount}`) await quotas.setUsage(appCount, StaticQuotaName.APPS, QuotaUsageType.STATIC) } diff --git a/packages/server/src/migrations/functions/usageQuotas/syncRows.ts b/packages/server/src/migrations/functions/usageQuotas/syncRows.ts index 92574d1f27..506218a41f 100644 --- a/packages/server/src/migrations/functions/usageQuotas/syncRows.ts +++ b/packages/server/src/migrations/functions/usageQuotas/syncRows.ts @@ -1,4 +1,4 @@ -import { tenancy, db as dbCore } from "@budibase/backend-core" +import { db as dbCore } from "@budibase/backend-core" import { getUniqueRows } from "../../../utilities/usageQuota/rows" import { quotas } from "@budibase/pro" import { StaticQuotaName, QuotaUsageType, App } from "@budibase/types" @@ -18,8 +18,7 @@ export const run = async () => { }) // sync row count - const tenantId = tenancy.getTenantId() - console.log(`[Tenant: ${tenantId}] Syncing row count: ${rowCount}`) + console.log(`Syncing row count: ${rowCount}`) await quotas.setUsagePerApp( counts, StaticQuotaName.ROWS, diff --git a/packages/server/src/startup.ts b/packages/server/src/startup.ts index 6cdbf87c2c..f6a5307b8f 100644 --- a/packages/server/src/startup.ts +++ b/packages/server/src/startup.ts @@ -16,13 +16,10 @@ import * as bullboard from "./automations/bullboard" import * as pro from "@budibase/pro" import * as api from "./api" import sdk from "./sdk" -const pino = require("koa-pino-logger") let STARTUP_RAN = false async function initRoutes(app: any) { - app.use(pino(logging.pinoSettings())) - if (!env.isTest()) { const plugin = await bullboard.init() app.use(plugin) diff --git a/packages/server/src/tests/jestEnv.ts b/packages/server/src/tests/jestEnv.ts index 1f76bccd5f..34c51009aa 100644 --- a/packages/server/src/tests/jestEnv.ts +++ b/packages/server/src/tests/jestEnv.ts @@ -6,7 +6,6 @@ process.env.MULTI_TENANCY = "1" // @ts-ignore process.env.BUDIBASE_DIR = tmpdir("budibase-unittests") process.env.LOG_LEVEL = process.env.LOG_LEVEL || "error" -process.env.ENABLE_4XX_HTTP_LOGGING = "0" process.env.MOCK_REDIS = "1" process.env.PLATFORM_URL = "http://localhost:10000" process.env.REDIS_PASSWORD = "budibase" diff --git a/packages/server/src/tests/jestSetup.ts b/packages/server/src/tests/jestSetup.ts index 9f3b85cac4..e233e7152e 100644 --- a/packages/server/src/tests/jestSetup.ts +++ b/packages/server/src/tests/jestSetup.ts @@ -1,4 +1,3 @@ -import "./logging" import env from "../environment" import { env as coreEnv, timers } from "@budibase/backend-core" import { testContainerUtils } from "@budibase/backend-core/tests" diff --git a/packages/server/src/tests/logging.ts b/packages/server/src/tests/logging.ts deleted file mode 100644 index 271f4d62ff..0000000000 --- a/packages/server/src/tests/logging.ts +++ /dev/null @@ -1,34 +0,0 @@ -export enum LogLevel { - TRACE = "trace", - DEBUG = "debug", - INFO = "info", - WARN = "warn", - ERROR = "error", -} - -const LOG_INDEX: { [key in LogLevel]: number } = { - [LogLevel.TRACE]: 1, - [LogLevel.DEBUG]: 2, - [LogLevel.INFO]: 3, - [LogLevel.WARN]: 4, - [LogLevel.ERROR]: 5, -} - -const setIndex = LOG_INDEX[process.env.LOG_LEVEL as LogLevel] - -if (setIndex > LOG_INDEX.trace) { - global.console.trace = jest.fn() -} - -if (setIndex > LOG_INDEX.debug) { - global.console.debug = jest.fn() -} - -if (setIndex > LOG_INDEX.info) { - global.console.info = jest.fn() - global.console.log = jest.fn() -} - -if (setIndex > LOG_INDEX.warn) { - global.console.warn = jest.fn() -} diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index ccd0c2b20b..409fd47778 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1677,11 +1677,6 @@ protobufjs "^6.11.3" yargs "^16.2.0" -"@hapi/bourne@^2.0.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@hapi/bourne/-/bourne-2.1.0.tgz#66aff77094dc3080bd5df44ec63881f2676eb020" - integrity sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q== - "@hapi/hoek@^9.0.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -4168,16 +4163,6 @@ argparse@^2.0.1: resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38" integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q== -args@^5.0.1: - version "5.0.3" - resolved "https://registry.yarnpkg.com/args/-/args-5.0.3.tgz#943256db85021a85684be2f0882f25d796278702" - integrity sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA== - dependencies: - camelcase "5.0.0" - chalk "2.4.2" - leven "2.1.0" - mri "1.1.4" - argsarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/argsarray/-/argsarray-0.0.1.tgz#6e7207b4ecdb39b0af88303fa5ae22bda8df61cb" @@ -4992,11 +4977,6 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" - integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA== - camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" @@ -5022,7 +5002,7 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== -chalk@2.4.2, chalk@^2.0.0, chalk@^2.1.0: +chalk@^2.0.0, chalk@^2.1.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -5617,11 +5597,6 @@ date-utils@*: resolved "https://registry.yarnpkg.com/date-utils/-/date-utils-1.2.21.tgz#61fb16cdc1274b3c9acaaffe9fc69df8720a2b64" integrity sha512-wJMBjqlwXR0Iv0wUo/lFbhSQ7MmG1hl36iuxuE91kW+5b5sWbase73manEqNH9sOLFAMG83B4ffNKq9/Iq0FVA== -dateformat@^4.5.1: - version "4.6.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5" - integrity sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA== - dayjs@^1.10.4, dayjs@^1.10.5: version "1.11.3" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.3.tgz#4754eb694a624057b9ad2224b67b15d552589258" @@ -6913,13 +6888,6 @@ fast-text-encoding@^1.0.0, fast-text-encoding@^1.0.3: resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== -fast-url-parser@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" - integrity sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ== - dependencies: - punycode "^1.3.2" - fastest-levenshtein@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz#9990f7d3a88cc5a9ffd1f1745745251700d497e2" @@ -9281,7 +9249,7 @@ jimp@0.16.1: "@jimp/types" "^0.16.1" regenerator-runtime "^0.13.3" -jmespath@0.15.0, jmespath@^0.15.0: +jmespath@0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217" integrity sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w== @@ -9307,7 +9275,7 @@ join-component@^1.1.0: resolved "https://registry.yarnpkg.com/join-component/-/join-component-1.1.0.tgz#b8417b750661a392bee2c2537c68b2a9d4977cd5" integrity sha512-bF7vcQxbODoGK1imE2P9GS9aw4zD0Sd+Hni68IMZLj7zRnquH7dXUmMw9hDI5S/Jzt7q+IyTXN0rSg2GI0IKhQ== -joycon@^3.0.0, joycon@^3.0.1: +joycon@^3.0.1: version "3.1.1" resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== @@ -9680,13 +9648,6 @@ koa-passport@4.1.4: dependencies: passport "^0.4.0" -koa-pino-logger@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/koa-pino-logger/-/koa-pino-logger-3.0.0.tgz#27600b4f3639e8767dfc6b66493109c5457f53ba" - integrity sha512-teJsT88JLRBYH7pJACGAwAHfl2y/x5u5aSPD03Z/HW6QDMAWyRxk4dsY0/UbtM8wgaXIaxZgIFUxxvgiQFr6WQ== - dependencies: - pino-http "^5.0.1" - koa-router@^10.0.0: version "10.1.1" resolved "https://registry.yarnpkg.com/koa-router/-/koa-router-10.1.1.tgz#20809f82648518b84726cd445037813cd99f17ff" @@ -9902,11 +9863,6 @@ levelup@4.4.0, levelup@^4.3.2: level-supports "~1.0.0" xtend "~4.0.0" -leven@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" - integrity sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA== - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -10592,11 +10548,6 @@ monitor-event-loop-delay@^1.0.0: resolved "https://registry.yarnpkg.com/monitor-event-loop-delay/-/monitor-event-loop-delay-1.0.0.tgz#b5ab78165a3bb93f2b275c50d01430c7f155d1f7" integrity sha512-YRIr1exCIfBDLZle8WHOfSo7Xg3M+phcZfq9Fx1L6Abo+atGp7cge5pM7PjyBn4s1oZI/BRD4EMrzQBbPpVb5Q== -mri@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a" - integrity sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -11618,44 +11569,12 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== -pino-http@^5.0.1: - version "5.8.0" - resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-5.8.0.tgz#6e688fd5f965c5b6991f340eb660ea2927be9aa7" - integrity sha512-YwXiyRb9y0WCD1P9PcxuJuh3Dc5qmXde/paJE86UGYRdiFOi828hR9iUGmk5gaw6NBT9gLtKANOHFimvh19U5w== - dependencies: - fast-url-parser "^1.1.3" - pino "^6.13.0" - pino-std-serializers "^4.0.0" - -pino-pretty@5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-5.1.3.tgz#c4085093d1dffda359ab52731f87d96f7f832dc9" - integrity sha512-Zj+0TVdYKkAAIx9EUCL5e4TttwgsaFvJh2ceIMQeFCY8ak9tseEZQGSgpvyjEj1/iIVGIh5tdhkGEQWSMILKHA== - dependencies: - "@hapi/bourne" "^2.0.0" - args "^5.0.1" - chalk "^4.0.0" - dateformat "^4.5.1" - fast-safe-stringify "^2.0.7" - jmespath "^0.15.0" - joycon "^3.0.0" - pump "^3.0.0" - readable-stream "^3.6.0" - rfdc "^1.3.0" - split2 "^3.1.1" - strip-json-comments "^3.1.1" - pino-std-serializers@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== -pino-std-serializers@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" - integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== - -pino@^6.11.2, pino@^6.13.0: +pino@^6.11.2: version "6.14.0" resolved "https://registry.yarnpkg.com/pino/-/pino-6.14.0.tgz#b745ea87a99a6c4c9b374e4f29ca7910d4c69f78" integrity sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg== @@ -12131,11 +12050,6 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== -punycode@^1.3.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== - punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -12275,7 +12189,7 @@ readable-stream@1.1.14, readable-stream@^1.0.27-1: isarray "0.0.1" string_decoder "~0.10.x" -"readable-stream@2 || 3", readable-stream@^3.0.0, readable-stream@^3.0.1, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: +"readable-stream@2 || 3", readable-stream@^3.0.1, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -12687,7 +12601,7 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rfdc@^1.2.0, rfdc@^1.3.0: +rfdc@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== @@ -13288,13 +13202,6 @@ split2@^2.1.0: dependencies: through2 "^2.0.2" -split2@^3.1.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" - integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== - dependencies: - readable-stream "^3.0.0" - split2@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809" diff --git a/packages/worker/package.json b/packages/worker/package.json index 0e8b54a521..957f516650 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -56,7 +56,6 @@ "koa-body": "4.2.0", "koa-compress": "4.0.1", "koa-passport": "4.1.4", - "koa-pino-logger": "3.0.0", "koa-send": "5.0.1", "koa-session": "5.13.1", "koa-static": "5.0.0", @@ -66,7 +65,6 @@ "passport-google-oauth": "2.0.0", "passport-jwt": "4.0.0", "passport-local": "1.0.0", - "pino-pretty": "5.1.3", "pouchdb": "7.3.0", "pouchdb-all-dbs": "1.1.1", "server-destroy": "1.0.1" diff --git a/packages/worker/scripts/dev/manage.js b/packages/worker/scripts/dev/manage.js index 21a9eab9c6..ecf5defd47 100644 --- a/packages/worker/scripts/dev/manage.js +++ b/packages/worker/scripts/dev/manage.js @@ -30,6 +30,7 @@ async function init() { DEPLOYMENT_ENVIRONMENT: "development", TENANT_FEATURE_FLAGS: "*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR", ENABLE_EMAIL_TEST_MODE: 1, + HTTP_LOGGING: 0, } let envFile = "" Object.keys(envFileJson).forEach(key => { diff --git a/packages/worker/src/elasticApm.ts b/packages/worker/src/elasticApm.ts deleted file mode 100644 index 5581b9dd4b..0000000000 --- a/packages/worker/src/elasticApm.ts +++ /dev/null @@ -1,10 +0,0 @@ -import apm from "elastic-apm-node" - -// enable APM if configured -if (process.env.ELASTIC_APM_ENABLED) { - console.log("Starting elastic-apm-node") - apm.start({ - serviceName: process.env.SERVICE, - environment: process.env.BUDIBASE_ENVIRONMENT, - }) -} diff --git a/packages/worker/src/environment.ts b/packages/worker/src/environment.ts index 812af6aacd..678ffe7f14 100644 --- a/packages/worker/src/environment.ts +++ b/packages/worker/src/environment.ts @@ -47,7 +47,6 @@ const environment = { // flags NODE_ENV: process.env.NODE_ENV, SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED || ""), - LOG_LEVEL: process.env.LOG_LEVEL, MULTI_TENANCY: process.env.MULTI_TENANCY, DISABLE_ACCOUNT_PORTAL: process.env.DISABLE_ACCOUNT_PORTAL, SMTP_FALLBACK_ENABLED: process.env.SMTP_FALLBACK_ENABLED, diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index 1a646c623d..30596d1d76 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -2,10 +2,6 @@ if (process.env.DD_APM_ENABLED) { require("./ddApm") } -if (process.env.ELASTIC_APM_ENABLED) { - require("./elasticApm") -} - // need to load environment first import env from "./environment" import { Scope } from "@sentry/node" @@ -31,7 +27,6 @@ import api from "./api" import * as redis from "./utilities/redis" const Sentry = require("@sentry/node") const koaSession = require("koa-session") -const logger = require("koa-pino-logger") const { userAgent } = require("koa-useragent") import destroyable from "server-destroy" @@ -60,8 +55,8 @@ app.use(handleScimBody) app.use(koaBody({ multipart: true })) app.use(koaSession(app)) -app.use(middleware.logging) -app.use(logger(logging.pinoSettings())) +app.use(middleware.correlation) +app.use(middleware.pino) app.use(userAgent) // authentication diff --git a/packages/worker/src/tests/jestEnv.ts b/packages/worker/src/tests/jestEnv.ts index 5784e44dcf..fc92bbbf23 100644 --- a/packages/worker/src/tests/jestEnv.ts +++ b/packages/worker/src/tests/jestEnv.ts @@ -2,7 +2,6 @@ process.env.SELF_HOSTED = "0" process.env.NODE_ENV = "jest" process.env.JWT_SECRET = "test-jwtsecret" process.env.LOG_LEVEL = process.env.LOG_LEVEL || "error" -process.env.ENABLE_4XX_HTTP_LOGGING = "0" process.env.MULTI_TENANCY = "1" process.env.MINIO_URL = "http://localhost" process.env.MINIO_ACCESS_KEY = "test" diff --git a/packages/worker/src/tests/jestSetup.ts b/packages/worker/src/tests/jestSetup.ts index 7a3fb08cb9..17bcb7dfb4 100644 --- a/packages/worker/src/tests/jestSetup.ts +++ b/packages/worker/src/tests/jestSetup.ts @@ -1,5 +1,3 @@ -import "./logging" - import { mocks, testContainerUtils } from "@budibase/backend-core/tests" import env from "../environment" import { env as coreEnv, timers } from "@budibase/backend-core" diff --git a/packages/worker/src/tests/logging.ts b/packages/worker/src/tests/logging.ts deleted file mode 100644 index 271f4d62ff..0000000000 --- a/packages/worker/src/tests/logging.ts +++ /dev/null @@ -1,34 +0,0 @@ -export enum LogLevel { - TRACE = "trace", - DEBUG = "debug", - INFO = "info", - WARN = "warn", - ERROR = "error", -} - -const LOG_INDEX: { [key in LogLevel]: number } = { - [LogLevel.TRACE]: 1, - [LogLevel.DEBUG]: 2, - [LogLevel.INFO]: 3, - [LogLevel.WARN]: 4, - [LogLevel.ERROR]: 5, -} - -const setIndex = LOG_INDEX[process.env.LOG_LEVEL as LogLevel] - -if (setIndex > LOG_INDEX.trace) { - global.console.trace = jest.fn() -} - -if (setIndex > LOG_INDEX.debug) { - global.console.debug = jest.fn() -} - -if (setIndex > LOG_INDEX.info) { - global.console.info = jest.fn() - global.console.log = jest.fn() -} - -if (setIndex > LOG_INDEX.warn) { - global.console.warn = jest.fn() -} diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 20ec58a674..5db376b1b3 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -682,11 +682,6 @@ dependencies: "@elastic/ecs-helpers" "^1.1.0" -"@hapi/bourne@^2.0.0": - version "2.1.0" - resolved "https://registry.yarnpkg.com/@hapi/bourne/-/bourne-2.1.0.tgz#66aff77094dc3080bd5df44ec63881f2676eb020" - integrity sha512-i1BpaNDVLJdRBEKeJWkVO6tYX6DMFBuwMhSuWqLsY4ufeTKGVuV5rBsUhxPayXqnnWHgXUAmWK16H/ykO5Wj4Q== - "@hapi/hoek@^9.0.0": version "9.3.0" resolved "https://registry.yarnpkg.com/@hapi/hoek/-/hoek-9.3.0.tgz#8368869dcb735be2e7f5cb7647de78e167a251fb" @@ -2133,16 +2128,6 @@ argparse@^1.0.10, argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" -args@^5.0.1: - version "5.0.3" - resolved "https://registry.yarnpkg.com/args/-/args-5.0.3.tgz#943256db85021a85684be2f0882f25d796278702" - integrity sha512-h6k/zfFgusnv3i5TU08KQkVKuCPBtL/PWQbWkHUxvJrZ2nAyeaUupneemcrgn1xmqxPQsPIzwkUhOpoqPDRZuA== - dependencies: - camelcase "5.0.0" - chalk "2.4.2" - leven "2.1.0" - mri "1.1.4" - argsarray@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/argsarray/-/argsarray-0.0.1.tgz#6e7207b4ecdb39b0af88303fa5ae22bda8df61cb" @@ -2676,11 +2661,6 @@ callsites@^3.0.0: resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73" integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ== -camelcase@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.0.0.tgz#03295527d58bd3cd4aa75363f35b2e8d97be2f42" - integrity sha512-faqwZqnWxbxn+F1d399ygeamQNy3lPp/H9H6rNrqYh4FSVCtcY+3cub1MxA8o9mDd55mM8Aghuu/kuyYA6VTsA== - camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" @@ -2706,7 +2686,7 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== -chalk@2.4.2, chalk@^2.0.0, chalk@^2.1.0: +chalk@^2.0.0, chalk@^2.1.0: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -3142,11 +3122,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -dateformat@^4.5.1: - version "4.6.3" - resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.6.3.tgz#556fa6497e5217fedb78821424f8a1c22fa3f4b5" - integrity sha512-2P0p0pFGzHS5EMnhdxQi7aJN+iMheud0UhG4dlE1DLAlvL8JHjJJTX/CSm4JXwV0Ka5nGk3zC5mcb5bUQUxxMA== - dayjs@^1.10.4: version "1.11.7" resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.7.tgz#4b296922642f70999544d1144a2c25730fce63e2" @@ -4014,13 +3989,6 @@ fast-stream-to-buffer@^1.0.0: dependencies: end-of-stream "^1.4.1" -fast-url-parser@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" - integrity sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ== - dependencies: - punycode "^1.3.2" - fastq@^1.6.0: version "1.13.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" @@ -5744,7 +5712,7 @@ jest@28.1.1: import-local "^3.0.2" jest-cli "^28.1.1" -jmespath@0.15.0, jmespath@^0.15.0: +jmespath@0.15.0: version "0.15.0" resolved "https://registry.yarnpkg.com/jmespath/-/jmespath-0.15.0.tgz#a3f222a9aae9f966f5d27c796510e28091764217" integrity sha512-+kHj8HXArPfpPEKGLZ+kB5ONRTCiGQXo8RQYL0hH8t6pWXUBBK5KkkQmTNOwKK4LEsd0yTsgtjJVm4UBSZea4w== @@ -5765,11 +5733,6 @@ join-component@^1.1.0: resolved "https://registry.yarnpkg.com/join-component/-/join-component-1.1.0.tgz#b8417b750661a392bee2c2537c68b2a9d4977cd5" integrity sha512-bF7vcQxbODoGK1imE2P9GS9aw4zD0Sd+Hni68IMZLj7zRnquH7dXUmMw9hDI5S/Jzt7q+IyTXN0rSg2GI0IKhQ== -joycon@^3.0.0: - version "3.1.1" - resolved "https://registry.yarnpkg.com/joycon/-/joycon-3.1.1.tgz#bce8596d6ae808f8b68168f5fc69280996894f03" - integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== - js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -5998,13 +5961,6 @@ koa-passport@4.1.4: dependencies: passport "^0.4.0" -koa-pino-logger@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/koa-pino-logger/-/koa-pino-logger-3.0.0.tgz#27600b4f3639e8767dfc6b66493109c5457f53ba" - integrity sha512-teJsT88JLRBYH7pJACGAwAHfl2y/x5u5aSPD03Z/HW6QDMAWyRxk4dsY0/UbtM8wgaXIaxZgIFUxxvgiQFr6WQ== - dependencies: - pino-http "^5.0.1" - koa-send@5.0.1, koa-send@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/koa-send/-/koa-send-5.0.1.tgz#39dceebfafb395d0d60beaffba3a70b4f543fe79" @@ -6169,11 +6125,6 @@ levelup@4.4.0, levelup@^4.3.2: level-supports "~1.0.0" xtend "~4.0.0" -leven@2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/leven/-/leven-2.1.0.tgz#c2e7a9f772094dee9d34202ae8acce4687875580" - integrity sha512-nvVPLpIHUxCUoRLrFqTgSxXJ614d8AgQoWl7zPe/2VadE8+1dpU3LBhowRuBAcuwruWtOdD8oYC9jDNJjXDPyA== - leven@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" @@ -6609,11 +6560,6 @@ monitor-event-loop-delay@^1.0.0: resolved "https://registry.yarnpkg.com/monitor-event-loop-delay/-/monitor-event-loop-delay-1.0.0.tgz#b5ab78165a3bb93f2b275c50d01430c7f155d1f7" integrity sha512-YRIr1exCIfBDLZle8WHOfSo7Xg3M+phcZfq9Fx1L6Abo+atGp7cge5pM7PjyBn4s1oZI/BRD4EMrzQBbPpVb5Q== -mri@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a" - integrity sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -7256,44 +7202,12 @@ pify@^5.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== -pino-http@^5.0.1: - version "5.8.0" - resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-5.8.0.tgz#6e688fd5f965c5b6991f340eb660ea2927be9aa7" - integrity sha512-YwXiyRb9y0WCD1P9PcxuJuh3Dc5qmXde/paJE86UGYRdiFOi828hR9iUGmk5gaw6NBT9gLtKANOHFimvh19U5w== - dependencies: - fast-url-parser "^1.1.3" - pino "^6.13.0" - pino-std-serializers "^4.0.0" - -pino-pretty@5.1.3: - version "5.1.3" - resolved "https://registry.yarnpkg.com/pino-pretty/-/pino-pretty-5.1.3.tgz#c4085093d1dffda359ab52731f87d96f7f832dc9" - integrity sha512-Zj+0TVdYKkAAIx9EUCL5e4TttwgsaFvJh2ceIMQeFCY8ak9tseEZQGSgpvyjEj1/iIVGIh5tdhkGEQWSMILKHA== - dependencies: - "@hapi/bourne" "^2.0.0" - args "^5.0.1" - chalk "^4.0.0" - dateformat "^4.5.1" - fast-safe-stringify "^2.0.7" - jmespath "^0.15.0" - joycon "^3.0.0" - pump "^3.0.0" - readable-stream "^3.6.0" - rfdc "^1.3.0" - split2 "^3.1.1" - strip-json-comments "^3.1.1" - pino-std-serializers@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== -pino-std-serializers@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" - integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== - -pino@^6.11.2, pino@^6.13.0: +pino@^6.11.2: version "6.14.0" resolved "https://registry.yarnpkg.com/pino/-/pino-6.14.0.tgz#b745ea87a99a6c4c9b374e4f29ca7910d4c69f78" integrity sha512-iuhEDel3Z3hF9Jfe44DPXR8l07bhjuFY3GMHIXbjnY9XcafbyDDwl2sN2vw2GjMPf5Nkoe+OFao7ffn9SXaKDg== @@ -7660,11 +7574,6 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== -punycode@^1.3.2: - version "1.4.1" - resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" - integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== - punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -7776,7 +7685,7 @@ readable-stream@1.1.14, readable-stream@^1.0.27-1: isarray "0.0.1" string_decoder "~0.10.x" -"readable-stream@2 || 3", readable-stream@^3.0.0, readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: +"readable-stream@2 || 3", readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -8078,7 +7987,7 @@ reusify@^1.0.4: resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw== -rfdc@^1.2.0, rfdc@^1.3.0: +rfdc@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/rfdc/-/rfdc-1.3.0.tgz#d0b7c441ab2720d05dc4cf26e01c89631d9da08b" integrity sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA== @@ -8448,13 +8357,6 @@ split2@^2.1.0: dependencies: through2 "^2.0.2" -split2@^3.1.1: - version "3.2.2" - resolved "https://registry.yarnpkg.com/split2/-/split2-3.2.2.tgz#bf2cf2a37d838312c249c89206fd7a17dd12365f" - integrity sha512-9NThjpgZnifTkJpzTZ7Eue85S49QwpNhZTq6GRJwObb6jnLFNGB7Qm73V5HewTROPyxD0C29xqmaI68bQtV+hg== - dependencies: - readable-stream "^3.0.0" - split@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" From e94a05887fd0a4768b88974368c6454c0f0efc66 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 4 Apr 2023 14:18:08 +0000 Subject: [PATCH 02/13] v2.4.44-alpha.6 --- lerna.json | 2 +- packages/backend-core/package.json | 6 +++--- packages/bbui/package.json | 6 +++--- packages/builder/package.json | 12 ++++++------ packages/cli/package.json | 8 ++++---- packages/client/package.json | 12 ++++++------ packages/frontend-core/package.json | 6 +++--- packages/sdk/package.json | 2 +- packages/server/package.json | 12 ++++++------ packages/shared-core/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 13 files changed, 41 insertions(+), 41 deletions(-) diff --git a/lerna.json b/lerna.json index 68c88e16b3..88a4aa12a2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "npmClient": "yarn", "packages": ["packages/*"], "command": { diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 47657eac46..4a946dd40a 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -24,7 +24,7 @@ "dependencies": { "@budibase/nano": "10.1.2", "@budibase/pouchdb-replication-stream": "1.2.10", - "@budibase/types": "2.4.44-alpha.5", + "@budibase/types": "2.4.44-alpha.6", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", @@ -79,8 +79,8 @@ "jest-serial-runner": "^1.2.1", "koa": "2.13.4", "nodemon": "2.0.16", - "pouchdb-adapter-memory": "7.2.2", "pino-pretty": "10.0.0", + "pouchdb-adapter-memory": "7.2.2", "timekeeper": "2.2.0", "ts-jest": "28.0.4", "ts-node": "10.8.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 402034271d..5b03b7a40d 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,8 +38,8 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/shared-core": "2.4.44-alpha.5", - "@budibase/string-templates": "2.4.44-alpha.5", + "@budibase/shared-core": "2.4.44-alpha.6", + "@budibase/string-templates": "2.4.44-alpha.6", "@spectrum-css/accordion": "3.0.24", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", diff --git a/packages/builder/package.json b/packages/builder/package.json index da397b961b..9b278d1e08 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "license": "GPL-3.0", "private": true, "scripts": { @@ -58,11 +58,11 @@ } }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.5", - "@budibase/client": "2.4.44-alpha.5", - "@budibase/frontend-core": "2.4.44-alpha.5", - "@budibase/shared-core": "2.4.44-alpha.5", - "@budibase/string-templates": "2.4.44-alpha.5", + "@budibase/bbui": "2.4.44-alpha.6", + "@budibase/client": "2.4.44-alpha.6", + "@budibase/frontend-core": "2.4.44-alpha.6", + "@budibase/shared-core": "2.4.44-alpha.6", + "@budibase/string-templates": "2.4.44-alpha.6", "@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 522a644ed5..77129c7464 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "dist/index.js", "bin": { @@ -29,9 +29,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.5", - "@budibase/string-templates": "2.4.44-alpha.5", - "@budibase/types": "2.4.44-alpha.5", + "@budibase/backend-core": "2.4.44-alpha.6", + "@budibase/string-templates": "2.4.44-alpha.6", + "@budibase/types": "2.4.44-alpha.6", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 205507da2d..4fa8f447a6 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,11 +19,11 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.5", - "@budibase/frontend-core": "2.4.44-alpha.5", - "@budibase/shared-core": "2.4.44-alpha.5", - "@budibase/string-templates": "2.4.44-alpha.5", - "@budibase/types": "2.4.44-alpha.5", + "@budibase/bbui": "2.4.44-alpha.6", + "@budibase/frontend-core": "2.4.44-alpha.6", + "@budibase/shared-core": "2.4.44-alpha.6", + "@budibase/string-templates": "2.4.44-alpha.6", + "@budibase/types": "2.4.44-alpha.6", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 6735504dbb..d2ebe3fe9c 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,13 +1,13 @@ { "name": "@budibase/frontend-core", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.4.44-alpha.5", - "@budibase/shared-core": "2.4.44-alpha.5", + "@budibase/bbui": "2.4.44-alpha.6", + "@budibase/shared-core": "2.4.44-alpha.6", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index dbc9b68e10..843568b151 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 24168df926..d82c019107 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -44,12 +44,12 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.4.44-alpha.5", - "@budibase/client": "2.4.44-alpha.5", + "@budibase/backend-core": "2.4.44-alpha.6", + "@budibase/client": "2.4.44-alpha.6", "@budibase/pro": "2.4.44-alpha.5", - "@budibase/shared-core": "2.4.44-alpha.5", - "@budibase/string-templates": "2.4.44-alpha.5", - "@budibase/types": "2.4.44-alpha.5", + "@budibase/shared-core": "2.4.44-alpha.6", + "@budibase/string-templates": "2.4.44-alpha.6", + "@budibase/types": "2.4.44-alpha.6", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/shared-core/package.json b/packages/shared-core/package.json index 394d8925d5..850f667854 100644 --- a/packages/shared-core/package.json +++ b/packages/shared-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/shared-core", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Shared data utils", "main": "dist/cjs/src/index.js", "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\"" }, "dependencies": { - "@budibase/types": "2.4.44-alpha.5" + "@budibase/types": "2.4.44-alpha.6" }, "devDependencies": { "concurrently": "^7.6.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 646cde4ce4..2b1beee692 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 4806235e0f..d7c69cecf5 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase types", "main": "dist/cjs/index.js", "types": "dist/mjs/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 957f516650..39fe03e485 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.4.44-alpha.5", + "version": "2.4.44-alpha.6", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.5", + "@budibase/backend-core": "2.4.44-alpha.6", "@budibase/pro": "2.4.44-alpha.5", - "@budibase/string-templates": "2.4.44-alpha.5", - "@budibase/types": "2.4.44-alpha.5", + "@budibase/string-templates": "2.4.44-alpha.6", + "@budibase/types": "2.4.44-alpha.6", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From bcf5bb9ca047768512e7ba94370941191379ad08 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 4 Apr 2023 14:21:08 +0000 Subject: [PATCH 03/13] Update pro version to 2.4.44-alpha.6 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 131 +++++++++++++++++++++++++++---- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 144 +++++++++++++++++++++++++++++++---- 4 files changed, 246 insertions(+), 33 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index d82c019107..3276e856bc 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -46,7 +46,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.4.44-alpha.6", "@budibase/client": "2.4.44-alpha.6", - "@budibase/pro": "2.4.44-alpha.5", + "@budibase/pro": "2.4.44-alpha.6", "@budibase/shared-core": "2.4.44-alpha.6", "@budibase/string-templates": "2.4.44-alpha.6", "@budibase/types": "2.4.44-alpha.6", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 409fd47778..1d34e8682f 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1290,14 +1290,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.5": - version "2.4.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.5.tgz#072082d5322a27b9cfaee75718ddcf464afaec13" - integrity sha512-TRiepsq3MlQ0ZqZoRJDmYUUTb31gURPvHs6CmfqR1wP0sh+yf+5PgmLQDLLXTHOZ7b461yp5KDVC9OjNsna3WQ== +"@budibase/backend-core@2.4.44-alpha.6": + version "2.4.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.6.tgz#9045938f4175e55180e2bcecc2cb3ff74c29cead" + integrity sha512-V4h0ahiNcAmFARbW0dnx90Y50x52bAagRmmDD6WoYrepISDFnEOl25Gg50HxTFrfvJt5+MIF//yXeyPtiuQHww== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.5" + "@budibase/types" "2.4.44-alpha.6" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1312,6 +1312,7 @@ joi "17.6.0" jsonwebtoken "9.0.0" koa-passport "4.1.4" + koa-pino-logger "4.0.0" lodash "4.17.21" lodash.isarguments "3.1.0" node-fetch "2.6.7" @@ -1429,15 +1430,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.5": - version "2.4.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.5.tgz#c748dfc16f5b30226c4006ae42a07636e5499102" - integrity sha512-HTKFiglaRb3aii4XakLezyLteo4SAg2ZumH6o/FSaRPrcN4KlPjxVCSxhXVSxu3m6GMdbcGLlah7+lK6iHnyEA== +"@budibase/pro@2.4.44-alpha.6": + version "2.4.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.6.tgz#a05241200d6daea59de1111812d9cd8a239ab3c3" + integrity sha512-vPDrSYEttTV4dfqsWdRYWwDkRWrag6CQJSIKrpL7rdbrt6BHWovZQMbZgA6JQpjnT5CX/WPMjr/0P9b5tITnEw== dependencies: - "@budibase/backend-core" "2.4.44-alpha.5" + "@budibase/backend-core" "2.4.44-alpha.6" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.5" + "@budibase/types" "2.4.44-alpha.6" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1490,10 +1491,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.5": - version "2.4.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.5.tgz#42c56241ab29ef81a048b93bc84644b69e41e63b" - integrity sha512-ACco4vREtv1un3aMH2sTKI8kD+/Hly2ee9AZw9YxFlsl78sOkvBPD25ki7oc8GH2pjLQ1Sjw7yG3SgW8MIsdbg== +"@budibase/types@2.4.44-alpha.6": + version "2.4.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.6.tgz#2292742c11c26503ae03af07d5263e0a6a85e015" + integrity sha512-G9JPREk1/ziSKBU/JY6IrErll+TsT/l8jffZnCB+y5hV1YU2A0bZJDixG+8d5/Xmz+xK+2mf8n8R8mdKwEyJuA== dependencies: scim-patch "^0.7.0" @@ -6016,7 +6017,7 @@ duplexer3@^0.1.4: resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" integrity sha512-CEj8FwwNA4cVH2uFCoHUrmojhYh1vmCdOaneKJXwkeY1i9jnlslVo9dx+hQ5Hl9GnH/Bwy/IjxAyOePyPKYnzA== -duplexify@^4.0.0: +duplexify@^4.0.0, duplexify@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.2.tgz#18b4f8d28289132fa0b9573c898d9f903f81c7b0" integrity sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw== @@ -6888,6 +6889,13 @@ fast-text-encoding@^1.0.0, fast-text-encoding@^1.0.3: resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.3.tgz#ec02ac8e01ab8a319af182dae2681213cfe9ce53" integrity sha512-dtm4QZH9nZtcDt8qJiOH9fcQd1NAgi+K1O2DbE6GG1PPCK/BWfOH3idCTRQ4ImXRUOyopDEgDEnVEE7Y/2Wrig== +fast-url-parser@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" + integrity sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ== + dependencies: + punycode "^1.3.2" + fastest-levenshtein@^1.0.12: version "1.0.12" resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.12.tgz#9990f7d3a88cc5a9ffd1f1745745251700d497e2" @@ -9648,6 +9656,13 @@ koa-passport@4.1.4: dependencies: passport "^0.4.0" +koa-pino-logger@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/koa-pino-logger/-/koa-pino-logger-4.0.0.tgz#a45c9fd0a39e9cd84ac23da502055054ee51b80d" + integrity sha512-YI/LB9ajyLPpjvf6e+7Ewmn+OQkCJpu/Y9eI1n7fnipu5Y1NchuNlke0mqh3/2z+5oDYr7pijjOWruEDIfua2A== + dependencies: + pino-http "^6.5.0" + koa-router@^10.0.0: version "10.1.1" resolved "https://registry.yarnpkg.com/koa-router/-/koa-router-10.1.1.tgz#20809f82648518b84726cd445037813cd99f17ff" @@ -10998,6 +11013,11 @@ omggif@^1.0.10, omggif@^1.0.9: resolved "https://registry.yarnpkg.com/omggif/-/omggif-1.0.10.tgz#ddaaf90d4a42f532e9e7cb3a95ecdd47f17c7b19" integrity sha512-LMJTtvgc/nugXj0Vcrrs68Mn2D1r0zf630VNtqtpI1FEO7e+O9FP4gqs9AcnBaSEeoHIPm28u6qgPR0oyEpGSw== +on-exit-leak-free@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz#b39c9e3bf7690d890f4861558b0d7b90a442d209" + integrity sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg== + on-finished@^2.3.0: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -11569,11 +11589,39 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha512-MnUuEycAemtSaeFSjXKW/aroV7akBbY+Sv+RkyqFjgAe73F+MR0TBWKBRDkmfWq/HiFmdavfZ1G7h4SPZXaCSg== +pino-abstract-transport@v0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz#4b54348d8f73713bfd14e3dc44228739aa13d9c0" + integrity sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ== + dependencies: + duplexify "^4.1.2" + split2 "^4.0.0" + +pino-http@^6.5.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-6.6.0.tgz#d0a1deacada8c93327fdaa48f5bdc94bc43d3407" + integrity sha512-PlItaK2MLpoIMLEcClhfb1VQk/o6fKppINl5s6sPE/4rvufkdO3kCSs/92EwrBsB1yssRCQqDV+w1xpYuPVnjg== + dependencies: + fast-url-parser "^1.1.3" + get-caller-file "^2.0.5" + pino "^7.5.0" + pino-std-serializers "^5.0.0" + pino-std-serializers@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== +pino-std-serializers@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" + integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== + +pino-std-serializers@^5.0.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-5.6.0.tgz#31b141155d6520967c5ec72944d08fb45c490fd3" + integrity sha512-VdUXCw8gO+xhir7sFuoYSjTnzB+TMDGxhAC/ph3YS3sdHnXNdsK0wMtADNUltfeGkn2KDxEM21fnjF3RwXyC8A== + pino@^6.11.2: version "6.14.0" resolved "https://registry.yarnpkg.com/pino/-/pino-6.14.0.tgz#b745ea87a99a6c4c9b374e4f29ca7910d4c69f78" @@ -11587,6 +11635,23 @@ pino@^6.11.2: quick-format-unescaped "^4.0.3" sonic-boom "^1.0.2" +pino@^7.5.0: + version "7.11.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-7.11.0.tgz#0f0ea5c4683dc91388081d44bff10c83125066f6" + integrity sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.0.0" + on-exit-leak-free "^0.2.0" + pino-abstract-transport v0.5.0 + pino-std-serializers "^4.0.0" + process-warning "^1.0.0" + quick-format-unescaped "^4.0.3" + real-require "^0.1.0" + safe-stable-stringify "^2.1.0" + sonic-boom "^2.2.1" + thread-stream "^0.15.1" + pirates@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" @@ -12050,6 +12115,11 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== +punycode@^1.3.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== + punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -12238,6 +12308,11 @@ readline-sync@^1.4.9: resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b" integrity sha512-gNva8/6UAe8QYepIQH/jQ2qn91Qj0B9sYjMBBs3QOB8F2CXcKgLxQaJRP76sWVRQt+QU+8fAkCbCvjjMFu7Ycw== +real-require@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.1.0.tgz#736ac214caa20632847b7ca8c1056a0767df9381" + integrity sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg== + recast@^0.10.1: version "0.10.43" resolved "https://registry.yarnpkg.com/recast/-/recast-0.10.43.tgz#b95d50f6d60761a5f6252e15d80678168491ce7f" @@ -12668,6 +12743,11 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-stable-stringify@^2.1.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" + integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== + safe-stable-stringify@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.3.1.tgz#ab67cbe1fe7d40603ca641c5e765cb942d04fc73" @@ -13067,6 +13147,13 @@ sonic-boom@^1.0.2: atomic-sleep "^1.0.0" flatstr "^1.0.12" +sonic-boom@^2.2.1: + version "2.8.0" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-2.8.0.tgz#c1def62a77425090e6ad7516aad8eb402e047611" + integrity sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg== + dependencies: + atomic-sleep "^1.0.0" + sort-keys-length@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/sort-keys-length/-/sort-keys-length-1.0.1.tgz#9cb6f4f4e9e48155a6aa0671edd336ff1479a188" @@ -13202,6 +13289,11 @@ split2@^2.1.0: dependencies: through2 "^2.0.2" +split2@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + split2@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/split2/-/split2-4.1.0.tgz#101907a24370f85bb782f08adaabe4e281ecf809" @@ -13832,6 +13924,13 @@ thenify-all@^1.0.0: dependencies: any-promise "^1.0.0" +thread-stream@^0.15.1: + version "0.15.2" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-0.15.2.tgz#fb95ad87d2f1e28f07116eb23d85aba3bc0425f4" + integrity sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA== + dependencies: + real-require "^0.1.0" + through2@3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.2.tgz#99f88931cfc761ec7678b41d5d7336b5b6a07bf4" diff --git a/packages/worker/package.json b/packages/worker/package.json index 39fe03e485..6f41215234 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.4.44-alpha.6", - "@budibase/pro": "2.4.44-alpha.5", + "@budibase/pro": "2.4.44-alpha.6", "@budibase/string-templates": "2.4.44-alpha.6", "@budibase/types": "2.4.44-alpha.6", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 5db376b1b3..8bdae42e84 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -475,14 +475,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.5": - version "2.4.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.5.tgz#072082d5322a27b9cfaee75718ddcf464afaec13" - integrity sha512-TRiepsq3MlQ0ZqZoRJDmYUUTb31gURPvHs6CmfqR1wP0sh+yf+5PgmLQDLLXTHOZ7b461yp5KDVC9OjNsna3WQ== +"@budibase/backend-core@2.4.44-alpha.6": + version "2.4.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.6.tgz#9045938f4175e55180e2bcecc2cb3ff74c29cead" + integrity sha512-V4h0ahiNcAmFARbW0dnx90Y50x52bAagRmmDD6WoYrepISDFnEOl25Gg50HxTFrfvJt5+MIF//yXeyPtiuQHww== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.5" + "@budibase/types" "2.4.44-alpha.6" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -497,6 +497,7 @@ joi "17.6.0" jsonwebtoken "9.0.0" koa-passport "4.1.4" + koa-pino-logger "4.0.0" lodash "4.17.21" lodash.isarguments "3.1.0" node-fetch "2.6.7" @@ -564,15 +565,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.5": - version "2.4.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.5.tgz#c748dfc16f5b30226c4006ae42a07636e5499102" - integrity sha512-HTKFiglaRb3aii4XakLezyLteo4SAg2ZumH6o/FSaRPrcN4KlPjxVCSxhXVSxu3m6GMdbcGLlah7+lK6iHnyEA== +"@budibase/pro@2.4.44-alpha.6": + version "2.4.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.6.tgz#a05241200d6daea59de1111812d9cd8a239ab3c3" + integrity sha512-vPDrSYEttTV4dfqsWdRYWwDkRWrag6CQJSIKrpL7rdbrt6BHWovZQMbZgA6JQpjnT5CX/WPMjr/0P9b5tITnEw== dependencies: - "@budibase/backend-core" "2.4.44-alpha.5" + "@budibase/backend-core" "2.4.44-alpha.6" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.5" + "@budibase/types" "2.4.44-alpha.6" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -607,10 +608,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.5": - version "2.4.44-alpha.5" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.5.tgz#42c56241ab29ef81a048b93bc84644b69e41e63b" - integrity sha512-ACco4vREtv1un3aMH2sTKI8kD+/Hly2ee9AZw9YxFlsl78sOkvBPD25ki7oc8GH2pjLQ1Sjw7yG3SgW8MIsdbg== +"@budibase/types@2.4.44-alpha.6": + version "2.4.44-alpha.6" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.6.tgz#2292742c11c26503ae03af07d5263e0a6a85e015" + integrity sha512-G9JPREk1/ziSKBU/JY6IrErll+TsT/l8jffZnCB+y5hV1YU2A0bZJDixG+8d5/Xmz+xK+2mf8n8R8mdKwEyJuA== dependencies: scim-patch "^0.7.0" @@ -3443,6 +3444,16 @@ duplexer3@^0.1.4: resolved "https://registry.yarnpkg.com/duplexer3/-/duplexer3-0.1.4.tgz#ee01dd1cac0ed3cbc7fdbea37dc0a8f1ce002ce2" integrity sha512-CEj8FwwNA4cVH2uFCoHUrmojhYh1vmCdOaneKJXwkeY1i9jnlslVo9dx+hQ5Hl9GnH/Bwy/IjxAyOePyPKYnzA== +duplexify@^4.1.2: + version "4.1.2" + resolved "https://registry.yarnpkg.com/duplexify/-/duplexify-4.1.2.tgz#18b4f8d28289132fa0b9573c898d9f903f81c7b0" + integrity sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw== + dependencies: + end-of-stream "^1.4.1" + inherits "^2.0.3" + readable-stream "^3.1.1" + stream-shift "^1.0.0" + ecc-jsbn@~0.1.1: version "0.1.2" resolved "https://registry.yarnpkg.com/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz#3a83a904e54353287874c564b7549386849a98c9" @@ -3989,6 +4000,13 @@ fast-stream-to-buffer@^1.0.0: dependencies: end-of-stream "^1.4.1" +fast-url-parser@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/fast-url-parser/-/fast-url-parser-1.1.3.tgz#f4af3ea9f34d8a271cf58ad2b3759f431f0b318d" + integrity sha512-5jOCVXADYNuRkKFzNJ0dCCewsZiYo0dz8QNYljkOpFC6r2U4OBmKtvm/Tsuh4w1YYdDqDb31a8TVhBJ2OJKdqQ== + dependencies: + punycode "^1.3.2" + fastq@^1.6.0: version "1.13.0" resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.13.0.tgz#616760f88a7526bdfc596b7cab8c18938c36b98c" @@ -5961,6 +5979,13 @@ koa-passport@4.1.4: dependencies: passport "^0.4.0" +koa-pino-logger@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/koa-pino-logger/-/koa-pino-logger-4.0.0.tgz#a45c9fd0a39e9cd84ac23da502055054ee51b80d" + integrity sha512-YI/LB9ajyLPpjvf6e+7Ewmn+OQkCJpu/Y9eI1n7fnipu5Y1NchuNlke0mqh3/2z+5oDYr7pijjOWruEDIfua2A== + dependencies: + pino-http "^6.5.0" + koa-send@5.0.1, koa-send@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/koa-send/-/koa-send-5.0.1.tgz#39dceebfafb395d0d60beaffba3a70b4f543fe79" @@ -6900,6 +6925,11 @@ object.pick@^1.3.0: dependencies: isobject "^3.0.1" +on-exit-leak-free@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/on-exit-leak-free/-/on-exit-leak-free-0.2.0.tgz#b39c9e3bf7690d890f4861558b0d7b90a442d209" + integrity sha512-dqaz3u44QbRXQooZLTUKU41ZrzYrcvLISVgbrzbyCMxpmSLJvZ3ZamIJIZ29P6OhZIkNIQKosdeM6t1LYbA9hg== + on-finished@^2.3.0: version "2.4.1" resolved "https://registry.yarnpkg.com/on-finished/-/on-finished-2.4.1.tgz#58c8c44116e54845ad57f14ab10b03533184ac3f" @@ -7202,11 +7232,39 @@ pify@^5.0.0: resolved "https://registry.yarnpkg.com/pify/-/pify-5.0.0.tgz#1f5eca3f5e87ebec28cc6d54a0e4aaf00acc127f" integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== +pino-abstract-transport@v0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/pino-abstract-transport/-/pino-abstract-transport-0.5.0.tgz#4b54348d8f73713bfd14e3dc44228739aa13d9c0" + integrity sha512-+KAgmVeqXYbTtU2FScx1XS3kNyfZ5TrXY07V96QnUSFqo2gAqlvmaxH67Lj7SWazqsMabf+58ctdTcBgnOLUOQ== + dependencies: + duplexify "^4.1.2" + split2 "^4.0.0" + +pino-http@^6.5.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/pino-http/-/pino-http-6.6.0.tgz#d0a1deacada8c93327fdaa48f5bdc94bc43d3407" + integrity sha512-PlItaK2MLpoIMLEcClhfb1VQk/o6fKppINl5s6sPE/4rvufkdO3kCSs/92EwrBsB1yssRCQqDV+w1xpYuPVnjg== + dependencies: + fast-url-parser "^1.1.3" + get-caller-file "^2.0.5" + pino "^7.5.0" + pino-std-serializers "^5.0.0" + pino-std-serializers@^3.1.0: version "3.2.0" resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-3.2.0.tgz#b56487c402d882eb96cd67c257868016b61ad671" integrity sha512-EqX4pwDPrt3MuOAAUBMU0Tk5kR/YcCM5fNPEzgCO2zJ5HfX0vbiH9HbJglnyeQsN96Kznae6MWD47pZB5avTrg== +pino-std-serializers@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-4.0.0.tgz#1791ccd2539c091ae49ce9993205e2cd5dbba1e2" + integrity sha512-cK0pekc1Kjy5w9V2/n+8MkZwusa6EyyxfeQCB799CQRhRt/CqYKiWs5adeu8Shve2ZNffvfC/7J64A2PJo1W/Q== + +pino-std-serializers@^5.0.0: + version "5.6.0" + resolved "https://registry.yarnpkg.com/pino-std-serializers/-/pino-std-serializers-5.6.0.tgz#31b141155d6520967c5ec72944d08fb45c490fd3" + integrity sha512-VdUXCw8gO+xhir7sFuoYSjTnzB+TMDGxhAC/ph3YS3sdHnXNdsK0wMtADNUltfeGkn2KDxEM21fnjF3RwXyC8A== + pino@^6.11.2: version "6.14.0" resolved "https://registry.yarnpkg.com/pino/-/pino-6.14.0.tgz#b745ea87a99a6c4c9b374e4f29ca7910d4c69f78" @@ -7220,6 +7278,23 @@ pino@^6.11.2: quick-format-unescaped "^4.0.3" sonic-boom "^1.0.2" +pino@^7.5.0: + version "7.11.0" + resolved "https://registry.yarnpkg.com/pino/-/pino-7.11.0.tgz#0f0ea5c4683dc91388081d44bff10c83125066f6" + integrity sha512-dMACeu63HtRLmCG8VKdy4cShCPKaYDR4youZqoSWLxl5Gu99HUw8bw75thbPv9Nip+H+QYX8o3ZJbTdVZZ2TVg== + dependencies: + atomic-sleep "^1.0.0" + fast-redact "^3.0.0" + on-exit-leak-free "^0.2.0" + pino-abstract-transport v0.5.0 + pino-std-serializers "^4.0.0" + process-warning "^1.0.0" + quick-format-unescaped "^4.0.3" + real-require "^0.1.0" + safe-stable-stringify "^2.1.0" + sonic-boom "^2.2.1" + thread-stream "^0.15.1" + pirates@^4.0.4: version "4.0.5" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" @@ -7574,6 +7649,11 @@ punycode@1.3.2: resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d" integrity sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw== +punycode@^1.3.2: + version "1.4.1" + resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.4.1.tgz#c0d5a63b2718800ad8e1eb0fa5269c84dd41845e" + integrity sha512-jmYNElW7yvO7TV33CjSmvSiE2yco3bV2czu/OzDKdMNVZQWfxCblURLhf+47syQRBntjfLdd/H0egrzIG+oaFQ== + punycode@^2.1.0, punycode@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" @@ -7729,6 +7809,11 @@ readdirp@~3.6.0: dependencies: picomatch "^2.2.1" +real-require@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/real-require/-/real-require-0.1.0.tgz#736ac214caa20632847b7ca8c1056a0767df9381" + integrity sha512-r/H9MzAWtrv8aSVjPCMFpDMl5q66GqtmmRkRjpHTsp4zBAa+snZyiQNlMONiUmEJcsnaw0wCauJ2GWODr/aFkg== + recast@^0.11.17: version "0.11.23" resolved "https://registry.yarnpkg.com/recast/-/recast-0.11.23.tgz#451fd3004ab1e4df9b4e4b66376b2a21912462d3" @@ -8054,6 +8139,11 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" +safe-stable-stringify@^2.1.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" + integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== + "safer-buffer@>= 2.1.2 < 3", safer-buffer@^2.0.2, safer-buffer@^2.1.0, safer-buffer@~2.1.0: version "2.1.2" resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" @@ -8275,6 +8365,13 @@ sonic-boom@^1.0.2: atomic-sleep "^1.0.0" flatstr "^1.0.12" +sonic-boom@^2.2.1: + version "2.8.0" + resolved "https://registry.yarnpkg.com/sonic-boom/-/sonic-boom-2.8.0.tgz#c1def62a77425090e6ad7516aad8eb402e047611" + integrity sha512-kuonw1YOYYNOve5iHdSahXPOK49GqwA+LZhI6Wz/l0rP57iKyXXIHaRagOBHAPmGwJC6od2Z9zgvZ5loSgMlVg== + dependencies: + atomic-sleep "^1.0.0" + source-map-resolve@^0.5.0: version "0.5.3" resolved "https://registry.yarnpkg.com/source-map-resolve/-/source-map-resolve-0.5.3.tgz#190866bece7553e1f8f267a2ee82c606b5509a1a" @@ -8357,6 +8454,11 @@ split2@^2.1.0: dependencies: through2 "^2.0.2" +split2@^4.0.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/split2/-/split2-4.2.0.tgz#c9c5920904d148bab0b9f67145f245a86aadbfa4" + integrity sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg== + split@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/split/-/split-1.0.1.tgz#605bd9be303aa59fb35f9229fbea0ddec9ea07d9" @@ -8452,6 +8554,11 @@ stream-chopper@^3.0.1: dependencies: readable-stream "^3.0.6" +stream-shift@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" + integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== + stream-to-array@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/stream-to-array/-/stream-to-array-2.3.0.tgz#bbf6b39f5f43ec30bc71babcb37557acecf34353" @@ -8732,6 +8839,13 @@ text-table@^0.2.0: resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= +thread-stream@^0.15.1: + version "0.15.2" + resolved "https://registry.yarnpkg.com/thread-stream/-/thread-stream-0.15.2.tgz#fb95ad87d2f1e28f07116eb23d85aba3bc0425f4" + integrity sha512-UkEhKIg2pD+fjkHQKyJO3yoIvAP3N6RlNFt2dUhcS1FGvCD1cQa1M/PGknCLFIyZdtJOWQjejp7bdNqmN7zwdA== + dependencies: + real-require "^0.1.0" + through2@3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/through2/-/through2-3.0.2.tgz#99f88931cfc761ec7678b41d5d7336b5b6a07bf4" From 35fc9ba45cd3fb8e89681537aefc87db62d74588 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 4 Apr 2023 15:45:34 +0100 Subject: [PATCH 04/13] Add quote to httpLogging in helm chart (#10205) --- charts/budibase/templates/app-service-deployment.yaml | 2 +- charts/budibase/templates/worker-service-deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index 4d73b75ae7..6ba9337f5b 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -65,7 +65,7 @@ spec: - name: API_ENCRYPTION_KEY value: {{ .Values.globals.apiEncryptionKey | quote }} - name: HTTP_LOGGING - value: {{ .Values.services.apps.httpLogging }} + value: {{ .Values.services.apps.httpLogging | quote }} - name: INTERNAL_API_KEY valueFrom: secretKeyRef: diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index d12be421dc..0df295b5d6 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -65,7 +65,7 @@ spec: - name: API_ENCRYPTION_KEY value: {{ .Values.globals.apiEncryptionKey | quote }} - name: HTTP_LOGGING - value: {{ .Values.services.worker.httpLogging }} + value: {{ .Values.services.worker.httpLogging | quote }} - name: INTERNAL_API_KEY valueFrom: secretKeyRef: From 244b911efbd85f38ddb4a721f84bde30758874e0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 4 Apr 2023 14:53:06 +0000 Subject: [PATCH 05/13] v2.4.44-alpha.7 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 6 +++--- packages/builder/package.json | 12 ++++++------ packages/cli/package.json | 8 ++++---- packages/client/package.json | 12 ++++++------ packages/frontend-core/package.json | 6 +++--- packages/sdk/package.json | 2 +- packages/server/package.json | 12 ++++++------ packages/shared-core/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lerna.json b/lerna.json index 88a4aa12a2..96480bcbe7 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "npmClient": "yarn", "packages": ["packages/*"], "command": { diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 4a946dd40a..d660be5122 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -24,7 +24,7 @@ "dependencies": { "@budibase/nano": "10.1.2", "@budibase/pouchdb-replication-stream": "1.2.10", - "@budibase/types": "2.4.44-alpha.6", + "@budibase/types": "2.4.44-alpha.7", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 5b03b7a40d..770cb2da39 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,8 +38,8 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/shared-core": "2.4.44-alpha.6", - "@budibase/string-templates": "2.4.44-alpha.6", + "@budibase/shared-core": "2.4.44-alpha.7", + "@budibase/string-templates": "2.4.44-alpha.7", "@spectrum-css/accordion": "3.0.24", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", diff --git a/packages/builder/package.json b/packages/builder/package.json index 9b278d1e08..1affb4dff5 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "license": "GPL-3.0", "private": true, "scripts": { @@ -58,11 +58,11 @@ } }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.6", - "@budibase/client": "2.4.44-alpha.6", - "@budibase/frontend-core": "2.4.44-alpha.6", - "@budibase/shared-core": "2.4.44-alpha.6", - "@budibase/string-templates": "2.4.44-alpha.6", + "@budibase/bbui": "2.4.44-alpha.7", + "@budibase/client": "2.4.44-alpha.7", + "@budibase/frontend-core": "2.4.44-alpha.7", + "@budibase/shared-core": "2.4.44-alpha.7", + "@budibase/string-templates": "2.4.44-alpha.7", "@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 77129c7464..fbfa83befa 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "dist/index.js", "bin": { @@ -29,9 +29,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.6", - "@budibase/string-templates": "2.4.44-alpha.6", - "@budibase/types": "2.4.44-alpha.6", + "@budibase/backend-core": "2.4.44-alpha.7", + "@budibase/string-templates": "2.4.44-alpha.7", + "@budibase/types": "2.4.44-alpha.7", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 4fa8f447a6..64efc92372 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,11 +19,11 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.6", - "@budibase/frontend-core": "2.4.44-alpha.6", - "@budibase/shared-core": "2.4.44-alpha.6", - "@budibase/string-templates": "2.4.44-alpha.6", - "@budibase/types": "2.4.44-alpha.6", + "@budibase/bbui": "2.4.44-alpha.7", + "@budibase/frontend-core": "2.4.44-alpha.7", + "@budibase/shared-core": "2.4.44-alpha.7", + "@budibase/string-templates": "2.4.44-alpha.7", + "@budibase/types": "2.4.44-alpha.7", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index d2ebe3fe9c..3811d726c9 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,13 +1,13 @@ { "name": "@budibase/frontend-core", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.4.44-alpha.6", - "@budibase/shared-core": "2.4.44-alpha.6", + "@budibase/bbui": "2.4.44-alpha.7", + "@budibase/shared-core": "2.4.44-alpha.7", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 843568b151..39478936f0 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 3276e856bc..1f1e3adeba 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -44,12 +44,12 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.4.44-alpha.6", - "@budibase/client": "2.4.44-alpha.6", + "@budibase/backend-core": "2.4.44-alpha.7", + "@budibase/client": "2.4.44-alpha.7", "@budibase/pro": "2.4.44-alpha.6", - "@budibase/shared-core": "2.4.44-alpha.6", - "@budibase/string-templates": "2.4.44-alpha.6", - "@budibase/types": "2.4.44-alpha.6", + "@budibase/shared-core": "2.4.44-alpha.7", + "@budibase/string-templates": "2.4.44-alpha.7", + "@budibase/types": "2.4.44-alpha.7", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/shared-core/package.json b/packages/shared-core/package.json index 850f667854..9b952eddf5 100644 --- a/packages/shared-core/package.json +++ b/packages/shared-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/shared-core", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Shared data utils", "main": "dist/cjs/src/index.js", "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\"" }, "dependencies": { - "@budibase/types": "2.4.44-alpha.6" + "@budibase/types": "2.4.44-alpha.7" }, "devDependencies": { "concurrently": "^7.6.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 2b1beee692..e3e28eea50 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index d7c69cecf5..b9dfa9dc74 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase types", "main": "dist/cjs/index.js", "types": "dist/mjs/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 6f41215234..2f3a840cd2 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.4.44-alpha.6", + "version": "2.4.44-alpha.7", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.6", + "@budibase/backend-core": "2.4.44-alpha.7", "@budibase/pro": "2.4.44-alpha.6", - "@budibase/string-templates": "2.4.44-alpha.6", - "@budibase/types": "2.4.44-alpha.6", + "@budibase/string-templates": "2.4.44-alpha.7", + "@budibase/types": "2.4.44-alpha.7", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 1785fd83004a916d436afc027fefb70ffc709b58 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 4 Apr 2023 14:56:03 +0000 Subject: [PATCH 06/13] Update pro version to 2.4.44-alpha.7 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 1f1e3adeba..e8fbd0cb66 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -46,7 +46,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.4.44-alpha.7", "@budibase/client": "2.4.44-alpha.7", - "@budibase/pro": "2.4.44-alpha.6", + "@budibase/pro": "2.4.44-alpha.7", "@budibase/shared-core": "2.4.44-alpha.7", "@budibase/string-templates": "2.4.44-alpha.7", "@budibase/types": "2.4.44-alpha.7", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 1d34e8682f..0b7b862f3a 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1290,14 +1290,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.6": - version "2.4.44-alpha.6" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.6.tgz#9045938f4175e55180e2bcecc2cb3ff74c29cead" - integrity sha512-V4h0ahiNcAmFARbW0dnx90Y50x52bAagRmmDD6WoYrepISDFnEOl25Gg50HxTFrfvJt5+MIF//yXeyPtiuQHww== +"@budibase/backend-core@2.4.44-alpha.7": + version "2.4.44-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.7.tgz#f3d33ae0747bf9bffe21f50ea543b08de94b445b" + integrity sha512-xfcLYud87Va3/XQk9ZeiZ43zfVd8UY/blurNanp8Ja1MDejfNmvkw92G9RzxNwcNaEgdl8CTXoisfe89iWHc1Q== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.6" + "@budibase/types" "2.4.44-alpha.7" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1430,15 +1430,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.6": - version "2.4.44-alpha.6" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.6.tgz#a05241200d6daea59de1111812d9cd8a239ab3c3" - integrity sha512-vPDrSYEttTV4dfqsWdRYWwDkRWrag6CQJSIKrpL7rdbrt6BHWovZQMbZgA6JQpjnT5CX/WPMjr/0P9b5tITnEw== +"@budibase/pro@2.4.44-alpha.7": + version "2.4.44-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.7.tgz#2eb125db27677aa5674078e7e4bef1b94320b2b4" + integrity sha512-K8pTpXH/0M2u5Y0KYfAOyQ7OL3U2yrIMGrPA/JbYJhWGOlvtt8XFnSlAljRzwmiMThRespMf16hcDRmdL8TX7w== dependencies: - "@budibase/backend-core" "2.4.44-alpha.6" + "@budibase/backend-core" "2.4.44-alpha.7" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.6" + "@budibase/types" "2.4.44-alpha.7" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1491,10 +1491,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.6": - version "2.4.44-alpha.6" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.6.tgz#2292742c11c26503ae03af07d5263e0a6a85e015" - integrity sha512-G9JPREk1/ziSKBU/JY6IrErll+TsT/l8jffZnCB+y5hV1YU2A0bZJDixG+8d5/Xmz+xK+2mf8n8R8mdKwEyJuA== +"@budibase/types@2.4.44-alpha.7": + version "2.4.44-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.7.tgz#1dd5548714ebb7a7d9c78259074f1e447ea3a6bb" + integrity sha512-24pDPPGgKnrR0yy63INM8XxJod47YoU/tBTM3TLqmQflkm2eorBtqOodZJ6+gq/qVyBV7HMlUU9Ntlj3pf3zyA== dependencies: scim-patch "^0.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 2f3a840cd2..96fe642da3 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.4.44-alpha.7", - "@budibase/pro": "2.4.44-alpha.6", + "@budibase/pro": "2.4.44-alpha.7", "@budibase/string-templates": "2.4.44-alpha.7", "@budibase/types": "2.4.44-alpha.7", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 8bdae42e84..e2470fcc55 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -475,14 +475,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.6": - version "2.4.44-alpha.6" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.6.tgz#9045938f4175e55180e2bcecc2cb3ff74c29cead" - integrity sha512-V4h0ahiNcAmFARbW0dnx90Y50x52bAagRmmDD6WoYrepISDFnEOl25Gg50HxTFrfvJt5+MIF//yXeyPtiuQHww== +"@budibase/backend-core@2.4.44-alpha.7": + version "2.4.44-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.7.tgz#f3d33ae0747bf9bffe21f50ea543b08de94b445b" + integrity sha512-xfcLYud87Va3/XQk9ZeiZ43zfVd8UY/blurNanp8Ja1MDejfNmvkw92G9RzxNwcNaEgdl8CTXoisfe89iWHc1Q== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.6" + "@budibase/types" "2.4.44-alpha.7" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -565,15 +565,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.6": - version "2.4.44-alpha.6" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.6.tgz#a05241200d6daea59de1111812d9cd8a239ab3c3" - integrity sha512-vPDrSYEttTV4dfqsWdRYWwDkRWrag6CQJSIKrpL7rdbrt6BHWovZQMbZgA6JQpjnT5CX/WPMjr/0P9b5tITnEw== +"@budibase/pro@2.4.44-alpha.7": + version "2.4.44-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.7.tgz#2eb125db27677aa5674078e7e4bef1b94320b2b4" + integrity sha512-K8pTpXH/0M2u5Y0KYfAOyQ7OL3U2yrIMGrPA/JbYJhWGOlvtt8XFnSlAljRzwmiMThRespMf16hcDRmdL8TX7w== dependencies: - "@budibase/backend-core" "2.4.44-alpha.6" + "@budibase/backend-core" "2.4.44-alpha.7" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.6" + "@budibase/types" "2.4.44-alpha.7" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -608,10 +608,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.6": - version "2.4.44-alpha.6" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.6.tgz#2292742c11c26503ae03af07d5263e0a6a85e015" - integrity sha512-G9JPREk1/ziSKBU/JY6IrErll+TsT/l8jffZnCB+y5hV1YU2A0bZJDixG+8d5/Xmz+xK+2mf8n8R8mdKwEyJuA== +"@budibase/types@2.4.44-alpha.7": + version "2.4.44-alpha.7" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.7.tgz#1dd5548714ebb7a7d9c78259074f1e447ea3a6bb" + integrity sha512-24pDPPGgKnrR0yy63INM8XxJod47YoU/tBTM3TLqmQflkm2eorBtqOodZJ6+gq/qVyBV7HMlUU9Ntlj3pf3zyA== dependencies: scim-patch "^0.7.0" From ae9f91885f44fcf411e0126d352174f5cad01d27 Mon Sep 17 00:00:00 2001 From: adrinr Date: Wed, 5 Apr 2023 12:17:02 +0100 Subject: [PATCH 07/13] Fix flaky tests --- .../server/src/api/routes/tests/user.spec.js | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/packages/server/src/api/routes/tests/user.spec.js b/packages/server/src/api/routes/tests/user.spec.js index afb3acfe0d..5f90b174f6 100644 --- a/packages/server/src/api/routes/tests/user.spec.js +++ b/packages/server/src/api/routes/tests/user.spec.js @@ -57,6 +57,7 @@ describe("/users", () => { it("should be able to update the user", async () => { const user = await config.createUser({ id: `us_update${utils.newid()}` }) user.roleId = BUILTIN_ROLE_IDS.BASIC + delete user._rev const res = await request .put(`/api/users/metadata`) .set(config.defaultHeaders()) @@ -65,6 +66,46 @@ describe("/users", () => { .expect("Content-Type", /json/) expect(res.body.ok).toEqual(true) }) + + it("should be able to update the user multiple times", async () => { + const user = await config.createUser() + delete user._rev + + const res1 = await request + .put(`/api/users/metadata`) + .set(config.defaultHeaders()) + .send({ ...user, roleId: BUILTIN_ROLE_IDS.BASIC }) + .expect(200) + .expect("Content-Type", /json/) + + const res = await request + .put(`/api/users/metadata`) + .set(config.defaultHeaders()) + .send({ ...user, _rev: res1.body.rev, roleId: BUILTIN_ROLE_IDS.POWER }) + .expect(200) + .expect("Content-Type", /json/) + + expect(res.body.ok).toEqual(true) + }) + + it("should require the _rev field for multiple updates", async () => { + const user = await config.createUser() + delete user._rev + + await request + .put(`/api/users/metadata`) + .set(config.defaultHeaders()) + .send({ ...user, roleId: BUILTIN_ROLE_IDS.BASIC }) + .expect(200) + .expect("Content-Type", /json/) + + await request + .put(`/api/users/metadata`) + .set(config.defaultHeaders()) + .send({ ...user, roleId: BUILTIN_ROLE_IDS.POWER }) + .expect(409) + .expect("Content-Type", /json/) + }) }) describe("destroy", () => { From 38535e8ef4fe8b8d6c90f566c90cedf3e0354ab7 Mon Sep 17 00:00:00 2001 From: adrinr Date: Wed, 5 Apr 2023 12:17:32 +0100 Subject: [PATCH 08/13] Format --- .../server/src/api/routes/tests/user.spec.js | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/packages/server/src/api/routes/tests/user.spec.js b/packages/server/src/api/routes/tests/user.spec.js index 5f90b174f6..0a2b02364a 100644 --- a/packages/server/src/api/routes/tests/user.spec.js +++ b/packages/server/src/api/routes/tests/user.spec.js @@ -133,6 +133,7 @@ describe("/users", () => { expect(res.body.tableId).toBeDefined() }) }) + describe("setFlag", () => { it("should throw an error if a flag is not provided", async () => { await config.createUser() @@ -142,8 +143,9 @@ describe("/users", () => { .send({ value: "test" }) .expect(400) .expect("Content-Type", /json/) - expect(res.body.message).toEqual("Must supply a 'flag' field in request body.") - + expect(res.body.message).toEqual( + "Must supply a 'flag' field in request body." + ) }) it("should be able to set a flag on the user", async () => { @@ -187,8 +189,9 @@ describe("/users", () => { .send({ value: "test" }) .expect(400) .expect("Content-Type", /json/) - expect(res.body.message).toEqual("Must supply a 'flag' field in request body.") - + expect(res.body.message).toEqual( + "Must supply a 'flag' field in request body." + ) }) it("should be able to set a flag on the user", async () => { @@ -206,33 +209,37 @@ describe("/users", () => { describe("syncUser", () => { it("should sync the user", async () => { let user = await config.createUser() - await config.createApp('New App') + await config.createApp("New App") let res = await request .post(`/api/users/metadata/sync/${user._id}`) .set(config.defaultHeaders()) .expect(200) .expect("Content-Type", /json/) - expect(res.body.message).toEqual('User synced.') + expect(res.body.message).toEqual("User synced.") }) - it("should sync the user when a previous user is specified", async () => { - const app1 = await config.createApp('App 1') - const app2 = await config.createApp('App 2') + const app1 = await config.createApp("App 1") + const app2 = await config.createApp("App 2") let user = await config.createUser({ builder: false, admin: true, - roles: { [app1.appId]: 'ADMIN' } - }) + roles: { [app1.appId]: "ADMIN" }, + }) let res = await request .post(`/api/users/metadata/sync/${user._id}`) .set(config.defaultHeaders()) - .send({ previousUser: { ...user, roles: { ...user.roles, [app2.appId]: 'BASIC' } } }) + .send({ + previousUser: { + ...user, + roles: { ...user.roles, [app2.appId]: "BASIC" }, + }, + }) .expect(200) .expect("Content-Type", /json/) - expect(res.body.message).toEqual('User synced.') + expect(res.body.message).toEqual("User synced.") }) }) }) From f02f996744fb2e6834ae4a048cff3ddac096a55b Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 5 Apr 2023 12:18:30 +0000 Subject: [PATCH 09/13] v2.4.44-alpha.8 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 6 +++--- packages/builder/package.json | 12 ++++++------ packages/cli/package.json | 8 ++++---- packages/client/package.json | 12 ++++++------ packages/frontend-core/package.json | 6 +++--- packages/sdk/package.json | 2 +- packages/server/package.json | 12 ++++++------ packages/shared-core/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lerna.json b/lerna.json index 96480bcbe7..e01e7296a4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "npmClient": "yarn", "packages": ["packages/*"], "command": { diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index d660be5122..49d558aefa 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -24,7 +24,7 @@ "dependencies": { "@budibase/nano": "10.1.2", "@budibase/pouchdb-replication-stream": "1.2.10", - "@budibase/types": "2.4.44-alpha.7", + "@budibase/types": "2.4.44-alpha.8", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 770cb2da39..7ff7e14027 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,8 +38,8 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/shared-core": "2.4.44-alpha.7", - "@budibase/string-templates": "2.4.44-alpha.7", + "@budibase/shared-core": "2.4.44-alpha.8", + "@budibase/string-templates": "2.4.44-alpha.8", "@spectrum-css/accordion": "3.0.24", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", diff --git a/packages/builder/package.json b/packages/builder/package.json index 1affb4dff5..f9f38bed83 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "license": "GPL-3.0", "private": true, "scripts": { @@ -58,11 +58,11 @@ } }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.7", - "@budibase/client": "2.4.44-alpha.7", - "@budibase/frontend-core": "2.4.44-alpha.7", - "@budibase/shared-core": "2.4.44-alpha.7", - "@budibase/string-templates": "2.4.44-alpha.7", + "@budibase/bbui": "2.4.44-alpha.8", + "@budibase/client": "2.4.44-alpha.8", + "@budibase/frontend-core": "2.4.44-alpha.8", + "@budibase/shared-core": "2.4.44-alpha.8", + "@budibase/string-templates": "2.4.44-alpha.8", "@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index fbfa83befa..94e6d8c047 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "dist/index.js", "bin": { @@ -29,9 +29,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.7", - "@budibase/string-templates": "2.4.44-alpha.7", - "@budibase/types": "2.4.44-alpha.7", + "@budibase/backend-core": "2.4.44-alpha.8", + "@budibase/string-templates": "2.4.44-alpha.8", + "@budibase/types": "2.4.44-alpha.8", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 64efc92372..d8de3e25b4 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,11 +19,11 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.7", - "@budibase/frontend-core": "2.4.44-alpha.7", - "@budibase/shared-core": "2.4.44-alpha.7", - "@budibase/string-templates": "2.4.44-alpha.7", - "@budibase/types": "2.4.44-alpha.7", + "@budibase/bbui": "2.4.44-alpha.8", + "@budibase/frontend-core": "2.4.44-alpha.8", + "@budibase/shared-core": "2.4.44-alpha.8", + "@budibase/string-templates": "2.4.44-alpha.8", + "@budibase/types": "2.4.44-alpha.8", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 3811d726c9..8ae06017f0 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,13 +1,13 @@ { "name": "@budibase/frontend-core", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.4.44-alpha.7", - "@budibase/shared-core": "2.4.44-alpha.7", + "@budibase/bbui": "2.4.44-alpha.8", + "@budibase/shared-core": "2.4.44-alpha.8", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 39478936f0..3cda22f9f2 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index e8fbd0cb66..ade90dd3d8 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -44,12 +44,12 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.4.44-alpha.7", - "@budibase/client": "2.4.44-alpha.7", + "@budibase/backend-core": "2.4.44-alpha.8", + "@budibase/client": "2.4.44-alpha.8", "@budibase/pro": "2.4.44-alpha.7", - "@budibase/shared-core": "2.4.44-alpha.7", - "@budibase/string-templates": "2.4.44-alpha.7", - "@budibase/types": "2.4.44-alpha.7", + "@budibase/shared-core": "2.4.44-alpha.8", + "@budibase/string-templates": "2.4.44-alpha.8", + "@budibase/types": "2.4.44-alpha.8", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/shared-core/package.json b/packages/shared-core/package.json index 9b952eddf5..03d7291560 100644 --- a/packages/shared-core/package.json +++ b/packages/shared-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/shared-core", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Shared data utils", "main": "dist/cjs/src/index.js", "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\"" }, "dependencies": { - "@budibase/types": "2.4.44-alpha.7" + "@budibase/types": "2.4.44-alpha.8" }, "devDependencies": { "concurrently": "^7.6.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index e3e28eea50..1f43bf0324 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index b9dfa9dc74..b44d322162 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase types", "main": "dist/cjs/index.js", "types": "dist/mjs/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 96fe642da3..41ea4c7ac8 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.4.44-alpha.7", + "version": "2.4.44-alpha.8", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.7", + "@budibase/backend-core": "2.4.44-alpha.8", "@budibase/pro": "2.4.44-alpha.7", - "@budibase/string-templates": "2.4.44-alpha.7", - "@budibase/types": "2.4.44-alpha.7", + "@budibase/string-templates": "2.4.44-alpha.8", + "@budibase/types": "2.4.44-alpha.8", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 18ccf134b9206d1d6e77da3ccac8d58ae140e23c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 5 Apr 2023 12:21:27 +0000 Subject: [PATCH 10/13] Update pro version to 2.4.44-alpha.8 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index ade90dd3d8..2b25855d2d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -46,7 +46,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.4.44-alpha.8", "@budibase/client": "2.4.44-alpha.8", - "@budibase/pro": "2.4.44-alpha.7", + "@budibase/pro": "2.4.44-alpha.8", "@budibase/shared-core": "2.4.44-alpha.8", "@budibase/string-templates": "2.4.44-alpha.8", "@budibase/types": "2.4.44-alpha.8", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 0b7b862f3a..0e40c6706c 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1290,14 +1290,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.7": - version "2.4.44-alpha.7" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.7.tgz#f3d33ae0747bf9bffe21f50ea543b08de94b445b" - integrity sha512-xfcLYud87Va3/XQk9ZeiZ43zfVd8UY/blurNanp8Ja1MDejfNmvkw92G9RzxNwcNaEgdl8CTXoisfe89iWHc1Q== +"@budibase/backend-core@2.4.44-alpha.8": + version "2.4.44-alpha.8" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.8.tgz#087897628a3a137480e777296e7d2f2524a13b2e" + integrity sha512-7Vz/oGQ/Zt3OTLlXbOo5pE2PCzwI/oJoc1SM36Svhm383fa7rSgi2kI5zkyUhjIe3J8s4DyRmMv6IloNEPGd+A== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.7" + "@budibase/types" "2.4.44-alpha.8" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1430,15 +1430,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.7": - version "2.4.44-alpha.7" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.7.tgz#2eb125db27677aa5674078e7e4bef1b94320b2b4" - integrity sha512-K8pTpXH/0M2u5Y0KYfAOyQ7OL3U2yrIMGrPA/JbYJhWGOlvtt8XFnSlAljRzwmiMThRespMf16hcDRmdL8TX7w== +"@budibase/pro@2.4.44-alpha.8": + version "2.4.44-alpha.8" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.8.tgz#60d3c6f809ddae99b6b4f155127859e5597114e9" + integrity sha512-KbxnjbooOC+UX1pzL8Sd5O04XlddSG9a/eDQrMr+blzZ51yFiLod07sdl40KJzTm48isVvmL+U7H66MPkoUYfw== dependencies: - "@budibase/backend-core" "2.4.44-alpha.7" + "@budibase/backend-core" "2.4.44-alpha.8" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.7" + "@budibase/types" "2.4.44-alpha.8" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1491,10 +1491,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.7": - version "2.4.44-alpha.7" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.7.tgz#1dd5548714ebb7a7d9c78259074f1e447ea3a6bb" - integrity sha512-24pDPPGgKnrR0yy63INM8XxJod47YoU/tBTM3TLqmQflkm2eorBtqOodZJ6+gq/qVyBV7HMlUU9Ntlj3pf3zyA== +"@budibase/types@2.4.44-alpha.8": + version "2.4.44-alpha.8" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.8.tgz#4ff5350a2cd61fc2c6ac901bb4bd10917fe9d789" + integrity sha512-qm6+0JuJYN7rtONciR2bPts7MO73nrHHp4OsZdeq5dkWBZn8/RM+D5oOgSnBiMnX2slcO3ipX9ZI1GBweeFaNg== dependencies: scim-patch "^0.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 41ea4c7ac8..42f25d97d9 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.4.44-alpha.8", - "@budibase/pro": "2.4.44-alpha.7", + "@budibase/pro": "2.4.44-alpha.8", "@budibase/string-templates": "2.4.44-alpha.8", "@budibase/types": "2.4.44-alpha.8", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index e2470fcc55..aac65ee504 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -475,14 +475,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.7": - version "2.4.44-alpha.7" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.7.tgz#f3d33ae0747bf9bffe21f50ea543b08de94b445b" - integrity sha512-xfcLYud87Va3/XQk9ZeiZ43zfVd8UY/blurNanp8Ja1MDejfNmvkw92G9RzxNwcNaEgdl8CTXoisfe89iWHc1Q== +"@budibase/backend-core@2.4.44-alpha.8": + version "2.4.44-alpha.8" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.8.tgz#087897628a3a137480e777296e7d2f2524a13b2e" + integrity sha512-7Vz/oGQ/Zt3OTLlXbOo5pE2PCzwI/oJoc1SM36Svhm383fa7rSgi2kI5zkyUhjIe3J8s4DyRmMv6IloNEPGd+A== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.7" + "@budibase/types" "2.4.44-alpha.8" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -565,15 +565,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.7": - version "2.4.44-alpha.7" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.7.tgz#2eb125db27677aa5674078e7e4bef1b94320b2b4" - integrity sha512-K8pTpXH/0M2u5Y0KYfAOyQ7OL3U2yrIMGrPA/JbYJhWGOlvtt8XFnSlAljRzwmiMThRespMf16hcDRmdL8TX7w== +"@budibase/pro@2.4.44-alpha.8": + version "2.4.44-alpha.8" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.8.tgz#60d3c6f809ddae99b6b4f155127859e5597114e9" + integrity sha512-KbxnjbooOC+UX1pzL8Sd5O04XlddSG9a/eDQrMr+blzZ51yFiLod07sdl40KJzTm48isVvmL+U7H66MPkoUYfw== dependencies: - "@budibase/backend-core" "2.4.44-alpha.7" + "@budibase/backend-core" "2.4.44-alpha.8" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.7" + "@budibase/types" "2.4.44-alpha.8" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -608,10 +608,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.7": - version "2.4.44-alpha.7" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.7.tgz#1dd5548714ebb7a7d9c78259074f1e447ea3a6bb" - integrity sha512-24pDPPGgKnrR0yy63INM8XxJod47YoU/tBTM3TLqmQflkm2eorBtqOodZJ6+gq/qVyBV7HMlUU9Ntlj3pf3zyA== +"@budibase/types@2.4.44-alpha.8": + version "2.4.44-alpha.8" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.8.tgz#4ff5350a2cd61fc2c6ac901bb4bd10917fe9d789" + integrity sha512-qm6+0JuJYN7rtONciR2bPts7MO73nrHHp4OsZdeq5dkWBZn8/RM+D5oOgSnBiMnX2slcO3ipX9ZI1GBweeFaNg== dependencies: scim-patch "^0.7.0" From 77ffb8d86dfb67c6420c2daf71fcf4bf592095f1 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Wed, 5 Apr 2023 15:33:56 +0100 Subject: [PATCH 11/13] Run integration suite in CI again / auto detect tenancy / refactors (#10209) * qa-core-ci-fixes * global setup and teardown wip * Updates to logs and setup * Remove date and console mocking * Update CI to spin up minimal dev env * Update readme * Fix scopeBackend.sh * Ensure docker services are initialised before starting worker * Lint * Fix admin user being created on startup (#10219) * use regular bootstrap and build * Lint * Temp: re-use global setup to get around app limit in QA --- .github/workflows/budibase_ci.yml | 43 +- package.json | 7 +- packages/backend-core/src/logging/index.ts | 3 + .../backend-core/src/logging/pino/logger.ts | 19 +- packages/builder/reporterConfig.json | 10 - packages/builder/setup.js | 43 - packages/builder/testConfig.json | 13 - packages/builder/ts/setup.ts | 4 - packages/server/package.json | 1 + packages/server/scripts/dev/manage.js | 3 +- packages/server/scripts/likeCypress.ts | 35 - packages/server/src/startup.ts | 74 +- packages/types/src/api/account/accounts.ts | 13 + packages/types/src/api/account/index.ts | 1 + packages/types/src/api/web/index.ts | 1 + .../types/src/api/web/system/environment.ts | 8 + packages/types/src/api/web/system/index.ts | 1 + packages/types/src/sdk/db.ts | 1 + packages/worker/package.json | 1 + qa-core/.env | 8 - qa-core/.gitignore | 1 - qa-core/README.md | 16 +- qa-core/docker-compose.yaml | 12 - qa-core/jest.config.ts | 18 + qa-core/package.json | 40 +- qa-core/scripts/createEnv.js | 22 + qa-core/scripts/jestSetup.js | 11 - .../src/account-api/api/AccountInternalAPI.ts | 16 + .../api/AccountInternalAPIClient.ts | 70 ++ .../src/account-api/api/apis/AccountAPI.ts | 61 ++ .../src/account-api/api/apis/LicenseAPI.ts | 9 + qa-core/src/account-api/api/apis/index.ts | 2 + qa-core/src/account-api/api/index.ts | 1 + qa-core/src/account-api/index.ts | 1 + .../TestConfiguration/InternalAPIClient.ts | 73 -- .../TestConfiguration/accounts.ts | 38 - .../TestConfiguration/accountsAPIClient.ts | 62 -- .../TestConfiguration/applications.ts | 178 ---- .../internal-api/TestConfiguration/auth.ts | 39 - .../TestConfiguration/generator.ts | 3 - .../internal-api/TestConfiguration/index.ts | 79 -- .../fixtures/types/responseMessage.ts | 3 - .../TestConfiguration/PublicAPIClient.ts | 77 -- .../public-api/TestConfiguration/accounts.ts | 38 - .../TestConfiguration/accountsAPIClient.ts | 66 -- .../TestConfiguration/applications.ts | 77 -- .../public-api/TestConfiguration/auth.ts | 48 - .../public-api/TestConfiguration/index.ts | 90 -- .../public-api/TestConfiguration/rows.ts | 53 -- .../public-api/TestConfiguration/users.ts | 44 - .../config/public-api/fixtures/accounts.ts | 22 - .../public-api/fixtures/applications.ts | 15 - .../public-api/fixtures/types/newAccount.ts | 5 - qa-core/src/environment.ts | 22 +- .../internal-api/api/BudibaseInternalAPI.ts | 39 + .../api/BudibaseInternalAPIClient.ts | 76 ++ qa-core/src/internal-api/api/apis/AppAPI.ts | 173 ++++ qa-core/src/internal-api/api/apis/AuthAPI.ts | 39 + .../internal-api/api/apis/EnvironmentAPI.ts | 21 + qa-core/src/internal-api/api/apis/RoleAPI.ts | 23 + .../api/apis/RowAPI.ts} | 34 +- .../api/apis/ScreenAPI.ts} | 18 +- qa-core/src/internal-api/api/apis/SelfAPI.ts | 33 + .../api/apis/TableAPI.ts} | 29 +- .../api/apis/UserAPI.ts} | 62 +- qa-core/src/internal-api/api/index.ts | 1 + .../internal-api/config/TestConfiguration.ts | 25 + qa-core/src/internal-api/config/index.ts | 1 + qa-core/src/internal-api/fixtures/accounts.ts | 20 + .../internal-api/fixtures/applications.ts | 13 +- qa-core/src/internal-api/fixtures/index.ts | 6 + .../internal-api/fixtures/rows.ts | 0 .../internal-api/fixtures/screens.ts | 6 +- .../fixtures/tables.ts} | 0 .../fixtures/users.ts} | 10 +- qa-core/src/internal-api/index.ts | 1 + .../tests/applications/create.spec.ts | 42 + .../tests/applications/delete.spec.ts | 19 + .../tests/applications/publish.spec.ts | 54 ++ .../tests/applications/update.spec.ts | 45 + .../tests/dataSources/example.spec.ts | 27 + .../tests/screens/screens.spec.ts | 51 + .../internal-api/tests/tables/tables.spec.ts | 144 +++ .../tests/users/appSpecificRoles.spec.ts | 107 +++ .../tests/users}/customRoles.spec.ts | 187 ++-- .../tests/users}/screenAccess.spec.ts | 108 +-- .../tests/users/tableAccess.spec.ts | 123 +++ .../tests/users}/userManagement.spec.ts | 51 +- qa-core/src/jest/globalSetup.ts | 78 ++ qa-core/src/jest/globalTeardown.ts | 9 + qa-core/src/{ => jest}/jest.extends.ts | 0 qa-core/src/jest/jestSetup.ts | 1 + .../src/public-api/api/BudibasePublicAPI.ts | 23 + .../public-api/api/BudibasePublicAPIClient.ts | 74 ++ qa-core/src/public-api/api/apis/AppAPI.ts | 68 ++ qa-core/src/public-api/api/apis/RowAPI.ts | 61 ++ .../api/apis/TableAPI.ts} | 25 +- qa-core/src/public-api/api/apis/UserAPI.ts | 40 + qa-core/src/public-api/api/index.ts | 1 + .../public-api/config/TestConfiguration.ts | 33 + qa-core/src/public-api/config/index.ts | 1 + .../fixtures/accounts.ts | 8 +- .../src/public-api/fixtures/applications.ts | 10 + qa-core/src/public-api/fixtures/index.ts | 5 + qa-core/src/public-api/fixtures/rows.ts | 10 + .../public-api/fixtures/tables.ts | 17 +- .../{config => }/public-api/fixtures/users.ts | 8 +- qa-core/src/public-api/index.ts | 1 + .../tests}/applications/applications.spec.ts | 54 +- .../src/public-api/tests/tables/rows.spec.ts | 62 ++ .../public-api/tests/tables/tables.spec.ts | 51 + .../src/public-api/tests/users/users.spec.ts | 49 + .../src/shared/BudibaseTestConfiguration.ts | 64 ++ qa-core/src/{config => shared}/generator.ts | 0 qa-core/src/shared/index.ts | 2 + .../internal-api/applications/create.spec.ts | 54 -- .../internal-api/applications/delete.spec.ts | 31 - .../internal-api/applications/publish.spec.ts | 71 -- .../internal-api/applications/update.spec.ts | 59 -- .../internal-api/dataSources/example.spec.ts | 36 - .../internal-api/screens/screens.spec.ts | 62 -- .../tests/internal-api/tables/tables.spec.ts | 160 ---- .../userManagement/appSpecificRoles.spec.ts | 124 --- .../userManagement/tableAccess.spec.ts | 149 --- .../src/tests/public-api/tables/rows.spec.ts | 71 -- .../tests/public-api/tables/tables.spec.ts | 58 -- .../src/tests/public-api/users/users.spec.ts | 54 -- qa-core/src/types/api.ts | 5 + .../fixtures => }/types/apiKeyResponse.ts | 0 qa-core/src/types/app.ts | 10 + .../fixtures => }/types/appPackage.ts | 0 .../fixtures => }/types/deploy.ts | 0 qa-core/src/types/index.ts | 13 + .../fixtures => }/types/newAccount.ts | 0 qa-core/src/types/responseMessage.ts | 3 + .../fixtures => }/types/routing.ts | 0 qa-core/src/types/state.ts | 7 + .../types/unpublishAppResponse.ts | 0 qa-core/yarn.lock | 901 +++++++++--------- scripts/scopeBackend.sh | 16 + 140 files changed, 2835 insertions(+), 2993 deletions(-) delete mode 100644 packages/builder/reporterConfig.json delete mode 100644 packages/builder/setup.js delete mode 100644 packages/builder/testConfig.json delete mode 100644 packages/builder/ts/setup.ts delete mode 100644 packages/server/scripts/likeCypress.ts create mode 100644 packages/types/src/api/account/accounts.ts create mode 100644 packages/types/src/api/web/system/environment.ts create mode 100644 packages/types/src/api/web/system/index.ts delete mode 100644 qa-core/.env delete mode 100644 qa-core/docker-compose.yaml create mode 100644 qa-core/jest.config.ts create mode 100644 qa-core/scripts/createEnv.js delete mode 100644 qa-core/scripts/jestSetup.js create mode 100644 qa-core/src/account-api/api/AccountInternalAPI.ts create mode 100644 qa-core/src/account-api/api/AccountInternalAPIClient.ts create mode 100644 qa-core/src/account-api/api/apis/AccountAPI.ts create mode 100644 qa-core/src/account-api/api/apis/LicenseAPI.ts create mode 100644 qa-core/src/account-api/api/apis/index.ts create mode 100644 qa-core/src/account-api/api/index.ts create mode 100644 qa-core/src/account-api/index.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/accounts.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/accountsAPIClient.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/applications.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/auth.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/generator.ts delete mode 100644 qa-core/src/config/internal-api/TestConfiguration/index.ts delete mode 100644 qa-core/src/config/internal-api/fixtures/types/responseMessage.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/accounts.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/applications.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/auth.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/index.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/rows.ts delete mode 100644 qa-core/src/config/public-api/TestConfiguration/users.ts delete mode 100644 qa-core/src/config/public-api/fixtures/accounts.ts delete mode 100644 qa-core/src/config/public-api/fixtures/applications.ts delete mode 100644 qa-core/src/config/public-api/fixtures/types/newAccount.ts create mode 100644 qa-core/src/internal-api/api/BudibaseInternalAPI.ts create mode 100644 qa-core/src/internal-api/api/BudibaseInternalAPIClient.ts create mode 100644 qa-core/src/internal-api/api/apis/AppAPI.ts create mode 100644 qa-core/src/internal-api/api/apis/AuthAPI.ts create mode 100644 qa-core/src/internal-api/api/apis/EnvironmentAPI.ts create mode 100644 qa-core/src/internal-api/api/apis/RoleAPI.ts rename qa-core/src/{config/internal-api/TestConfiguration/rows.ts => internal-api/api/apis/RowAPI.ts} (63%) rename qa-core/src/{config/internal-api/TestConfiguration/screens.ts => internal-api/api/apis/ScreenAPI.ts} (54%) create mode 100644 qa-core/src/internal-api/api/apis/SelfAPI.ts rename qa-core/src/{config/internal-api/TestConfiguration/tables.ts => internal-api/api/apis/TableAPI.ts} (57%) rename qa-core/src/{config/internal-api/TestConfiguration/userManagement.ts => internal-api/api/apis/UserAPI.ts} (62%) create mode 100644 qa-core/src/internal-api/api/index.ts create mode 100644 qa-core/src/internal-api/config/TestConfiguration.ts create mode 100644 qa-core/src/internal-api/config/index.ts create mode 100644 qa-core/src/internal-api/fixtures/accounts.ts rename qa-core/src/{config => }/internal-api/fixtures/applications.ts (57%) create mode 100644 qa-core/src/internal-api/fixtures/index.ts rename qa-core/src/{config => }/internal-api/fixtures/rows.ts (100%) rename qa-core/src/{config => }/internal-api/fixtures/screens.ts (81%) rename qa-core/src/{config/internal-api/fixtures/table.ts => internal-api/fixtures/tables.ts} (100%) rename qa-core/src/{config/internal-api/fixtures/userManagement.ts => internal-api/fixtures/users.ts} (86%) create mode 100644 qa-core/src/internal-api/index.ts create mode 100644 qa-core/src/internal-api/tests/applications/create.spec.ts create mode 100644 qa-core/src/internal-api/tests/applications/delete.spec.ts create mode 100644 qa-core/src/internal-api/tests/applications/publish.spec.ts create mode 100644 qa-core/src/internal-api/tests/applications/update.spec.ts create mode 100644 qa-core/src/internal-api/tests/dataSources/example.spec.ts create mode 100644 qa-core/src/internal-api/tests/screens/screens.spec.ts create mode 100644 qa-core/src/internal-api/tests/tables/tables.spec.ts create mode 100644 qa-core/src/internal-api/tests/users/appSpecificRoles.spec.ts rename qa-core/src/{tests/internal-api/userManagement => internal-api/tests/users}/customRoles.spec.ts (55%) rename qa-core/src/{tests/internal-api/userManagement => internal-api/tests/users}/screenAccess.spec.ts (52%) create mode 100644 qa-core/src/internal-api/tests/users/tableAccess.spec.ts rename qa-core/src/{tests/internal-api/userManagement => internal-api/tests/users}/userManagement.spec.ts (53%) create mode 100644 qa-core/src/jest/globalSetup.ts create mode 100644 qa-core/src/jest/globalTeardown.ts rename qa-core/src/{ => jest}/jest.extends.ts (100%) create mode 100644 qa-core/src/jest/jestSetup.ts create mode 100644 qa-core/src/public-api/api/BudibasePublicAPI.ts create mode 100644 qa-core/src/public-api/api/BudibasePublicAPIClient.ts create mode 100644 qa-core/src/public-api/api/apis/AppAPI.ts create mode 100644 qa-core/src/public-api/api/apis/RowAPI.ts rename qa-core/src/{config/public-api/TestConfiguration/tables.ts => public-api/api/apis/TableAPI.ts} (53%) create mode 100644 qa-core/src/public-api/api/apis/UserAPI.ts create mode 100644 qa-core/src/public-api/api/index.ts create mode 100644 qa-core/src/public-api/config/TestConfiguration.ts create mode 100644 qa-core/src/public-api/config/index.ts rename qa-core/src/{config/internal-api => public-api}/fixtures/accounts.ts (69%) create mode 100644 qa-core/src/public-api/fixtures/applications.ts create mode 100644 qa-core/src/public-api/fixtures/index.ts create mode 100644 qa-core/src/public-api/fixtures/rows.ts rename qa-core/src/{config => }/public-api/fixtures/tables.ts (67%) rename qa-core/src/{config => }/public-api/fixtures/users.ts (76%) create mode 100644 qa-core/src/public-api/index.ts rename qa-core/src/{tests/public-api => public-api/tests}/applications/applications.spec.ts (53%) create mode 100644 qa-core/src/public-api/tests/tables/rows.spec.ts create mode 100644 qa-core/src/public-api/tests/tables/tables.spec.ts create mode 100644 qa-core/src/public-api/tests/users/users.spec.ts create mode 100644 qa-core/src/shared/BudibaseTestConfiguration.ts rename qa-core/src/{config => shared}/generator.ts (100%) create mode 100644 qa-core/src/shared/index.ts delete mode 100644 qa-core/src/tests/internal-api/applications/create.spec.ts delete mode 100644 qa-core/src/tests/internal-api/applications/delete.spec.ts delete mode 100644 qa-core/src/tests/internal-api/applications/publish.spec.ts delete mode 100644 qa-core/src/tests/internal-api/applications/update.spec.ts delete mode 100644 qa-core/src/tests/internal-api/dataSources/example.spec.ts delete mode 100644 qa-core/src/tests/internal-api/screens/screens.spec.ts delete mode 100644 qa-core/src/tests/internal-api/tables/tables.spec.ts delete mode 100644 qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts delete mode 100644 qa-core/src/tests/internal-api/userManagement/tableAccess.spec.ts delete mode 100644 qa-core/src/tests/public-api/tables/rows.spec.ts delete mode 100644 qa-core/src/tests/public-api/tables/tables.spec.ts delete mode 100644 qa-core/src/tests/public-api/users/users.spec.ts create mode 100644 qa-core/src/types/api.ts rename qa-core/src/{config/public-api/fixtures => }/types/apiKeyResponse.ts (100%) create mode 100644 qa-core/src/types/app.ts rename qa-core/src/{config/internal-api/fixtures => }/types/appPackage.ts (100%) rename qa-core/src/{config/internal-api/fixtures => }/types/deploy.ts (100%) create mode 100644 qa-core/src/types/index.ts rename qa-core/src/{config/internal-api/fixtures => }/types/newAccount.ts (100%) create mode 100644 qa-core/src/types/responseMessage.ts rename qa-core/src/{config/internal-api/fixtures => }/types/routing.ts (100%) create mode 100644 qa-core/src/types/state.ts rename qa-core/src/{config/internal-api/fixtures => }/types/unpublishAppResponse.ts (100%) create mode 100755 scripts/scopeBackend.sh diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index d095e3c2a4..a9de0ba342 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -77,28 +77,21 @@ jobs: - run: yarn bootstrap - run: yarn test:pro -# integration-test: -# runs-on: ubuntu-latest -# services: -# couchdb: -# image: ibmcom/couchdb3 -# env: -# COUCHDB_PASSWORD: budibase -# COUCHDB_USER: budibase -# ports: -# - 4567:5984 -# steps: -# - uses: actions/checkout@v2 -# - name: Use Node.js 14.x -# uses: actions/setup-node@v1 -# with: -# node-version: 14.x -# - name: Install Pro -# run: yarn install:pro $BRANCH $BASE_BRANCH -# - run: yarn -# - run: yarn bootstrap -# - run: yarn build -# - run: | -# cd qa-core -# yarn -# yarn api:test:ci + integration-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v1 + with: + node-version: 14.x + - name: Install Pro + run: yarn install:pro $BRANCH $BASE_BRANCH + - run: yarn && yarn bootstrap && yarn build + - run: | + cd qa-core + yarn setup + yarn test:ci + env: + BB_ADMIN_USER_EMAIL: admin + BB_ADMIN_USER_PASSWORD: admin \ No newline at end of file diff --git a/package.json b/package.json index d4aa14424e..e1a768b2be 100644 --- a/package.json +++ b/package.json @@ -23,10 +23,12 @@ }, "scripts": { "setup": "node ./hosting/scripts/setup.js && yarn && yarn bootstrap && yarn build && yarn dev", - "bootstrap": "lerna bootstrap && lerna link && ./scripts/link-dependencies.sh", + "bootstrap": "lerna bootstrap", + "postbootstrap": "lerna link && ./scripts/link-dependencies.sh", "build": "lerna run --stream build", "build:dev": "lerna run --stream prebuild && tsc --build --watch --preserveWatchOutput", - "build:backend": "lerna run --stream build --ignore @budibase/client --ignore @budibase/bbui --ignore @budibase/builder --ignore @budibase/cli", + "backend:bootstrap": "./scripts/scopeBackend.sh 'lerna bootstrap' && yarn run postbootstrap", + "backend:build": "./scripts/scopeBackend.sh 'lerna run --stream build'", "build:sdk": "lerna run --stream build:sdk", "deps:circular": "madge packages/server/dist/index.js packages/worker/src/index.ts packages/backend-core/dist/src/index.js packages/cli/src/index.js --circular", "release": "lerna publish ${RELEASE_VERSION_TYPE:-patch} --yes --force-publish && yarn release:pro", @@ -44,6 +46,7 @@ "dev": "yarn run kill-all && lerna link && lerna run --stream --parallel dev:builder --concurrency 1 --stream", "dev:noserver": "yarn run kill-builder && lerna link && lerna run --stream dev:stack:up && lerna run --stream --parallel dev:builder --concurrency 1 --ignore @budibase/backend-core --ignore @budibase/server --ignore @budibase/worker", "dev:server": "yarn run kill-server && lerna run --stream --parallel dev:builder --concurrency 1 --scope @budibase/backend-core --scope @budibase/worker --scope @budibase/server", + "dev:built": "cd packages/server && yarn dev:stack:up && cd ../../ && lerna run --stream --parallel dev:built", "test": "lerna run --stream test --stream", "test:pro": "bash scripts/pro/test.sh", "lint:eslint": "eslint packages && eslint qa-core", diff --git a/packages/backend-core/src/logging/index.ts b/packages/backend-core/src/logging/index.ts index 137a943deb..276a8d627c 100644 --- a/packages/backend-core/src/logging/index.ts +++ b/packages/backend-core/src/logging/index.ts @@ -1,3 +1,6 @@ export * as correlation from "./correlation/correlation" export { default as logger } from "./pino/logger" export * from "./alerts" + +// turn off or on context logging i.e. tenantId, appId etc +export let LOG_CONTEXT = true diff --git a/packages/backend-core/src/logging/pino/logger.ts b/packages/backend-core/src/logging/pino/logger.ts index 0b73a00f4d..c82876f49a 100644 --- a/packages/backend-core/src/logging/pino/logger.ts +++ b/packages/backend-core/src/logging/pino/logger.ts @@ -3,6 +3,7 @@ import pino, { LoggerOptions } from "pino" import * as context from "../../context" import * as correlation from "../correlation" import { IdentityType } from "@budibase/types" +import { LOG_CONTEXT } from "../index" // LOGGER @@ -77,14 +78,22 @@ function getLogParams(args: any[]): [MergingObject, string] { const identity = getIdentity() + let contextObject = {} + + if (LOG_CONTEXT) { + contextObject = { + tenantId: getTenantId(), + appId: getAppId(), + identityId: identity?._id, + identityType: identity?.type, + correlationId: correlation.getId(), + } + } + const mergingObject = { objects: objects.length ? objects : undefined, - tenantId: getTenantId(), - appId: getAppId(), - identityId: identity?._id, - identityType: identity?.type, - correlationId: correlation.getId(), err: error, + ...contextObject, } return [mergingObject, message] diff --git a/packages/builder/reporterConfig.json b/packages/builder/reporterConfig.json deleted file mode 100644 index 2c2ef7c138..0000000000 --- a/packages/builder/reporterConfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "reporterEnabled": "mochawesome", - "mochawesomeReporterOptions": { - "reportDir": "cypress/reports", - "quiet": true, - "overwrite": false, - "html": false, - "json": true - } -} \ No newline at end of file diff --git a/packages/builder/setup.js b/packages/builder/setup.js deleted file mode 100644 index b3fd96877b..0000000000 --- a/packages/builder/setup.js +++ /dev/null @@ -1,43 +0,0 @@ -const testConfig = require("./testConfig.json") - -// normal development system -const SERVER_PORT = testConfig.env.PORT -const WORKER_PORT = testConfig.env.WORKER_PORT - -if (!process.env.NODE_ENV) { - process.env.NODE_ENV = "cypress" -} -process.env.ENABLE_ANALYTICS = "0" -process.env.JWT_SECRET = testConfig.env.JWT_SECRET -process.env.SELF_HOSTED = 1 -process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/` -process.env.APPS_URL = `http://localhost:${SERVER_PORT}/` -process.env.MINIO_URL = `http://localhost:4004` -process.env.MINIO_ACCESS_KEY = "budibase" -process.env.MINIO_SECRET_KEY = "budibase" -process.env.COUCH_DB_USER = "budibase" -process.env.COUCH_DB_PASSWORD = "budibase" -process.env.INTERNAL_API_KEY = "budibase" -process.env.ALLOW_DEV_AUTOMATIONS = 1 -process.env.MOCK_REDIS = 1 - -// Stop info logs polluting test outputs -process.env.LOG_LEVEL = "error" - -exports.run = (serverLoc = "../server/dist", workerLoc = "../worker/dist") => { - // require("dotenv").config({ path: resolve(dir, ".env") }) - // don't make this a variable or top level require - // it will cause environment module to be loaded prematurely - - // override the port with the worker port temporarily - process.env.PORT = WORKER_PORT - require(workerLoc) - - // override the port with the server port - process.env.PORT = SERVER_PORT - require(serverLoc) -} - -if (require.main === module) { - exports.run() -} diff --git a/packages/builder/testConfig.json b/packages/builder/testConfig.json deleted file mode 100644 index f93adb0262..0000000000 --- a/packages/builder/testConfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "baseUrl": "http://localhost:4100", - "projectId": "bmbemn", - "reporterOptions": { - "configFile": "reporterConfig.json" - }, - "env": { - "PORT": "4100", - "WORKER_PORT": "4200", - "JWT_SECRET": "test", - "HOST_IP": "" - } -} \ No newline at end of file diff --git a/packages/builder/ts/setup.ts b/packages/builder/ts/setup.ts deleted file mode 100644 index 12965ce7c9..0000000000 --- a/packages/builder/ts/setup.ts +++ /dev/null @@ -1,4 +0,0 @@ -// @ts-ignore -import { run } from "../setup" - -run("../server/src/index", "../worker/src/index") diff --git a/packages/server/package.json b/packages/server/package.json index 2b25855d2d..09200655fa 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -26,6 +26,7 @@ "dev:stack:down": "node scripts/dev/manage.js down", "dev:stack:nuke": "node scripts/dev/manage.js nuke", "dev:builder": "yarn run dev:stack:up && nodemon", + "dev:built": "yarn run dev:stack:up && yarn run run:docker", "specs": "ts-node specs/generate.ts && openapi-typescript specs/openapi.yaml --output src/definitions/openapi.ts", "initialise": "node scripts/initialise.js", "env:multi:enable": "node scripts/multiTenancy.js enable", diff --git a/packages/server/scripts/dev/manage.js b/packages/server/scripts/dev/manage.js index c5043895cb..5db45040bf 100644 --- a/packages/server/scripts/dev/manage.js +++ b/packages/server/scripts/dev/manage.js @@ -45,7 +45,8 @@ async function init() { BB_ADMIN_USER_PASSWORD: "", PLUGINS_DIR: "", TENANT_FEATURE_FLAGS: "*:LICENSING,*:USER_GROUPS,*:ONBOARDING_TOUR", - HTTP_LOGGING: 0, + HTTP_MIGRATIONS: "0", + HTTP_LOGGING: "0", } let envFile = "" Object.keys(envFileJson).forEach(key => { diff --git a/packages/server/scripts/likeCypress.ts b/packages/server/scripts/likeCypress.ts deleted file mode 100644 index 6e9f763635..0000000000 --- a/packages/server/scripts/likeCypress.ts +++ /dev/null @@ -1,35 +0,0 @@ -/****************************************************** - * This script just makes it easy to re-create * - * a cypress like environment for testing the backend * - ******************************************************/ -import path from "path" -const tmpdir = path.join(require("os").tmpdir(), ".budibase") - -const SERVER_PORT = "4100" -const WORKER_PORT = "4200" - -// @ts-ignore -process.env.NODE_ENV = "cypress" -process.env.ENABLE_ANALYTICS = "0" -process.env.JWT_SECRET = "budibase" -process.env.COUCH_URL = `leveldb://${tmpdir}/.data/` -process.env.SELF_HOSTED = "1" -process.env.WORKER_URL = `http://localhost:${WORKER_PORT}/` -process.env.MINIO_URL = `http://localhost:4004` -process.env.MINIO_ACCESS_KEY = "budibase" -process.env.MINIO_SECRET_KEY = "budibase" -process.env.COUCH_DB_USER = "budibase" -process.env.COUCH_DB_PASSWORD = "budibase" -process.env.INTERNAL_API_KEY = "budibase" -process.env.ALLOW_DEV_AUTOMATIONS = "1" - -// don't make this a variable or top level require -// it will cause environment module to be loaded prematurely - -// override the port with the worker port temporarily -process.env.PORT = WORKER_PORT -const worker = require("../../worker/src/index") - -// override the port with the server port -process.env.PORT = SERVER_PORT -const server = require("../src/app") diff --git a/packages/server/src/startup.ts b/packages/server/src/startup.ts index f6a5307b8f..95d0715185 100644 --- a/packages/server/src/startup.ts +++ b/packages/server/src/startup.ts @@ -45,8 +45,10 @@ async function initPro() { } function shutdown(server?: any) { - server.close() - server.destroy() + if (server) { + server.close() + server.destroy() + } } export async function startup(app?: any, server?: any) { @@ -69,39 +71,7 @@ export async function startup(app?: any, server?: any) { await migrations.migrate() } catch (e) { logging.logAlert("Error performing migrations. Exiting.", e) - shutdown() - } - } - - // check and create admin user if required - if ( - env.SELF_HOSTED && - !env.MULTI_TENANCY && - env.BB_ADMIN_USER_EMAIL && - env.BB_ADMIN_USER_PASSWORD - ) { - const checklist = await getChecklist() - if (!checklist?.adminUser?.checked) { - try { - const tenantId = tenancy.getTenantId() - const user = await createAdminUser( - env.BB_ADMIN_USER_EMAIL, - env.BB_ADMIN_USER_PASSWORD, - tenantId - ) - // Need to set up an API key for automated integration tests - if (env.isTest()) { - await generateApiKey(user._id) - } - - console.log( - "Admin account automatically created for", - env.BB_ADMIN_USER_EMAIL - ) - } catch (e) { - logging.logAlert("Error creating initial admin user. Exiting.", e) - shutdown() - } + shutdown(server) } } @@ -130,4 +100,38 @@ export async function startup(app?: any, server?: any) { // bring routes online as final step once everything ready await initRoutes(app) } + + // check and create admin user if required + // this must be run after the api has been initialised due to + // the app user sync + if ( + env.SELF_HOSTED && + !env.MULTI_TENANCY && + env.BB_ADMIN_USER_EMAIL && + env.BB_ADMIN_USER_PASSWORD + ) { + const checklist = await getChecklist() + if (!checklist?.adminUser?.checked) { + try { + const tenantId = tenancy.getTenantId() + const user = await createAdminUser( + env.BB_ADMIN_USER_EMAIL, + env.BB_ADMIN_USER_PASSWORD, + tenantId + ) + // Need to set up an API key for automated integration tests + if (env.isTest()) { + await generateApiKey(user._id) + } + + console.log( + "Admin account automatically created for", + env.BB_ADMIN_USER_EMAIL + ) + } catch (e) { + logging.logAlert("Error creating initial admin user. Exiting.", e) + shutdown(server) + } + } + } } diff --git a/packages/types/src/api/account/accounts.ts b/packages/types/src/api/account/accounts.ts new file mode 100644 index 0000000000..9191babc86 --- /dev/null +++ b/packages/types/src/api/account/accounts.ts @@ -0,0 +1,13 @@ +import { Hosting } from "../../sdk" + +export interface CreateAccountRequest { + email: string + tenantId: string + hosting: Hosting + size: string + profession: string + // optional fields + tenantName?: string + name?: string + password: string +} diff --git a/packages/types/src/api/account/index.ts b/packages/types/src/api/account/index.ts index 4be610d1b3..1f46e364d8 100644 --- a/packages/types/src/api/account/index.ts +++ b/packages/types/src/api/account/index.ts @@ -1,3 +1,4 @@ +export * from "./accounts" export * from "./user" export * from "./license" export * from "./status" diff --git a/packages/types/src/api/web/index.ts b/packages/types/src/api/web/index.ts index 141119c837..6d3b4124f5 100644 --- a/packages/types/src/api/web/index.ts +++ b/packages/types/src/api/web/index.ts @@ -3,6 +3,7 @@ export * from "./auth" export * from "./user" export * from "./errors" export * from "./schedule" +export * from "./system" export * from "./app" export * from "./global" export * from "./pagination" diff --git a/packages/types/src/api/web/system/environment.ts b/packages/types/src/api/web/system/environment.ts new file mode 100644 index 0000000000..e27a1338e2 --- /dev/null +++ b/packages/types/src/api/web/system/environment.ts @@ -0,0 +1,8 @@ +export interface GetEnvironmentResponse { + multiTenancy: boolean + cloud: boolean + accountPortalUrl: string + baseUrl: string + disableAccountPortal: boolean + isDev: boolean +} diff --git a/packages/types/src/api/web/system/index.ts b/packages/types/src/api/web/system/index.ts new file mode 100644 index 0000000000..d19c9296c9 --- /dev/null +++ b/packages/types/src/api/web/system/index.ts @@ -0,0 +1 @@ +export * from "./environment" diff --git a/packages/types/src/sdk/db.ts b/packages/types/src/sdk/db.ts index 00170a1105..2cccd3be6a 100644 --- a/packages/types/src/sdk/db.ts +++ b/packages/types/src/sdk/db.ts @@ -1,6 +1,7 @@ import Nano from "@budibase/nano" import { AllDocsResponse, AnyDocument, Document } from "../" import { Writable } from "stream" +import PouchDB from "pouchdb" export enum SearchIndex { ROWS = "rows", diff --git a/packages/worker/package.json b/packages/worker/package.json index 42f25d97d9..8721f5deca 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -22,6 +22,7 @@ "build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION", "dev:stack:init": "node ./scripts/dev/manage.js init", "dev:builder": "npm run dev:stack:init && nodemon", + "dev:built": "yarn run dev:stack:init && yarn run run:docker", "test": "bash scripts/test.sh", "test:watch": "jest --watch", "env:multi:enable": "node scripts/multiTenancy.js enable", diff --git a/qa-core/.env b/qa-core/.env deleted file mode 100644 index 3b59c512d6..0000000000 --- a/qa-core/.env +++ /dev/null @@ -1,8 +0,0 @@ -BB_ADMIN_USER_EMAIL=qa@budibase.com -BB_ADMIN_USER_PASSWORD=budibase -COUCH_DB_URL=http://budibase:budibase@localhost:4567 -COUCH_DB_USER=budibase -COUCH_DB_PASSWORD=budibase -JWT_SECRET=test -BUDIBASE_HOST=http://localhost:10000 -BUDIBASE_ACCOUNTS_URL=http://localhost:10001 \ No newline at end of file diff --git a/qa-core/.gitignore b/qa-core/.gitignore index 3ff834abfc..4c442c31dc 100644 --- a/qa-core/.gitignore +++ b/qa-core/.gitignore @@ -2,5 +2,4 @@ node_modules/ .env watchtower-hook.json dist/ -.testReport.json testResults.json diff --git a/qa-core/README.md b/qa-core/README.md index c9d0727878..8390f276d9 100644 --- a/qa-core/README.md +++ b/qa-core/README.md @@ -6,13 +6,11 @@ The QA Core API tests are a jest suite that run directly against the budibase ba You can run the whole test suite with one command, that spins up the budibase server and runs the jest tests: -`yarn api:test` +`yarn test:ci` -## Setup Server Only +## Setup Server -You can also just stand up the budibase server alone. - -`yarn api:server:setup` +You can run the local development stack by following the instructions on the main readme. ## Run Tests @@ -24,11 +22,7 @@ for watch mode, where the tests will run on every change: `yarn test:watch` -To run tests locally against a cloud service you can use the command: -`yarn run api:test:local` +To run tests locally against a cloud service you can update the configuration inside the `.env` file and run: -To run the tests in CI, it assumes the correct environment variables are set, and the server is already running. Use the command: -`yarn run api:test:ci` +`yarn test` -To run the nightly tests against the QA environment, use the command: -`yarn run api:test:nightly` diff --git a/qa-core/docker-compose.yaml b/qa-core/docker-compose.yaml deleted file mode 100644 index abd8e4818e..0000000000 --- a/qa-core/docker-compose.yaml +++ /dev/null @@ -1,12 +0,0 @@ -version: "3.8" -services: - qa-core-couchdb: - # platform: linux/amd64 - container_name: budi-couchdb-qa - restart: on-failure - image: ibmcom/couchdb3 - environment: - - COUCHDB_PASSWORD=${COUCH_DB_PASSWORD} - - COUCHDB_USER=${COUCH_DB_USER} - ports: - - "4567:5984" diff --git a/qa-core/jest.config.ts b/qa-core/jest.config.ts new file mode 100644 index 0000000000..de63f9074b --- /dev/null +++ b/qa-core/jest.config.ts @@ -0,0 +1,18 @@ +import { Config } from "@jest/types" + +const config: Config.InitialOptions = { + preset: "ts-jest", + setupFiles: ["./src/jest/jestSetup.ts"], + setupFilesAfterEnv: ["./src/jest/jest.extends.ts"], + testEnvironment: "node", + globalSetup: "./src/jest/globalSetup.ts", + globalTeardown: "./src/jest/globalTeardown.ts", + moduleNameMapper: { + "@budibase/types": "/../packages/types/src", + "@budibase/server": "/../packages/server/src", + "@budibase/backend-core": "/../packages/backend-core/src", + "@budibase/backend-core/(.*)": "/../packages/backend-core/$1", + }, +} + +export default config diff --git a/qa-core/package.json b/qa-core/package.json index 4df423652c..73fd59cab2 100644 --- a/qa-core/package.json +++ b/qa-core/package.json @@ -9,46 +9,26 @@ "url": "https://github.com/Budibase/budibase.git" }, "scripts": { - "test": "env-cmd jest --runInBand", - "test:watch": "env-cmd jest --watch", - "test:debug": "DEBUG=1 jest", + "setup": "yarn && node scripts/createEnv.js", + "test": "jest --runInBand --json --outputFile=testResults.json", + "test:watch": "yarn run test --watch", + "test:debug": "DEBUG=1 yarn run test", "test:notify": "node scripts/testResultsWebhook", - "test:ci": "jest --runInBand --json --outputFile=testResults.json --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"", - "docker:up": "docker-compose up -d", - "docker:down": "docker-compose down", - "api:server:setup": "npm run docker:up && env-cmd ts-node ../packages/builder/ts/setup.ts", - "api:server:setup:ci": "env-cmd node ../packages/builder/setup.js", - "api:test": "jest --runInBand --json --outputFile=testResults.json", - "api:test:ci": "start-server-and-test api:server:setup:ci http://localhost:4100/builder test", - "api:test:local": "start-server-and-test api:server:setup http://localhost:4100/builder test" - }, - "jest": { - "preset": "ts-jest", - "testEnvironment": "node", - "moduleNameMapper": { - "@budibase/types": "/../packages/types/src", - "@budibase/server": "/../packages/server/src", - "@budibase/backend-core": "/../packages/backend-core/src", - "@budibase/backend-core/(.*)": "/../packages/backend-core/$1" - }, - "setupFiles": [ - "./scripts/jestSetup.js" - ], - "setupFilesAfterEnv": [ - "./src/jest.extends.ts" - ] + "test:smoke": "yarn run test --testPathIgnorePatterns=\\\"\\/dataSources\\/\\\"", + "test:ci": "start-server-and-test dev:built http://localhost:4001/health test:smoke", + "dev:built": "cd ../ && yarn dev:built" }, "devDependencies": { "@budibase/types": "^2.3.17", "@types/jest": "29.0.0", "@types/node-fetch": "2.6.2", "chance": "1.1.8", - "env-cmd": "^10.1.0", - "jest": "28.1.1", + "dotenv": "16.0.1", + "jest": "29.0.0", "prettier": "2.7.1", "start-server-and-test": "1.14.0", "timekeeper": "2.2.0", - "ts-jest": "28.0.8", + "ts-jest": "29.0.0", "ts-node": "10.8.1", "tsconfig-paths": "4.0.0", "typescript": "4.7.3" diff --git a/qa-core/scripts/createEnv.js b/qa-core/scripts/createEnv.js new file mode 100644 index 0000000000..cc21282ca9 --- /dev/null +++ b/qa-core/scripts/createEnv.js @@ -0,0 +1,22 @@ +#!/usr/bin/env node +const path = require("path") +const fs = require("fs") + +function init() { + const envFilePath = path.join(process.cwd(), ".env") + if (!fs.existsSync(envFilePath)) { + const envFileJson = { + BUDIBASE_URL: "http://localhost:10000", + ACCOUNT_PORTAL_URL: "http://localhost:10001", + BB_ADMIN_USER_EMAIL: "admin", + BB_ADMIN_USER_PASSWORD: "admin", + } + let envFile = "" + Object.keys(envFileJson).forEach(key => { + envFile += `${key}=${envFileJson[key]}\n` + }) + fs.writeFileSync(envFilePath, envFile) + } +} + +init() diff --git a/qa-core/scripts/jestSetup.js b/qa-core/scripts/jestSetup.js deleted file mode 100644 index a6f8a6478c..0000000000 --- a/qa-core/scripts/jestSetup.js +++ /dev/null @@ -1,11 +0,0 @@ -// mock all dates to 2020-01-01T00:00:00.000Z -// use tk.reset() to use real dates in individual tests -const MOCK_DATE = new Date("2020-01-01T00:00:00.000Z") -const tk = require("timekeeper") -tk.freeze(MOCK_DATE) - -if (!process.env.DEBUG) { - global.console.log = jest.fn() // console.log are ignored in tests -} - -jest.setTimeout(60000) diff --git a/qa-core/src/account-api/api/AccountInternalAPI.ts b/qa-core/src/account-api/api/AccountInternalAPI.ts new file mode 100644 index 0000000000..a5abdcbccd --- /dev/null +++ b/qa-core/src/account-api/api/AccountInternalAPI.ts @@ -0,0 +1,16 @@ +import AccountInternalAPIClient from "./AccountInternalAPIClient" +import { AccountAPI, LicenseAPI } from "./apis" +import { State } from "../../types" + +export default class AccountInternalAPI { + client: AccountInternalAPIClient + + accounts: AccountAPI + licenses: LicenseAPI + + constructor(state: State) { + this.client = new AccountInternalAPIClient(state) + this.accounts = new AccountAPI(this.client) + this.licenses = new LicenseAPI(this.client) + } +} diff --git a/qa-core/src/account-api/api/AccountInternalAPIClient.ts b/qa-core/src/account-api/api/AccountInternalAPIClient.ts new file mode 100644 index 0000000000..7438059a8c --- /dev/null +++ b/qa-core/src/account-api/api/AccountInternalAPIClient.ts @@ -0,0 +1,70 @@ +import env from "../../environment" +import fetch, { HeadersInit } from "node-fetch" +import { State } from "../../types" + +type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" + +interface ApiOptions { + method?: APIMethod + body?: object + headers?: HeadersInit | undefined +} + +export default class AccountInternalAPIClient { + state: State + host: string + + constructor(state: State) { + if (!env.ACCOUNT_PORTAL_URL) { + throw new Error("Must set ACCOUNT_PORTAL_URL env var") + } + this.host = `${env.ACCOUNT_PORTAL_URL}` + this.state = state + } + + apiCall = + (method: APIMethod) => + async (url = "", options: ApiOptions = {}) => { + const requestOptions = { + method, + body: JSON.stringify(options.body), + headers: { + "Content-Type": "application/json", + Accept: "application/json", + cookie: this.state.cookie, + redirect: "follow", + follow: 20, + ...options.headers, + }, + credentials: "include", + } + + // @ts-ignore + const response = await fetch(`${this.host}${url}`, requestOptions) + + let body: any + const contentType = response.headers.get("content-type") + if (contentType && contentType.includes("application/json")) { + body = await response.json() + } else { + body = await response.text() + } + + const message = `${method} ${url} - ${response.status} + Response body: ${JSON.stringify(body)} + Request body: ${requestOptions.body}` + + if (response.status > 499) { + console.error(message) + } else if (response.status >= 400) { + console.warn(message) + } + return [response, body] + } + + post = this.apiCall("POST") + get = this.apiCall("GET") + patch = this.apiCall("PATCH") + del = this.apiCall("DELETE") + put = this.apiCall("PUT") +} diff --git a/qa-core/src/account-api/api/apis/AccountAPI.ts b/qa-core/src/account-api/api/apis/AccountAPI.ts new file mode 100644 index 0000000000..a97fe29fd0 --- /dev/null +++ b/qa-core/src/account-api/api/apis/AccountAPI.ts @@ -0,0 +1,61 @@ +import { Response } from "node-fetch" +import { Account, CreateAccountRequest } from "@budibase/types" +import AccountInternalAPIClient from "../AccountInternalAPIClient" +import { APIRequestOpts } from "../../../types" + +export default class AccountAPI { + client: AccountInternalAPIClient + + constructor(client: AccountInternalAPIClient) { + this.client = client + } + + async validateEmail( + email: string, + opts: APIRequestOpts = { doExpect: true } + ): Promise { + const [response, json] = await this.client.post( + `/api/accounts/validate/email`, + { + body: { email }, + } + ) + if (opts.doExpect) { + expect(response).toHaveStatusCode(200) + } + return response + } + + async validateTenantId( + tenantId: string, + opts: APIRequestOpts = { doExpect: true } + ): Promise { + const [response, json] = await this.client.post( + `/api/accounts/validate/tenantId`, + { + body: { tenantId }, + } + ) + if (opts.doExpect) { + expect(response).toHaveStatusCode(200) + } + return response + } + + async create( + body: CreateAccountRequest, + opts: APIRequestOpts = { doExpect: true } + ): Promise<[Response, Account]> { + const headers = { + "no-verify": "1", + } + const [response, json] = await this.client.post(`/api/accounts`, { + body, + headers, + }) + if (opts.doExpect) { + expect(response).toHaveStatusCode(201) + } + return [response, json] + } +} diff --git a/qa-core/src/account-api/api/apis/LicenseAPI.ts b/qa-core/src/account-api/api/apis/LicenseAPI.ts new file mode 100644 index 0000000000..080c22a4ff --- /dev/null +++ b/qa-core/src/account-api/api/apis/LicenseAPI.ts @@ -0,0 +1,9 @@ +import AccountInternalAPIClient from "../AccountInternalAPIClient" + +export default class LicenseAPI { + client: AccountInternalAPIClient + + constructor(client: AccountInternalAPIClient) { + this.client = client + } +} diff --git a/qa-core/src/account-api/api/apis/index.ts b/qa-core/src/account-api/api/apis/index.ts new file mode 100644 index 0000000000..b8a1dc7b4a --- /dev/null +++ b/qa-core/src/account-api/api/apis/index.ts @@ -0,0 +1,2 @@ +export { default as AccountAPI } from "./AccountAPI" +export { default as LicenseAPI } from "./LicenseAPI" diff --git a/qa-core/src/account-api/api/index.ts b/qa-core/src/account-api/api/index.ts new file mode 100644 index 0000000000..7a81f60d0b --- /dev/null +++ b/qa-core/src/account-api/api/index.ts @@ -0,0 +1 @@ +export { default as AccountInternalAPI } from "./AccountInternalAPI" diff --git a/qa-core/src/account-api/index.ts b/qa-core/src/account-api/index.ts new file mode 100644 index 0000000000..e1a716605a --- /dev/null +++ b/qa-core/src/account-api/index.ts @@ -0,0 +1 @@ +export * from "./api" diff --git a/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts b/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts deleted file mode 100644 index 26249b52f8..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/InternalAPIClient.ts +++ /dev/null @@ -1,73 +0,0 @@ -import env from "../../../environment" -import fetch, { HeadersInit } from "node-fetch" - -type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" - -interface ApiOptions { - method?: APIMethod - body?: object - headers?: HeadersInit | undefined -} - -class InternalAPIClient { - host: string - tenantName?: string - appId?: string - cookie?: string - - constructor(appId?: string) { - if (!env.BUDIBASE_HOST) { - throw new Error("Must set BUDIBASE_HOST env var") - } - this.host = `${env.BUDIBASE_HOST}/api` - this.appId = appId - } - - setTenantName(tenantName: string) { - this.tenantName = tenantName - } - - apiCall = - (method: APIMethod) => - async (url = "", options: ApiOptions = {}) => { - const requestOptions = { - method, - body: JSON.stringify(options.body), - headers: { - "x-budibase-app-id": this.appId, - "Content-Type": "application/json", - Accept: "application/json", - cookie: this.cookie, - redirect: "follow", - follow: 20, - ...options.headers, - }, - credentials: "include", - } - - // prettier-ignore - // @ts-ignore - const response = await fetch(`https://${process.env.TENANT_ID}.${this.host}${url}`, requestOptions) - - if ( - response.status == 404 || - response.status == 500 || - response.status == 403 - ) { - console.error("Error in apiCall") - console.error("Response:", response) - const json = await response.json() - console.error("Response body:", json) - console.error("Request body:", requestOptions.body) - } - return response - } - - post = this.apiCall("POST") - get = this.apiCall("GET") - patch = this.apiCall("PATCH") - del = this.apiCall("DELETE") - put = this.apiCall("PUT") -} - -export default InternalAPIClient diff --git a/qa-core/src/config/internal-api/TestConfiguration/accounts.ts b/qa-core/src/config/internal-api/TestConfiguration/accounts.ts deleted file mode 100644 index fdf5aedbd0..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/accounts.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Response } from "node-fetch" -import { Account } from "@budibase/types" -import AccountsAPIClient from "./accountsAPIClient" -import { NewAccount } from "../fixtures/types/newAccount" - -export default class AccountsApi { - api: AccountsAPIClient - - constructor(AccountsAPIClient: AccountsAPIClient) { - this.api = AccountsAPIClient - } - - async validateEmail(email: string): Promise { - const response = await this.api.post(`/accounts/validate/email`, { - body: { email }, - }) - expect(response).toHaveStatusCode(200) - return response - } - - async validateTenantId(tenantId: string): Promise { - const response = await this.api.post(`/accounts/validate/tenantId`, { - body: { tenantId }, - }) - expect(response).toHaveStatusCode(200) - return response - } - - async create(body: Partial): Promise<[Response, Account]> { - const headers = { - "no-verify": "1", - } - const response = await this.api.post(`/accounts`, { body, headers }) - const json = await response.json() - expect(response).toHaveStatusCode(201) - return [response, json] - } -} diff --git a/qa-core/src/config/internal-api/TestConfiguration/accountsAPIClient.ts b/qa-core/src/config/internal-api/TestConfiguration/accountsAPIClient.ts deleted file mode 100644 index 2e9904797c..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/accountsAPIClient.ts +++ /dev/null @@ -1,62 +0,0 @@ -import env from "../../../environment" -import fetch, { HeadersInit } from "node-fetch" - -type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" - -interface ApiOptions { - method?: APIMethod - body?: object - headers?: HeadersInit | undefined -} - -class AccountsAPIClient { - host: string - appId?: string - cookie?: string - - constructor(appId?: string) { - if (!env.BUDIBASE_ACCOUNTS_URL) { - throw new Error("Must set BUDIBASE_ACCOUNTS_URL env var") - } - this.host = `${env.BUDIBASE_ACCOUNTS_URL}/api` - this.appId = appId - } - - apiCall = - (method: APIMethod) => - async (url = "", options: ApiOptions = {}) => { - const requestOptions = { - method, - body: JSON.stringify(options.body), - headers: { - "x-budibase-app-id": this.appId, - "Content-Type": "application/json", - Accept: "application/json", - cookie: this.cookie, - redirect: "follow", - follow: 20, - ...options.headers, - }, - credentials: "include", - } - - // @ts-ignore - const response = await fetch(`${this.host}${url}`, requestOptions) - if (response.status == 404 || response.status == 500) { - console.error("Error in apiCall") - console.error("Response:", response) - const json = await response.json() - console.error("Response body:", json) - console.error("Request body:", requestOptions.body) - } - return response - } - - post = this.apiCall("POST") - get = this.apiCall("GET") - patch = this.apiCall("PATCH") - del = this.apiCall("DELETE") - put = this.apiCall("PUT") -} - -export default AccountsAPIClient diff --git a/qa-core/src/config/internal-api/TestConfiguration/applications.ts b/qa-core/src/config/internal-api/TestConfiguration/applications.ts deleted file mode 100644 index 1e3658dcd2..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/applications.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import { App } from "@budibase/types" -import { Response } from "node-fetch" -import InternalAPIClient from "./InternalAPIClient" -import { RouteConfig } from "../fixtures/types/routing" -import { AppPackageResponse } from "../fixtures/types/appPackage" -import { DeployConfig } from "../fixtures/types/deploy" -import { responseMessage } from "../fixtures/types/responseMessage" -import { UnpublishAppResponse } from "../fixtures/types/unpublishAppResponse" - -export default class AppApi { - api: InternalAPIClient - constructor(apiClient: InternalAPIClient) { - this.api = apiClient - } - // TODO Fix the fetch apps to receive an optional number of apps and compare if the received app is more or less. - // each possible scenario should have its own method. - async fetchEmptyAppList(): Promise<[Response, Application[]]> { - const response = await this.api.get(`/applications?status=all`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json.length).toBeGreaterThanOrEqual(0) - return [response, json] - } - - async fetchAllApplications(): Promise<[Response, Application[]]> { - const response = await this.api.get(`/applications?status=all`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json.length).toBeGreaterThanOrEqual(1) - return [response, json] - } - - async canRender(): Promise<[Response, boolean]> { - const response = await this.api.get("/routing/client") - expect(response).toHaveStatusCode(200) - const json = await response.json() - const publishedAppRenders = Object.keys(json.routes).length > 0 - expect(publishedAppRenders).toBe(true) - return [response, publishedAppRenders] - } - - async getAppPackage(appId: string): Promise<[Response, AppPackageResponse]> { - const response = await this.api.get(`/applications/${appId}/appPackage`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json.application.appId).toEqual(appId) - return [response, json] - } - - async publish(appId: string | undefined): Promise<[Response, DeployConfig]> { - const response = await this.api.post(`/applications/${appId}/publish`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - return [response, json] - } - - async create(body: any): Promise> { - const response = await this.api.post(`/applications`, { body }) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json._id).toBeDefined() - return json - } - - async read(id: string): Promise<[Response, Application]> { - const response = await this.api.get(`/applications/${id}`) - const json = await response.json() - return [response, json.data] - } - - async sync(appId: string): Promise<[Response, responseMessage]> { - const response = await this.api.post(`/applications/${appId}/sync`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - return [response, json] - } - - // TODO - async updateClient( - appId: string, - body: any - ): Promise<[Response, Application]> { - const response = await this.api.put( - `/applications/${appId}/client/update`, - { body } - ) - const json = await response.json() - return [response, json] - } - - async revertPublished(appId: string): Promise<[Response, responseMessage]> { - const response = await this.api.post(`/dev/${appId}/revert`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json).toEqual({ - message: "Reverted changes successfully.", - }) - return [response, json] - } - - async revertUnpublished(appId: string): Promise<[Response, responseMessage]> { - const response = await this.api.post(`/dev/${appId}/revert`) - const json = await response.json() - expect(response).toHaveStatusCode(400) - expect(json).toEqual({ - message: "App has not yet been deployed", - status: 400, - }) - return [response, json] - } - - async delete(appId: string): Promise { - const response = await this.api.del(`/applications/${appId}`) - expect(response).toHaveStatusCode(200) - return response - } - - async rename( - appId: string, - oldName: string, - body: any - ): Promise<[Response, Application]> { - const response = await this.api.put(`/applications/${appId}`, { body }) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json.name).not.toEqual(oldName) - return [response, json] - } - - async addScreentoApp(body: any): Promise<[Response, Application]> { - const response = await this.api.post(`/screens`, { body }) - const json = await response.json() - return [response, json] - } - - async getRoutes(screenExists?: boolean): Promise<[Response, RouteConfig]> { - const response = await this.api.get(`/routing`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - if (screenExists) { - expect(json.routes["/test"]).toBeTruthy() - } else { - expect(json.routes["/test"]).toBeUndefined() - } - - return [response, json] - } - - async unpublish(appId: string): Promise<[Response]> { - const response = await this.api.post(`/applications/${appId}/unpublish`) - expect(response).toHaveStatusCode(204) - return [response] - } - - async unlock(appId: string): Promise<[Response, responseMessage]> { - const response = await this.api.del(`/dev/${appId}/lock`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json.message).toEqual("Lock released successfully.") - return [response, json] - } - - async updateIcon(appId: string): Promise<[Response, Application]> { - const body = { - icon: { - name: "ConversionFunnel", - color: "var(--spectrum-global-color-red-400)", - }, - } - const response = await this.api.put(`/applications/${appId}`, { body }) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json.icon.name).toEqual(body.icon.name) - expect(json.icon.color).toEqual(body.icon.color) - return [response, json] - } -} diff --git a/qa-core/src/config/internal-api/TestConfiguration/auth.ts b/qa-core/src/config/internal-api/TestConfiguration/auth.ts deleted file mode 100644 index 3fe57c50be..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/auth.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Response } from "node-fetch" -import InternalAPIClient from "./InternalAPIClient" - -export default class AuthApi { - api: InternalAPIClient - - constructor(apiClient: InternalAPIClient) { - this.api = apiClient - } - - async loginAsAdmin(): Promise<[Response, any]> { - const response = await this.api.post(`/global/auth/default/login`, { - body: { - username: process.env.BB_ADMIN_USER_EMAIL, - password: process.env.BB_ADMIN_USER_PASSWORD, - }, - }) - const cookie = response.headers.get("set-cookie") - this.api.cookie = cookie as any - return [response, cookie] - } - - async login(email: String, password: String): Promise<[Response, any]> { - const response = await this.api.post(`/global/auth/default/login`, { - body: { - username: email, - password: password, - }, - }) - expect(response).toHaveStatusCode(200) - const cookie = response.headers.get("set-cookie") - this.api.cookie = cookie as any - return [response, cookie] - } - - async logout(): Promise { - return this.api.post(`/global/auth/logout`) - } -} diff --git a/qa-core/src/config/internal-api/TestConfiguration/generator.ts b/qa-core/src/config/internal-api/TestConfiguration/generator.ts deleted file mode 100644 index c9395f7e47..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/generator.ts +++ /dev/null @@ -1,3 +0,0 @@ -const Chance = require("chance") - -export default new Chance() diff --git a/qa-core/src/config/internal-api/TestConfiguration/index.ts b/qa-core/src/config/internal-api/TestConfiguration/index.ts deleted file mode 100644 index c72f48690a..0000000000 --- a/qa-core/src/config/internal-api/TestConfiguration/index.ts +++ /dev/null @@ -1,79 +0,0 @@ -import ApplicationApi from "./applications" -import AuthApi from "./auth" -import InternalAPIClient from "./InternalAPIClient" -import AccountsApiClient from "./accountsAPIClient" -import TablesApi from "./tables" -import RowApi from "./rows" -import ScreenApi from "./screens" -import UserManagementApi from "./userManagement" -import AccountsApi from "./accounts" -import { generateAccount } from "../fixtures/accounts" - -export default class TestConfiguration { - applications: ApplicationApi - auth: AuthApi - screen: ScreenApi - context: T - tables: TablesApi - rows: RowApi - users: UserManagementApi - accounts: AccountsApi - apiClient: InternalAPIClient - accountsApiClient: AccountsApiClient - - constructor( - apiClient: InternalAPIClient, - accountsApiClient: AccountsApiClient - ) { - this.apiClient = apiClient - this.accountsApiClient = accountsApiClient - - this.applications = new ApplicationApi(this.apiClient) - this.tables = new TablesApi(this.apiClient) - this.rows = new RowApi(this.apiClient) - this.auth = new AuthApi(this.apiClient) - this.screen = new ScreenApi(this.apiClient) - this.users = new UserManagementApi(this.apiClient) - this.accounts = new AccountsApi(this.accountsApiClient) - this.context = {} - } - - async loginAsAdmin() { - await this.auth.login( - process.env.BB_ADMIN_USER_EMAIL, - process.env.BB_ADMIN_USER_PASSWORD - ) - } - // TODO: add logic to setup or login based in env variables - - async setupAccountAndTenant() { - const account = generateAccount() - await this.accounts.validateEmail(account.email) - await this.accounts.validateTenantId(account.tenantId) - process.env.TENANT_ID = account.tenantId - await this.accounts.create(account) - await this.updateApiClients(account.tenantName) - await this.auth.login(account.email, account.password) - } - - async updateApiClients(tenantName: string) { - this.apiClient.setTenantName(tenantName) - this.applications = new ApplicationApi(this.apiClient) - this.tables = new TablesApi(this.apiClient) - this.rows = new RowApi(this.apiClient) - this.auth = new AuthApi(this.apiClient) - this.screen = new ScreenApi(this.apiClient) - this.users = new UserManagementApi(this.apiClient) - this.context = {} - } - - async login(email: string, password: string) { - await this.auth.logout() - await this.auth.login(email, password) - } - - async afterAll() { - this.context = {} - await this.auth.logout() - } -} diff --git a/qa-core/src/config/internal-api/fixtures/types/responseMessage.ts b/qa-core/src/config/internal-api/fixtures/types/responseMessage.ts deleted file mode 100644 index 06c701c059..0000000000 --- a/qa-core/src/config/internal-api/fixtures/types/responseMessage.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface responseMessage { - message: string -} diff --git a/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts b/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts deleted file mode 100644 index 28bf2f85ff..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/PublicAPIClient.ts +++ /dev/null @@ -1,77 +0,0 @@ -import env from "../../../environment" -import fetch, { HeadersInit } from "node-fetch" - -type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" - -interface ApiOptions { - method?: APIMethod - body?: object - headers?: HeadersInit | undefined -} - -class PublicAPIClient { - host: string - apiKey?: string - tenantName?: string - appId?: string - cookie?: string - - constructor(appId?: string) { - if (!env.BUDIBASE_HOST) { - throw new Error("Must set BUDIBASE_HOST env var") - } - this.host = `${env.BUDIBASE_HOST}/api/public/v1` - - this.appId = appId - } - - setTenantName(tenantName: string) { - this.tenantName = tenantName - } - - setApiKey(apiKey: string) { - this.apiKey = apiKey - process.env.BUDIBASE_PUBLIC_API_KEY = apiKey - this.host = `${env.BUDIBASE_HOST}/api/public/v1` - } - - apiCall = - (method: APIMethod) => - async (url = "", options: ApiOptions = {}) => { - const requestOptions = { - method, - body: JSON.stringify(options.body), - headers: { - "x-budibase-api-key": this.apiKey || null, - "x-budibase-app-id": this.appId, - "Content-Type": "application/json", - Accept: "application/json", - ...options.headers, - cookie: this.cookie, - redirect: "follow", - follow: 20, - }, - } - - // prettier-ignore - // @ts-ignore - const response = await fetch(`https://${process.env.TENANT_ID}.${this.host}${url}`, requestOptions) - - if (response.status == 500 || response.status == 403) { - console.error("Error in apiCall") - console.error("Response:", response) - const json = await response.json() - console.error("Response body:", json) - console.error("Request body:", requestOptions.body) - } - return response - } - - post = this.apiCall("POST") - get = this.apiCall("GET") - patch = this.apiCall("PATCH") - del = this.apiCall("DELETE") - put = this.apiCall("PUT") -} - -export default PublicAPIClient diff --git a/qa-core/src/config/public-api/TestConfiguration/accounts.ts b/qa-core/src/config/public-api/TestConfiguration/accounts.ts deleted file mode 100644 index fdf5aedbd0..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/accounts.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Response } from "node-fetch" -import { Account } from "@budibase/types" -import AccountsAPIClient from "./accountsAPIClient" -import { NewAccount } from "../fixtures/types/newAccount" - -export default class AccountsApi { - api: AccountsAPIClient - - constructor(AccountsAPIClient: AccountsAPIClient) { - this.api = AccountsAPIClient - } - - async validateEmail(email: string): Promise { - const response = await this.api.post(`/accounts/validate/email`, { - body: { email }, - }) - expect(response).toHaveStatusCode(200) - return response - } - - async validateTenantId(tenantId: string): Promise { - const response = await this.api.post(`/accounts/validate/tenantId`, { - body: { tenantId }, - }) - expect(response).toHaveStatusCode(200) - return response - } - - async create(body: Partial): Promise<[Response, Account]> { - const headers = { - "no-verify": "1", - } - const response = await this.api.post(`/accounts`, { body, headers }) - const json = await response.json() - expect(response).toHaveStatusCode(201) - return [response, json] - } -} diff --git a/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts b/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts deleted file mode 100644 index 4a2961afb1..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/accountsAPIClient.ts +++ /dev/null @@ -1,66 +0,0 @@ -import env from "../../../environment" -import fetch, { HeadersInit } from "node-fetch" - -type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" - -interface ApiOptions { - method?: APIMethod - body?: object - headers?: HeadersInit | undefined -} - -class AccountsAPIClient { - host: string - appId?: string - cookie?: string - - constructor(appId?: string) { - if (!env.BUDIBASE_ACCOUNTS_URL) { - throw new Error("Must set BUDIBASE_ACCOUNTS_URL env var") - } - this.host = `${env.BUDIBASE_ACCOUNTS_URL}/api` - this.appId = appId - } - - apiCall = - (method: APIMethod) => - async (url = "", options: ApiOptions = {}) => { - const requestOptions = { - method, - body: JSON.stringify(options.body), - headers: { - "x-budibase-app-id": this.appId, - "Content-Type": "application/json", - Accept: "application/json", - cookie: this.cookie, - redirect: "follow", - follow: 20, - ...options.headers, - }, - credentials: "include", - } - - // @ts-ignore - const response = await fetch(`${this.host}${url}`, requestOptions) - if ( - response.status == 404 || - response.status == 500 || - response.status == 400 - ) { - console.error("Error in apiCall") - console.error("Response:", response) - const json = await response.json() - console.error("Response body:", json) - console.error("Request body:", requestOptions.body) - } - return response - } - - post = this.apiCall("POST") - get = this.apiCall("GET") - patch = this.apiCall("PATCH") - del = this.apiCall("DELETE") - put = this.apiCall("PUT") -} - -export default AccountsAPIClient diff --git a/qa-core/src/config/public-api/TestConfiguration/applications.ts b/qa-core/src/config/public-api/TestConfiguration/applications.ts deleted file mode 100644 index 56b0b70795..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/applications.ts +++ /dev/null @@ -1,77 +0,0 @@ -import PublicAPIClient from "./PublicAPIClient" -import { - Application, - SearchInputParams, - CreateApplicationParams, -} from "@budibase/server/api/controllers/public/mapping/types" -import { Response } from "node-fetch" -import generateApp from "../fixtures/applications" - -export default class AppApi { - api: PublicAPIClient - - constructor(apiClient: PublicAPIClient) { - this.api = apiClient - } - - async seed(): Promise<[Response, Application]> { - return this.create(generateApp()) - } - - async create( - body: CreateApplicationParams - ): Promise<[Response, Application]> { - const response = await this.api.post(`/applications`, { body }) - const json = await response.json() - return [response, json.data] - } - - async read(id: string): Promise<[Response, Application]> { - const response = await this.api.get(`/applications/${id}`) - const json = await response.json() - return [response, json.data] - } - - async search(body: SearchInputParams): Promise<[Response, [Application]]> { - const response = await this.api.post(`/applications/search`, { body }) - const json = await response.json() - return [response, json.data] - } - - async update( - id: string, - body: Application - ): Promise<[Response, Application]> { - const response = await this.api.put(`/applications/${id}`, { body }) - const json = await response.json() - return [response, json.data] - } - - async delete(id: string): Promise<[Response, Application]> { - const response = await this.api.del(`/applications/${id}`) - const json = await response.json() - return [response, json.data] - } - - async publish(id: string): Promise<[Response, any]> { - const response = await this.api.post(`/applications/${id}/publish`) - const json = await response.json() - return [response, json.data] - } - - async unpublish(id: string): Promise<[Response]> { - const response = await this.api.post(`/applications/${id}/unpublish`) - return [response] - } - - async createFirstApp() { - const body = { - name: "My first app", - url: "my-first-app", - useTemplate: false, - sampleData: true, - } - const response = await this.api.post("/applications", { body }) - expect(response).toHaveStatusCode(200) - } -} diff --git a/qa-core/src/config/public-api/TestConfiguration/auth.ts b/qa-core/src/config/public-api/TestConfiguration/auth.ts deleted file mode 100644 index 3eb4df2245..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/auth.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Response } from "node-fetch" -import AccountsAPIClient from "./accountsAPIClient" -import { ApiKeyResponse } from "../fixtures/types/apiKeyResponse" - -export default class AuthApi { - api: AccountsAPIClient - - constructor(apiClient: AccountsAPIClient) { - this.api = apiClient - } - - async loginAsAdmin(): Promise<[Response, any]> { - const response = await this.api.post(`/auth/login`, { - body: { - username: process.env.BB_ADMIN_USER_EMAIL, - password: process.env.BB_ADMIN_USER_PASSWORD, - }, - }) - const cookie = response.headers.get("set-cookie") - this.api.cookie = cookie as any - return [response, cookie] - } - - async login(email: String, password: String): Promise<[Response, any]> { - const response = await this.api.post(`/global/auth/default/login`, { - body: { - username: email, - password: password, - }, - }) - expect(response).toHaveStatusCode(200) - const cookie = response.headers.get("set-cookie") - this.api.cookie = cookie as any - return [response, cookie] - } - - async logout(): Promise { - return this.api.post(`/global/auth/logout`) - } - - async getApiKey(): Promise { - const response = await this.api.get(`/global/self/api_key`) - const json = await response.json() - expect(response).toHaveStatusCode(200) - expect(json).toHaveProperty("apiKey") - return json - } -} diff --git a/qa-core/src/config/public-api/TestConfiguration/index.ts b/qa-core/src/config/public-api/TestConfiguration/index.ts deleted file mode 100644 index e67da27883..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/index.ts +++ /dev/null @@ -1,90 +0,0 @@ -import PublicAPIClient from "./PublicAPIClient" -import ApplicationApi from "./applications" -import TableApi from "./tables" -import UserApi from "./users" -import RowApi from "./rows" -import AuthApi from "./auth" -import AccountsApiClient from "./accountsAPIClient" -import AccountsApi from "./accounts" -import { generateAccount } from "../fixtures/accounts" -import internalApplicationsApi from "../../internal-api/TestConfiguration/applications" - -import InternalAPIClient from "../../internal-api/TestConfiguration/InternalAPIClient" - -export default class TestConfiguration { - applications: ApplicationApi - auth: AuthApi - users: UserApi - tables: TableApi - rows: RowApi - context: T - accounts: AccountsApi - apiClient: PublicAPIClient - accountsApiClient: AccountsApiClient - internalApiClient: InternalAPIClient - internalApplicationsApi: internalApplicationsApi - - constructor( - apiClient: PublicAPIClient, - accountsApiClient: AccountsApiClient, - internalApiClient: InternalAPIClient - ) { - this.apiClient = apiClient - this.accountsApiClient = accountsApiClient - this.internalApiClient = internalApiClient - - this.auth = new AuthApi(this.internalApiClient) - this.accounts = new AccountsApi(this.accountsApiClient) - this.applications = new ApplicationApi(apiClient) - this.users = new UserApi(apiClient) - this.tables = new TableApi(apiClient) - this.rows = new RowApi(apiClient) - this.internalApplicationsApi = new internalApplicationsApi( - internalApiClient - ) - - this.context = {} - } - - async setupAccountAndTenant() { - // This step is required to create a new account and tenant for the tests, its part of - // the support for running tests in multiple environments. - const account = generateAccount() - await this.accounts.validateEmail(account.email) - await this.accounts.validateTenantId(account.tenantId) - process.env.TENANT_ID = account.tenantId - await this.accounts.create(account) - await this.updateApiClients(account.tenantName) - await this.auth.login(account.email, account.password) - const body = { - name: "My first app", - url: "my-first-app", - useTemplate: false, - sampleData: true, - } - await this.internalApplicationsApi.create(body) - } - - // After the account and tenant have been created, we need to get and set the API key for the test - async setApiKey() { - const apiKeyResponse = await this.auth.getApiKey() - this.apiClient.setApiKey(apiKeyResponse.apiKey) - } - async updateApiClients(tenantName: string) { - this.apiClient.setTenantName(tenantName) - this.applications = new ApplicationApi(this.apiClient) - this.rows = new RowApi(this.apiClient) - this.internalApiClient.setTenantName(tenantName) - this.internalApplicationsApi = new internalApplicationsApi( - this.internalApiClient - ) - this.auth = new AuthApi(this.internalApiClient) - this.context = {} - } - - async beforeAll() {} - - async afterAll() { - this.context = {} - } -} diff --git a/qa-core/src/config/public-api/TestConfiguration/rows.ts b/qa-core/src/config/public-api/TestConfiguration/rows.ts deleted file mode 100644 index c3689de5d8..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/rows.ts +++ /dev/null @@ -1,53 +0,0 @@ -import PublicAPIClient from "./PublicAPIClient" -import { - CreateRowParams, - Row, - SearchInputParams, -} from "@budibase/server/api/controllers/public/mapping/types" -import { HeadersInit, Response } from "node-fetch" -import { generateRow } from "../fixtures/tables" - -export default class RowApi { - api: PublicAPIClient - headers?: HeadersInit - tableId?: string - - constructor(apiClient: PublicAPIClient) { - this.api = apiClient - } - - async seed(tableId: string) { - return this.create(generateRow({ tableId })) - } - - async create(body: CreateRowParams): Promise<[Response, Row]> { - const response = await this.api.post(`/tables/${this.tableId}/rows`, { - body, - }) - const json = await response.json() - return [response, json.data] - } - - async read(id: string): Promise<[Response, Row]> { - const response = await this.api.get(`/tables/${this.tableId}/rows/${id}`) - const json = await response.json() - return [response, json.data] - } - - async search(body: SearchInputParams): Promise<[Response, [Row]]> { - const response = await this.api.post( - `/tables/${this.tableId}/rows/search`, - { body } - ) - const json = await response.json() - return [response, json.data] - } - - async update(id: string, body: Row): Promise<[Response, Row]> { - const response = await this.api.put(`/tables/${this.tableId}/rows/${id}`, { - body, - }) - const json = await response.json() - return [response, json.data] - } -} diff --git a/qa-core/src/config/public-api/TestConfiguration/users.ts b/qa-core/src/config/public-api/TestConfiguration/users.ts deleted file mode 100644 index c332777aed..0000000000 --- a/qa-core/src/config/public-api/TestConfiguration/users.ts +++ /dev/null @@ -1,44 +0,0 @@ -import PublicAPIClient from "./PublicAPIClient" -import { - CreateUserParams, - SearchInputParams, - User, -} from "@budibase/server/api/controllers/public/mapping/types" -import { Response } from "node-fetch" -import generateUser from "../fixtures/users" - -export default class UserApi { - api: PublicAPIClient - - constructor(apiClient: PublicAPIClient) { - this.api = apiClient - } - - async seed() { - return this.create(generateUser()) - } - - async create(body: CreateUserParams): Promise<[Response, User]> { - const response = await this.api.post(`/users`, { body }) - const json = await response.json() - return [response, json.data] - } - - async read(id: string): Promise<[Response, User]> { - const response = await this.api.get(`/users/${id}`) - const json = await response.json() - return [response, json.data] - } - - async search(body: SearchInputParams): Promise<[Response, [User]]> { - const response = await this.api.post(`/users/search`, { body }) - const json = await response.json() - return [response, json.data] - } - - async update(id: string, body: User): Promise<[Response, User]> { - const response = await this.api.put(`/users/${id}`, { body }) - const json = await response.json() - return [response, json.data] - } -} diff --git a/qa-core/src/config/public-api/fixtures/accounts.ts b/qa-core/src/config/public-api/fixtures/accounts.ts deleted file mode 100644 index 64b6d51f44..0000000000 --- a/qa-core/src/config/public-api/fixtures/accounts.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { NewAccount } from "./types/newAccount" - -import generator from "../../generator" -import { Hosting } from "@budibase/types" - -export const generateAccount = (): Partial => { - const randomGuid = generator.guid() - //Needs to start with a letter - let tenant: string = "tenant" + randomGuid - tenant = tenant.replace(/-/g, "") - - return { - email: `qa+${randomGuid}@budibase.com`, - hosting: Hosting.CLOUD, - name: `qa+${randomGuid}@budibase.com`, - password: `${randomGuid}`, - profession: "software_engineer", - size: "10+", - tenantId: `${tenant}`, - tenantName: `${tenant}`, - } -} diff --git a/qa-core/src/config/public-api/fixtures/applications.ts b/qa-core/src/config/public-api/fixtures/applications.ts deleted file mode 100644 index e2d1f85574..0000000000 --- a/qa-core/src/config/public-api/fixtures/applications.ts +++ /dev/null @@ -1,15 +0,0 @@ -import generator from "../../generator" -import { - Application, - CreateApplicationParams, -} from "@budibase/server/api/controllers/public/mapping/types" - -const generate = ( - overrides: Partial = {} -): CreateApplicationParams => ({ - name: generator.word(), - url: `/${generator.word()}`, - ...overrides, -}) - -export default generate diff --git a/qa-core/src/config/public-api/fixtures/types/newAccount.ts b/qa-core/src/config/public-api/fixtures/types/newAccount.ts deleted file mode 100644 index e7ad88e697..0000000000 --- a/qa-core/src/config/public-api/fixtures/types/newAccount.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Account } from "@budibase/types" - -export interface NewAccount extends Account { - password: string -} diff --git a/qa-core/src/environment.ts b/qa-core/src/environment.ts index 25d4c95057..9377461a24 100644 --- a/qa-core/src/environment.ts +++ b/qa-core/src/environment.ts @@ -1,12 +1,18 @@ +import { join } from "path" + +let LOADED = false +if (!LOADED) { + require("dotenv").config({ + path: join(__dirname, "..", ".env"), + }) + LOADED = true +} + const env = { - BUDIBASE_ACCOUNT_URL: process.env.BUDIBASE_ACCOUNT_URL, - BUDIBASE_PUBLIC_API_KEY: process.env.BUDIBASE_PUBLIC_API_KEY, - BUDIBASE_ACCOUNTS_URL: process.env.BUDIBASE_ACCOUNTS_URL, - BUDIBASE_HOST: process.env.BUDIBASE_HOST, - _set(key: any, value: any) { - process.env[key] = value - module.exports[key] = value - }, + BUDIBASE_URL: process.env.BUDIBASE_URL, + ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL, + BB_ADMIN_USER_EMAIL: process.env.BB_ADMIN_USER_EMAIL, + BB_ADMIN_USER_PASSWORD: process.env.BB_ADMIN_USER_PASSWORD, } export = env diff --git a/qa-core/src/internal-api/api/BudibaseInternalAPI.ts b/qa-core/src/internal-api/api/BudibaseInternalAPI.ts new file mode 100644 index 0000000000..5bb6b72ef0 --- /dev/null +++ b/qa-core/src/internal-api/api/BudibaseInternalAPI.ts @@ -0,0 +1,39 @@ +import AppAPI from "./apis/AppAPI" +import AuthAPI from "./apis/AuthAPI" +import EnvironmentAPI from "./apis/EnvironmentAPI" +import RoleAPI from "./apis/RoleAPI" +import RowAPI from "./apis/RowAPI" +import ScreenAPI from "./apis/ScreenAPI" +import SelfAPI from "./apis/SelfAPI" +import TableAPI from "./apis/TableAPI" +import UserAPI from "./apis/UserAPI" +import BudibaseInternalAPIClient from "./BudibaseInternalAPIClient" +import { State } from "../../types" + +export default class BudibaseInternalAPI { + client: BudibaseInternalAPIClient + + apps: AppAPI + auth: AuthAPI + environment: EnvironmentAPI + roles: RoleAPI + rows: RowAPI + screens: ScreenAPI + self: SelfAPI + tables: TableAPI + users: UserAPI + + constructor(state: State) { + this.client = new BudibaseInternalAPIClient(state) + + this.apps = new AppAPI(this.client) + this.auth = new AuthAPI(this.client, state) + this.environment = new EnvironmentAPI(this.client) + this.roles = new RoleAPI(this.client) + this.rows = new RowAPI(this.client) + this.screens = new ScreenAPI(this.client) + this.self = new SelfAPI(this.client) + this.tables = new TableAPI(this.client) + this.users = new UserAPI(this.client) + } +} diff --git a/qa-core/src/internal-api/api/BudibaseInternalAPIClient.ts b/qa-core/src/internal-api/api/BudibaseInternalAPIClient.ts new file mode 100644 index 0000000000..ab6c5f065e --- /dev/null +++ b/qa-core/src/internal-api/api/BudibaseInternalAPIClient.ts @@ -0,0 +1,76 @@ +import env from "../../environment" +import fetch, { HeadersInit } from "node-fetch" +import { State } from "../../types" + +type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" + +interface ApiOptions { + method?: APIMethod + body?: object + headers?: HeadersInit | undefined +} + +class BudibaseInternalAPIClient { + host: string + state: State + + constructor(state: State) { + if (!env.BUDIBASE_URL) { + throw new Error("Must set BUDIBASE_URL env var") + } + this.host = `${env.ACCOUNT_PORTAL_URL}/api` + this.host = `${env.BUDIBASE_URL}/api` + this.state = state + } + + apiCall = + (method: APIMethod) => + async (url = "", options: ApiOptions = {}) => { + const requestOptions = { + method, + body: JSON.stringify(options.body), + headers: { + "x-budibase-app-id": this.state.appId, + "Content-Type": "application/json", + Accept: "application/json", + cookie: this.state.cookie, + redirect: "follow", + follow: 20, + ...options.headers, + }, + credentials: "include", + } + + // prettier-ignore + // @ts-ignore + const response = await fetch(`${this.host}${url}`, requestOptions) + + let body: any + const contentType = response.headers.get("content-type") + if (contentType && contentType.includes("application/json")) { + body = await response.json() + } else { + body = await response.text() + } + + const message = `${method} ${url} - ${response.status} + Response body: ${JSON.stringify(body)} + Request body: ${requestOptions.body}` + + if (response.status > 499) { + console.error(message) + } else if (response.status >= 400) { + console.warn(message) + } + + return [response, body] + } + + post = this.apiCall("POST") + get = this.apiCall("GET") + patch = this.apiCall("PATCH") + del = this.apiCall("DELETE") + put = this.apiCall("PUT") +} + +export default BudibaseInternalAPIClient diff --git a/qa-core/src/internal-api/api/apis/AppAPI.ts b/qa-core/src/internal-api/api/apis/AppAPI.ts new file mode 100644 index 0000000000..992728899e --- /dev/null +++ b/qa-core/src/internal-api/api/apis/AppAPI.ts @@ -0,0 +1,173 @@ +import { App } from "@budibase/types" +import { Response } from "node-fetch" +import { + RouteConfig, + AppPackageResponse, + DeployConfig, + MessageResponse, +} from "../../../types" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" + +export default class AppAPI { + client: BudibaseInternalAPIClient + + constructor(client: BudibaseInternalAPIClient) { + this.client = client + } + + // TODO Fix the fetch apps to receive an optional number of apps and compare if the received app is more or less. + // each possible scenario should have its own method. + async fetchEmptyAppList(): Promise<[Response, App[]]> { + const [response, json] = await this.client.get(`/applications?status=all`) + expect(response).toHaveStatusCode(200) + expect(json.length).toBeGreaterThanOrEqual(0) + return [response, json] + } + + async fetchAllApplications(): Promise<[Response, App[]]> { + const [response, json] = await this.client.get(`/applications?status=all`) + expect(response).toHaveStatusCode(200) + expect(json.length).toBeGreaterThanOrEqual(1) + return [response, json] + } + + async canRender(): Promise<[Response, boolean]> { + const [response, json] = await this.client.get("/routing/client") + expect(response).toHaveStatusCode(200) + const publishedAppRenders = Object.keys(json.routes).length > 0 + expect(publishedAppRenders).toBe(true) + return [response, publishedAppRenders] + } + + async getAppPackage(appId: string): Promise<[Response, AppPackageResponse]> { + const [response, json] = await this.client.get( + `/applications/${appId}/appPackage` + ) + expect(response).toHaveStatusCode(200) + expect(json.application.appId).toEqual(appId) + return [response, json] + } + + async publish(appId: string | undefined): Promise<[Response, DeployConfig]> { + const [response, json] = await this.client.post( + `/applications/${appId}/publish` + ) + expect(response).toHaveStatusCode(200) + return [response, json] + } + + async create(body: any): Promise { + const [response, json] = await this.client.post(`/applications`, { body }) + expect(response).toHaveStatusCode(200) + expect(json._id).toBeDefined() + return json + } + + async read(id: string): Promise<[Response, App]> { + const [response, json] = await this.client.get(`/applications/${id}`) + return [response, json.data] + } + + async sync(appId: string): Promise<[Response, MessageResponse]> { + const [response, json] = await this.client.post( + `/applications/${appId}/sync` + ) + expect(response).toHaveStatusCode(200) + return [response, json] + } + + // TODO + async updateClient(appId: string, body: any): Promise<[Response, App]> { + const [response, json] = await this.client.put( + `/applications/${appId}/client/update`, + { body } + ) + return [response, json] + } + + async revertPublished(appId: string): Promise<[Response, MessageResponse]> { + const [response, json] = await this.client.post(`/dev/${appId}/revert`) + expect(response).toHaveStatusCode(200) + expect(json).toEqual({ + message: "Reverted changes successfully.", + }) + return [response, json] + } + + async revertUnpublished(appId: string): Promise<[Response, MessageResponse]> { + const [response, json] = await this.client.post(`/dev/${appId}/revert`) + expect(response).toHaveStatusCode(400) + expect(json).toEqual({ + message: "App has not yet been deployed", + status: 400, + }) + return [response, json] + } + + async delete(appId: string): Promise { + const [response, _] = await this.client.del(`/applications/${appId}`) + expect(response).toHaveStatusCode(200) + return response + } + + async rename( + appId: string, + oldName: string, + body: any + ): Promise<[Response, App]> { + const [response, json] = await this.client.put(`/applications/${appId}`, { + body, + }) + expect(response).toHaveStatusCode(200) + expect(json.name).not.toEqual(oldName) + return [response, json] + } + + async addScreentoApp(body: any): Promise<[Response, App]> { + const [response, json] = await this.client.post(`/screens`, { body }) + return [response, json] + } + + async getRoutes(screenExists?: boolean): Promise<[Response, RouteConfig]> { + const [response, json] = await this.client.get(`/routing`) + expect(response).toHaveStatusCode(200) + if (screenExists) { + expect(json.routes["/test"]).toBeTruthy() + } else { + expect(json.routes["/test"]).toBeUndefined() + } + + return [response, json] + } + + async unpublish(appId: string): Promise<[Response]> { + const [response, json] = await this.client.post( + `/applications/${appId}/unpublish` + ) + expect(response).toHaveStatusCode(204) + return [response] + } + + async unlock(appId: string): Promise<[Response, MessageResponse]> { + const [response, json] = await this.client.del(`/dev/${appId}/lock`) + expect(response).toHaveStatusCode(200) + expect(json.message).toEqual("Lock released successfully.") + return [response, json] + } + + async updateIcon(appId: string): Promise<[Response, App]> { + const body = { + icon: { + name: "ConversionFunnel", + color: "var(--spectrum-global-color-red-400)", + }, + } + const [response, json] = await this.client.put(`/applications/${appId}`, { + body, + }) + expect(response).toHaveStatusCode(200) + expect(json.icon.name).toEqual(body.icon.name) + expect(json.icon.color).toEqual(body.icon.color) + return [response, json] + } +} diff --git a/qa-core/src/internal-api/api/apis/AuthAPI.ts b/qa-core/src/internal-api/api/apis/AuthAPI.ts new file mode 100644 index 0000000000..fec9f7e503 --- /dev/null +++ b/qa-core/src/internal-api/api/apis/AuthAPI.ts @@ -0,0 +1,39 @@ +import { Response } from "node-fetch" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" +import { APIRequestOpts, State } from "../../../types" + +export default class AuthAPI { + state: State + client: BudibaseInternalAPIClient + + constructor(client: BudibaseInternalAPIClient, state: State) { + this.client = client + this.state = state + } + + async login( + tenantId: string, + email: String, + password: String, + opts: APIRequestOpts = { doExpect: true } + ): Promise<[Response, string]> { + const [response, json] = await this.client.post( + `/global/auth/${tenantId}/login`, + { + body: { + username: email, + password: password, + }, + } + ) + if (opts.doExpect) { + expect(response).toHaveStatusCode(200) + } + const cookie = response.headers.get("set-cookie") + return [response, cookie!] + } + + async logout(): Promise { + return this.client.post(`/global/auth/logout`) + } +} diff --git a/qa-core/src/internal-api/api/apis/EnvironmentAPI.ts b/qa-core/src/internal-api/api/apis/EnvironmentAPI.ts new file mode 100644 index 0000000000..c9458d92a5 --- /dev/null +++ b/qa-core/src/internal-api/api/apis/EnvironmentAPI.ts @@ -0,0 +1,21 @@ +import { GetEnvironmentResponse } from "@budibase/types" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" +import { APIRequestOpts } from "../../../types" + +export default class EnvironmentAPI { + client: BudibaseInternalAPIClient + + constructor(client: BudibaseInternalAPIClient) { + this.client = client + } + + async getEnvironment( + opts: APIRequestOpts = { doExpect: true } + ): Promise { + const [response, json] = await this.client.get(`/system/environment`) + if (opts.doExpect) { + expect(response.status).toBe(200) + } + return json + } +} diff --git a/qa-core/src/internal-api/api/apis/RoleAPI.ts b/qa-core/src/internal-api/api/apis/RoleAPI.ts new file mode 100644 index 0000000000..4c77a23ca3 --- /dev/null +++ b/qa-core/src/internal-api/api/apis/RoleAPI.ts @@ -0,0 +1,23 @@ +import { Response } from "node-fetch" +import { Role, UserRoles } from "@budibase/types" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" + +export default class RoleAPI { + client: BudibaseInternalAPIClient + + constructor(client: BudibaseInternalAPIClient) { + this.client = client + } + + async getRoles(): Promise<[Response, Role[]]> { + const [response, json] = await this.client.get(`/roles`) + expect(response).toHaveStatusCode(200) + return [response, json] + } + + async createRole(body: Partial): Promise<[Response, UserRoles]> { + const [response, json] = await this.client.post(`/roles`, { body }) + expect(response).toHaveStatusCode(200) + return [response, json] + } +} diff --git a/qa-core/src/config/internal-api/TestConfiguration/rows.ts b/qa-core/src/internal-api/api/apis/RowAPI.ts similarity index 63% rename from qa-core/src/config/internal-api/TestConfiguration/rows.ts rename to qa-core/src/internal-api/api/apis/RowAPI.ts index 7269807f56..6818ae0067 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/rows.ts +++ b/qa-core/src/internal-api/api/apis/RowAPI.ts @@ -1,18 +1,18 @@ import { Response } from "node-fetch" import { Row } from "@budibase/types" -import InternalAPIClient from "./InternalAPIClient" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" -export default class RowsApi { - api: InternalAPIClient +export default class RowAPI { rowAdded: boolean - constructor(apiClient: InternalAPIClient) { - this.api = apiClient + client: BudibaseInternalAPIClient + + constructor(client: BudibaseInternalAPIClient) { + this.client = client this.rowAdded = false } async getAll(tableId: string): Promise<[Response, Row[]]> { - const response = await this.api.get(`/${tableId}/rows`) - const json = await response.json() + const [response, json] = await this.client.get(`/${tableId}/rows`) if (this.rowAdded) { expect(response).toHaveStatusCode(200) expect(json.length).toBeGreaterThanOrEqual(1) @@ -20,8 +20,9 @@ export default class RowsApi { return [response, json] } async add(tableId: string, body: any): Promise<[Response, Row]> { - const response = await this.api.post(`/${tableId}/rows`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/${tableId}/rows`, { + body, + }) expect(response).toHaveStatusCode(200) expect(json._id).toBeDefined() expect(json._rev).toBeDefined() @@ -31,8 +32,9 @@ export default class RowsApi { } async delete(tableId: string, body: any): Promise<[Response, Row[]]> { - const response = await this.api.del(`/${tableId}/rows/`, { body }) - const json = await response.json() + const [response, json] = await this.client.del(`/${tableId}/rows/`, { + body, + }) expect(response).toHaveStatusCode(200) return [response, json] } @@ -41,8 +43,9 @@ export default class RowsApi { tableId: string, body: any ): Promise<[Response, Row[]]> { - const response = await this.api.post(`/${tableId}/search`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/${tableId}/search`, { + body, + }) expect(response).toHaveStatusCode(200) expect(json.hasNextPage).toEqual(false) return [response, json.rows] @@ -52,8 +55,9 @@ export default class RowsApi { tableId: string, body: any ): Promise<[Response, Row[]]> { - const response = await this.api.post(`/${tableId}/search`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/${tableId}/search`, { + body, + }) expect(response).toHaveStatusCode(200) expect(json.hasNextPage).toEqual(true) expect(json.rows.length).toEqual(10) diff --git a/qa-core/src/config/internal-api/TestConfiguration/screens.ts b/qa-core/src/internal-api/api/apis/ScreenAPI.ts similarity index 54% rename from qa-core/src/config/internal-api/TestConfiguration/screens.ts rename to qa-core/src/internal-api/api/apis/ScreenAPI.ts index 8ec377599e..8d511be263 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/screens.ts +++ b/qa-core/src/internal-api/api/apis/ScreenAPI.ts @@ -1,17 +1,16 @@ import { Screen } from "@budibase/types" import { Response } from "node-fetch" -import InternalAPIClient from "./InternalAPIClient" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" -export default class ScreenApi { - api: InternalAPIClient +export default class ScreenAPI { + client: BudibaseInternalAPIClient - constructor(apiClient: InternalAPIClient) { - this.api = apiClient + constructor(client: BudibaseInternalAPIClient) { + this.client = client } async create(body: any): Promise<[Response, Screen]> { - const response = await this.api.post(`/screens`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/screens`, { body }) expect(response).toHaveStatusCode(200) expect(json._id).toBeDefined() expect(json.routing.roleId).toBe(body.routing.roleId) @@ -19,8 +18,9 @@ export default class ScreenApi { } async delete(screenId: string, rev: string): Promise<[Response, Screen]> { - const response = await this.api.del(`/screens/${screenId}/${rev}`) - const json = await response.json() + const [response, json] = await this.client.del( + `/screens/${screenId}/${rev}` + ) expect(response).toHaveStatusCode(200) return [response, json] } diff --git a/qa-core/src/internal-api/api/apis/SelfAPI.ts b/qa-core/src/internal-api/api/apis/SelfAPI.ts new file mode 100644 index 0000000000..a2c1d1fbb8 --- /dev/null +++ b/qa-core/src/internal-api/api/apis/SelfAPI.ts @@ -0,0 +1,33 @@ +import { Response } from "node-fetch" +import { User } from "@budibase/types" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" +import { ApiKeyResponse } from "../../../types" + +export default class SelfAPI { + client: BudibaseInternalAPIClient + + constructor(client: BudibaseInternalAPIClient) { + this.client = client + } + + async getSelf(): Promise<[Response, Partial]> { + const [response, json] = await this.client.get(`/global/self`) + expect(response).toHaveStatusCode(200) + return [response, json] + } + + async changeSelfPassword(body: Partial): Promise<[Response, User]> { + const [response, json] = await this.client.post(`/global/self`, { body }) + expect(response).toHaveStatusCode(200) + expect(json._id).toEqual(body._id) + expect(json._rev).not.toEqual(body._rev) + return [response, json] + } + + async getApiKey(): Promise { + const [response, json] = await this.client.get(`/global/self/api_key`) + expect(response).toHaveStatusCode(200) + expect(json).toHaveProperty("apiKey") + return json + } +} diff --git a/qa-core/src/config/internal-api/TestConfiguration/tables.ts b/qa-core/src/internal-api/api/apis/TableAPI.ts similarity index 57% rename from qa-core/src/config/internal-api/TestConfiguration/tables.ts rename to qa-core/src/internal-api/api/apis/TableAPI.ts index 5e52b71c94..4733301de6 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/tables.ts +++ b/qa-core/src/internal-api/api/apis/TableAPI.ts @@ -1,34 +1,31 @@ import { Response } from "node-fetch" import { Table } from "@budibase/types" -import InternalAPIClient from "./InternalAPIClient" -import { responseMessage } from "../fixtures/types/responseMessage" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" +import { MessageResponse } from "../../../types" -export default class TablesApi { - api: InternalAPIClient +export default class TableAPI { + client: BudibaseInternalAPIClient - constructor(apiClient: InternalAPIClient) { - this.api = apiClient + constructor(client: BudibaseInternalAPIClient) { + this.client = client } async getAll(expectedNumber: Number): Promise<[Response, Table[]]> { - const response = await this.api.get(`/tables`) - const json = await response.json() + const [response, json] = await this.client.get(`/tables`) expect(response).toHaveStatusCode(200) expect(json.length).toBe(expectedNumber) return [response, json] } async getTableById(id: string): Promise<[Response, Table]> { - const response = await this.api.get(`/tables/${id}`) - const json = await response.json() + const [response, json] = await this.client.get(`/tables/${id}`) expect(response).toHaveStatusCode(200) expect(json._id).toEqual(id) return [response, json] } async save(body: any, columnAdded?: boolean): Promise<[Response, Table]> { - const response = await this.api.post(`/tables`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/tables`, { body }) expect(response).toHaveStatusCode(200) expect(json._id).toBeDefined() expect(json._rev).toBeDefined() @@ -40,8 +37,7 @@ export default class TablesApi { } async forbiddenSave(body: any): Promise<[Response, Table]> { - const response = await this.api.post(`/tables`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/tables`, { body }) expect(response).toHaveStatusCode(403) return [response, json] @@ -50,9 +46,8 @@ export default class TablesApi { async delete( id: string, revId: string - ): Promise<[Response, responseMessage]> { - const response = await this.api.del(`/tables/${id}/${revId}`) - const json = await response.json() + ): Promise<[Response, MessageResponse]> { + const [response, json] = await this.client.del(`/tables/${id}/${revId}`) expect(response).toHaveStatusCode(200) expect(json.message).toEqual(`Table ${id} deleted.`) return [response, json] diff --git a/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts b/qa-core/src/internal-api/api/apis/UserAPI.ts similarity index 62% rename from qa-core/src/config/internal-api/TestConfiguration/userManagement.ts rename to qa-core/src/internal-api/api/apis/UserAPI.ts index 20909e8e86..44a1283241 100644 --- a/qa-core/src/config/internal-api/TestConfiguration/userManagement.ts +++ b/qa-core/src/internal-api/api/apis/UserAPI.ts @@ -1,33 +1,30 @@ import { Response } from "node-fetch" import { Role, User, UserDeletedEvent, UserRoles } from "@budibase/types" -import InternalAPIClient from "./InternalAPIClient" -import { responseMessage } from "../fixtures/types/responseMessage" +import BudibaseInternalAPIClient from "../BudibaseInternalAPIClient" +import { MessageResponse } from "../../../types" -export default class UserManagementApi { - api: InternalAPIClient +export default class UserAPI { + client: BudibaseInternalAPIClient - constructor(apiClient: InternalAPIClient) { - this.api = apiClient + constructor(client: BudibaseInternalAPIClient) { + this.client = client } async search(): Promise<[Response, Partial[]]> { - const response = await this.api.post(`/global/users/search`, {}) - const json = await response.json() + const [response, json] = await this.client.post(`/global/users/search`, {}) expect(response).toHaveStatusCode(200) expect(json.data.length).toBeGreaterThan(0) return [response, json] } async getSelf(): Promise<[Response, Partial]> { - const response = await this.api.get(`/global/self`) - const json = await response.json() + const [response, json] = await this.client.get(`/global/self`) expect(response).toHaveStatusCode(200) return [response, json] } async getAll(): Promise<[Response, Partial[]]> { - const response = await this.api.get(`/global/users`) - const json = await response.json() + const [response, json] = await this.client.get(`/global/users`) expect(response).toHaveStatusCode(200) expect(json.length).toBeGreaterThan(0) return [response, json] @@ -41,22 +38,24 @@ export default class UserManagementApi { groups: [], }, } - const response = await this.api.post(`/global/users/bulk`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/global/users/bulk`, { + body, + }) expect(response).toHaveStatusCode(200) expect(json.created.unsuccessful.length).toEqual(0) expect(json.created.successful.length).toEqual(body.create.users.length) return [response, json] } - async deleteMultiple(userId: string[]): Promise<[Response, responseMessage]> { + async deleteMultiple(userId: string[]): Promise<[Response, MessageResponse]> { const body = { delete: { userIds: [userId], }, } - const response = await this.api.post(`/global/users/bulk`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/global/users/bulk`, { + body, + }) expect(response).toHaveStatusCode(200) expect(json.deleted.successful.length).toEqual(1) expect(json.deleted.unsuccessful.length).toEqual(0) @@ -64,16 +63,17 @@ export default class UserManagementApi { return [response, json] } async delete(userId: string): Promise<[Response, UserDeletedEvent]> { - const response = await this.api.del(`/global/users/${userId}`) - const json = await response.json() + const [response, json] = await this.client.del(`/global/users/${userId}`) expect(response).toHaveStatusCode(200) expect(json.message).toEqual(`User ${userId} deleted.`) return [response, json] } - async invite(body: any): Promise<[Response, responseMessage]> { - const response = await this.api.post(`/global/users/multi/invite`, { body }) - const json = await response.json() + async invite(body: any): Promise<[Response, MessageResponse]> { + const [response, json] = await this.client.post( + `/global/users/multi/invite`, + { body } + ) expect(response).toHaveStatusCode(200) expect(json.unsuccessful.length).toEqual(0) expect(json.successful.length).toEqual(body.length) @@ -82,15 +82,13 @@ export default class UserManagementApi { } async getRoles(): Promise<[Response, Role[]]> { - const response = await this.api.get(`/roles`) - const json = await response.json() + const [response, json] = await this.client.get(`/roles`) expect(response).toHaveStatusCode(200) return [response, json] } async updateInfo(body: any): Promise<[Response, User]> { - const response = await this.api.post(`/global/users/`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/global/users/`, { body }) expect(response).toHaveStatusCode(200) expect(json._id).toEqual(body._id) expect(json._rev).not.toEqual(body._rev) @@ -98,8 +96,7 @@ export default class UserManagementApi { } async forcePasswordReset(body: any): Promise<[Response, User]> { - const response = await this.api.post(`/global/users/`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/global/users/`, { body }) expect(response).toHaveStatusCode(200) expect(json._id).toEqual(body._id) expect(json._rev).not.toEqual(body._rev) @@ -107,15 +104,13 @@ export default class UserManagementApi { } async getInfo(userId: string): Promise<[Response, User]> { - const response = await this.api.get(`/global/users/${userId}`) - const json = await response.json() + const [response, json] = await this.client.get(`/global/users/${userId}`) expect(response).toHaveStatusCode(200) return [response, json] } async changeSelfPassword(body: Partial): Promise<[Response, User]> { - const response = await this.api.post(`/global/self`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/global/self`, { body }) expect(response).toHaveStatusCode(200) expect(json._id).toEqual(body._id) expect(json._rev).not.toEqual(body._rev) @@ -123,8 +118,7 @@ export default class UserManagementApi { } async createRole(body: Partial): Promise<[Response, UserRoles]> { - const response = await this.api.post(`/roles`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/roles`, { body }) expect(response).toHaveStatusCode(200) return [response, json] } diff --git a/qa-core/src/internal-api/api/index.ts b/qa-core/src/internal-api/api/index.ts new file mode 100644 index 0000000000..b6d01a710a --- /dev/null +++ b/qa-core/src/internal-api/api/index.ts @@ -0,0 +1 @@ +export { default as BudibaseInternalAPI } from "./BudibaseInternalAPI" diff --git a/qa-core/src/internal-api/config/TestConfiguration.ts b/qa-core/src/internal-api/config/TestConfiguration.ts new file mode 100644 index 0000000000..dc5fec73dc --- /dev/null +++ b/qa-core/src/internal-api/config/TestConfiguration.ts @@ -0,0 +1,25 @@ +import { BudibaseInternalAPI } from "../api" +import { BudibaseTestConfiguration } from "../../shared" + +export default class TestConfiguration extends BudibaseTestConfiguration { + // apis + api: BudibaseInternalAPI + + // context + context: T + + constructor() { + super() + // for brevity + this.api = this.internalApi + this.context = {} + } + + async beforeAll() { + await super.beforeAll() + } + + async afterAll() { + await super.afterAll() + } +} diff --git a/qa-core/src/internal-api/config/index.ts b/qa-core/src/internal-api/config/index.ts new file mode 100644 index 0000000000..182c7825b6 --- /dev/null +++ b/qa-core/src/internal-api/config/index.ts @@ -0,0 +1 @@ +export { default as TestConfiguration } from "./TestConfiguration" diff --git a/qa-core/src/internal-api/fixtures/accounts.ts b/qa-core/src/internal-api/fixtures/accounts.ts new file mode 100644 index 0000000000..ff7042a1ad --- /dev/null +++ b/qa-core/src/internal-api/fixtures/accounts.ts @@ -0,0 +1,20 @@ +import { generator } from "../../shared" +import { Hosting, CreateAccountRequest } from "@budibase/types" + +export const generateAccount = (): CreateAccountRequest => { + const uuid = generator.guid() + + const email = `qa+${uuid}@budibase.com` + const tenant = `tenant${uuid.replace(/-/g, "")}` + + return { + email, + hosting: Hosting.CLOUD, + name: email, + password: uuid, + profession: "software_engineer", + size: "10+", + tenantId: tenant, + tenantName: tenant, + } +} diff --git a/qa-core/src/config/internal-api/fixtures/applications.ts b/qa-core/src/internal-api/fixtures/applications.ts similarity index 57% rename from qa-core/src/config/internal-api/fixtures/applications.ts rename to qa-core/src/internal-api/fixtures/applications.ts index 45d82cf4f0..542d4345dc 100644 --- a/qa-core/src/config/internal-api/fixtures/applications.ts +++ b/qa-core/src/internal-api/fixtures/applications.ts @@ -1,21 +1,20 @@ -import generator from "../../generator" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import { Template } from "@budibase/types" -import { App } from "@budibase/types" +import { generator } from "../../shared" +import { CreateAppRequest } from "../../types" export const generateApp = ( - overrides: Partial = {} -): Partial => ({ + overrides: Partial = {} +): CreateAppRequest => ({ name: generator.word() + generator.hash(), url: `/${generator.word() + generator.hash()}`, ...overrides, }) // Applications type doesn't work here, save to add useTemplate parameter? -export const appFromTemplate = (): any => { +export const appFromTemplate = (): CreateAppRequest => { return { name: generator.word(), url: `/${generator.word()}`, + // @ts-ignore useTemplate: "true", templateName: "Near Miss Register", templateKey: "app/near-miss-register", diff --git a/qa-core/src/internal-api/fixtures/index.ts b/qa-core/src/internal-api/fixtures/index.ts new file mode 100644 index 0000000000..d97c5f76b7 --- /dev/null +++ b/qa-core/src/internal-api/fixtures/index.ts @@ -0,0 +1,6 @@ +export * as accounts from "./accounts" +export * as apps from "./applications" +export * as rows from "./rows" +export * as screens from "./screens" +export * as tables from "./tables" +export * as users from "./users" diff --git a/qa-core/src/config/internal-api/fixtures/rows.ts b/qa-core/src/internal-api/fixtures/rows.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/rows.ts rename to qa-core/src/internal-api/fixtures/rows.ts diff --git a/qa-core/src/config/internal-api/fixtures/screens.ts b/qa-core/src/internal-api/fixtures/screens.ts similarity index 81% rename from qa-core/src/config/internal-api/fixtures/screens.ts rename to qa-core/src/internal-api/fixtures/screens.ts index 044a35ba83..97010cc8b6 100644 --- a/qa-core/src/config/internal-api/fixtures/screens.ts +++ b/qa-core/src/internal-api/fixtures/screens.ts @@ -1,8 +1,8 @@ -import generator from "../../generator" +import { generator } from "../../shared" const randomId = generator.guid() -const generateScreen = (roleId: string): any => ({ +export const generateScreen = (roleId: string): any => ({ showNavigation: true, width: "Large", name: randomId, @@ -30,5 +30,3 @@ const generateScreen = (roleId: string): any => ({ homeScreen: false, }, }) - -export default generateScreen diff --git a/qa-core/src/config/internal-api/fixtures/table.ts b/qa-core/src/internal-api/fixtures/tables.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/table.ts rename to qa-core/src/internal-api/fixtures/tables.ts diff --git a/qa-core/src/config/internal-api/fixtures/userManagement.ts b/qa-core/src/internal-api/fixtures/users.ts similarity index 86% rename from qa-core/src/config/internal-api/fixtures/userManagement.ts rename to qa-core/src/internal-api/fixtures/users.ts index 90ea6bd738..9979ef7663 100644 --- a/qa-core/src/config/internal-api/fixtures/userManagement.ts +++ b/qa-core/src/internal-api/fixtures/users.ts @@ -1,10 +1,10 @@ -import generator from "../../generator" +import { generator } from "../../shared" import { User } from "@budibase/types" const generateDeveloper = (): Partial => { const randomId = generator.guid() return { - email: `pedro+${randomId}@budibase.com`, + email: `${randomId}@budibase.com`, password: randomId, roles: {}, forceResetPassword: true, @@ -17,7 +17,7 @@ const generateDeveloper = (): Partial => { const generateAdmin = (): Partial => { const randomId = generator.guid() return { - email: `pedro+${randomId}@budibase.com`, + email: `${randomId}@budibase.com`, password: randomId, roles: {}, forceResetPassword: true, @@ -32,7 +32,7 @@ const generateAdmin = (): Partial => { const generateAppUser = (): Partial => { const randomId = generator.guid() return { - email: `pedro+${randomId}@budibase.com`, + email: `${randomId}@budibase.com`, password: randomId, roles: {}, forceResetPassword: true, @@ -49,7 +49,7 @@ export const generateInviteUser = (): Object[] => { const randomId = generator.guid() return [ { - email: `pedro+${randomId}@budibase.com`, + email: `${randomId}@budibase.com`, userInfo: { userGroups: [], }, diff --git a/qa-core/src/internal-api/index.ts b/qa-core/src/internal-api/index.ts new file mode 100644 index 0000000000..e1a716605a --- /dev/null +++ b/qa-core/src/internal-api/index.ts @@ -0,0 +1 @@ +export * from "./api" diff --git a/qa-core/src/internal-api/tests/applications/create.spec.ts b/qa-core/src/internal-api/tests/applications/create.spec.ts new file mode 100644 index 0000000000..2bb209719c --- /dev/null +++ b/qa-core/src/internal-api/tests/applications/create.spec.ts @@ -0,0 +1,42 @@ +import TestConfiguration from "../../config/TestConfiguration" +import * as fixtures from "../../fixtures" + +describe("Internal API - Application creation", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Get applications without applications", async () => { + await config.api.apps.fetchEmptyAppList() + }) + + it("Get all Applications after creating an application", async () => { + await config.api.apps.create({ + ...fixtures.apps.generateApp(), + useTemplate: "false", + }) + + await config.api.apps.fetchAllApplications() + }) + + it("Get application details", async () => { + const app = await config.createApp({ + ...fixtures.apps.generateApp(), + useTemplate: "false", + }) + + const [appPackageResponse, appPackageJson] = + await config.api.apps.getAppPackage(app.appId!) + expect(appPackageJson.application.name).toEqual(app.name) + expect(appPackageJson.application.version).toEqual(app.version) + expect(appPackageJson.application.url).toEqual(app.url) + expect(appPackageJson.application.tenantId).toEqual(app.tenantId) + expect(appPackageJson.application.status).toEqual(app.status) + }) +}) diff --git a/qa-core/src/internal-api/tests/applications/delete.spec.ts b/qa-core/src/internal-api/tests/applications/delete.spec.ts new file mode 100644 index 0000000000..1841d7c42d --- /dev/null +++ b/qa-core/src/internal-api/tests/applications/delete.spec.ts @@ -0,0 +1,19 @@ +import TestConfiguration from "../../config/TestConfiguration" + +describe("Internal API - Application creation, update, publish and delete", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("DELETE - Delete an application", async () => { + const app = await config.createApp() + + await config.api.apps.delete(app.appId!) + }) +}) diff --git a/qa-core/src/internal-api/tests/applications/publish.spec.ts b/qa-core/src/internal-api/tests/applications/publish.spec.ts new file mode 100644 index 0000000000..3d5fa7c598 --- /dev/null +++ b/qa-core/src/internal-api/tests/applications/publish.spec.ts @@ -0,0 +1,54 @@ +import TestConfiguration from "../../config/TestConfiguration" +import { db } from "@budibase/backend-core" +import * as fixtures from "../../fixtures" + +describe("Internal API - Application creation, update, publish and delete", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Publish app", async () => { + // create the app + const app = await config.createApp(fixtures.apps.appFromTemplate()) + + // check preview renders + await config.api.apps.canRender() + + // publish app + await config.api.apps.publish(app.appId) + + // check published app renders + config.state.appId = db.getProdAppID(app.appId!) + await config.api.apps.canRender() + + // unpublish app + await config.api.apps.unpublish(app.appId!) + }) + + it("Sync application before deployment", async () => { + const app = await config.createApp() + + const [syncResponse, sync] = await config.api.apps.sync(app.appId!) + expect(sync).toEqual({ + message: "App sync not required, app not deployed.", + }) + }) + + it("Sync application after deployment", async () => { + const app = await config.createApp() + + // publish app + await config.api.apps.publish(app._id) + + const [syncResponse, sync] = await config.api.apps.sync(app.appId!) + expect(sync).toEqual({ + message: "App sync completed successfully.", + }) + }) +}) diff --git a/qa-core/src/internal-api/tests/applications/update.spec.ts b/qa-core/src/internal-api/tests/applications/update.spec.ts new file mode 100644 index 0000000000..93b57dcb61 --- /dev/null +++ b/qa-core/src/internal-api/tests/applications/update.spec.ts @@ -0,0 +1,45 @@ +import TestConfiguration from "../../config/TestConfiguration" +import { generator } from "../../../shared" +import * as fixtures from "../../fixtures" + +describe("Internal API - Application creation, update, publish and delete", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Update an application", async () => { + const app = await config.createApp() + + await config.api.apps.rename(app.appId!, app.name!, { + name: generator.word(), + }) + }) + + it("Revert Changes without changes", async () => { + const app = await config.createApp() + + await config.api.apps.revertUnpublished(app.appId!) + }) + + it("Revert Changes", async () => { + const app = await config.createApp() + + // publish app + await config.api.apps.publish(app._id) + + // Change/add component to the app + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + + // // Revert the app to published state + await config.api.apps.revertPublished(app.appId!) + + // Check screen is removed + await config.api.apps.getRoutes() + }) +}) diff --git a/qa-core/src/internal-api/tests/dataSources/example.spec.ts b/qa-core/src/internal-api/tests/dataSources/example.spec.ts new file mode 100644 index 0000000000..0b8bc38a45 --- /dev/null +++ b/qa-core/src/internal-api/tests/dataSources/example.spec.ts @@ -0,0 +1,27 @@ +import TestConfiguration from "../../config/TestConfiguration" +import * as fixtures from "../../fixtures" + +describe("Internal API - Data Sources", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Create an app with a data source", async () => { + // Create app + await config.createApp() + + // Create Screen + const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"] + for (let role in roleArray) { + const [response, screen] = await config.api.screens.create( + fixtures.screens.generateScreen(roleArray[role]) + ) + } + }) +}) diff --git a/qa-core/src/internal-api/tests/screens/screens.spec.ts b/qa-core/src/internal-api/tests/screens/screens.spec.ts new file mode 100644 index 0000000000..9c5fa42847 --- /dev/null +++ b/qa-core/src/internal-api/tests/screens/screens.spec.ts @@ -0,0 +1,51 @@ +import TestConfiguration from "../../config/TestConfiguration" +import * as fixtures from "../../fixtures" + +describe("Internal API - /screens endpoints", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Create a screen with each role type", async () => { + // Create app + await config.createApp() + + // Create Screen + const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"] + for (let role in roleArray) { + const [response, screen] = await config.api.screens.create( + fixtures.screens.generateScreen(roleArray[role]) + ) + } + }) + + it("Get screens", async () => { + // Create app + await config.createApp() + + // Create Screen + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + + // Check screen exists + await config.api.apps.getRoutes(true) + }) + + it("Delete a screen", async () => { + // Create app + await config.createApp() + + // Create Screen + const [screenResponse, screen] = await config.api.screens.create( + fixtures.screens.generateScreen("BASIC") + ) + + // Delete Screen + await config.api.screens.delete(screen._id!, screen._rev!) + }) +}) diff --git a/qa-core/src/internal-api/tests/tables/tables.spec.ts b/qa-core/src/internal-api/tests/tables/tables.spec.ts new file mode 100644 index 0000000000..09d8f68e86 --- /dev/null +++ b/qa-core/src/internal-api/tests/tables/tables.spec.ts @@ -0,0 +1,144 @@ +import TestConfiguration from "../../config/TestConfiguration" +import { generator } from "../../../shared" +import * as fixtures from "../../fixtures" + +describe("Internal API - Table Operations", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + async function createAppFromTemplate() { + return config.api.apps.create({ + name: generator.word(), + url: `/${generator.word()}`, + useTemplate: "true", + templateName: "Near Miss Register", + templateKey: "app/near-miss-register", + templateFile: undefined, + }) + } + + it("Create and delete table, columns and rows", async () => { + // create the app + await config.createApp(fixtures.apps.appFromTemplate()) + + // Get current tables: expect 2 in this template + await config.api.tables.getAll(2) + + // Add new table + const [createdTableResponse, createdTableData] = + await config.api.tables.save(fixtures.tables.generateTable()) + + //Table was added + await config.api.tables.getAll(3) + + //Get information about the table + await config.api.tables.getTableById(createdTableData._id!) + + //Add Column to table + const newColumn = + fixtures.tables.generateNewColumnForTable(createdTableData) + const [addColumnResponse, addColumnData] = await config.api.tables.save( + newColumn, + true + ) + + //Add Row to table + const newRow = fixtures.rows.generateNewRowForTable(addColumnData._id!) + await config.api.rows.add(addColumnData._id!, newRow) + + //Get Row from table + const [getRowResponse, getRowData] = await config.api.rows.getAll( + addColumnData._id! + ) + + //Delete Row from table + const rowToDelete = { + rows: [getRowData[0]], + } + const [deleteRowResponse, deleteRowData] = await config.api.rows.delete( + addColumnData._id!, + rowToDelete + ) + expect(deleteRowData[0]._id).toEqual(getRowData[0]._id) + + //Delete the table + const [deleteTableResponse, deleteTable] = await config.api.tables.delete( + addColumnData._id!, + addColumnData._rev! + ) + + //Table was deleted + await config.api.tables.getAll(2) + }) + + it("Search and pagination", async () => { + // create the app + await config.createApp(fixtures.apps.appFromTemplate()) + + // Get current tables: expect 2 in this template + await config.api.tables.getAll(2) + + // Add new table + const [createdTableResponse, createdTableData] = + await config.api.tables.save(fixtures.tables.generateTable()) + + //Table was added + await config.api.tables.getAll(3) + + //Get information about the table + await config.api.tables.getTableById(createdTableData._id!) + + //Add Column to table + const newColumn = + fixtures.tables.generateNewColumnForTable(createdTableData) + const [addColumnResponse, addColumnData] = await config.api.tables.save( + newColumn, + true + ) + + //Add Row to table + let newRow = fixtures.rows.generateNewRowForTable(addColumnData._id!) + await config.api.rows.add(addColumnData._id!, newRow) + + //Search single row + await config.api.rows.searchNoPagination( + createdTableData._id!, + fixtures.rows.searchBody(createdTableData.primaryDisplay!) + ) + + //Add 10 more rows + for (let i = 0; i < 10; i++) { + let newRow = fixtures.rows.generateNewRowForTable(addColumnData._id!) + await config.api.rows.add(addColumnData._id!, newRow) + } + + //Search rows with pagination + const [allRowsResponse, allRowsJson] = + await config.api.rows.searchWithPagination( + createdTableData._id!, + fixtures.rows.searchBody(createdTableData.primaryDisplay!) + ) + + //Delete Rows from table + const rowToDelete = { + rows: [allRowsJson], + } + const [deleteRowResponse, deleteRowData] = await config.api.rows.delete( + createdTableData._id!, + rowToDelete + ) + + //Search single row + await config.api.rows.searchWithPagination( + createdTableData._id!, + fixtures.rows.searchBody(createdTableData.primaryDisplay!) + ) + }) +}) diff --git a/qa-core/src/internal-api/tests/users/appSpecificRoles.spec.ts b/qa-core/src/internal-api/tests/users/appSpecificRoles.spec.ts new file mode 100644 index 0000000000..c3c9395b78 --- /dev/null +++ b/qa-core/src/internal-api/tests/users/appSpecificRoles.spec.ts @@ -0,0 +1,107 @@ +import TestConfiguration from "../../config/TestConfiguration" +import { User } from "@budibase/types" +import { db } from "@budibase/backend-core" +import * as fixtures from "../../fixtures" + +describe("Internal API - App Specific Roles & Permissions", () => { + const config = new TestConfiguration() + + // Before each test, login as admin. Some tests will require login as a different user + beforeAll(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + afterAll(async () => { + await config.afterAll() + }) + + it("Add BASIC user to app", async () => { + const appUser = fixtures.users.generateUser() + expect(appUser[0].builder?.global).toEqual(false) + expect(appUser[0].admin?.global).toEqual(false) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) + + const app = await config.createApp(fixtures.apps.appFromTemplate()) + + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( + createUserJson.created.successful[0]._id + ) + const body: User = { + ...userInfoJson, + roles: { + [app.appId!]: "BASIC", + }, + } + await config.api.users.updateInfo(body) + + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.users.getInfo(createUserJson.created.successful[0]._id) + expect(changedUserInfoJson.roles[app.appId!]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId!]).toEqual("BASIC") + }) + + it("Add ADMIN user to app", async () => { + // Create a user with ADMIN role and check if it was created successfully + const adminUser = fixtures.users.generateUser(1, "admin") + expect(adminUser[0].builder?.global).toEqual(true) + expect(adminUser[0].admin?.global).toEqual(true) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(adminUser) + + // const app = await config.createApp(fixtures.apps.appFromTemplate()) + const app = await config.createApp(fixtures.apps.appFromTemplate()) + + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( + createUserJson.created.successful[0]._id + ) + const body: User = { + ...userInfoJson, + roles: { + [app.appId!]: "ADMIN", + }, + } + await config.api.users.updateInfo(body) + + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.users.getInfo(createUserJson.created.successful[0]._id) + expect(changedUserInfoJson.roles[app.appId!]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId!]).toEqual("ADMIN") + + // publish app + await config.api.apps.publish(app.appId) + // check published app renders + config.state.appId = db.getProdAppID(app.appId!) + await config.api.apps.canRender() + }) + + it("Add POWER user to app", async () => { + const powerUser = fixtures.users.generateUser(1, "developer") + expect(powerUser[0].builder?.global).toEqual(true) + + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(powerUser) + + const app = await config.createApp() + + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( + createUserJson.created.successful[0]._id + ) + const body: User = { + ...userInfoJson, + roles: { + [app.appId!]: "POWER", + }, + } + await config.api.users.updateInfo(body) + + // Get the user information again and check if the role was added + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.users.getInfo(createUserJson.created.successful[0]._id) + expect(changedUserInfoJson.roles[app.appId!]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId!]).toEqual("POWER") + }) +}) diff --git a/qa-core/src/tests/internal-api/userManagement/customRoles.spec.ts b/qa-core/src/internal-api/tests/users/customRoles.spec.ts similarity index 55% rename from qa-core/src/tests/internal-api/userManagement/customRoles.spec.ts rename to qa-core/src/internal-api/tests/users/customRoles.spec.ts index d672bc0eb2..a02e9f315a 100644 --- a/qa-core/src/tests/internal-api/userManagement/customRoles.spec.ts +++ b/qa-core/src/internal-api/tests/users/customRoles.spec.ts @@ -1,27 +1,16 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { generateApp } from "../../../config/internal-api/fixtures/applications" -import { generateUser } from "../../../config/internal-api/fixtures/userManagement" +import TestConfiguration from "../../config/TestConfiguration" import { App, User } from "@budibase/types" -import generateScreen from "../../../config/internal-api/fixtures/screens" import { db } from "@budibase/backend-core" +import * as fixtures from "./../../fixtures" describe.skip("Internal API - App Specific Roles & Permissions", () => { - let api: InternalAPIClient - let accountsAPI: AccountsAPIClient - let config: TestConfiguration + const config = new TestConfiguration() let app: Partial // Before each test, login as admin. Some tests will require login as a different user beforeEach(async () => { - api = new InternalAPIClient() - accountsAPI = new AccountsAPIClient() - config = new TestConfiguration(api, accountsAPI) - await config.setupAccountAndTenant() - app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId + await config.beforeAll() + app = await config.createApp() }) afterAll(async () => { @@ -30,12 +19,11 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { it("Custom role access for level 1 permissions", async () => { // Set up user - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) //Create level 1 role const role = { @@ -43,12 +31,11 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { permissionId: "public", name: "level 1", } - const [createRoleResponse, createRoleJson] = await config.users.createRole( - role - ) + const [createRoleResponse, createRoleJson] = + await config.api.users.createRole(role) // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -60,42 +47,45 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { [prodAppId]: createRoleJson._id, }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id) - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with level 1 user - await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + await config.login( + config.state.tenantId!, + appUser[0].email!, + appUser[0].password! + ) + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(1) }) it("Custom role access for level 2 permissions", async () => { // Set up user - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App @@ -105,12 +95,11 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { permissionId: "read_only", name: "level 2", } - const [createRoleResponse, createRoleJson] = await config.users.createRole( - role - ) + const [createRoleResponse, createRoleJson] = + await config.api.users.createRole(role) // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -122,40 +111,39 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { [prodAppId]: createRoleJson._id, }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id) - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with level 1 user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(1) }) it("Custom role access for level 3 permissions", async () => { - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App @@ -165,12 +153,11 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { permissionId: "write", name: "level 3", } - const [createRoleResponse, createRoleJson] = await config.users.createRole( - role - ) + const [createRoleResponse, createRoleJson] = + await config.api.users.createRole(role) // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -182,40 +169,39 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { [prodAppId]: createRoleJson._id, }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id) - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with level 1 user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(1) }) it("Custom role access for level 4 permissions", async () => { - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App @@ -225,12 +211,11 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { permissionId: "power", name: "level 4", } - const [createRoleResponse, createRoleJson] = await config.users.createRole( - role - ) + const [createRoleResponse, createRoleJson] = + await config.api.users.createRole(role) // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -242,40 +227,39 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { [prodAppId]: createRoleJson._id, }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id) - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with level 1 user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(1) }) it("Custom role access for level 5 permissions", async () => { - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App @@ -285,12 +269,11 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { permissionId: "admin", name: "level 5", } - const [createRoleResponse, createRoleJson] = await config.users.createRole( - role - ) + const [createRoleResponse, createRoleJson] = + await config.api.users.createRole(role) // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -302,30 +285,30 @@ describe.skip("Internal API - App Specific Roles & Permissions", () => { [prodAppId]: createRoleJson._id, }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual(createRoleJson._id) - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with level 1 user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(1) }) diff --git a/qa-core/src/tests/internal-api/userManagement/screenAccess.spec.ts b/qa-core/src/internal-api/tests/users/screenAccess.spec.ts similarity index 52% rename from qa-core/src/tests/internal-api/userManagement/screenAccess.spec.ts rename to qa-core/src/internal-api/tests/users/screenAccess.spec.ts index 26f9d25ff0..563eebb6f8 100644 --- a/qa-core/src/tests/internal-api/userManagement/screenAccess.spec.ts +++ b/qa-core/src/internal-api/tests/users/screenAccess.spec.ts @@ -1,24 +1,14 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { generateApp } from "../../../config/internal-api/fixtures/applications" -import { generateUser } from "../../../config/internal-api/fixtures/userManagement" +import TestConfiguration from "../../config/TestConfiguration" import { User } from "@budibase/types" -import generateScreen from "../../../config/internal-api/fixtures/screens" import { db } from "@budibase/backend-core" +import * as fixtures from "./../../fixtures" describe.skip("Internal API - Role screen access", () => { - let api: InternalAPIClient - let accountsAPI: AccountsAPIClient - let config: TestConfiguration + const config = new TestConfiguration() // Before each test, login as admin. Some tests will require login as a different user beforeEach(async () => { - api = new InternalAPIClient() - accountsAPI = new AccountsAPIClient() - config = new TestConfiguration(api, accountsAPI) - await config.setupAccountAndTenant() + await config.beforeAll() }) afterAll(async () => { @@ -27,19 +17,17 @@ describe.skip("Internal API - Role screen access", () => { it("Check Screen access for BASIC Role", async () => { // Set up user - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId + const app = await config.createApp() // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -51,31 +39,31 @@ describe.skip("Internal API - Role screen access", () => { [prodAppId]: "BASIC", }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual("BASIC") - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with BASIC user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(1) expect(appPackageJson.screens[0].routing.roleId).toEqual("BASIC") @@ -83,19 +71,17 @@ describe.skip("Internal API - Role screen access", () => { it("Check Screen access for POWER role", async () => { // Set up user - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId + const app = await config.createApp() // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -107,49 +93,47 @@ describe.skip("Internal API - Role screen access", () => { [prodAppId]: "POWER", }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual("POWER") - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with POWER user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(2) }) it("Check Screen access for ADMIN role", async () => { // Set up user - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) // Create App - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId + const app = await config.createApp() // Update user roles - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( createUserJson.created.successful[0]._id ) const prodAppId = db.getProdAppID(app.appId!) @@ -161,30 +145,30 @@ describe.skip("Internal API - Role screen access", () => { [prodAppId]: "ADMIN", }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) + await config.api.users.getInfo(createUserJson.created.successful[0]._id) expect(changedUserInfoJson.roles[prodAppId]).toBeDefined() expect(changedUserInfoJson.roles[prodAppId]).toEqual("ADMIN") - await config.screen.create(generateScreen("BASIC")) - await config.screen.create(generateScreen("POWER")) - await config.screen.create(generateScreen("ADMIN")) + await config.api.screens.create(fixtures.screens.generateScreen("BASIC")) + await config.api.screens.create(fixtures.screens.generateScreen("POWER")) + await config.api.screens.create(fixtures.screens.generateScreen("ADMIN")) - await config.applications.publish(app.appId) + await config.api.apps.publish(app.appId) const [firstappPackageResponse, firstappPackageJson] = - await config.applications.getAppPackage(app.appId) + await config.api.apps.getAppPackage(app.appId!) expect(firstappPackageJson.screens).toBeDefined() expect(firstappPackageJson.screens.length).toEqual(3) // login with ADMIN user await config.login(appUser[0].email!, appUser[0].password!) - const [selfInfoResponse, selfInfoJson] = await config.users.getSelf() + const [selfInfoResponse, selfInfoJson] = await config.api.users.getSelf() // fetch app package const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId!) + await config.api.apps.getAppPackage(app.appId!) expect(appPackageJson.screens).toBeDefined() expect(appPackageJson.screens.length).toEqual(3) }) diff --git a/qa-core/src/internal-api/tests/users/tableAccess.spec.ts b/qa-core/src/internal-api/tests/users/tableAccess.spec.ts new file mode 100644 index 0000000000..0db3a8a85e --- /dev/null +++ b/qa-core/src/internal-api/tests/users/tableAccess.spec.ts @@ -0,0 +1,123 @@ +import TestConfiguration from "../../config/TestConfiguration" +import { User } from "@budibase/types" +import * as fixtures from "./../../fixtures" + +describe.skip("Internal API - Role table access", () => { + const config = new TestConfiguration() + + // Before each test, login as admin. Some tests will require login as a different user + beforeEach(async () => { + await config.beforeAll() + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("Check Table access for app user", async () => { + const appUser = fixtures.users.generateUser() + expect(appUser[0].builder?.global).toEqual(false) + expect(appUser[0].admin?.global).toEqual(false) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(appUser) + + const app = await config.createApp() + + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( + createUserJson.created.successful[0]._id + ) + const body: User = { + ...userInfoJson, + roles: { + [app.appId!]: "BASIC", + }, + } + await config.api.users.updateInfo(body) + + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.users.getInfo(createUserJson.created.successful[0]._id) + expect(changedUserInfoJson.roles[app.appId!]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId!]).toEqual("BASIC") + + const [createdTableResponse, createdTableData] = + await config.api.tables.save(fixtures.tables.generateTable()) + + await config.login(appUser[0].email!, appUser[0].password!) + + const newColumn = + fixtures.tables.generateNewColumnForTable(createdTableData) + await config.api.tables.forbiddenSave(newColumn) + await config.api.tables.forbiddenSave(fixtures.tables.generateTable()) + }) + + it.skip("Check Table access for developer", async () => { + const developer = fixtures.users.generateUser(1, "developer") + expect(developer[0].builder?.global).toEqual(true) + + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(developer) + + const app = await config.createApp() + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( + createUserJson.created.successful[0]._id + ) + const body: User = { + ...userInfoJson, + roles: { + [app.appId!]: "POWER", + }, + } + await config.api.users.updateInfo(body) + + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.users.getInfo(createUserJson.created.successful[0]._id) + expect(changedUserInfoJson.roles[app.appId!]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId!]).toEqual("POWER") + + const [createdTableResponse, createdTableData] = + await config.api.tables.save(fixtures.tables.generateTable()) + await config.login(developer[0].email!, developer[0].password!) + const newColumn = + fixtures.tables.generateNewColumnForTable(createdTableData) + const [addColumnResponse, addColumnData] = await config.api.tables.save( + newColumn, + true + ) + }) + + it.skip("Check Table access for admin", async () => { + const adminUser = fixtures.users.generateUser(1, "admin") + expect(adminUser[0].builder?.global).toEqual(true) + expect(adminUser[0].admin?.global).toEqual(true) + const [createUserResponse, createUserJson] = + await config.api.users.addMultiple(adminUser) + + const app = await config.createApp() + + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( + createUserJson.created.successful[0]._id + ) + const body: User = { + ...userInfoJson, + roles: { + [app.appId!]: "ADMIN", + }, + } + await config.api.users.updateInfo(body) + + const [changedUserInfoResponse, changedUserInfoJson] = + await config.api.users.getInfo(createUserJson.created.successful[0]._id) + expect(changedUserInfoJson.roles[app.appId!]).toBeDefined() + expect(changedUserInfoJson.roles[app.appId!]).toEqual("ADMIN") + + await config.login(adminUser[0].email!, adminUser[0].password!) + const [createdTableResponse, createdTableData] = + await config.api.tables.save(fixtures.tables.generateTable()) + const newColumn = + fixtures.tables.generateNewColumnForTable(createdTableData) + const [addColumnResponse, addColumnData] = await config.api.tables.save( + newColumn, + true + ) + }) +}) diff --git a/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts b/qa-core/src/internal-api/tests/users/userManagement.spec.ts similarity index 53% rename from qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts rename to qa-core/src/internal-api/tests/users/userManagement.spec.ts index 591f6dfe02..28096c08c9 100644 --- a/qa-core/src/tests/internal-api/userManagement/userManagement.spec.ts +++ b/qa-core/src/internal-api/tests/users/userManagement.spec.ts @@ -1,18 +1,13 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { generateUser } from "../../../config/internal-api/fixtures/userManagement" +import TestConfiguration from "../../config/TestConfiguration" import { User } from "@budibase/types" +import * as fixtures from "./../../fixtures" describe("Internal API - User Management & Permissions", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) + const config = new TestConfiguration() // Before each test, login as admin. Some tests will require login as a different user beforeAll(async () => { - await config.setupAccountAndTenant() + await config.beforeAll() }) afterAll(async () => { @@ -21,60 +16,60 @@ describe("Internal API - User Management & Permissions", () => { it("Add Users with different roles", async () => { // Get all users - await config.users.search() + await config.api.users.search() // Get all roles - await config.users.getRoles() + await config.api.users.getRoles() // Add users with each role - const admin = generateUser(1, "admin") + const admin = fixtures.users.generateUser(1, "admin") expect(admin[0].builder?.global).toEqual(true) expect(admin[0].admin?.global).toEqual(true) - const developer = generateUser(1, "developer") + const developer = fixtures.users.generateUser(1, "developer") expect(developer[0].builder?.global).toEqual(true) - const appUser = generateUser(1, "appUser") + const appUser = fixtures.users.generateUser(1, "appUser") expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) const userList = [...admin, ...developer, ...appUser] - await config.users.addMultiple(userList) + await config.api.users.addMultiple(userList) // Check users are added - const [allUsersResponse, allUsersJson] = await config.users.getAll() + const [allUsersResponse, allUsersJson] = await config.api.users.getAll() expect(allUsersJson.length).toBeGreaterThan(0) }) it("Delete User", async () => { - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [userResponse, userJson] = await config.users.addMultiple(appUser) + const [userResponse, userJson] = await config.api.users.addMultiple(appUser) const userId = userJson.created.successful[0]._id - await config.users.delete(userId) + await config.api.users.delete(userId) }) it("Reset Password", async () => { - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [userResponse, userJson] = await config.users.addMultiple(appUser) - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userResponse, userJson] = await config.api.users.addMultiple(appUser) + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( userJson.created.successful[0]._id ) const body: User = { ...userInfoJson, password: "newPassword", } - await config.users.forcePasswordReset(body) + await config.api.users.forcePasswordReset(body) }) it("Change User information", async () => { - const appUser = generateUser() + const appUser = fixtures.users.generateUser() expect(appUser[0].builder?.global).toEqual(false) expect(appUser[0].admin?.global).toEqual(false) - const [userResponse, userJson] = await config.users.addMultiple(appUser) - const [userInfoResponse, userInfoJson] = await config.users.getInfo( + const [userResponse, userJson] = await config.api.users.addMultiple(appUser) + const [userInfoResponse, userInfoJson] = await config.api.users.getInfo( userJson.created.successful[0]._id ) const body: User = { @@ -85,10 +80,10 @@ describe("Internal API - User Management & Permissions", () => { global: true, }, } - await config.users.updateInfo(body) + await config.api.users.updateInfo(body) const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(userJson.created.successful[0]._id) + await config.api.users.getInfo(userJson.created.successful[0]._id) expect(changedUserInfoJson.builder?.global).toBeDefined() expect(changedUserInfoJson.builder?.global).toEqual(true) }) diff --git a/qa-core/src/jest/globalSetup.ts b/qa-core/src/jest/globalSetup.ts new file mode 100644 index 0000000000..a25c483173 --- /dev/null +++ b/qa-core/src/jest/globalSetup.ts @@ -0,0 +1,78 @@ +import { AccountInternalAPI } from "../account-api" +import * as fixtures from "../internal-api/fixtures" +import { BudibaseInternalAPI } from "../internal-api" +import { DEFAULT_TENANT_ID, logging } from "@budibase/backend-core" +import { CreateAccountRequest } from "@budibase/types" +import env from "../environment" +import { APIRequestOpts } from "../types" + +// turn off or on context logging i.e. tenantId, appId etc +// it's not applicable for the qa run +logging.LOG_CONTEXT = false + +const accountsApi = new AccountInternalAPI({}) +const internalApi = new BudibaseInternalAPI({}) + +const API_OPTS: APIRequestOpts = { doExpect: false } + +// @ts-ignore +global.qa = {} + +async function createAccount() { + const account = fixtures.accounts.generateAccount() + await accountsApi.accounts.validateEmail(account.email, API_OPTS) + await accountsApi.accounts.validateTenantId(account.tenantId, API_OPTS) + await accountsApi.accounts.create(account, API_OPTS) + return account +} + +async function loginAsAdmin() { + const username = env.BB_ADMIN_USER_EMAIL! + const password = env.BB_ADMIN_USER_PASSWORD! + const tenantId = DEFAULT_TENANT_ID + const [res, cookie] = await internalApi.auth.login( + tenantId, + username, + password, + API_OPTS + ) + + // @ts-ignore + global.qa.authCookie = cookie +} + +async function loginAsAccount(account: CreateAccountRequest) { + const [res, cookie] = await internalApi.auth.login( + account.tenantId, + account.email, + account.password, + API_OPTS + ) + + // @ts-ignore + global.qa.authCookie = cookie +} + +async function setup() { + console.log("\nGLOBAL SETUP STARTING") + const env = await internalApi.environment.getEnvironment(API_OPTS) + + console.log(`Environment: ${JSON.stringify(env)}`) + + if (env.multiTenancy) { + const account = await createAccount() + // @ts-ignore + global.qa.tenantId = account.tenantId + await loginAsAccount(account) + } else { + // @ts-ignore + global.qa.tenantId = DEFAULT_TENANT_ID + await loginAsAdmin() + } + + // @ts-ignore + console.log(`Tenant: ${global.qa.tenantId}`) + console.log("GLOBAL SETUP COMPLETE") +} + +export default setup diff --git a/qa-core/src/jest/globalTeardown.ts b/qa-core/src/jest/globalTeardown.ts new file mode 100644 index 0000000000..9cd7fff041 --- /dev/null +++ b/qa-core/src/jest/globalTeardown.ts @@ -0,0 +1,9 @@ +async function teardown() { + console.log("\nGLOBAL TEARDOWN STARTING") + + // TODO: Delete account and apps after test run + + console.log("GLOBAL TEARDOWN COMPLETE") +} + +export default teardown diff --git a/qa-core/src/jest.extends.ts b/qa-core/src/jest/jest.extends.ts similarity index 100% rename from qa-core/src/jest.extends.ts rename to qa-core/src/jest/jest.extends.ts diff --git a/qa-core/src/jest/jestSetup.ts b/qa-core/src/jest/jestSetup.ts new file mode 100644 index 0000000000..7f0aeddaa3 --- /dev/null +++ b/qa-core/src/jest/jestSetup.ts @@ -0,0 +1 @@ +jest.setTimeout(60000) diff --git a/qa-core/src/public-api/api/BudibasePublicAPI.ts b/qa-core/src/public-api/api/BudibasePublicAPI.ts new file mode 100644 index 0000000000..4a79259d6e --- /dev/null +++ b/qa-core/src/public-api/api/BudibasePublicAPI.ts @@ -0,0 +1,23 @@ +import AppAPI from "./apis/AppAPI" +import UserAPI from "./apis/UserAPI" +import TableAPI from "./apis/TableAPI" +import RowAPI from "./apis/RowAPI" + +import BudibasePublicAPIClient from "./BudibasePublicAPIClient" +import { State } from "../../types" + +export default class BudibasePublicAPI { + client: BudibasePublicAPIClient + apps: AppAPI + users: UserAPI + tables: TableAPI + rows: RowAPI + + constructor(state: State) { + this.client = new BudibasePublicAPIClient(state) + this.apps = new AppAPI(this.client) + this.users = new UserAPI(this.client) + this.tables = new TableAPI(this.client) + this.rows = new RowAPI(this.client, state) + } +} diff --git a/qa-core/src/public-api/api/BudibasePublicAPIClient.ts b/qa-core/src/public-api/api/BudibasePublicAPIClient.ts new file mode 100644 index 0000000000..d5fd6b9ef4 --- /dev/null +++ b/qa-core/src/public-api/api/BudibasePublicAPIClient.ts @@ -0,0 +1,74 @@ +import env from "../../environment" +import fetch, { HeadersInit } from "node-fetch" +import { State } from "../../types" + +type APIMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" + +interface ApiOptions { + method?: APIMethod + body?: object + headers?: HeadersInit | undefined +} + +class BudibasePublicAPIClient { + state: State + host: string + + constructor(state: State) { + if (!env.BUDIBASE_URL) { + throw new Error("Must set BUDIBASE_URL env var") + } + this.host = `${env.BUDIBASE_URL}/api/public/v1` + this.state = state + } + + apiCall = + (method: APIMethod) => + async (url = "", options: ApiOptions = {}) => { + const requestOptions = { + method, + body: JSON.stringify(options.body), + headers: { + "x-budibase-api-key": this.state.apiKey, + "x-budibase-app-id": this.state.appId, + "Content-Type": "application/json", + Accept: "application/json", + ...options.headers, + redirect: "follow", + follow: 20, + }, + } + + // prettier-ignore + // @ts-ignore + const response = await fetch(`${this.host}${url}`, requestOptions) + + let body: any + const contentType = response.headers.get("content-type") + if (contentType && contentType.includes("application/json")) { + body = await response.json() + } else { + body = await response.text() + } + + const message = `${method} ${url} - ${response.status} + Response body: ${JSON.stringify(body)} + Request body: ${requestOptions.body}` + + if (response.status > 499) { + console.error(message) + } else if (response.status >= 400) { + console.warn(message) + } + + return [response, body] + } + + post = this.apiCall("POST") + get = this.apiCall("GET") + patch = this.apiCall("PATCH") + del = this.apiCall("DELETE") + put = this.apiCall("PUT") +} + +export default BudibasePublicAPIClient diff --git a/qa-core/src/public-api/api/apis/AppAPI.ts b/qa-core/src/public-api/api/apis/AppAPI.ts new file mode 100644 index 0000000000..71a9b007c6 --- /dev/null +++ b/qa-core/src/public-api/api/apis/AppAPI.ts @@ -0,0 +1,68 @@ +import { Response } from "node-fetch" +import BudibasePublicAPIClient from "../BudibasePublicAPIClient" +import * as fixtures from "../../fixtures" +import { + Application, + SearchInputParams, + CreateApplicationParams, +} from "../../../types" + +export default class AppAPI { + client: BudibasePublicAPIClient + + constructor(client: BudibasePublicAPIClient) { + this.client = client + } + + async seed(): Promise<[Response, Application]> { + return this.create(fixtures.apps.generateApp()) + } + + async create( + body: CreateApplicationParams + ): Promise<[Response, Application]> { + const [response, json] = await this.client.post(`/applications`, { body }) + return [response, json.data] + } + + async read(id: string): Promise<[Response, Application]> { + const [response, json] = await this.client.get(`/applications/${id}`) + return [response, json.data] + } + + async search(body: SearchInputParams): Promise<[Response, [Application]]> { + const [response, json] = await this.client.post(`/applications/search`, { + body, + }) + return [response, json.data] + } + + async update( + id: string, + body: Application + ): Promise<[Response, Application]> { + const [response, json] = await this.client.put(`/applications/${id}`, { + body, + }) + return [response, json.data] + } + + async delete(id: string): Promise<[Response, Application]> { + const [response, json] = await this.client.del(`/applications/${id}`) + return [response, json.data] + } + + async publish(id: string): Promise<[Response, any]> { + const [response, json] = await this.client.post( + `/applications/${id}/publish` + ) + return [response, json.data] + } + + async unpublish(id: string): Promise<[Response]> { + const [response, json] = await this.client.post( + `/applications/${id}/unpublish` + ) + return [response] + } +} diff --git a/qa-core/src/public-api/api/apis/RowAPI.ts b/qa-core/src/public-api/api/apis/RowAPI.ts new file mode 100644 index 0000000000..68649db5a3 --- /dev/null +++ b/qa-core/src/public-api/api/apis/RowAPI.ts @@ -0,0 +1,61 @@ +import { + CreateRowParams, + Row, + SearchInputParams, +} from "@budibase/server/api/controllers/public/mapping/types" +import { HeadersInit, Response } from "node-fetch" +import BudibasePublicAPIClient from "../BudibasePublicAPIClient" +import * as fixtures from "../../fixtures" +import { State } from "../../../types" + +export default class RowAPI { + client: BudibasePublicAPIClient + + headers?: HeadersInit + + state: State + + constructor(client: BudibasePublicAPIClient, state: State) { + this.state = state + this.client = client + } + + async seed(tableId: string) { + return this.create(fixtures.rows.generateRow({ tableId })) + } + + async create(body: CreateRowParams): Promise<[Response, Row]> { + const [response, json] = await this.client.post( + `/tables/${this.state.tableId}/rows`, + { + body, + } + ) + return [response, json.data] + } + + async read(id: string): Promise<[Response, Row]> { + const [response, json] = await this.client.get( + `/tables/${this.state.tableId}/rows/${id}` + ) + return [response, json.data] + } + + async search(body: SearchInputParams): Promise<[Response, [Row]]> { + const [response, json] = await this.client.post( + `/tables/${this.state.tableId}/rows/search`, + { body } + ) + return [response, json.data] + } + + async update(id: string, body: Row): Promise<[Response, Row]> { + const [response, json] = await this.client.put( + `/tables/${this.state.tableId}/rows/${id}`, + { + body, + } + ) + return [response, json.data] + } +} diff --git a/qa-core/src/config/public-api/TestConfiguration/tables.ts b/qa-core/src/public-api/api/apis/TableAPI.ts similarity index 53% rename from qa-core/src/config/public-api/TestConfiguration/tables.ts rename to qa-core/src/public-api/api/apis/TableAPI.ts index 9a1c9db019..b7bafb2b67 100644 --- a/qa-core/src/config/public-api/TestConfiguration/tables.ts +++ b/qa-core/src/public-api/api/apis/TableAPI.ts @@ -1,18 +1,19 @@ -import PublicAPIClient from "./PublicAPIClient" import { Table, SearchInputParams, CreateTableParams, } from "@budibase/server/api/controllers/public/mapping/types" import { HeadersInit, Response } from "node-fetch" -import { generateTable } from "../fixtures/tables" +import { generateTable } from "../../fixtures/tables" +import BudibasePublicAPIClient from "../BudibasePublicAPIClient" -export default class TableApi { - api: PublicAPIClient +export default class TableAPI { headers?: HeadersInit - constructor(apiClient: PublicAPIClient) { - this.api = apiClient + client: BudibasePublicAPIClient + + constructor(client: BudibasePublicAPIClient) { + this.client = client } async seed() { @@ -20,28 +21,24 @@ export default class TableApi { } async create(body: CreateTableParams): Promise<[Response, Table]> { - const response = await this.api.post(`/tables`, { + const [response, json] = await this.client.post(`/tables`, { body, }) - const json = await response.json() return [response, json.data] } async read(id: string): Promise<[Response, Table]> { - const response = await this.api.get(`/tables/${id}`) - const json = await response.json() + const [response, json] = await this.client.get(`/tables/${id}`) return [response, json.data] } async search(body: SearchInputParams): Promise<[Response, [Table]]> { - const response = await this.api.post(`/tables/search`, { body }) - const json = await response.json() + const [response, json] = await this.client.post(`/tables/search`, { body }) return [response, json.data] } async update(id: string, body: Table): Promise<[Response, Table]> { - const response = await this.api.put(`/tables/${id}`, { body }) - const json = await response.json() + const [response, json] = await this.client.put(`/tables/${id}`, { body }) return [response, json.data] } } diff --git a/qa-core/src/public-api/api/apis/UserAPI.ts b/qa-core/src/public-api/api/apis/UserAPI.ts new file mode 100644 index 0000000000..7676a0fdd6 --- /dev/null +++ b/qa-core/src/public-api/api/apis/UserAPI.ts @@ -0,0 +1,40 @@ +import { + CreateUserParams, + SearchInputParams, + User, +} from "@budibase/server/api/controllers/public/mapping/types" +import { Response } from "node-fetch" +import BudibasePublicAPIClient from "../BudibasePublicAPIClient" +import * as fixtures from "../../fixtures" + +export default class UserAPI { + client: BudibasePublicAPIClient + + constructor(client: BudibasePublicAPIClient) { + this.client = client + } + + async seed() { + return this.create(fixtures.users.generateUser()) + } + + async create(body: CreateUserParams): Promise<[Response, User]> { + const [response, json] = await this.client.post(`/users`, { body }) + return [response, json.data] + } + + async read(id: string): Promise<[Response, User]> { + const [response, json] = await this.client.get(`/users/${id}`) + return [response, json.data] + } + + async search(body: SearchInputParams): Promise<[Response, [User]]> { + const [response, json] = await this.client.post(`/users/search`, { body }) + return [response, json.data] + } + + async update(id: string, body: User): Promise<[Response, User]> { + const [response, json] = await this.client.put(`/users/${id}`, { body }) + return [response, json.data] + } +} diff --git a/qa-core/src/public-api/api/index.ts b/qa-core/src/public-api/api/index.ts new file mode 100644 index 0000000000..54d6e44043 --- /dev/null +++ b/qa-core/src/public-api/api/index.ts @@ -0,0 +1 @@ +export { default as BudibasePublicAPI } from "./BudibasePublicAPI" diff --git a/qa-core/src/public-api/config/TestConfiguration.ts b/qa-core/src/public-api/config/TestConfiguration.ts new file mode 100644 index 0000000000..d9c12ee267 --- /dev/null +++ b/qa-core/src/public-api/config/TestConfiguration.ts @@ -0,0 +1,33 @@ +import { BudibasePublicAPI } from "../api" +import { BudibaseTestConfiguration } from "../../shared" + +export default class TestConfiguration extends BudibaseTestConfiguration { + // apis + api: BudibasePublicAPI + + context: T + + constructor() { + super() + this.api = new BudibasePublicAPI(this.state) + this.context = {} + } + + // LIFECYCLE + + async beforeAll() { + await super.beforeAll() + await this.setApiKey() + } + + async afterAll() { + await super.afterAll() + } + + // AUTH + + async setApiKey() { + const apiKeyResponse = await this.internalApi.self.getApiKey() + this.state.apiKey = apiKeyResponse.apiKey + } +} diff --git a/qa-core/src/public-api/config/index.ts b/qa-core/src/public-api/config/index.ts new file mode 100644 index 0000000000..182c7825b6 --- /dev/null +++ b/qa-core/src/public-api/config/index.ts @@ -0,0 +1 @@ +export { default as TestConfiguration } from "./TestConfiguration" diff --git a/qa-core/src/config/internal-api/fixtures/accounts.ts b/qa-core/src/public-api/fixtures/accounts.ts similarity index 69% rename from qa-core/src/config/internal-api/fixtures/accounts.ts rename to qa-core/src/public-api/fixtures/accounts.ts index 64b6d51f44..314d7d9176 100644 --- a/qa-core/src/config/internal-api/fixtures/accounts.ts +++ b/qa-core/src/public-api/fixtures/accounts.ts @@ -1,9 +1,7 @@ -import { NewAccount } from "./types/newAccount" +import { generator } from "../../shared" +import { CreateAccountRequest, Hosting } from "@budibase/types" -import generator from "../../generator" -import { Hosting } from "@budibase/types" - -export const generateAccount = (): Partial => { +export const generateAccount = (): CreateAccountRequest => { const randomGuid = generator.guid() //Needs to start with a letter let tenant: string = "tenant" + randomGuid diff --git a/qa-core/src/public-api/fixtures/applications.ts b/qa-core/src/public-api/fixtures/applications.ts new file mode 100644 index 0000000000..b8595b4b33 --- /dev/null +++ b/qa-core/src/public-api/fixtures/applications.ts @@ -0,0 +1,10 @@ +import { generator } from "../../shared" +import { Application, CreateApplicationParams } from "../../types" + +export const generateApp = ( + overrides: Partial = {} +): CreateApplicationParams => ({ + name: generator.word(), + url: `/${generator.word()}`, + ...overrides, +}) diff --git a/qa-core/src/public-api/fixtures/index.ts b/qa-core/src/public-api/fixtures/index.ts new file mode 100644 index 0000000000..02d48cd628 --- /dev/null +++ b/qa-core/src/public-api/fixtures/index.ts @@ -0,0 +1,5 @@ +export * as accounts from "./accounts" +export * as apps from "./applications" +export * as rows from "./rows" +export * as tables from "./tables" +export * as users from "./users" diff --git a/qa-core/src/public-api/fixtures/rows.ts b/qa-core/src/public-api/fixtures/rows.ts new file mode 100644 index 0000000000..50d999eaa4 --- /dev/null +++ b/qa-core/src/public-api/fixtures/rows.ts @@ -0,0 +1,10 @@ +import { CreateRowParams, Row } from "../../types" +import { generator } from "../../shared" + +export const generateRow = (overrides: Partial = {}): CreateRowParams => ({ + type: "row", + tableId: "seed_table", + testColumn: generator.string({ length: 32, alpha: true, numeric: true }), + relationship: [generator.string({ length: 32, alpha: true, numeric: true })], + ...overrides, +}) diff --git a/qa-core/src/config/public-api/fixtures/tables.ts b/qa-core/src/public-api/fixtures/tables.ts similarity index 67% rename from qa-core/src/config/public-api/fixtures/tables.ts rename to qa-core/src/public-api/fixtures/tables.ts index e1ecb8bec1..89e3df690a 100644 --- a/qa-core/src/config/public-api/fixtures/tables.ts +++ b/qa-core/src/public-api/fixtures/tables.ts @@ -1,10 +1,5 @@ -import { - CreateRowParams, - CreateTableParams, - Row, - Table, -} from "@budibase/server/api/controllers/public/mapping/types" -import generator from "../../generator" +import { CreateTableParams, Table } from "../../types" +import { generator } from "../../shared" export const generateTable = ( overrides: Partial = {} @@ -50,11 +45,3 @@ export const generateTable = ( }, ...overrides, }) - -export const generateRow = (overrides: Partial = {}): CreateRowParams => ({ - type: "row", - tableId: "seed_table", - testColumn: generator.string({ length: 32, alpha: true, numeric: true }), - relationship: [generator.string({ length: 32, alpha: true, numeric: true })], - ...overrides, -}) diff --git a/qa-core/src/config/public-api/fixtures/users.ts b/qa-core/src/public-api/fixtures/users.ts similarity index 76% rename from qa-core/src/config/public-api/fixtures/users.ts rename to qa-core/src/public-api/fixtures/users.ts index 033147361f..14c525fc0f 100644 --- a/qa-core/src/config/public-api/fixtures/users.ts +++ b/qa-core/src/public-api/fixtures/users.ts @@ -2,9 +2,11 @@ import { CreateUserParams, User, } from "@budibase/server/api/controllers/public/mapping/types" -import generator from "../../generator" +import { generator } from "../../shared" -const generate = (overrides: Partial = {}): CreateUserParams => ({ +export const generateUser = ( + overrides: Partial = {} +): CreateUserParams => ({ email: generator.email(), roles: { [generator.string({ length: 32, alpha: true, numeric: true })]: @@ -21,5 +23,3 @@ const generate = (overrides: Partial = {}): CreateUserParams => ({ }, ...overrides, }) - -export default generate diff --git a/qa-core/src/public-api/index.ts b/qa-core/src/public-api/index.ts new file mode 100644 index 0000000000..e1a716605a --- /dev/null +++ b/qa-core/src/public-api/index.ts @@ -0,0 +1 @@ +export * from "./api" diff --git a/qa-core/src/tests/public-api/applications/applications.spec.ts b/qa-core/src/public-api/tests/applications/applications.spec.ts similarity index 53% rename from qa-core/src/tests/public-api/applications/applications.spec.ts rename to qa-core/src/public-api/tests/applications/applications.spec.ts index a5c0ed3691..0c8636452a 100644 --- a/qa-core/src/tests/public-api/applications/applications.spec.ts +++ b/qa-core/src/public-api/tests/applications/applications.spec.ts @@ -1,27 +1,15 @@ -import TestConfiguration from "../../../config/public-api/TestConfiguration" -import PublicAPIClient from "../../../config/public-api/TestConfiguration/PublicAPIClient" -import AccountsAPIClient from "../../../config/public-api/TestConfiguration/accountsAPIClient" -import generateApp from "../../../config/public-api/fixtures/applications" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" import { db as dbCore } from "@budibase/backend-core" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" +import { TestConfiguration } from "../../config" +import { Application } from "../../../types" +import * as fixtures from "../../fixtures" describe("Public API - /applications endpoints", () => { - const api = new PublicAPIClient() - const accountsAPI = new AccountsAPIClient() - const internalAPI = new InternalAPIClient() - const config = new TestConfiguration( - api, - accountsAPI, - internalAPI - ) + const config = new TestConfiguration() beforeAll(async () => { - await config.setupAccountAndTenant() - await config.setApiKey() - - const [response, app] = await config.applications.seed() - config.context = app + await config.beforeAll() + await config.createApp() + config.context = (await config.api.apps.read(config.state.appId!))[1] }) afterAll(async () => { @@ -29,13 +17,15 @@ describe("Public API - /applications endpoints", () => { }) it("POST - Create an application", async () => { - const [response, app] = await config.applications.create(generateApp()) + const [response, app] = await config.api.apps.create( + fixtures.apps.generateApp() + ) expect(response).toHaveStatusCode(200) expect(app._id).toBeDefined() }) it("POST - Search applications", async () => { - const [response, apps] = await config.applications.search({ + const [response, apps] = await config.api.apps.search({ name: config.context.name, }) expect(response).toHaveStatusCode(200) @@ -43,14 +33,14 @@ describe("Public API - /applications endpoints", () => { }) it("GET - Retrieve an application", async () => { - const [response, app] = await config.applications.read(config.context._id) + const [response, app] = await config.api.apps.read(config.context._id) expect(response).toHaveStatusCode(200) expect(app).toEqual(config.context) }) it("PUT - update an application", async () => { config.context.name = "UpdatedName" - const [response, app] = await config.applications.update( + const [response, app] = await config.api.apps.update( config.context._id, config.context ) @@ -61,7 +51,7 @@ describe("Public API - /applications endpoints", () => { it("POST - publish an application", async () => { config.context.name = "UpdatedName" - const [response, deployment] = await config.applications.publish( + const [response, deployment] = await config.api.apps.publish( config.context._id ) expect(response).toHaveStatusCode(200) @@ -71,37 +61,37 @@ describe("Public API - /applications endpoints", () => { // Verify publish const prodAppId = dbCore.getProdAppID(config.context._id) - const [_, publishedApp] = await config.applications.read(prodAppId) + const [_, publishedApp] = await config.api.apps.read(prodAppId) expect(response).toHaveStatusCode(200) expect(publishedApp._id).toEqual(prodAppId) }) it("POST - unpublish a published application", async () => { - await config.applications.publish(config.context._id) - const [response] = await config.applications.unpublish(config.context._id) + await config.api.apps.publish(config.context._id) + const [response] = await config.api.apps.unpublish(config.context._id) expect(response).toHaveStatusCode(204) }) it("POST - unpublish an unpublished application", async () => { - const [response] = await config.applications.unpublish(config.context._id) + const [response] = await config.api.apps.unpublish(config.context._id) expect(response).toHaveStatusCode(400) }) it("DELETE - delete a published application and the dev application", async () => { - await config.applications.publish(config.context._id) - const [response, deletion] = await config.applications.delete( + await config.api.apps.publish(config.context._id) + const [response, deletion] = await config.api.apps.delete( config.context._id ) expect(response).toHaveStatusCode(200) expect(deletion._id).toEqual(config.context._id) // verify dev app deleted - const [devAppResponse] = await config.applications.read(config.context._id) + const [devAppResponse] = await config.api.apps.read(config.context._id) expect(devAppResponse).toHaveStatusCode(404) // verify prod app deleted const prodAppId = dbCore.getProdAppID(config.context._id) - const [publishedAppResponse] = await config.applications.read(prodAppId) + const [publishedAppResponse] = await config.api.apps.read(prodAppId) expect(publishedAppResponse).toHaveStatusCode(404) }) }) diff --git a/qa-core/src/public-api/tests/tables/rows.spec.ts b/qa-core/src/public-api/tests/tables/rows.spec.ts new file mode 100644 index 0000000000..e35f071a4e --- /dev/null +++ b/qa-core/src/public-api/tests/tables/rows.spec.ts @@ -0,0 +1,62 @@ +import { TestConfiguration } from "../../config" +import * as fixtures from "../../fixtures" +import { Row } from "../../../types" + +describe("Public API - /rows endpoints", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + await config.createApp() + + const [tResp, table] = await config.api.tables.seed() + config.state.tableId = table._id + + const [rResp, row] = await config.api.rows.seed(table._id) + config.context = row + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("POST - Create a row", async () => { + const [response, row] = await config.api.rows.create( + fixtures.rows.generateRow() + ) + expect(response).toHaveStatusCode(200) + expect(row._id).toBeDefined() + }) + + it("POST - Search rows", async () => { + const [response, rows] = await config.api.rows.search({ + query: { + string: { + testColumn: config.context.testColumn as string, + }, + }, + }) + expect(response).toHaveStatusCode(200) + expect(rows.length).toEqual(1) + expect(rows[0]._id).toEqual(config.context._id) + expect(rows[0].tableId).toEqual(config.context.tableId) + expect(rows[0].testColumn).toEqual(config.context.testColumn) + }) + + it("GET - Retrieve a row", async () => { + const [response, row] = await config.api.rows.read(config.context._id) + expect(response).toHaveStatusCode(200) + expect(row._id).toEqual(config.context._id) + expect(row.tableId).toEqual(config.context.tableId) + }) + + it("PUT - update a row", async () => { + config.context.testColumn = "UpdatedName" + const [response, row] = await config.api.rows.update( + config.context._id, + config.context + ) + expect(response).toHaveStatusCode(200) + expect(row.testColumn).toEqual(config.context.testColumn) + }) +}) diff --git a/qa-core/src/public-api/tests/tables/tables.spec.ts b/qa-core/src/public-api/tests/tables/tables.spec.ts new file mode 100644 index 0000000000..010444b7c8 --- /dev/null +++ b/qa-core/src/public-api/tests/tables/tables.spec.ts @@ -0,0 +1,51 @@ +import { TestConfiguration } from "../../config" +import * as fixtures from "../../fixtures" +import { Table } from "../../../types" + +describe("Public API - /tables endpoints", () => { + const config = new TestConfiguration
() + + beforeAll(async () => { + await config.beforeAll() + await config.createApp() + + const [tableResp, table] = await config.api.tables.seed() + config.context = table + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("POST - Create a table", async () => { + const [response, table] = await config.api.tables.create( + fixtures.tables.generateTable() + ) + expect(response).toHaveStatusCode(200) + expect(table._id).toBeDefined() + }) + + it("POST - Search tables", async () => { + const [response, tables] = await config.api.tables.search({ + name: config.context.name, + }) + expect(response).toHaveStatusCode(200) + expect(tables[0]).toEqual(config.context) + }) + + it("GET - Retrieve a table", async () => { + const [response, table] = await config.api.tables.read(config.context._id) + expect(response).toHaveStatusCode(200) + expect(table).toEqual(config.context) + }) + + it("PUT - update a table", async () => { + config.context.name = "updatedName" + const [response, table] = await config.api.tables.update( + config.context._id, + config.context + ) + expect(response).toHaveStatusCode(200) + expect(table).toEqual(config.context) + }) +}) diff --git a/qa-core/src/public-api/tests/users/users.spec.ts b/qa-core/src/public-api/tests/users/users.spec.ts new file mode 100644 index 0000000000..98f390b9bd --- /dev/null +++ b/qa-core/src/public-api/tests/users/users.spec.ts @@ -0,0 +1,49 @@ +import TestConfiguration from "../../config/TestConfiguration" +import * as fixtures from "../../fixtures" +import { User } from "../../../types" + +describe("Public API - /users endpoints", () => { + const config = new TestConfiguration() + + beforeAll(async () => { + await config.beforeAll() + const [_, user] = await config.api.users.seed() + config.context = user + }) + + afterAll(async () => { + await config.afterAll() + }) + + it("POST - Create a user", async () => { + const [response, user] = await config.api.users.create( + fixtures.users.generateUser() + ) + expect(response).toHaveStatusCode(200) + expect(user._id).toBeDefined() + }) + + it("POST - Search users", async () => { + const [response, users] = await config.api.users.search({ + name: config.context.email, + }) + expect(response).toHaveStatusCode(200) + expect(users[0]).toEqual(config.context) + }) + + it("GET - Retrieve a user", async () => { + const [response, user] = await config.api.users.read(config.context._id) + expect(response).toHaveStatusCode(200) + expect(user).toEqual(config.context) + }) + + it("PUT - update a user", async () => { + config.context.firstName = "Updated First Name" + const [response, user] = await config.api.users.update( + config.context._id, + config.context + ) + expect(response).toHaveStatusCode(200) + expect(user).toEqual(config.context) + }) +}) diff --git a/qa-core/src/shared/BudibaseTestConfiguration.ts b/qa-core/src/shared/BudibaseTestConfiguration.ts new file mode 100644 index 0000000000..6adc1bf5c4 --- /dev/null +++ b/qa-core/src/shared/BudibaseTestConfiguration.ts @@ -0,0 +1,64 @@ +import { BudibaseInternalAPI } from "../internal-api" +import { AccountInternalAPI } from "../account-api" +import { CreateAppRequest, State } from "../types" +import * as fixtures from "../internal-api/fixtures" + +// TEMP +import setup from "../jest/globalSetup" + +export default class BudibaseTestConfiguration { + // apis + internalApi: BudibaseInternalAPI + accountsApi: AccountInternalAPI + + // state + state: State + + constructor() { + this.state = {} + this.internalApi = new BudibaseInternalAPI(this.state) + this.accountsApi = new AccountInternalAPI(this.state) + } + + // LIFECYCLE + + async beforeAll() { + // TEMP - move back to single tenant when we integrate licensing with + // the test run - need to use multiple tenants in cloud to get around + // app limit restrictions + await setup() + + // @ts-ignore + this.state.tenantId = global.qa.tenantId + // @ts-ignore + this.state.cookie = global.qa.authCookie + } + + async afterAll() { + // nothing yet + } + + async createApp(overrides: Partial = {}) { + const app = await this.internalApi.apps.create( + fixtures.apps.generateApp(overrides) + ) + this.state.appId = app.appId + return app + } + + // AUTH + + async login(email: string, password: string, tenantId?: string) { + if (!tenantId && this.state.tenantId) { + tenantId = this.state.tenantId + } else { + throw new Error("Could not determine tenant id") + } + const [res, cookie] = await this.internalApi.auth.login( + tenantId, + email, + password + ) + this.state.cookie = cookie + } +} diff --git a/qa-core/src/config/generator.ts b/qa-core/src/shared/generator.ts similarity index 100% rename from qa-core/src/config/generator.ts rename to qa-core/src/shared/generator.ts diff --git a/qa-core/src/shared/index.ts b/qa-core/src/shared/index.ts new file mode 100644 index 0000000000..0eba40e7d1 --- /dev/null +++ b/qa-core/src/shared/index.ts @@ -0,0 +1,2 @@ +export { default as generator } from "./generator" +export { default as BudibaseTestConfiguration } from "./BudibaseTestConfiguration" diff --git a/qa-core/src/tests/internal-api/applications/create.spec.ts b/qa-core/src/tests/internal-api/applications/create.spec.ts deleted file mode 100644 index 4a84eb25ec..0000000000 --- a/qa-core/src/tests/internal-api/applications/create.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import { db } from "@budibase/backend-core" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { - generateApp, - appFromTemplate, -} from "../../../config/internal-api/fixtures/applications" -import generator from "../../../config/generator" -import generateScreen from "../../../config/internal-api/fixtures/screens" - -describe("Internal API - Application creation", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("Get applications without applications", async () => { - await config.applications.fetchEmptyAppList() - }) - - it("Get all Applications after creating an application", async () => { - await config.applications.create({ - ...generateApp(), - useTemplate: false, - }) - - await config.applications.fetchAllApplications() - }) - - it("Get application details", async () => { - const app = await config.applications.create({ - ...generateApp(), - useTemplate: false, - }) - config.applications.api.appId = app.appId - - const [appPackageResponse, appPackageJson] = - await config.applications.getAppPackage(app.appId) - expect(appPackageJson.application.name).toEqual(app.name) - expect(appPackageJson.application.version).toEqual(app.version) - expect(appPackageJson.application.url).toEqual(app.url) - expect(appPackageJson.application.tenantId).toEqual(app.tenantId) - expect(appPackageJson.application.status).toEqual(app.status) - }) -}) diff --git a/qa-core/src/tests/internal-api/applications/delete.spec.ts b/qa-core/src/tests/internal-api/applications/delete.spec.ts deleted file mode 100644 index 58a1c91da0..0000000000 --- a/qa-core/src/tests/internal-api/applications/delete.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import { db } from "@budibase/backend-core" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { - generateApp, - appFromTemplate, -} from "../../../config/internal-api/fixtures/applications" -import generator from "../../../config/generator" -import generateScreen from "../../../config/internal-api/fixtures/screens" - -describe("Internal API - Application creation, update, publish and delete", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("DELETE - Delete an application", async () => { - const app = await config.applications.create(generateApp()) - - await config.applications.delete(app.appId) - }) -}) diff --git a/qa-core/src/tests/internal-api/applications/publish.spec.ts b/qa-core/src/tests/internal-api/applications/publish.spec.ts deleted file mode 100644 index ffae642afc..0000000000 --- a/qa-core/src/tests/internal-api/applications/publish.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import { db } from "@budibase/backend-core" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { - generateApp, - appFromTemplate, -} from "../../../config/internal-api/fixtures/applications" -import generator from "../../../config/generator" -import generateScreen from "../../../config/internal-api/fixtures/screens" - -describe("Internal API - Application creation, update, publish and delete", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("Publish app", async () => { - // create the app - const app = await config.applications.create(appFromTemplate()) - config.applications.api.appId = app.appId - - // check preview renders - await config.applications.canRender() - - // publish app - await config.applications.publish(app.appId) - - // check published app renders - config.applications.api.appId = db.getProdAppID(app.appId!) - await config.applications.canRender() - - // unpublish app - await config.applications.unpublish(app.appId) - }) - - it("Sync application before deployment", async () => { - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - const [syncResponse, sync] = await config.applications.sync( - app.appId - ) - expect(sync).toEqual({ - message: "App sync not required, app not deployed.", - }) - }) - - it("Sync application after deployment", async () => { - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - // publish app - await config.applications.publish(app._id) - - const [syncResponse, sync] = await config.applications.sync( - app.appId - ) - expect(sync).toEqual({ - message: "App sync completed successfully.", - }) - }) -}) diff --git a/qa-core/src/tests/internal-api/applications/update.spec.ts b/qa-core/src/tests/internal-api/applications/update.spec.ts deleted file mode 100644 index 28c92ba2d7..0000000000 --- a/qa-core/src/tests/internal-api/applications/update.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import { db } from "@budibase/backend-core" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { - generateApp, - appFromTemplate, -} from "../../../config/internal-api/fixtures/applications" -import generator from "../../../config/generator" -import generateScreen from "../../../config/internal-api/fixtures/screens" - -describe("Internal API - Application creation, update, publish and delete", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("Update an application", async () => { - const app = await config.applications.create(generateApp()) - - config.applications.api.appId = app.appId - - await config.applications.rename(app.appId, app.name, { - name: generator.word(), - }) - }) - - it("Revert Changes without changes", async () => { - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - await config.applications.revertUnpublished(app.appId) - }) - - it("Revert Changes", async () => { - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - // publish app - await config.applications.publish(app._id) - - // Change/add component to the app - await config.screen.create(generateScreen("BASIC")) - - // // Revert the app to published state - await config.applications.revertPublished(app.appId) - - // Check screen is removed - await config.applications.getRoutes() - }) -}) diff --git a/qa-core/src/tests/internal-api/dataSources/example.spec.ts b/qa-core/src/tests/internal-api/dataSources/example.spec.ts deleted file mode 100644 index 736e49bd89..0000000000 --- a/qa-core/src/tests/internal-api/dataSources/example.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { App } from "@budibase/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { generateApp } from "../../../config/internal-api/fixtures/applications" -import { Screen } from "@budibase/types" -import generateScreen from "../../../config/internal-api/fixtures/screens" - -describe("Internal API - Data Sources", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - const appConfig = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("Create an app with a data source", async () => { - // Create app - const app = await appConfig.applications.create(generateApp()) - - // Create Screen - const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"] - appConfig.applications.api.appId = app.appId - for (let role in roleArray) { - const [response, screen] = await config.screen.create( - generateScreen(roleArray[role]) - ) - } - }) -}) diff --git a/qa-core/src/tests/internal-api/screens/screens.spec.ts b/qa-core/src/tests/internal-api/screens/screens.spec.ts deleted file mode 100644 index cfc2b7763d..0000000000 --- a/qa-core/src/tests/internal-api/screens/screens.spec.ts +++ /dev/null @@ -1,62 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { App } from "@budibase/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { generateApp } from "../../../config/internal-api/fixtures/applications" -import { Screen } from "@budibase/types" -import generateScreen from "../../../config/internal-api/fixtures/screens" - -describe("Internal API - /screens endpoints", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - const appConfig = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("Create a screen with each role type", async () => { - // Create app - const app = await appConfig.applications.create(generateApp()) - - // Create Screen - const roleArray = ["BASIC", "POWER", "ADMIN", "PUBLIC"] - appConfig.applications.api.appId = app.appId - for (let role in roleArray) { - const [response, screen] = await config.screen.create( - generateScreen(roleArray[role]) - ) - } - }) - - it("Get screens", async () => { - // Create app - const app = await appConfig.applications.create(generateApp()) - - // Create Screen - appConfig.applications.api.appId = app.appId - await config.screen.create(generateScreen("BASIC")) - - // Check screen exists - await appConfig.applications.getRoutes(true) - }) - - it("Delete a screen", async () => { - // Create app - const app = await appConfig.applications.create(generateApp()) - - // Create Screen - appConfig.applications.api.appId = app.appId - const [screenResponse, screen] = await config.screen.create( - generateScreen("BASIC") - ) - - // Delete Screen - await config.screen.delete(screen._id!, screen._rev!) - }) -}) diff --git a/qa-core/src/tests/internal-api/tables/tables.spec.ts b/qa-core/src/tests/internal-api/tables/tables.spec.ts deleted file mode 100644 index e3375aa24c..0000000000 --- a/qa-core/src/tests/internal-api/tables/tables.spec.ts +++ /dev/null @@ -1,160 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import generator from "../../../config/generator" -import { - generateTable, - generateNewColumnForTable, -} from "../../../config/internal-api/fixtures/table" -import { - generateNewRowForTable, - searchBody, -} from "../../../config/internal-api/fixtures/rows" - -describe("Internal API - Table Operations", () => { - const api = new InternalAPIClient() - const accountsAPI = new AccountsAPIClient() - const config = new TestConfiguration(api, accountsAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - async function createAppFromTemplate() { - return config.applications.create({ - name: generator.word(), - url: `/${generator.word()}`, - useTemplate: "true", - templateName: "Near Miss Register", - templateKey: "app/near-miss-register", - templateFile: undefined, - }) - } - - it("Create and delete table, columns and rows", async () => { - // create the app - const appName = generator.word() - const app = await createAppFromTemplate() - config.applications.api.appId = app.appId - - // Get current tables: expect 2 in this template - await config.tables.getAll(2) - - // Add new table - const [createdTableResponse, createdTableData] = await config.tables.save( - generateTable() - ) - - //Table was added - await config.tables.getAll(3) - - //Get information about the table - await config.tables.getTableById(createdTableData._id) - - //Add Column to table - const newColumn = generateNewColumnForTable(createdTableData) - const [addColumnResponse, addColumnData] = await config.tables.save( - newColumn, - true - ) - - //Add Row to table - const newRow = generateNewRowForTable(addColumnData._id) - await config.rows.add(addColumnData._id, newRow) - - //Get Row from table - const [getRowResponse, getRowData] = await config.rows.getAll( - addColumnData._id - ) - - //Delete Row from table - const rowToDelete = { - rows: [getRowData[0]], - } - const [deleteRowResponse, deleteRowData] = await config.rows.delete( - addColumnData._id, - rowToDelete - ) - expect(deleteRowData[0]._id).toEqual(getRowData[0]._id) - - //Delete the table - const [deleteTableResponse, deleteTable] = await config.tables.delete( - addColumnData._id, - addColumnData._rev - ) - - //Table was deleted - await config.tables.getAll(2) - }) - - it("Search and pagination", async () => { - // create the app - const appName = generator.word() - const app = await createAppFromTemplate() - config.applications.api.appId = app.appId - - // Get current tables: expect 2 in this template - await config.tables.getAll(2) - - // Add new table - const [createdTableResponse, createdTableData] = await config.tables.save( - generateTable() - ) - - //Table was added - await config.tables.getAll(3) - - //Get information about the table - await config.tables.getTableById(createdTableData._id) - - //Add Column to table - const newColumn = generateNewColumnForTable(createdTableData) - const [addColumnResponse, addColumnData] = await config.tables.save( - newColumn, - true - ) - - //Add Row to table - let newRow = generateNewRowForTable(addColumnData._id) - await config.rows.add(addColumnData._id, newRow) - - //Search single row - await config.rows.searchNoPagination( - createdTableData._id, - searchBody(createdTableData.primaryDisplay) - ) - - //Add 10 more rows - for (let i = 0; i < 10; i++) { - let newRow = generateNewRowForTable(addColumnData._id) - await config.rows.add(addColumnData._id, newRow) - } - - //Search rows with pagination - const [allRowsResponse, allRowsJson] = - await config.rows.searchWithPagination( - createdTableData._id, - searchBody(createdTableData.primaryDisplay) - ) - - //Delete Rows from table - const rowToDelete = { - rows: [allRowsJson], - } - const [deleteRowResponse, deleteRowData] = await config.rows.delete( - createdTableData._id, - rowToDelete - ) - - //Search single row - await config.rows.searchWithPagination( - createdTableData._id, - searchBody(createdTableData.primaryDisplay) - ) - }) -}) diff --git a/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts b/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts deleted file mode 100644 index 63d70cf141..0000000000 --- a/qa-core/src/tests/internal-api/userManagement/appSpecificRoles.spec.ts +++ /dev/null @@ -1,124 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { - generateApp, - appFromTemplate, -} from "../../../config/internal-api/fixtures/applications" -import { generateUser } from "../../../config/internal-api/fixtures/userManagement" -import { User } from "@budibase/types" -import { db } from "@budibase/backend-core" - -describe("Internal API - App Specific Roles & Permissions", () => { - let api: InternalAPIClient - let accountsAPI: AccountsAPIClient - let config: TestConfiguration - - // Before each test, login as admin. Some tests will require login as a different user - beforeAll(async () => { - api = new InternalAPIClient() - accountsAPI = new AccountsAPIClient() - config = new TestConfiguration(api, accountsAPI) - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - afterAll(async () => { - await config.afterAll() - }) - - it("Add BASIC user to app", async () => { - const appUser = generateUser() - expect(appUser[0].builder?.global).toEqual(false) - expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) - - const app = await config.applications.create(appFromTemplate()) - config.applications.api.appId = app.appId - - const [userInfoResponse, userInfoJson] = await config.users.getInfo( - createUserJson.created.successful[0]._id - ) - const body: User = { - ...userInfoJson, - roles: { - [app.appId]: "BASIC", - }, - } - await config.users.updateInfo(body) - - const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId]).toEqual("BASIC") - }) - - it("Add ADMIN user to app", async () => { - // Create a user with ADMIN role and check if it was created successfully - const adminUser = generateUser(1, "admin") - expect(adminUser[0].builder?.global).toEqual(true) - expect(adminUser[0].admin?.global).toEqual(true) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - adminUser - ) - - const app = await config.applications.create(appFromTemplate()) - config.applications.api.appId = app.appId - - const [userInfoResponse, userInfoJson] = await config.users.getInfo( - createUserJson.created.successful[0]._id - ) - const body: User = { - ...userInfoJson, - roles: { - [app.appId]: "ADMIN", - }, - } - await config.users.updateInfo(body) - - const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId]).toEqual("ADMIN") - - // publish app - await config.applications.publish(app.appId) - // check published app renders - config.applications.api.appId = db.getProdAppID(app.appId!) - await config.applications.canRender() - }) - - it("Add POWER user to app", async () => { - const powerUser = generateUser(1, "developer") - expect(powerUser[0].builder?.global).toEqual(true) - - const [createUserResponse, createUserJson] = await config.users.addMultiple( - powerUser - ) - - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - const [userInfoResponse, userInfoJson] = await config.users.getInfo( - createUserJson.created.successful[0]._id - ) - const body: User = { - ...userInfoJson, - roles: { - [app.appId]: "POWER", - }, - } - await config.users.updateInfo(body) - - // Get the user information again and check if the role was added - const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId]).toEqual("POWER") - }) -}) diff --git a/qa-core/src/tests/internal-api/userManagement/tableAccess.spec.ts b/qa-core/src/tests/internal-api/userManagement/tableAccess.spec.ts deleted file mode 100644 index 93e75348bd..0000000000 --- a/qa-core/src/tests/internal-api/userManagement/tableAccess.spec.ts +++ /dev/null @@ -1,149 +0,0 @@ -import TestConfiguration from "../../../config/internal-api/TestConfiguration" -import { Application } from "@budibase/server/api/controllers/public/mapping/types" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" -import AccountsAPIClient from "../../../config/internal-api/TestConfiguration/accountsAPIClient" -import { generateApp } from "../../../config/internal-api/fixtures/applications" -import { generateUser } from "../../../config/internal-api/fixtures/userManagement" -import { User } from "@budibase/types" -import { - generateNewColumnForTable, - generateTable, -} from "../../../config/internal-api/fixtures/table" - -describe.skip("Internal API - Role table access", () => { - let api: InternalAPIClient - let accountsAPI: AccountsAPIClient - let config: TestConfiguration - - // Before each test, login as admin. Some tests will require login as a different user - beforeEach(async () => { - api = new InternalAPIClient() - accountsAPI = new AccountsAPIClient() - config = new TestConfiguration(api, accountsAPI) - await config.setupAccountAndTenant() - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("Check Table access for app user", async () => { - const appUser = generateUser() - expect(appUser[0].builder?.global).toEqual(false) - expect(appUser[0].admin?.global).toEqual(false) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - appUser - ) - - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - const [userInfoResponse, userInfoJson] = await config.users.getInfo( - createUserJson.created.successful[0]._id - ) - const body: User = { - ...userInfoJson, - roles: { - [app.appId]: "BASIC", - }, - } - await config.users.updateInfo(body) - - const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId]).toEqual("BASIC") - - const [createdTableResponse, createdTableData] = await config.tables.save( - generateTable() - ) - - await config.login(appUser[0].email, appUser[0].password) - - const newColumn = generateNewColumnForTable(createdTableData) - await config.tables.forbiddenSave(newColumn) - await config.tables.forbiddenSave(generateTable()) - }) - - it.skip("Check Table access for developer", async () => { - const developer = generateUser(1, "developer") - expect(developer[0].builder?.global).toEqual(true) - - const [createUserResponse, createUserJson] = await config.users.addMultiple( - developer - ) - - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - const [userInfoResponse, userInfoJson] = await config.users.getInfo( - createUserJson.created.successful[0]._id - ) - const body: User = { - ...userInfoJson, - roles: { - [app.appId]: "POWER", - }, - } - await config.users.updateInfo(body) - - const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId]).toEqual("POWER") - - const [createdTableResponse, createdTableData] = await config.tables.save( - generateTable() - ) - await config.login( - developer[0].email, - developer[0].password - ) - const newColumn = generateNewColumnForTable(createdTableData) - const [addColumnResponse, addColumnData] = await config.tables.save( - newColumn, - true - ) - }) - - it.skip("Check Table access for admin", async () => { - const adminUser = generateUser(1, "admin") - expect(adminUser[0].builder?.global).toEqual(true) - expect(adminUser[0].admin?.global).toEqual(true) - const [createUserResponse, createUserJson] = await config.users.addMultiple( - adminUser - ) - - const app = await config.applications.create(generateApp()) - config.applications.api.appId = app.appId - - const [userInfoResponse, userInfoJson] = await config.users.getInfo( - createUserJson.created.successful[0]._id - ) - const body: User = { - ...userInfoJson, - roles: { - [app.appId]: "ADMIN", - }, - } - await config.users.updateInfo(body) - - const [changedUserInfoResponse, changedUserInfoJson] = - await config.users.getInfo(createUserJson.created.successful[0]._id) - expect(changedUserInfoJson.roles[app.appId]).toBeDefined() - expect(changedUserInfoJson.roles[app.appId]).toEqual("ADMIN") - - await config.login( - adminUser[0].email, - adminUser[0].password - ) - const [createdTableResponse, createdTableData] = await config.tables.save( - generateTable() - ) - const newColumn = generateNewColumnForTable(createdTableData) - const [addColumnResponse, addColumnData] = await config.tables.save( - newColumn, - true - ) - }) -}) diff --git a/qa-core/src/tests/public-api/tables/rows.spec.ts b/qa-core/src/tests/public-api/tables/rows.spec.ts deleted file mode 100644 index d21b61e41a..0000000000 --- a/qa-core/src/tests/public-api/tables/rows.spec.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { Row } from "@budibase/server/api/controllers/public/mapping/types" -import { generateRow } from "../../../config/public-api/fixtures/tables" -import TestConfiguration from "../../../config/public-api/TestConfiguration" -import PublicAPIClient from "../../../config/public-api/TestConfiguration/PublicAPIClient" -import AccountsAPIClient from "../../../config/public-api/TestConfiguration/accountsAPIClient" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" - -describe("Public API - /rows endpoints", () => { - const api = new PublicAPIClient() - const accountsAPI = new AccountsAPIClient() - const internalAPI = new InternalAPIClient() - const config = new TestConfiguration(api, accountsAPI, internalAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - await config.setApiKey() - - const [aResp, app] = await config.applications.seed() - - config.tables.api.appId = app._id - config.rows.api.appId = app._id - - const [tResp, table] = await config.tables.seed() - config.rows.tableId = table._id - - const [rResp, row] = await config.rows.seed(table._id) - config.context = row - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("POST - Create a row", async () => { - const [response, row] = await config.rows.create(generateRow()) - expect(response).toHaveStatusCode(200) - expect(row._id).toBeDefined() - }) - - it("POST - Search rows", async () => { - const [response, rows] = await config.rows.search({ - query: { - string: { - testColumn: config.context.testColumn as string, - }, - }, - }) - expect(response).toHaveStatusCode(200) - expect(rows.length).toEqual(1) - expect(rows[0]._id).toEqual(config.context._id) - expect(rows[0].tableId).toEqual(config.context.tableId) - expect(rows[0].testColumn).toEqual(config.context.testColumn) - }) - - it("GET - Retrieve a row", async () => { - const [response, row] = await config.rows.read(config.context._id) - expect(response).toHaveStatusCode(200) - expect(row._id).toEqual(config.context._id) - expect(row.tableId).toEqual(config.context.tableId) - }) - - it("PUT - update a row", async () => { - config.context.testColumn = "UpdatedName" - const [response, row] = await config.rows.update( - config.context._id, - config.context - ) - expect(response).toHaveStatusCode(200) - expect(row.testColumn).toEqual(config.context.testColumn) - }) -}) diff --git a/qa-core/src/tests/public-api/tables/tables.spec.ts b/qa-core/src/tests/public-api/tables/tables.spec.ts deleted file mode 100644 index fc506d7bb6..0000000000 --- a/qa-core/src/tests/public-api/tables/tables.spec.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Table } from "@budibase/server/api/controllers/public/mapping/types" -import { generateTable } from "../../../config/public-api/fixtures/tables" -import TestConfiguration from "../../../config/public-api/TestConfiguration" -import PublicAPIClient from "../../../config/public-api/TestConfiguration/PublicAPIClient" -import AccountsAPIClient from "../../../config/public-api/TestConfiguration/accountsAPIClient" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" - -describe("Public API - /tables endpoints", () => { - const api = new PublicAPIClient() - const accountsAPI = new AccountsAPIClient() - const internalAPI = new InternalAPIClient() - const config = new TestConfiguration
(api, accountsAPI, internalAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - await config.setApiKey() - - const [appResp, app] = await config.applications.seed() - config.tables.api.appId = app._id - - const [tableResp, table] = await config.tables.seed() - config.context = table - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("POST - Create a table", async () => { - const [response, table] = await config.tables.create(generateTable()) - expect(response).toHaveStatusCode(200) - expect(table._id).toBeDefined() - }) - - it("POST - Search tables", async () => { - const [response, tables] = await config.tables.search({ - name: config.context.name, - }) - expect(response).toHaveStatusCode(200) - expect(tables[0]).toEqual(config.context) - }) - - it("GET - Retrieve a table", async () => { - const [response, table] = await config.tables.read(config.context._id) - expect(response).toHaveStatusCode(200) - expect(table).toEqual(config.context) - }) - - it("PUT - update a table", async () => { - config.context.name = "updatedName" - const [response, table] = await config.tables.update( - config.context._id, - config.context - ) - expect(response).toHaveStatusCode(200) - expect(table).toEqual(config.context) - }) -}) diff --git a/qa-core/src/tests/public-api/users/users.spec.ts b/qa-core/src/tests/public-api/users/users.spec.ts deleted file mode 100644 index 597a8ff2dd..0000000000 --- a/qa-core/src/tests/public-api/users/users.spec.ts +++ /dev/null @@ -1,54 +0,0 @@ -import TestConfiguration from "../../../config/public-api/TestConfiguration" -import PublicAPIClient from "../../../config/public-api/TestConfiguration/PublicAPIClient" -import generateUser from "../../../config/public-api/fixtures/users" -import { User } from "@budibase/server/api/controllers/public/mapping/types" -import AccountsAPIClient from "../../../config/public-api/TestConfiguration/accountsAPIClient" -import InternalAPIClient from "../../../config/internal-api/TestConfiguration/InternalAPIClient" - -describe("Public API - /users endpoints", () => { - const api = new PublicAPIClient() - const accountsAPI = new AccountsAPIClient() - const internalAPI = new InternalAPIClient() - const config = new TestConfiguration(api, accountsAPI, internalAPI) - - beforeAll(async () => { - await config.setupAccountAndTenant() - await config.setApiKey() - const [_, user] = await config.users.seed() - config.context = user - }) - - afterAll(async () => { - await config.afterAll() - }) - - it("POST - Create a user", async () => { - const [response, user] = await config.users.create(generateUser()) - expect(response).toHaveStatusCode(200) - expect(user._id).toBeDefined() - }) - - it("POST - Search users", async () => { - const [response, users] = await config.users.search({ - name: config.context.email, - }) - expect(response).toHaveStatusCode(200) - expect(users[0]).toEqual(config.context) - }) - - it("GET - Retrieve a user", async () => { - const [response, user] = await config.users.read(config.context._id) - expect(response).toHaveStatusCode(200) - expect(user).toEqual(config.context) - }) - - it("PUT - update a user", async () => { - config.context.firstName = "Updated First Name" - const [response, user] = await config.users.update( - config.context._id, - config.context - ) - expect(response).toHaveStatusCode(200) - expect(user).toEqual(config.context) - }) -}) diff --git a/qa-core/src/types/api.ts b/qa-core/src/types/api.ts new file mode 100644 index 0000000000..c94150d3eb --- /dev/null +++ b/qa-core/src/types/api.ts @@ -0,0 +1,5 @@ +export interface APIRequestOpts { + // in some cases we need to bypass the expect assertion in an api call + // e.g. during global setup where jest is not available + doExpect: boolean +} diff --git a/qa-core/src/config/public-api/fixtures/types/apiKeyResponse.ts b/qa-core/src/types/apiKeyResponse.ts similarity index 100% rename from qa-core/src/config/public-api/fixtures/types/apiKeyResponse.ts rename to qa-core/src/types/apiKeyResponse.ts diff --git a/qa-core/src/types/app.ts b/qa-core/src/types/app.ts new file mode 100644 index 0000000000..7159112024 --- /dev/null +++ b/qa-core/src/types/app.ts @@ -0,0 +1,10 @@ +// TODO: Integrate with budibase +export interface CreateAppRequest { + name: string + url: string + useTemplate?: string + templateName?: string + templateKey?: string + templateFile?: string + includeSampleData?: boolean +} diff --git a/qa-core/src/config/internal-api/fixtures/types/appPackage.ts b/qa-core/src/types/appPackage.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/types/appPackage.ts rename to qa-core/src/types/appPackage.ts diff --git a/qa-core/src/config/internal-api/fixtures/types/deploy.ts b/qa-core/src/types/deploy.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/types/deploy.ts rename to qa-core/src/types/deploy.ts diff --git a/qa-core/src/types/index.ts b/qa-core/src/types/index.ts new file mode 100644 index 0000000000..bc75da46f8 --- /dev/null +++ b/qa-core/src/types/index.ts @@ -0,0 +1,13 @@ +export * from "./api" +export * from "./apiKeyResponse" +export * from "./app" +export * from "./appPackage" +export * from "./deploy" +export * from "./newAccount" +export * from "./responseMessage" +export * from "./routing" +export * from "./state" +export * from "./unpublishAppResponse" + +// re-export public api types +export * from "@budibase/server/api/controllers/public/mapping/types" diff --git a/qa-core/src/config/internal-api/fixtures/types/newAccount.ts b/qa-core/src/types/newAccount.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/types/newAccount.ts rename to qa-core/src/types/newAccount.ts diff --git a/qa-core/src/types/responseMessage.ts b/qa-core/src/types/responseMessage.ts new file mode 100644 index 0000000000..718ac207cc --- /dev/null +++ b/qa-core/src/types/responseMessage.ts @@ -0,0 +1,3 @@ +export interface MessageResponse { + message: string +} diff --git a/qa-core/src/config/internal-api/fixtures/types/routing.ts b/qa-core/src/types/routing.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/types/routing.ts rename to qa-core/src/types/routing.ts diff --git a/qa-core/src/types/state.ts b/qa-core/src/types/state.ts new file mode 100644 index 0000000000..0da471e090 --- /dev/null +++ b/qa-core/src/types/state.ts @@ -0,0 +1,7 @@ +export interface State { + apiKey?: string + appId?: string + cookie?: string + tableId?: string + tenantId?: string +} diff --git a/qa-core/src/config/internal-api/fixtures/types/unpublishAppResponse.ts b/qa-core/src/types/unpublishAppResponse.ts similarity index 100% rename from qa-core/src/config/internal-api/fixtures/types/unpublishAppResponse.ts rename to qa-core/src/types/unpublishAppResponse.ts diff --git a/qa-core/yarn.lock b/qa-core/yarn.lock index 61c6e436b9..42beb07108 100644 --- a/qa-core/yarn.lock +++ b/qa-core/yarn.lock @@ -108,6 +108,11 @@ resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.18.9.tgz#4b8aea3b069d8cb8a72cdfe28ddf5ceca695ef2f" integrity sha512-aBXPT3bmtLryXaoJLyYPXPlSD4p1ld9aYeR+sJNOZjJJGiOpb+fKfh3NkcCu7J54nUJwCERPBExCCpyCOHnu/w== +"@babel/helper-plugin-utils@^7.20.2": + version "7.20.2" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz#d1b9000752b18d0877cff85a5c376ce5c3121629" + integrity sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ== + "@babel/helper-simple-access@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz#d6d8f51f4ac2978068df934b569f08f29788c7ea" @@ -195,6 +200,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" +"@babel/plugin-syntax-jsx@^7.7.2": + version "7.21.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.21.4.tgz#f264ed7bf40ffc9ec239edabc17a50c4f5b6fea2" + integrity sha512-5hewiLct5OKyh6PLKEYaFclcqtIgCb6bmELouxjF6up5q3Sov7rOayW4RwhbaBL0dit8rA80GNfY+UuDp2mBbQ== + dependencies: + "@babel/helper-plugin-utils" "^7.20.2" + "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": version "7.10.4" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" @@ -388,69 +400,61 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-28.1.3.tgz#2030606ec03a18c31803b8a36382762e447655df" - integrity sha512-QPAkP5EwKdK/bxIr6C1I4Vs0rm2nHiANzj/Z5X2JQkrZo6IqvC4ldZ9K95tF0HdidhA8Bo6egxSzUFPYKcEXLw== +"@jest/console@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.5.0.tgz#593a6c5c0d3f75689835f1b3b4688c4f8544cb57" + integrity sha512-NEpkObxPwyw/XxZVLPmAGKE89IQRp4puc6IQRPru6JKd1M3fW9v1xM1AnzIJE65hbCkzQAdnL8P47e9hzhiYLQ== dependencies: - "@jest/types" "^28.1.3" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" - jest-message-util "^28.1.3" - jest-util "^28.1.3" + jest-message-util "^29.5.0" + jest-util "^29.5.0" slash "^3.0.0" -"@jest/core@^28.1.1", "@jest/core@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-28.1.3.tgz#0ebf2bd39840f1233cd5f2d1e6fc8b71bd5a1ac7" - integrity sha512-CIKBrlaKOzA7YG19BEqCw3SLIsEwjZkeJzf5bdooVnW4bH5cktqe3JX+G2YV1aK5vP8N9na1IGWFzYaTp6k6NA== +"@jest/core@^29.0.0", "@jest/core@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.5.0.tgz#76674b96904484e8214614d17261cc491e5f1f03" + integrity sha512-28UzQc7ulUrOQw1IsN/kv1QES3q2kkbl/wGslyhAclqZ/8cMdB5M68BffkIdSJgKBUt50d3hbwJ92XESlE7LiQ== dependencies: - "@jest/console" "^28.1.3" - "@jest/reporters" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/console" "^29.5.0" + "@jest/reporters" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^28.1.3" - jest-config "^28.1.3" - jest-haste-map "^28.1.3" - jest-message-util "^28.1.3" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.3" - jest-resolve-dependencies "^28.1.3" - jest-runner "^28.1.3" - jest-runtime "^28.1.3" - jest-snapshot "^28.1.3" - jest-util "^28.1.3" - jest-validate "^28.1.3" - jest-watcher "^28.1.3" + jest-changed-files "^29.5.0" + jest-config "^29.5.0" + jest-haste-map "^29.5.0" + jest-message-util "^29.5.0" + jest-regex-util "^29.4.3" + jest-resolve "^29.5.0" + jest-resolve-dependencies "^29.5.0" + jest-runner "^29.5.0" + jest-runtime "^29.5.0" + jest-snapshot "^29.5.0" + jest-util "^29.5.0" + jest-validate "^29.5.0" + jest-watcher "^29.5.0" micromatch "^4.0.4" - pretty-format "^28.1.3" - rimraf "^3.0.0" + pretty-format "^29.5.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-28.1.3.tgz#abed43a6b040a4c24fdcb69eab1f97589b2d663e" - integrity sha512-1bf40cMFTEkKyEf585R9Iz1WayDjHoHqvts0XFYEqyKM3cFWDpeMoqKKTAF9LSYQModPUlh8FKptoM2YcMWAXA== +"@jest/environment@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.5.0.tgz#9152d56317c1fdb1af389c46640ba74ef0bb4c65" + integrity sha512-5FXw2+wD29YU1d4I2htpRX7jYnAyTRjP2CsXQdo9SAM8g3ifxWPSV0HnClSn71xwctr0U3oZIIH+dtbfmnbXVQ== dependencies: - "@jest/fake-timers" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/fake-timers" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" - jest-mock "^28.1.3" - -"@jest/expect-utils@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-28.1.3.tgz#58561ce5db7cd253a7edddbc051fb39dda50f525" - integrity sha512-wvbi9LUrHJLn3NlDW6wF2hvIMtd4JUl2QNVrjq+IBSHirgfrR3o9RnVtxzdEGO2n9JyIWwHnLfby5KzqBGg2YA== - dependencies: - jest-get-type "^28.0.2" + jest-mock "^29.5.0" "@jest/expect-utils@^29.0.2": version "29.0.2" @@ -459,46 +463,54 @@ dependencies: jest-get-type "^29.0.0" -"@jest/expect@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-28.1.3.tgz#9ac57e1d4491baca550f6bdbd232487177ad6a72" - integrity sha512-lzc8CpUbSoE4dqT0U+g1qODQjBRHPpCPXissXD4mS9+sWQdmmpeJ9zSH1rS1HEkrsMN0fb7nKrJ9giAR1d3wBw== +"@jest/expect-utils@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/expect-utils/-/expect-utils-29.5.0.tgz#f74fad6b6e20f924582dc8ecbf2cb800fe43a036" + integrity sha512-fmKzsidoXQT2KwnrwE0SQq3uj8Z763vzR8LnLBwC2qYWEFpjX8daRsk6rHUM1QvNlEW/UJXNXm59ztmJJWs2Mg== dependencies: - expect "^28.1.3" - jest-snapshot "^28.1.3" + jest-get-type "^29.4.3" -"@jest/fake-timers@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-28.1.3.tgz#230255b3ad0a3d4978f1d06f70685baea91c640e" - integrity sha512-D/wOkL2POHv52h+ok5Oj/1gOG9HSywdoPtFsRCUmlCILXNn5eIWmcnd3DIiWlJnpGvQtmajqBP95Ei0EimxfLw== +"@jest/expect@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/expect/-/expect-29.5.0.tgz#80952f5316b23c483fbca4363ce822af79c38fba" + integrity sha512-PueDR2HGihN3ciUNGr4uelropW7rqUfTiOn+8u0leg/42UhblPxHkfoh0Ruu3I9Y1962P3u2DY4+h7GVTSVU6g== dependencies: - "@jest/types" "^28.1.3" - "@sinonjs/fake-timers" "^9.1.2" + expect "^29.5.0" + jest-snapshot "^29.5.0" + +"@jest/fake-timers@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.5.0.tgz#d4d09ec3286b3d90c60bdcd66ed28d35f1b4dc2c" + integrity sha512-9ARvuAAQcBwDAqOnglWq2zwNIRUDtk/SCkp/ToGEhFv5r86K21l+VEs0qNTaXtyiY0lEePl3kylijSYJQqdbDg== + dependencies: + "@jest/types" "^29.5.0" + "@sinonjs/fake-timers" "^10.0.2" "@types/node" "*" - jest-message-util "^28.1.3" - jest-mock "^28.1.3" - jest-util "^28.1.3" + jest-message-util "^29.5.0" + jest-mock "^29.5.0" + jest-util "^29.5.0" -"@jest/globals@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-28.1.3.tgz#a601d78ddc5fdef542728309894895b4a42dc333" - integrity sha512-XFU4P4phyryCXu1pbcqMO0GSQcYe1IsalYCDzRNyhetyeyxMcIxa11qPNDpVNLeretItNqEmYYQn1UYz/5x1NA== +"@jest/globals@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.5.0.tgz#6166c0bfc374c58268677539d0c181f9c1833298" + integrity sha512-S02y0qMWGihdzNbUiqSAiKSpSozSuHX5UYc7QbnHP+D9Lyw8DgGGCinrN9uSuHPeKgSSzvPom2q1nAtBvUsvPQ== dependencies: - "@jest/environment" "^28.1.3" - "@jest/expect" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/environment" "^29.5.0" + "@jest/expect" "^29.5.0" + "@jest/types" "^29.5.0" + jest-mock "^29.5.0" -"@jest/reporters@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-28.1.3.tgz#9adf6d265edafc5fc4a434cfb31e2df5a67a369a" - integrity sha512-JuAy7wkxQZVNU/V6g9xKzCGC5LVXx9FDcABKsSXp5MiKPEE2144a/vXTEDoyzjUpZKfVwp08Wqg5A4WfTMAzjg== +"@jest/reporters@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.5.0.tgz#985dfd91290cd78ddae4914ba7921bcbabe8ac9b" + integrity sha512-D05STXqj/M8bP9hQNSICtPqz97u7ffGzZu+9XLucXhkOFBqKcXe04JLZOgIekOxdb73MAoBUFnqvf7MCpKk5OA== dependencies: "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" - "@jridgewell/trace-mapping" "^0.3.13" + "@jest/console" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" + "@jridgewell/trace-mapping" "^0.3.15" "@types/node" "*" chalk "^4.0.0" collect-v8-coverage "^1.0.0" @@ -510,22 +522,14 @@ istanbul-lib-report "^3.0.0" istanbul-lib-source-maps "^4.0.0" istanbul-reports "^3.1.3" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - jest-worker "^28.1.3" + jest-message-util "^29.5.0" + jest-util "^29.5.0" + jest-worker "^29.5.0" slash "^3.0.0" string-length "^4.0.1" strip-ansi "^6.0.0" - terminal-link "^2.0.0" v8-to-istanbul "^9.0.1" -"@jest/schemas@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" - integrity sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg== - dependencies: - "@sinclair/typebox" "^0.24.1" - "@jest/schemas@^29.0.0": version "29.0.0" resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.0.0.tgz#5f47f5994dd4ef067fb7b4188ceac45f77fe952a" @@ -533,62 +537,69 @@ dependencies: "@sinclair/typebox" "^0.24.1" -"@jest/source-map@^28.1.2": - version "28.1.2" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-28.1.2.tgz#7fe832b172b497d6663cdff6c13b0a920e139e24" - integrity sha512-cV8Lx3BeStJb8ipPHnqVw/IM2VCMWO3crWZzYodSIkxXnRcXJipCdx1JCK0K5MsJJouZQTH73mzf4vgxRaH9ww== +"@jest/schemas@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-29.4.3.tgz#39cf1b8469afc40b6f5a2baaa146e332c4151788" + integrity sha512-VLYKXQmtmuEz6IxJsrZwzG9NvtkQsWNnWMsKxqWNu3+CnfzJQhp0WDDKWLVV9hLKr0l3SLLFRqcYHjhtyuDVxg== dependencies: - "@jridgewell/trace-mapping" "^0.3.13" + "@sinclair/typebox" "^0.25.16" + +"@jest/source-map@^29.4.3": + version "29.4.3" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.4.3.tgz#ff8d05cbfff875d4a791ab679b4333df47951d20" + integrity sha512-qyt/mb6rLyd9j1jUts4EQncvS6Yy3PM9HghnNv86QBlV+zdL2inCdK1tuVlL+J+lpiw2BI67qXOrX3UurBqQ1w== + dependencies: + "@jridgewell/trace-mapping" "^0.3.15" callsites "^3.0.0" graceful-fs "^4.2.9" -"@jest/test-result@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-28.1.3.tgz#5eae945fd9f4b8fcfce74d239e6f725b6bf076c5" - integrity sha512-kZAkxnSE+FqE8YjW8gNuoVkkC9I7S1qmenl8sGcDOLropASP+BkcGKwhXoyqQuGOGeYY0y/ixjrd/iERpEXHNg== +"@jest/test-result@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.5.0.tgz#7c856a6ca84f45cc36926a4e9c6b57f1973f1408" + integrity sha512-fGl4rfitnbfLsrfx1uUpDEESS7zM8JdgZgOCQuxQvL1Sn/I6ijeAVQWGfXI9zb1i9Mzo495cIpVZhA0yr60PkQ== dependencies: - "@jest/console" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/console" "^29.5.0" + "@jest/types" "^29.5.0" "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-28.1.3.tgz#9d0c283d906ac599c74bde464bc0d7e6a82886c3" - integrity sha512-NIMPEqqa59MWnDi1kvXXpYbqsfQmSJsIbnd85mdVGkiDfQ9WQQTXOLsvISUfonmnBT+w85WEgneCigEEdHDFxw== +"@jest/test-sequencer@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.5.0.tgz#34d7d82d3081abd523dbddc038a3ddcb9f6d3cc4" + integrity sha512-yPafQEcKjkSfDXyvtgiV4pevSeyuA6MQr6ZIdVkWJly9vkqjnFfcfhRQqpD5whjoU8EORki752xQmjaqoFjzMQ== dependencies: - "@jest/test-result" "^28.1.3" + "@jest/test-result" "^29.5.0" graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" + jest-haste-map "^29.5.0" slash "^3.0.0" -"@jest/transform@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-28.1.3.tgz#59d8098e50ab07950e0f2fc0fc7ec462371281b0" - integrity sha512-u5dT5di+oFI6hfcLOHGTAfmUxFRrjK+vnaP0kkVow9Md/M7V/MxqQMOz/VV25UZO8pzeA9PjfTpOu6BDuwSPQA== +"@jest/transform@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-29.5.0.tgz#cf9c872d0965f0cbd32f1458aa44a2b1988b00f9" + integrity sha512-8vbeZWqLJOvHaDfeMuoHITGKSz5qWc9u04lnWrQE3VyuSw604PzQM824ZeX9XSjUCeDiE3GuxZe5UKa8J61NQw== dependencies: "@babel/core" "^7.11.6" - "@jest/types" "^28.1.3" - "@jridgewell/trace-mapping" "^0.3.13" + "@jest/types" "^29.5.0" + "@jridgewell/trace-mapping" "^0.3.15" babel-plugin-istanbul "^6.1.1" chalk "^4.0.0" - convert-source-map "^1.4.0" - fast-json-stable-stringify "^2.0.0" + convert-source-map "^2.0.0" + fast-json-stable-stringify "^2.1.0" graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" - jest-regex-util "^28.0.2" - jest-util "^28.1.3" + jest-haste-map "^29.5.0" + jest-regex-util "^29.4.3" + jest-util "^29.5.0" micromatch "^4.0.4" pirates "^4.0.4" slash "^3.0.0" - write-file-atomic "^4.0.1" + write-file-atomic "^4.0.2" -"@jest/types@^28.1.1", "@jest/types@^28.1.3": - version "28.1.3" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-28.1.3.tgz#b05de80996ff12512bc5ceb1d208285a7d11748b" - integrity sha512-RyjiyMUZrKz/c+zlMFO1pm70DcIlST8AeWTkoUdZevew44wcNZQHsEVOiCVtgVnlFFD82FPaXycys58cf2muVQ== +"@jest/types@^29.0.0", "@jest/types@^29.5.0": + version "29.5.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-29.5.0.tgz#f59ef9b031ced83047c67032700d8c807d6e1593" + integrity sha512-qbu7kN6czmVRc3xWFQcAN03RAUamgppVUdXrvl1Wr3jlNF93o9mJbGcDWrwGB6ht44u7efB1qCFgVQmca24Uog== dependencies: - "@jest/schemas" "^28.1.3" + "@jest/schemas" "^29.4.3" "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^3.0.0" "@types/node" "*" @@ -624,7 +635,7 @@ "@jridgewell/sourcemap-codec" "^1.4.10" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/resolve-uri@^3.0.3": +"@jridgewell/resolve-uri@3.1.0", "@jridgewell/resolve-uri@^3.0.3": version "3.1.0" resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== @@ -634,7 +645,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72" integrity sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw== -"@jridgewell/sourcemap-codec@^1.4.10": +"@jridgewell/sourcemap-codec@1.4.14", "@jridgewell/sourcemap-codec@^1.4.10": version "1.4.14" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== @@ -647,7 +658,7 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.13", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.9": version "0.3.15" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz#aba35c48a38d3fd84b37e66c9c0423f9744f9774" integrity sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g== @@ -655,6 +666,14 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" +"@jridgewell/trace-mapping@^0.3.15": + version "0.3.17" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.17.tgz#793041277af9073b0951a7fe0f0d8c4c98c36985" + integrity sha512-MCNzAp77qzKca9+W/+I0+sEpaUnZoeasnghNeVc41VZCEKaCH73Vq3BZZ/SzWIgrqE4H4ceI+p+b6C0mHf9T4g== + dependencies: + "@jridgewell/resolve-uri" "3.1.0" + "@jridgewell/sourcemap-codec" "1.4.14" + "@mapbox/node-pre-gyp@^1.0.0": version "1.0.10" resolved "https://registry.yarnpkg.com/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.10.tgz#8e6735ccebbb1581e5a7e652244cadc8a844d03c" @@ -730,19 +749,24 @@ resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.35.tgz#7b5ca127aefe3ed482bb60f874bebbe3143e82f5" integrity sha512-iN6ehuDndiTiDz2F+Orv/+oHJR+PrGv+38oghCddpsW4YEZl5qyLsWxSwYUWrKEOfjpGtXDFW6scJtjpzSLeSw== -"@sinonjs/commons@^1.7.0": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" - integrity sha512-xkNcLAn/wZaX14RPlwizcKicDk9G3F8m2nU3L7Ukm5zBgTwiT0wsoFAHx9Jq56fJA1z/7uKGtCRu16sOUCLIHQ== +"@sinclair/typebox@^0.25.16": + version "0.25.24" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.25.24.tgz#8c7688559979f7079aacaf31aa881c3aa410b718" + integrity sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ== + +"@sinonjs/commons@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-2.0.0.tgz#fd4ca5b063554307e8327b4564bd56d3b73924a3" + integrity sha512-uLa0j859mMrg2slwQYdO/AkrOfmH+X6LTVmNTS9CqexuE2IvVORIkSpJLqePAbEnKJ77aMmCwr1NUZ57120Xcg== dependencies: type-detect "4.0.8" -"@sinonjs/fake-timers@^9.1.2": - version "9.1.2" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-9.1.2.tgz#4eaab737fab77332ab132d396a3c0d364bd0ea8c" - integrity sha512-BPS4ynJW/o92PUR4wgriz2Ud5gpST5vz6GQfMixEDK0Z8ZCUv2M7SkBLykH56T++Xs+8ln9zTGbOvNGIe02/jw== +"@sinonjs/fake-timers@^10.0.2": + version "10.0.2" + resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-10.0.2.tgz#d10549ed1f423d80639c528b6c7f5a1017747d0c" + integrity sha512-SwUDyjWnah1AaNl7kxsa7cfLhlTYoiyhDAIgyh+El30YvXs/o7OLXpYH88Zdhyx9JExKrmHDJ+10bwIcY80Jmw== dependencies: - "@sinonjs/commons" "^1.7.0" + "@sinonjs/commons" "^2.0.0" "@techpass/passport-openidconnect@0.3.2": version "0.3.2" @@ -1100,15 +1124,15 @@ axios@^1.1.3: form-data "^4.0.0" proxy-from-env "^1.1.0" -babel-jest@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-28.1.3.tgz#c1187258197c099072156a0a121c11ee1e3917d5" - integrity sha512-epUaPOEWMk3cWX0M/sPvCHHCe9fMFAa/9hXEgKP8nFfNl/jlGkE9ucq9NqkZGXLDduCJYS0UvSlPUwC0S+rH6Q== +babel-jest@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-29.5.0.tgz#3fe3ddb109198e78b1c88f9ebdecd5e4fc2f50a5" + integrity sha512-mA4eCDh5mSo2EcA9xQjVTpmbbNk32Zb3Q3QFQsNhaK56Q+yoXowzFodLux30HRgyOho5rsQ6B0P9QpMkvvnJ0Q== dependencies: - "@jest/transform" "^28.1.3" + "@jest/transform" "^29.5.0" "@types/babel__core" "^7.1.14" babel-plugin-istanbul "^6.1.1" - babel-preset-jest "^28.1.3" + babel-preset-jest "^29.5.0" chalk "^4.0.0" graceful-fs "^4.2.9" slash "^3.0.0" @@ -1124,10 +1148,10 @@ babel-plugin-istanbul@^6.1.1: istanbul-lib-instrument "^5.0.4" test-exclude "^6.0.0" -babel-plugin-jest-hoist@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-28.1.3.tgz#1952c4d0ea50f2d6d794353762278d1d8cca3fbe" - integrity sha512-Ys3tUKAmfnkRUpPdpa98eYrAR0nV+sSFUZZEGuQ2EbFd1y4SOLtD5QDNHAq+bb9a+bbXvYQC4b+ID/THIMcU6Q== +babel-plugin-jest-hoist@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.5.0.tgz#a97db437936f441ec196990c9738d4b88538618a" + integrity sha512-zSuuuAlTMT4mzLj2nPnUm6fsE6270vdOfnpbJ+RmruU75UhLFvL0N2NgI7xpeS7NaB6hGqmd5pVpGTDYvi4Q3w== dependencies: "@babel/template" "^7.3.3" "@babel/types" "^7.3.3" @@ -1152,12 +1176,12 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" -babel-preset-jest@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-28.1.3.tgz#5dfc20b99abed5db994406c2b9ab94c73aaa419d" - integrity sha512-L+fupJvlWAHbQfn74coNX3zf60LXMJsezNvvx8eIh7iOR1luJ1poxYgQk1F8PYtNq/6QODDHCqsSnTFSWC491A== +babel-preset-jest@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-29.5.0.tgz#57bc8cc88097af7ff6a5ab59d1cd29d52a5916e2" + integrity sha512-JOMloxOqdiBSxMAzjRaH023/vvcaSaec49zvg+2LmNsktC7ei39LTJGw02J+9uUtTZUq6xbLyJ4dxe9sSmIuAg== dependencies: - babel-plugin-jest-hoist "^28.1.3" + babel-plugin-jest-hoist "^29.5.0" babel-preset-current-node-syntax "^1.0.0" balanced-match@^1.0.0: @@ -1458,11 +1482,6 @@ combined-stream@^1.0.6, combined-stream@^1.0.8, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@^4.0.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - component-type@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/component-type/-/component-type-1.2.1.tgz#8a47901700238e4fc32269771230226f24b415a9" @@ -1490,13 +1509,18 @@ content-type@^1.0.4: resolved "https://registry.yarnpkg.com/content-type/-/content-type-1.0.4.tgz#e138cc75e040c727b1966fe5e5f8c9aee256fe3b" integrity sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA== -convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: +convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.8.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== dependencies: safe-buffer "~5.1.1" +convert-source-map@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" + integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== + cookies@~0.8.0: version "0.8.0" resolved "https://registry.yarnpkg.com/cookies/-/cookies-0.8.0.tgz#1293ce4b391740a8406e3c9870e828c4b54f3f90" @@ -1534,7 +1558,7 @@ cron-parser@^4.2.1: dependencies: luxon "^3.2.1" -cross-spawn@^7.0.0, cross-spawn@^7.0.3: +cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -1637,16 +1661,16 @@ detect-newline@^3.0.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== -diff-sequences@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" - integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== - diff-sequences@^29.0.0: version "29.0.0" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.0.0.tgz#bae49972ef3933556bcb0800b72e8579d19d9e4f" integrity sha512-7Qe/zd1wxSDL4D/X/FPjOMB+ZMDt71W94KYaq05I2l0oQqgXgs7s4ftYYmV38gBSrPz2vcygxfs1xn0FT+rKNA== +diff-sequences@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.4.3.tgz#9314bc1fabe09267ffeca9cbafc457d8499a13f2" + integrity sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA== + diff@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" @@ -1699,10 +1723,10 @@ emitter-listener@1.1.2: dependencies: shimmer "^1.2.0" -emittery@^0.10.2: - version "0.10.2" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.10.2.tgz#902eec8aedb8c41938c46e9385e9db7e03182933" - integrity sha512-aITqOwnLanpHLNXZJENbOgjUBeHocD+xsSJmNrjovKBW5HbSpW3d1pEls7GFQPUWXiwG9+0P4GtHfEqC/4M0Iw== +emittery@^0.13.1: + version "0.13.1" + resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" + integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== emoji-regex@^8.0.0: version "8.0.0" @@ -1738,14 +1762,6 @@ end-stream@~0.1.0: dependencies: write-stream "~0.4.3" -env-cmd@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/env-cmd/-/env-cmd-10.1.0.tgz#c7f5d3b550c9519f137fdac4dd8fb6866a8c8c4b" - integrity sha512-mMdWTT9XKN7yNth/6N6g2GuKuJTsKMDHlQFUDacb/heQRRWOTIZ42t1rMHnQu4jYxU1ajdTeJM+9eEETlqToMA== - dependencies: - commander "^4.0.0" - cross-spawn "^7.0.0" - errno@~0.1.1: version "0.1.8" resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -1828,17 +1844,6 @@ exit@^0.1.2: resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" integrity sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ== -expect@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/expect/-/expect-28.1.3.tgz#90a7c1a124f1824133dd4533cce2d2bdcb6603ec" - integrity sha512-eEh0xn8HlsuOBxFgIss+2mX85VAS4Qy3OSkjV7rlBWljtA4oWH37glVGyOZSZvErDT/yBywZdPGwCXuTvSG85g== - dependencies: - "@jest/expect-utils" "^28.1.3" - jest-get-type "^28.0.2" - jest-matcher-utils "^28.1.3" - jest-message-util "^28.1.3" - jest-util "^28.1.3" - expect@^29.0.0: version "29.0.2" resolved "https://registry.yarnpkg.com/expect/-/expect-29.0.2.tgz#22c7132400f60444b427211f1d6bb604a9ab2420" @@ -1850,6 +1855,17 @@ expect@^29.0.0: jest-message-util "^29.0.2" jest-util "^29.0.2" +expect@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-29.5.0.tgz#68c0509156cb2a0adb8865d413b137eeaae682f7" + integrity sha512-yM7xqUrCO2JdpFo4XpM82t+PJBFybdqoQuJLDGeDX2ij8NZzqRHyu3Hp188/JX7SWqud+7t4MUdvcgGBICMHZg== + dependencies: + "@jest/expect-utils" "^29.5.0" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-util "^29.5.0" + extend@~3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" @@ -1870,7 +1886,7 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -2364,95 +2380,86 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" -jest-changed-files@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-28.1.3.tgz#d9aeee6792be3686c47cb988a8eaf82ff4238831" - integrity sha512-esaOfUWJXk2nfZt9SPyC8gA1kNfdKLkQWyzsMlqq8msYSlNKfmZxfRgZn4Cd4MGVUF+7v6dBs0d5TOAKa7iIiA== +jest-changed-files@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.5.0.tgz#e88786dca8bf2aa899ec4af7644e16d9dcf9b23e" + integrity sha512-IFG34IUMUaNBIxjQXF/iu7g6EcdMrGRRxaUSw92I/2g2YC6vCdTltl4nHvt7Ci5nSJwXIkCu8Ka1DKF+X7Z1Ag== dependencies: execa "^5.0.0" p-limit "^3.1.0" -jest-circus@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-28.1.3.tgz#d14bd11cf8ee1a03d69902dc47b6bd4634ee00e4" - integrity sha512-cZ+eS5zc79MBwt+IhQhiEp0OeBddpc1n8MBo1nMB8A7oPMKEO+Sre+wHaLJexQUj9Ya/8NOBY0RESUgYjB6fow== +jest-circus@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-29.5.0.tgz#b5926989449e75bff0d59944bae083c9d7fb7317" + integrity sha512-gq/ongqeQKAplVxqJmbeUOJJKkW3dDNPY8PjhJ5G0lBRvu0e3EWGxGy5cI4LAGA7gV2UHCtWBI4EMXK8c9nQKA== dependencies: - "@jest/environment" "^28.1.3" - "@jest/expect" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/environment" "^29.5.0" + "@jest/expect" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" co "^4.6.0" dedent "^0.7.0" is-generator-fn "^2.0.0" - jest-each "^28.1.3" - jest-matcher-utils "^28.1.3" - jest-message-util "^28.1.3" - jest-runtime "^28.1.3" - jest-snapshot "^28.1.3" - jest-util "^28.1.3" + jest-each "^29.5.0" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-runtime "^29.5.0" + jest-snapshot "^29.5.0" + jest-util "^29.5.0" p-limit "^3.1.0" - pretty-format "^28.1.3" + pretty-format "^29.5.0" + pure-rand "^6.0.0" slash "^3.0.0" stack-utils "^2.0.3" -jest-cli@^28.1.1: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-28.1.3.tgz#558b33c577d06de55087b8448d373b9f654e46b2" - integrity sha512-roY3kvrv57Azn1yPgdTebPAXvdR2xfezaKKYzVxZ6It/5NCxzJym6tUI5P1zkdWhfUYkxEI9uZWcQdaFLo8mJQ== +jest-cli@^29.0.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.5.0.tgz#b34c20a6d35968f3ee47a7437ff8e53e086b4a67" + integrity sha512-L1KcP1l4HtfwdxXNFCL5bmUbLQiKrakMUriBEcc1Vfz6gx31ORKdreuWvmQVBit+1ss9NNR3yxjwfwzZNdQXJw== dependencies: - "@jest/core" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/core" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/types" "^29.5.0" chalk "^4.0.0" exit "^0.1.2" graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^28.1.3" - jest-util "^28.1.3" - jest-validate "^28.1.3" + jest-config "^29.5.0" + jest-util "^29.5.0" + jest-validate "^29.5.0" prompts "^2.0.1" yargs "^17.3.1" -jest-config@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-28.1.3.tgz#e315e1f73df3cac31447eed8b8740a477392ec60" - integrity sha512-MG3INjByJ0J4AsNBm7T3hsuxKQqFIiRo/AUqb1q9LRKI5UU6Aar9JHbr9Ivn1TVwfUD9KirRoM/T6u8XlcQPHQ== +jest-config@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.5.0.tgz#3cc972faec8c8aaea9ae158c694541b79f3748da" + integrity sha512-kvDUKBnNJPNBmFFOhDbm59iu1Fii1Q6SxyhXfvylq3UTHbg6o7j/g8k2dZyXWLvfdKB1vAPxNZnMgtKJcmu3kA== dependencies: "@babel/core" "^7.11.6" - "@jest/test-sequencer" "^28.1.3" - "@jest/types" "^28.1.3" - babel-jest "^28.1.3" + "@jest/test-sequencer" "^29.5.0" + "@jest/types" "^29.5.0" + babel-jest "^29.5.0" chalk "^4.0.0" ci-info "^3.2.0" deepmerge "^4.2.2" glob "^7.1.3" graceful-fs "^4.2.9" - jest-circus "^28.1.3" - jest-environment-node "^28.1.3" - jest-get-type "^28.0.2" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.3" - jest-runner "^28.1.3" - jest-util "^28.1.3" - jest-validate "^28.1.3" + jest-circus "^29.5.0" + jest-environment-node "^29.5.0" + jest-get-type "^29.4.3" + jest-regex-util "^29.4.3" + jest-resolve "^29.5.0" + jest-runner "^29.5.0" + jest-util "^29.5.0" + jest-validate "^29.5.0" micromatch "^4.0.4" parse-json "^5.2.0" - pretty-format "^28.1.3" + pretty-format "^29.5.0" slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.3.tgz#948a192d86f4e7a64c5264ad4da4877133d8792f" - integrity sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw== - dependencies: - chalk "^4.0.0" - diff-sequences "^28.1.1" - jest-get-type "^28.0.2" - pretty-format "^28.1.3" - jest-diff@^29.0.2: version "29.0.2" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.0.2.tgz#1a99419efda66f9ee72f91e580e774df95de5ddc" @@ -2463,82 +2470,82 @@ jest-diff@^29.0.2: jest-get-type "^29.0.0" pretty-format "^29.0.2" -jest-docblock@^28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-28.1.1.tgz#6f515c3bf841516d82ecd57a62eed9204c2f42a8" - integrity sha512-3wayBVNiOYx0cwAbl9rwm5kKFP8yHH3d/fkEaL02NPTkDojPtheGB7HZSFY4wzX+DxyrvhXz0KSCVksmCknCuA== +jest-diff@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.5.0.tgz#e0d83a58eb5451dcc1fa61b1c3ee4e8f5a290d63" + integrity sha512-LtxijLLZBduXnHSniy0WMdaHjmQnt3g5sa16W4p0HqukYTTsyTW3GD1q41TyGl5YFXj/5B2U6dlh5FM1LIMgxw== + dependencies: + chalk "^4.0.0" + diff-sequences "^29.4.3" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" + +jest-docblock@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.4.3.tgz#90505aa89514a1c7dceeac1123df79e414636ea8" + integrity sha512-fzdTftThczeSD9nZ3fzA/4KkHtnmllawWrXO69vtI+L9WjEIuXWs4AmyME7lN5hU7dB0sHhuPfcKofRsUb/2Fg== dependencies: detect-newline "^3.0.0" -jest-each@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-28.1.3.tgz#bdd1516edbe2b1f3569cfdad9acd543040028f81" - integrity sha512-arT1z4sg2yABU5uogObVPvSlSMQlDA48owx07BDPAiasW0yYpYHYOo4HHLz9q0BVzDVU4hILFjzJw0So9aCL/g== +jest-each@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.5.0.tgz#fc6e7014f83eac68e22b7195598de8554c2e5c06" + integrity sha512-HM5kIJ1BTnVt+DQZ2ALp3rzXEl+g726csObrW/jpEGl+CDSSQpOJJX2KE/vEg8cxcMXdyEPu6U4QX5eruQv5hA== dependencies: - "@jest/types" "^28.1.3" + "@jest/types" "^29.5.0" chalk "^4.0.0" - jest-get-type "^28.0.2" - jest-util "^28.1.3" - pretty-format "^28.1.3" + jest-get-type "^29.4.3" + jest-util "^29.5.0" + pretty-format "^29.5.0" -jest-environment-node@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-28.1.3.tgz#7e74fe40eb645b9d56c0c4b70ca4357faa349be5" - integrity sha512-ugP6XOhEpjAEhGYvp5Xj989ns5cB1K6ZdjBYuS30umT4CQEETaxSiPcZ/E1kFktX4GkrcM4qu07IIlDYX1gp+A== +jest-environment-node@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.5.0.tgz#f17219d0f0cc0e68e0727c58b792c040e332c967" + integrity sha512-ExxuIK/+yQ+6PRGaHkKewYtg6hto2uGCgvKdb2nfJfKXgZ17DfXjvbZ+jA1Qt9A8EQSfPnt5FKIfnOO3u1h9qw== dependencies: - "@jest/environment" "^28.1.3" - "@jest/fake-timers" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/environment" "^29.5.0" + "@jest/fake-timers" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" - jest-mock "^28.1.3" - jest-util "^28.1.3" - -jest-get-type@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" - integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== + jest-mock "^29.5.0" + jest-util "^29.5.0" jest-get-type@^29.0.0: version "29.0.0" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.0.0.tgz#843f6c50a1b778f7325df1129a0fd7aa713aef80" integrity sha512-83X19z/HuLKYXYHskZlBAShO7UfLFXu/vWajw9ZNJASN32li8yHMaVGAQqxFW1RCFOkB7cubaL6FaJVQqqJLSw== -jest-haste-map@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-28.1.3.tgz#abd5451129a38d9841049644f34b034308944e2b" - integrity sha512-3S+RQWDXccXDKSWnkHa/dPwt+2qwA8CJzR61w3FoYCvoo3Pn8tvGcysmMF0Bj0EX5RYvAI2EIvC57OmotfdtKA== +jest-get-type@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.4.3.tgz#1ab7a5207c995161100b5187159ca82dd48b3dd5" + integrity sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg== + +jest-haste-map@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-29.5.0.tgz#69bd67dc9012d6e2723f20a945099e972b2e94de" + integrity sha512-IspOPnnBro8YfVYSw6yDRKh/TiCdRngjxeacCps1cQ9cgVN6+10JUcuJ1EabrgYLOATsIAigxA0rLR9x/YlrSA== dependencies: - "@jest/types" "^28.1.3" + "@jest/types" "^29.5.0" "@types/graceful-fs" "^4.1.3" "@types/node" "*" anymatch "^3.0.3" fb-watchman "^2.0.0" graceful-fs "^4.2.9" - jest-regex-util "^28.0.2" - jest-util "^28.1.3" - jest-worker "^28.1.3" + jest-regex-util "^29.4.3" + jest-util "^29.5.0" + jest-worker "^29.5.0" micromatch "^4.0.4" walker "^1.0.8" optionalDependencies: fsevents "^2.3.2" -jest-leak-detector@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-28.1.3.tgz#a6685d9b074be99e3adee816ce84fd30795e654d" - integrity sha512-WFVJhnQsiKtDEo5lG2mM0v40QWnBM+zMdHHyJs8AWZ7J0QZJS59MsyKeJHWhpBZBH32S48FOVvGyOFT1h0DlqA== +jest-leak-detector@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.5.0.tgz#cf4bdea9615c72bac4a3a7ba7e7930f9c0610c8c" + integrity sha512-u9YdeeVnghBUtpN5mVxjID7KbkKE1QU4f6uUwuxiY0vYRi9BUCLKlPEZfDGR67ofdFmDz9oPAy2G92Ujrntmow== dependencies: - jest-get-type "^28.0.2" - pretty-format "^28.1.3" - -jest-matcher-utils@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-28.1.3.tgz#5a77f1c129dd5ba3b4d7fc20728806c78893146e" - integrity sha512-kQeJ7qHemKfbzKoGjHHrRKH6atgxMk8Enkk2iPQ3XwO6oE/KYD8lMYOziCkeSB9G4adPM4nR1DE8Tf5JeWH6Bw== - dependencies: - chalk "^4.0.0" - jest-diff "^28.1.3" - jest-get-type "^28.0.2" - pretty-format "^28.1.3" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" jest-matcher-utils@^29.0.2: version "29.0.2" @@ -2550,20 +2557,15 @@ jest-matcher-utils@^29.0.2: jest-get-type "^29.0.0" pretty-format "^29.0.2" -jest-message-util@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-28.1.3.tgz#232def7f2e333f1eecc90649b5b94b0055e7c43d" - integrity sha512-PFdn9Iewbt575zKPf1286Ht9EPoJmYT7P0kY+RibeYZ2XtOr53pDLEFoTWXbd1h4JiGiWpTBC84fc8xMXQMb7g== +jest-matcher-utils@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.5.0.tgz#d957af7f8c0692c5453666705621ad4abc2c59c5" + integrity sha512-lecRtgm/rjIK0CQ7LPQwzCs2VwW6WAahA55YBuI+xqmhm7LAaxokSB8C97yJeYyT+HvQkH741StzpU41wohhWw== dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^28.1.3" - "@types/stack-utils" "^2.0.0" chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^28.1.3" - slash "^3.0.0" - stack-utils "^2.0.3" + jest-diff "^29.5.0" + jest-get-type "^29.4.3" + pretty-format "^29.5.0" jest-message-util@^29.0.2: version "29.0.2" @@ -2580,137 +2582,153 @@ jest-message-util@^29.0.2: slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-28.1.3.tgz#d4e9b1fc838bea595c77ab73672ebf513ab249da" - integrity sha512-o3J2jr6dMMWYVH4Lh/NKmDXdosrsJgi4AviS8oXLujcjpCMBb1FMsblDnOXKZKfSiHLxYub1eS0IHuRXsio9eA== +jest-message-util@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.5.0.tgz#1f776cac3aca332ab8dd2e3b41625435085c900e" + integrity sha512-Kijeg9Dag6CKtIDA7O21zNTACqD5MD/8HfIV8pdD94vFyFuer52SigdC3IQMhab3vACxXMiFk+yMHNdbqtyTGA== dependencies: - "@jest/types" "^28.1.3" + "@babel/code-frame" "^7.12.13" + "@jest/types" "^29.5.0" + "@types/stack-utils" "^2.0.0" + chalk "^4.0.0" + graceful-fs "^4.2.9" + micromatch "^4.0.4" + pretty-format "^29.5.0" + slash "^3.0.0" + stack-utils "^2.0.3" + +jest-mock@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.5.0.tgz#26e2172bcc71d8b0195081ff1f146ac7e1518aed" + integrity sha512-GqOzvdWDE4fAV2bWQLQCkujxYWL7RxjCnj71b5VhDAGOevB3qj3Ovg26A5NI84ZpODxyzaozXLOh2NCgkbvyaw== + dependencies: + "@jest/types" "^29.5.0" "@types/node" "*" + jest-util "^29.5.0" jest-pnp-resolver@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== -jest-regex-util@^28.0.2: - version "28.0.2" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-28.0.2.tgz#afdc377a3b25fb6e80825adcf76c854e5bf47ead" - integrity sha512-4s0IgyNIy0y9FK+cjoVYoxamT7Zeo7MhzqRGx7YDYmaQn1wucY9rotiGkBzzcMXTtjrCAP/f7f+E0F7+fxPNdw== +jest-regex-util@^29.4.3: + version "29.4.3" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.4.3.tgz#a42616141e0cae052cfa32c169945d00c0aa0bb8" + integrity sha512-O4FglZaMmWXbGHSQInfXewIsd1LMn9p3ZXB/6r4FOkyhX2/iP/soMG98jGvk/A3HAN78+5VWcBGO0BJAPRh4kg== -jest-resolve-dependencies@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-28.1.3.tgz#8c65d7583460df7275c6ea2791901fa975c1fe66" - integrity sha512-qa0QO2Q0XzQoNPouMbCc7Bvtsem8eQgVPNkwn9LnS+R2n8DaVDPL/U1gngC0LTl1RYXJU0uJa2BMC2DbTfFrHA== +jest-resolve-dependencies@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.5.0.tgz#f0ea29955996f49788bf70996052aa98e7befee4" + integrity sha512-sjV3GFr0hDJMBpYeUuGduP+YeCRbd7S/ck6IvL3kQ9cpySYKqcqhdLLC2rFwrcL7tz5vYibomBrsFYWkIGGjOg== dependencies: - jest-regex-util "^28.0.2" - jest-snapshot "^28.1.3" + jest-regex-util "^29.4.3" + jest-snapshot "^29.5.0" -jest-resolve@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-28.1.3.tgz#cfb36100341ddbb061ec781426b3c31eb51aa0a8" - integrity sha512-Z1W3tTjE6QaNI90qo/BJpfnvpxtaFTFw5CDgwpyE/Kz8U/06N1Hjf4ia9quUhCh39qIGWF1ZuxFiBiJQwSEYKQ== +jest-resolve@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-29.5.0.tgz#b053cc95ad1d5f6327f0ac8aae9f98795475ecdc" + integrity sha512-1TzxJ37FQq7J10jPtQjcc+MkCkE3GBpBecsSUWJ0qZNJpmg6m0D9/7II03yJulm3H/fvVjgqLh/k2eYg+ui52w== dependencies: chalk "^4.0.0" graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" + jest-haste-map "^29.5.0" jest-pnp-resolver "^1.2.2" - jest-util "^28.1.3" - jest-validate "^28.1.3" + jest-util "^29.5.0" + jest-validate "^29.5.0" resolve "^1.20.0" - resolve.exports "^1.1.0" + resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-28.1.3.tgz#5eee25febd730b4713a2cdfd76bdd5557840f9a1" - integrity sha512-GkMw4D/0USd62OVO0oEgjn23TM+YJa2U2Wu5zz9xsQB1MxWKDOlrnykPxnMsN0tnJllfLPinHTka61u0QhaxBA== +jest-runner@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.5.0.tgz#6a57c282eb0ef749778d444c1d758c6a7693b6f8" + integrity sha512-m7b6ypERhFghJsslMLhydaXBiLf7+jXy8FwGRHO3BGV1mcQpPbwiqiKUR2zU2NJuNeMenJmlFZCsIqzJCTeGLQ== dependencies: - "@jest/console" "^28.1.3" - "@jest/environment" "^28.1.3" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/console" "^29.5.0" + "@jest/environment" "^29.5.0" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" - emittery "^0.10.2" + emittery "^0.13.1" graceful-fs "^4.2.9" - jest-docblock "^28.1.1" - jest-environment-node "^28.1.3" - jest-haste-map "^28.1.3" - jest-leak-detector "^28.1.3" - jest-message-util "^28.1.3" - jest-resolve "^28.1.3" - jest-runtime "^28.1.3" - jest-util "^28.1.3" - jest-watcher "^28.1.3" - jest-worker "^28.1.3" + jest-docblock "^29.4.3" + jest-environment-node "^29.5.0" + jest-haste-map "^29.5.0" + jest-leak-detector "^29.5.0" + jest-message-util "^29.5.0" + jest-resolve "^29.5.0" + jest-runtime "^29.5.0" + jest-util "^29.5.0" + jest-watcher "^29.5.0" + jest-worker "^29.5.0" p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-28.1.3.tgz#a57643458235aa53e8ec7821949e728960d0605f" - integrity sha512-NU+881ScBQQLc1JHG5eJGU7Ui3kLKrmwCPPtYsJtBykixrM2OhVQlpMmFWJjMyDfdkGgBMNjXCGB/ebzsgNGQw== +jest-runtime@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.5.0.tgz#c83f943ee0c1da7eb91fa181b0811ebd59b03420" + integrity sha512-1Hr6Hh7bAgXQP+pln3homOiEZtCDZFqwmle7Ew2j8OlbkIu6uE3Y/etJQG8MLQs3Zy90xrp2C0BRrtPHG4zryw== dependencies: - "@jest/environment" "^28.1.3" - "@jest/fake-timers" "^28.1.3" - "@jest/globals" "^28.1.3" - "@jest/source-map" "^28.1.2" - "@jest/test-result" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/environment" "^29.5.0" + "@jest/fake-timers" "^29.5.0" + "@jest/globals" "^29.5.0" + "@jest/source-map" "^29.4.3" + "@jest/test-result" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" + "@types/node" "*" chalk "^4.0.0" cjs-module-lexer "^1.0.0" collect-v8-coverage "^1.0.0" - execa "^5.0.0" glob "^7.1.3" graceful-fs "^4.2.9" - jest-haste-map "^28.1.3" - jest-message-util "^28.1.3" - jest-mock "^28.1.3" - jest-regex-util "^28.0.2" - jest-resolve "^28.1.3" - jest-snapshot "^28.1.3" - jest-util "^28.1.3" + jest-haste-map "^29.5.0" + jest-message-util "^29.5.0" + jest-mock "^29.5.0" + jest-regex-util "^29.4.3" + jest-resolve "^29.5.0" + jest-snapshot "^29.5.0" + jest-util "^29.5.0" slash "^3.0.0" strip-bom "^4.0.0" -jest-snapshot@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-28.1.3.tgz#17467b3ab8ddb81e2f605db05583d69388fc0668" - integrity sha512-4lzMgtiNlc3DU/8lZfmqxN3AYD6GGLbl+72rdBpXvcV+whX7mDrREzkPdp2RnmfIiWBg1YbuFSkXduF2JcafJg== +jest-snapshot@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.5.0.tgz#c9c1ce0331e5b63cd444e2f95a55a73b84b1e8ce" + integrity sha512-x7Wolra5V0tt3wRs3/ts3S6ciSQVypgGQlJpz2rsdQYoUKxMxPNaoHMGJN6qAuPJqS+2iQ1ZUn5kl7HCyls84g== dependencies: "@babel/core" "^7.11.6" "@babel/generator" "^7.7.2" + "@babel/plugin-syntax-jsx" "^7.7.2" "@babel/plugin-syntax-typescript" "^7.7.2" "@babel/traverse" "^7.7.2" "@babel/types" "^7.3.3" - "@jest/expect-utils" "^28.1.3" - "@jest/transform" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/expect-utils" "^29.5.0" + "@jest/transform" "^29.5.0" + "@jest/types" "^29.5.0" "@types/babel__traverse" "^7.0.6" "@types/prettier" "^2.1.5" babel-preset-current-node-syntax "^1.0.0" chalk "^4.0.0" - expect "^28.1.3" + expect "^29.5.0" graceful-fs "^4.2.9" - jest-diff "^28.1.3" - jest-get-type "^28.0.2" - jest-haste-map "^28.1.3" - jest-matcher-utils "^28.1.3" - jest-message-util "^28.1.3" - jest-util "^28.1.3" + jest-diff "^29.5.0" + jest-get-type "^29.4.3" + jest-matcher-utils "^29.5.0" + jest-message-util "^29.5.0" + jest-util "^29.5.0" natural-compare "^1.4.0" - pretty-format "^28.1.3" + pretty-format "^29.5.0" semver "^7.3.5" -jest-util@^28.0.0, jest-util@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-28.1.3.tgz#f4f932aa0074f0679943220ff9cbba7e497028b0" - integrity sha512-XdqfpHwpcSRko/C35uLYFM2emRAltIIKZiJ9eAmhjsj0CqZMa0p1ib0R5fWIqGhn1a103DebTbpqIaP1qCQ6tQ== +jest-util@^29.0.0, jest-util@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-29.5.0.tgz#24a4d3d92fc39ce90425311b23c27a6e0ef16b8f" + integrity sha512-RYMgG/MTadOr5t8KdhejfvUU82MxsCu5MF6KuDUHl+NuwzUt+Sm6jJWxTJVrDR1j5M/gJVCPKQEpWXY+yIQ6lQ== dependencies: - "@jest/types" "^28.1.3" + "@jest/types" "^29.5.0" "@types/node" "*" chalk "^4.0.0" ci-info "^3.2.0" @@ -2729,50 +2747,51 @@ jest-util@^29.0.2: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-28.1.3.tgz#e322267fd5e7c64cea4629612c357bbda96229df" - integrity sha512-SZbOGBWEsaTxBGCOpsRWlXlvNkvTkY0XxRfh7zYmvd8uL5Qzyg0CHAXiXKROflh801quA6+/DsT4ODDthOC/OA== +jest-validate@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.5.0.tgz#8e5a8f36178d40e47138dc00866a5f3bd9916ffc" + integrity sha512-pC26etNIi+y3HV8A+tUGr/lph9B18GnzSRAkPaaZJIE1eFdiYm6/CewuiJQ8/RlfHd1u/8Ioi8/sJ+CmbA+zAQ== dependencies: - "@jest/types" "^28.1.3" + "@jest/types" "^29.5.0" camelcase "^6.2.0" chalk "^4.0.0" - jest-get-type "^28.0.2" + jest-get-type "^29.4.3" leven "^3.1.0" - pretty-format "^28.1.3" + pretty-format "^29.5.0" -jest-watcher@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-28.1.3.tgz#c6023a59ba2255e3b4c57179fc94164b3e73abd4" - integrity sha512-t4qcqj9hze+jviFPUN3YAtAEeFnr/azITXQEMARf5cMwKY2SMBRnCQTXLixTl20OR6mLh9KLMrgVJgJISym+1g== +jest-watcher@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.5.0.tgz#cf7f0f949828ba65ddbbb45c743a382a4d911363" + integrity sha512-KmTojKcapuqYrKDpRwfqcQ3zjMlwu27SYext9pt4GlF5FUgB+7XE1mcCnSm6a4uUpFyQIkb6ZhzZvHl+jiBCiA== dependencies: - "@jest/test-result" "^28.1.3" - "@jest/types" "^28.1.3" + "@jest/test-result" "^29.5.0" + "@jest/types" "^29.5.0" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - emittery "^0.10.2" - jest-util "^28.1.3" + emittery "^0.13.1" + jest-util "^29.5.0" string-length "^4.0.1" -jest-worker@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-28.1.3.tgz#7e3c4ce3fa23d1bb6accb169e7f396f98ed4bb98" - integrity sha512-CqRA220YV/6jCo8VWvAt1KKx6eek1VIHMPeLEbpcfSfkEeWyBNppynM/o6q+Wmw+sOhos2ml34wZbSX3G13//g== +jest-worker@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-29.5.0.tgz#bdaefb06811bd3384d93f009755014d8acb4615d" + integrity sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA== dependencies: "@types/node" "*" + jest-util "^29.5.0" merge-stream "^2.0.0" supports-color "^8.0.0" -jest@28.1.1: - version "28.1.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-28.1.1.tgz#3c39a3a09791e16e9ef283597d24ab19a0df701e" - integrity sha512-qw9YHBnjt6TCbIDMPMpJZqf9E12rh6869iZaN08/vpOGgHJSAaLLUn6H8W3IAEuy34Ls3rct064mZLETkxJ2XA== +jest@29.0.0: + version "29.0.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.0.0.tgz#0614bce40ffd3a1a19a30c8a2c66d19103712001" + integrity sha512-9uz4Tclskb8WrfRXqu66FsFCFoyYctwWXpruKwnD95FZqkyoEAA1oGH53HUn7nQx7uEgZTKdNl/Yo6DqqU+XMg== dependencies: - "@jest/core" "^28.1.1" - "@jest/types" "^28.1.1" + "@jest/core" "^29.0.0" + "@jest/types" "^29.0.0" import-local "^3.0.2" - jest-cli "^28.1.1" + jest-cli "^29.0.0" jmespath@0.15.0: version "0.15.0" @@ -3836,16 +3855,6 @@ prettier@2.7.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== -pretty-format@^28.1.3: - version "28.1.3" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" - integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== - dependencies: - "@jest/schemas" "^28.1.3" - ansi-regex "^5.0.1" - ansi-styles "^5.0.0" - react-is "^18.0.0" - pretty-format@^29.0.0, pretty-format@^29.0.2: version "29.0.2" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.0.2.tgz#7f7666a7bf05ba2bcacde61be81c6db64f6f3be6" @@ -3855,6 +3864,15 @@ pretty-format@^29.0.0, pretty-format@^29.0.2: ansi-styles "^5.0.0" react-is "^18.0.0" +pretty-format@^29.5.0: + version "29.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.5.0.tgz#283134e74f70e2e3e7229336de0e4fce94ccde5a" + integrity sha512-V2mGkI31qdttvTFX7Mt4efOqHXqJWMu4/r66Xh3Z3BwZaPfPJgp6/gbwoujRpPUtfEF6AUUWx3Jim3GCw5g/Qw== + dependencies: + "@jest/schemas" "^29.4.3" + ansi-styles "^5.0.0" + react-is "^18.0.0" + process-nextick-args@~2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-2.0.1.tgz#7820d9b16120cc55ca9ae7792680ae7dba6d7fe2" @@ -3908,6 +3926,11 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +pure-rand@^6.0.0: + version "6.0.1" + resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.0.1.tgz#31207dddd15d43f299fdcdb2f572df65030c19af" + integrity sha512-t+x1zEHDjBwkDGY5v5ApnZ/utcd4XYDiJsaQQoptTXgUXX95sDg1elCdJghzicm7n2mbCBJ3uYWr6M22SO19rg== + qs@^6.11.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" @@ -4059,10 +4082,10 @@ resolve-from@^5.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== -resolve.exports@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" - integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== +resolve.exports@^2.0.0: + version "2.0.2" + resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" + integrity sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg== resolve@^1.20.0: version "1.22.1" @@ -4073,7 +4096,7 @@ resolve@^1.20.0: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -rimraf@^3.0.0, rimraf@^3.0.2: +rimraf@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== @@ -4361,7 +4384,7 @@ supports-color@^5.3.0: dependencies: has-flag "^3.0.0" -supports-color@^7.0.0, supports-color@^7.1.0: +supports-color@^7.1.0: version "7.2.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== @@ -4375,14 +4398,6 @@ supports-color@^8.0.0: dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" - integrity sha512-6sXEzV5+I5j8Bmq9/vUphGRM/RJNT9SCURJLjwfOg51heRtguGWDzcaBlgAzKhQa0EVNpPEKzQuBwZ8S8WaCeQ== - dependencies: - has-flag "^4.0.0" - supports-color "^7.0.0" - supports-preserve-symlinks-flag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09" @@ -4421,14 +4436,6 @@ tar@^6.1.11: mkdirp "^1.0.3" yallist "^4.0.0" -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -4509,14 +4516,14 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -ts-jest@28.0.8: - version "28.0.8" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-28.0.8.tgz#cd204b8e7a2f78da32cf6c95c9a6165c5b99cc73" - integrity sha512-5FaG0lXmRPzApix8oFG8RKjAz4ehtm8yMKOTy5HX3fY6W8kmvOrmcY0hKDElW52FJov+clhUbrKAqofnj4mXTg== +ts-jest@29.0.0: + version "29.0.0" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.0.0.tgz#3617e10c39a76380fe521d0c26186a773f5f1e46" + integrity sha512-OxUaigbv5Aon3OMLY9HBtwkGMs1upWE/URrmmVQFzzOcGlEPVuWzGmXUIkWGt/95Dj/T6MGuTrHHGL6kT6Yn8g== dependencies: bs-logger "0.x" fast-json-stable-stringify "2.x" - jest-util "^28.0.0" + jest-util "^29.0.0" json5 "^2.2.1" lodash.memoize "4.x" make-error "1.x" @@ -4767,7 +4774,7 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -write-file-atomic@^4.0.1: +write-file-atomic@^4.0.2: version "4.0.2" resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-4.0.2.tgz#a9df01ae5b77858a027fd2e80768ee433555fcfd" integrity sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg== diff --git a/scripts/scopeBackend.sh b/scripts/scopeBackend.sh new file mode 100755 index 0000000000..c8903b7df9 --- /dev/null +++ b/scripts/scopeBackend.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Define the packages +PACKAGES=("@budibase/backend-core" "@budibase/worker" "@budibase/server" "@budibase/string-templates" "@budibase/types" "@budibase/shared-core") + +# Generate the scope arguments +SCOPE_ARGS="" +for PACKAGE in "${PACKAGES[@]}"; do + SCOPE_ARGS+="--scope $PACKAGE " +done + +# Run the commands with the scope arguments +for COMMAND in "$@"; do + echo "Running: $COMMAND $SCOPE_ARGS" + yarn $COMMAND $SCOPE_ARGS +done From efa1ea7b1b75311be2b985482161ac3853f46235 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 5 Apr 2023 14:41:48 +0000 Subject: [PATCH 12/13] v2.4.44-alpha.9 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 6 +++--- packages/builder/package.json | 12 ++++++------ packages/cli/package.json | 8 ++++---- packages/client/package.json | 12 ++++++------ packages/frontend-core/package.json | 6 +++--- packages/sdk/package.json | 2 +- packages/server/package.json | 12 ++++++------ packages/shared-core/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 13 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lerna.json b/lerna.json index e01e7296a4..88a21a349a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "npmClient": "yarn", "packages": ["packages/*"], "command": { diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 49d558aefa..a81f4772d1 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -24,7 +24,7 @@ "dependencies": { "@budibase/nano": "10.1.2", "@budibase/pouchdb-replication-stream": "1.2.10", - "@budibase/types": "2.4.44-alpha.8", + "@budibase/types": "2.4.44-alpha.9", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 7ff7e14027..643dc9cbaa 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,8 +38,8 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/shared-core": "2.4.44-alpha.8", - "@budibase/string-templates": "2.4.44-alpha.8", + "@budibase/shared-core": "2.4.44-alpha.9", + "@budibase/string-templates": "2.4.44-alpha.9", "@spectrum-css/accordion": "3.0.24", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", diff --git a/packages/builder/package.json b/packages/builder/package.json index f9f38bed83..0faf293b3c 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "license": "GPL-3.0", "private": true, "scripts": { @@ -58,11 +58,11 @@ } }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.8", - "@budibase/client": "2.4.44-alpha.8", - "@budibase/frontend-core": "2.4.44-alpha.8", - "@budibase/shared-core": "2.4.44-alpha.8", - "@budibase/string-templates": "2.4.44-alpha.8", + "@budibase/bbui": "2.4.44-alpha.9", + "@budibase/client": "2.4.44-alpha.9", + "@budibase/frontend-core": "2.4.44-alpha.9", + "@budibase/shared-core": "2.4.44-alpha.9", + "@budibase/string-templates": "2.4.44-alpha.9", "@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/free-brands-svg-icons": "^6.2.1", "@fortawesome/free-solid-svg-icons": "^6.2.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 94e6d8c047..894616a22e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "dist/index.js", "bin": { @@ -29,9 +29,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.8", - "@budibase/string-templates": "2.4.44-alpha.8", - "@budibase/types": "2.4.44-alpha.8", + "@budibase/backend-core": "2.4.44-alpha.9", + "@budibase/string-templates": "2.4.44-alpha.9", + "@budibase/types": "2.4.44-alpha.9", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index d8de3e25b4..9fcf7b0820 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,11 +19,11 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "2.4.44-alpha.8", - "@budibase/frontend-core": "2.4.44-alpha.8", - "@budibase/shared-core": "2.4.44-alpha.8", - "@budibase/string-templates": "2.4.44-alpha.8", - "@budibase/types": "2.4.44-alpha.8", + "@budibase/bbui": "2.4.44-alpha.9", + "@budibase/frontend-core": "2.4.44-alpha.9", + "@budibase/shared-core": "2.4.44-alpha.9", + "@budibase/string-templates": "2.4.44-alpha.9", + "@budibase/types": "2.4.44-alpha.9", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 8ae06017f0..b512f6a423 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,13 +1,13 @@ { "name": "@budibase/frontend-core", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.4.44-alpha.8", - "@budibase/shared-core": "2.4.44-alpha.8", + "@budibase/bbui": "2.4.44-alpha.9", + "@budibase/shared-core": "2.4.44-alpha.9", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 3cda22f9f2..c42a07b72e 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 09200655fa..584d141bb7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -45,12 +45,12 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.4.44-alpha.8", - "@budibase/client": "2.4.44-alpha.8", + "@budibase/backend-core": "2.4.44-alpha.9", + "@budibase/client": "2.4.44-alpha.9", "@budibase/pro": "2.4.44-alpha.8", - "@budibase/shared-core": "2.4.44-alpha.8", - "@budibase/string-templates": "2.4.44-alpha.8", - "@budibase/types": "2.4.44-alpha.8", + "@budibase/shared-core": "2.4.44-alpha.9", + "@budibase/string-templates": "2.4.44-alpha.9", + "@budibase/types": "2.4.44-alpha.9", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/shared-core/package.json b/packages/shared-core/package.json index 03d7291560..a807898cc1 100644 --- a/packages/shared-core/package.json +++ b/packages/shared-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/shared-core", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Shared data utils", "main": "dist/cjs/src/index.js", "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\"" }, "dependencies": { - "@budibase/types": "2.4.44-alpha.8" + "@budibase/types": "2.4.44-alpha.9" }, "devDependencies": { "concurrently": "^7.6.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 1f43bf0324..4f0106563e 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index b44d322162..f3b32a04b6 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase types", "main": "dist/cjs/index.js", "types": "dist/mjs/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 8721f5deca..9d030fa492 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.4.44-alpha.8", + "version": "2.4.44-alpha.9", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -37,10 +37,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.4.44-alpha.8", + "@budibase/backend-core": "2.4.44-alpha.9", "@budibase/pro": "2.4.44-alpha.8", - "@budibase/string-templates": "2.4.44-alpha.8", - "@budibase/types": "2.4.44-alpha.8", + "@budibase/string-templates": "2.4.44-alpha.9", + "@budibase/types": "2.4.44-alpha.9", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 6396548064b6421771b1b0650b08c7f34eac4ab9 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 5 Apr 2023 14:44:51 +0000 Subject: [PATCH 13/13] Update pro version to 2.4.44-alpha.9 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 584d141bb7..df259e0a1f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -47,7 +47,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.4.44-alpha.9", "@budibase/client": "2.4.44-alpha.9", - "@budibase/pro": "2.4.44-alpha.8", + "@budibase/pro": "2.4.44-alpha.9", "@budibase/shared-core": "2.4.44-alpha.9", "@budibase/string-templates": "2.4.44-alpha.9", "@budibase/types": "2.4.44-alpha.9", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 0e40c6706c..dbfd5dae0c 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1290,14 +1290,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.8": - version "2.4.44-alpha.8" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.8.tgz#087897628a3a137480e777296e7d2f2524a13b2e" - integrity sha512-7Vz/oGQ/Zt3OTLlXbOo5pE2PCzwI/oJoc1SM36Svhm383fa7rSgi2kI5zkyUhjIe3J8s4DyRmMv6IloNEPGd+A== +"@budibase/backend-core@2.4.44-alpha.9": + version "2.4.44-alpha.9" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.9.tgz#ea2f1ec39fe0a97172b00e551f9e3b51f860e53b" + integrity sha512-uuZEqeyXnVwyNDPSwI8gF8zCv26PWvhbLoEYXMQqNl9J9q5g4i/lNacfKs1x9JDPABHE93mtLL5eoTogzrqTIg== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.8" + "@budibase/types" "2.4.44-alpha.9" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1430,15 +1430,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.8": - version "2.4.44-alpha.8" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.8.tgz#60d3c6f809ddae99b6b4f155127859e5597114e9" - integrity sha512-KbxnjbooOC+UX1pzL8Sd5O04XlddSG9a/eDQrMr+blzZ51yFiLod07sdl40KJzTm48isVvmL+U7H66MPkoUYfw== +"@budibase/pro@2.4.44-alpha.9": + version "2.4.44-alpha.9" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.9.tgz#f6a5bcfb607ebb2138762e53a04ad55cf6de6014" + integrity sha512-cPUXlt9XQ0DlwoR47wLiLGEQlib6vKW15cLkh0pkz57vHbr5T22Ix4G7vgKGPVr5kpaJVNVdYLxBZ3qy8hUnJQ== dependencies: - "@budibase/backend-core" "2.4.44-alpha.8" + "@budibase/backend-core" "2.4.44-alpha.9" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.8" + "@budibase/types" "2.4.44-alpha.9" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1491,10 +1491,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.8": - version "2.4.44-alpha.8" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.8.tgz#4ff5350a2cd61fc2c6ac901bb4bd10917fe9d789" - integrity sha512-qm6+0JuJYN7rtONciR2bPts7MO73nrHHp4OsZdeq5dkWBZn8/RM+D5oOgSnBiMnX2slcO3ipX9ZI1GBweeFaNg== +"@budibase/types@2.4.44-alpha.9": + version "2.4.44-alpha.9" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.9.tgz#a64fad8252f196bcb2a5fbd53f89ff5a90745813" + integrity sha512-auXyD1A1MZ42KYMaQpnHBgXbR3O3t6oycYESwhbkIaTHw3f9ir3m8Sus5R1eMI7YqI8nWjB6y9tW6lZoIAd/Pg== dependencies: scim-patch "^0.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 9d030fa492..d138001e2e 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -38,7 +38,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.4.44-alpha.9", - "@budibase/pro": "2.4.44-alpha.8", + "@budibase/pro": "2.4.44-alpha.9", "@budibase/string-templates": "2.4.44-alpha.9", "@budibase/types": "2.4.44-alpha.9", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index aac65ee504..c09dc187d3 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -475,14 +475,14 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.4.44-alpha.8": - version "2.4.44-alpha.8" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.8.tgz#087897628a3a137480e777296e7d2f2524a13b2e" - integrity sha512-7Vz/oGQ/Zt3OTLlXbOo5pE2PCzwI/oJoc1SM36Svhm383fa7rSgi2kI5zkyUhjIe3J8s4DyRmMv6IloNEPGd+A== +"@budibase/backend-core@2.4.44-alpha.9": + version "2.4.44-alpha.9" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.4.44-alpha.9.tgz#ea2f1ec39fe0a97172b00e551f9e3b51f860e53b" + integrity sha512-uuZEqeyXnVwyNDPSwI8gF8zCv26PWvhbLoEYXMQqNl9J9q5g4i/lNacfKs1x9JDPABHE93mtLL5eoTogzrqTIg== dependencies: "@budibase/nano" "10.1.2" "@budibase/pouchdb-replication-stream" "1.2.10" - "@budibase/types" "2.4.44-alpha.8" + "@budibase/types" "2.4.44-alpha.9" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -565,15 +565,15 @@ pouchdb-promise "^6.0.4" through2 "^2.0.0" -"@budibase/pro@2.4.44-alpha.8": - version "2.4.44-alpha.8" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.8.tgz#60d3c6f809ddae99b6b4f155127859e5597114e9" - integrity sha512-KbxnjbooOC+UX1pzL8Sd5O04XlddSG9a/eDQrMr+blzZ51yFiLod07sdl40KJzTm48isVvmL+U7H66MPkoUYfw== +"@budibase/pro@2.4.44-alpha.9": + version "2.4.44-alpha.9" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.4.44-alpha.9.tgz#f6a5bcfb607ebb2138762e53a04ad55cf6de6014" + integrity sha512-cPUXlt9XQ0DlwoR47wLiLGEQlib6vKW15cLkh0pkz57vHbr5T22Ix4G7vgKGPVr5kpaJVNVdYLxBZ3qy8hUnJQ== dependencies: - "@budibase/backend-core" "2.4.44-alpha.8" + "@budibase/backend-core" "2.4.44-alpha.9" "@budibase/shared-core" "2.4.44-alpha.1" "@budibase/string-templates" "2.4.44-alpha.1" - "@budibase/types" "2.4.44-alpha.8" + "@budibase/types" "2.4.44-alpha.9" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -608,10 +608,10 @@ resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.1.tgz#1679657aa180d9c59afa1dffa611bff0638bd933" integrity sha512-Sq+8HfM75EBMoOvKYFwELdlxmVN6wNZMofDjT/2G+9aF+Zfe5Tzw69C+unmdBgcGGjGCHEYWSz4mF0v8FPAGbg== -"@budibase/types@2.4.44-alpha.8": - version "2.4.44-alpha.8" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.8.tgz#4ff5350a2cd61fc2c6ac901bb4bd10917fe9d789" - integrity sha512-qm6+0JuJYN7rtONciR2bPts7MO73nrHHp4OsZdeq5dkWBZn8/RM+D5oOgSnBiMnX2slcO3ipX9ZI1GBweeFaNg== +"@budibase/types@2.4.44-alpha.9": + version "2.4.44-alpha.9" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.4.44-alpha.9.tgz#a64fad8252f196bcb2a5fbd53f89ff5a90745813" + integrity sha512-auXyD1A1MZ42KYMaQpnHBgXbR3O3t6oycYESwhbkIaTHw3f9ir3m8Sus5R1eMI7YqI8nWjB6y9tW6lZoIAd/Pg== dependencies: scim-patch "^0.7.0"