Add ts watch support for backend-core + stub out migrations
This commit is contained in:
parent
606d21b313
commit
23cbd217cd
|
@ -8,6 +8,7 @@
|
|||
"license": "GPL-3.0",
|
||||
"scripts": {
|
||||
"build": "rimraf dist/ && tsc -p tsconfig.build.json",
|
||||
"dev:builder": "rimraf dist/ && tsc -p tsconfig.build.json --watch",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watchAll"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import db from "./db"
|
||||
import errors from "./errors"
|
||||
import * as events from "./events"
|
||||
import * as migrations from "./migrations"
|
||||
|
||||
export = {
|
||||
init(opts: any = {}) {
|
||||
|
@ -17,7 +18,7 @@ export = {
|
|||
cache: require("../cache"),
|
||||
auth: require("../auth"),
|
||||
constants: require("../constants"),
|
||||
migrations: require("../migrations"),
|
||||
migrations,
|
||||
errors,
|
||||
...errors.errors,
|
||||
env: require("./environment"),
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"extends": "./tsconfig.json",
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist/**/*",
|
||||
"**/*.json",
|
||||
"**/*.spec.js",
|
||||
"**/*.spec.ts"
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist/**/*",
|
||||
"**/*.spec.js",
|
||||
// "**/*.spec.ts" // don't exclude spec.ts files for editor support
|
||||
]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"watch": ["src", "../backend-core", "../../../budibase-pro/packages/pro"],
|
||||
"ext": "js,ts,json",
|
||||
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"],
|
||||
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js", "../backend-core/dist/**/*"],
|
||||
"exec": "ts-node src/index.ts"
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
// TODO: Add migrations to account portal
|
||||
|
||||
// ACCOUNT_CREATED = "account:created",
|
||||
// ACCOUNT_VERIFIED = "account:verified",
|
|
@ -0,0 +1,10 @@
|
|||
export const backfillAppCreated = () => {}
|
||||
|
||||
export const backfillAppPublished = () => {}
|
||||
|
||||
// APP_CREATED = "app:created",
|
||||
// APP_PUBLISHED = "app:published",
|
||||
|
||||
// Maybe
|
||||
// APP_TEMPLATE_IMPORTED = "app:template:imported",
|
||||
// APP_FILE_IMPORTED = "app:file:imported",
|
|
@ -0,0 +1,2 @@
|
|||
// AUTOMATION_CREATED = "automation:created",
|
||||
// AUTOMATION_STEP_CREATED = "automation:step:created",
|
|
@ -0,0 +1 @@
|
|||
// DATASOURCE_CREATED = "datasource:created",
|
|
@ -0,0 +1 @@
|
|||
// LAYOUT_CREATED = "layout:created",
|
|
@ -0,0 +1,3 @@
|
|||
// QUERY_CREATED = "query:created",
|
||||
// <!-- maybe -->
|
||||
// QUERY_IMPORT = "query:import",
|
|
@ -0,0 +1,2 @@
|
|||
// ROLE_CREATED = "role:created",
|
||||
// ROLE_ASSIGNED = "role:assigned",
|
|
@ -0,0 +1 @@
|
|||
// ROW_IMPORT = "row:import",
|
|
@ -0,0 +1 @@
|
|||
// SCREEN_CREATED = "screen:created",
|
|
@ -0,0 +1,3 @@
|
|||
// TABLE_CREATED = "table:created",
|
||||
// <!-- maybe -->
|
||||
// TABLE_DATA_IMPORTED = "table:data:imported",
|
|
@ -0,0 +1,3 @@
|
|||
// VIEW_CREATED = "view:created",
|
||||
// VIEW_FILTER_CREATED = "view:filter:created",
|
||||
// VIEW_CALCULATION_CREATED = "view:calculation:created",
|
|
@ -0,0 +1,11 @@
|
|||
import * as app from "./app/app"
|
||||
|
||||
/**
|
||||
* Date:
|
||||
* May 2022
|
||||
*
|
||||
* Description:
|
||||
* Backfill app events.
|
||||
*/
|
||||
|
||||
export const run = async (db: any) => {}
|
|
@ -0,0 +1,11 @@
|
|||
import * as syncPublishedApps from "../usageQuotas/syncPublishedApps"
|
||||
|
||||
/**
|
||||
* Date:
|
||||
* May 2022
|
||||
*
|
||||
* Description:
|
||||
* Backfill global events.
|
||||
*/
|
||||
|
||||
export const run = async (db: any) => {}
|
|
@ -0,0 +1,7 @@
|
|||
// EMAIL_SMTP_CREATED = "email:smtp:created",
|
||||
// AUTH_SSO_CREATED = "auth:sso:created",
|
||||
// AUTH_SSO_ACTIVATED = "auth:sso:activated",
|
||||
// AUTH_SSO_DEACTIVATED = "auth:sso:deactivated",
|
||||
// ORG_NAME_UPDATED = "org:info:name:updated",
|
||||
// ORG_LOGO_UPDATED = "org:info:logo:updated",
|
||||
// ORG_PLATFORM_URL_UPDATED = "org:platformurl:updated",
|
|
@ -0,0 +1,3 @@
|
|||
// USER_CREATED = "user:created",
|
||||
// USER_PERMISSION_ADMIN_ASSIGNED = "user:admin:assigned",
|
||||
// USER_PERMISSION_BUILDER_ASSIGNED = "user:builder:assigned",
|
|
@ -1,7 +1,4 @@
|
|||
const {
|
||||
MIGRATION_TYPES,
|
||||
runMigrations,
|
||||
} = require("@budibase/backend-core/migrations")
|
||||
import { migrations } from "@budibase/backend-core"
|
||||
|
||||
// migration functions
|
||||
import * as userEmailViewCasing from "./functions/userEmailViewCasing"
|
||||
|
@ -35,33 +32,43 @@ export interface MigrationOptions {
|
|||
|
||||
export const MIGRATIONS: Migration[] = [
|
||||
{
|
||||
type: MIGRATION_TYPES.GLOBAL,
|
||||
type: migrations.MIGRATION_TYPES.GLOBAL,
|
||||
name: "user_email_view_casing",
|
||||
fn: userEmailViewCasing.run,
|
||||
},
|
||||
{
|
||||
type: MIGRATION_TYPES.GLOBAL,
|
||||
type: migrations.MIGRATION_TYPES.GLOBAL,
|
||||
name: "quotas_1",
|
||||
fn: quota1.run,
|
||||
},
|
||||
{
|
||||
type: MIGRATION_TYPES.APP,
|
||||
type: migrations.MIGRATION_TYPES.APP,
|
||||
name: "app_urls",
|
||||
opts: { all: true },
|
||||
fn: appUrls.run,
|
||||
},
|
||||
{
|
||||
type: MIGRATION_TYPES.GLOBAL,
|
||||
type: migrations.MIGRATION_TYPES.GLOBAL,
|
||||
name: "developer_quota",
|
||||
fn: developerQuota.run,
|
||||
},
|
||||
{
|
||||
type: MIGRATION_TYPES.GLOBAL,
|
||||
type: migrations.MIGRATION_TYPES.GLOBAL,
|
||||
name: "published_apps_quota",
|
||||
fn: publishedAppsQuota.run,
|
||||
},
|
||||
{
|
||||
type: migrations.MIGRATION_TYPES.GLOBAL,
|
||||
name: "event_backfill",
|
||||
fn: publishedAppsQuota.run,
|
||||
},
|
||||
{
|
||||
type: migrations.MIGRATION_TYPES.APP,
|
||||
name: "event_app_backfill",
|
||||
fn: publishedAppsQuota.run,
|
||||
},
|
||||
]
|
||||
|
||||
export const migrate = async (options?: MigrationOptions) => {
|
||||
await runMigrations(MIGRATIONS, options)
|
||||
await migrations.runMigrations(MIGRATIONS, options)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"watch": ["src", "../backend-core", "../../../budibase-pro/packages/pro"],
|
||||
"ext": "js,ts,json",
|
||||
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js"],
|
||||
"ignore": ["src/**/*.spec.ts", "src/**/*.spec.js", "../backend-core/dist/**/*"],
|
||||
"exec": "ts-node src/index.ts"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue