This commit is contained in:
Adria Navarro 2024-10-17 16:30:22 +02:00
parent 32b9d22ba0
commit ca974cf2f5
5 changed files with 10 additions and 15 deletions

View File

@ -209,7 +209,7 @@ export async function fetchAppPackage(
ctx: UserCtx<void, FetchAppPackageResponse>
) {
const appId = context.getAppId()
const application = await sdk.appMetadata.get()
const application = await sdk.applications.metadata.get()
const layouts = await getLayouts()
let screens = await getScreens()
const license = await licensing.cache.getCachedLicense()
@ -318,7 +318,7 @@ async function performAppCreate(ctx: UserCtx<CreateAppRequest, App>) {
newApplication.creationVersion = envCore.VERSION
}
const existing = await sdk.appMetadata.tryGet()
const existing = await sdk.applications.metadata.tryGet()
// If we used a template or imported an app there will be an existing doc.
// Fetch and migrate some metadata from the existing app.
if (existing) {
@ -492,7 +492,7 @@ export async function update(
export async function updateClient(ctx: UserCtx) {
// Get current app version
const application = await sdk.appMetadata.get()
const application = await sdk.applications.metadata.get()
const currentVersion = application.version
let manifest
@ -520,7 +520,7 @@ export async function updateClient(ctx: UserCtx) {
export async function revertClient(ctx: UserCtx) {
// Check app can be reverted
const application = await sdk.appMetadata.get()
const application = await sdk.applications.metadata.get()
if (!application.revertableVersion) {
ctx.throw(400, "There is no version to revert to")
}
@ -578,7 +578,7 @@ async function destroyApp(ctx: UserCtx) {
const db = dbCore.getDB(devAppId)
// standard app deletion flow
const app = await sdk.appMetadata.get()
const app = await sdk.applications.metadata.get()
const result = await db.destroy()
await quotas.removeApp()
await events.app.deleted(app)
@ -729,7 +729,7 @@ export async function updateAppPackage(
) {
return context.doInAppContext(appId, async () => {
const db = context.getAppDB()
const application = await sdk.appMetadata.get()
const application = await sdk.applications.metadata.get()
const newAppPackage: App = { ...application, ...appPackage }
if (appPackage._rev !== application._rev) {
@ -755,7 +755,7 @@ export async function setRevertableVersion(
return
}
const db = context.getAppDB()
const app = await sdk.appMetadata.get()
const app = await sdk.applications.metadata.get()
app.revertableVersion = ctx.request.body.revertableVersion
await db.put(app)
@ -764,7 +764,7 @@ export async function setRevertableVersion(
async function migrateAppNavigation() {
const db = context.getAppDB()
const existing = await sdk.appMetadata.get()
const existing = await sdk.applications.metadata.get()
const layouts: Layout[] = await getLayouts()
const screens: Screen[] = await getScreens()

View File

@ -1,5 +0,0 @@
import * as metadata from "./metadata"
export default {
...metadata,
}

View File

@ -2,10 +2,12 @@ import * as sync from "./sync"
import * as utils from "./utils"
import * as applications from "./applications"
import * as imports from "./import"
import * as metadata from "./metadata"
export default {
...sync,
...utils,
...applications,
...imports,
metadata,
}

View File

@ -11,7 +11,6 @@ import { default as plugins } from "./plugins"
import * as views from "./app/views"
import * as permissions from "./app/permissions"
import * as rowActions from "./app/rowActions"
import { default as appMetadata } from "./app/appMetadata"
const sdk = {
backups,
@ -27,7 +26,6 @@ const sdk = {
permissions,
links,
rowActions,
appMetadata,
}
// default export for TS