@budibase/server 2.6.19-alpha.29 → 2.6.19-alpha.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.5370eb5e.js → index.3dd3d237.js} +384 -387
- package/builder/assets/{index.026e10ae.css → index.8469b14c.css} +1 -1
- package/builder/index.html +2 -2
- package/dist/index.js +17 -14
- package/dist/index.js.map +2 -2
- package/package.json +8 -8
- package/src/api/controllers/application.ts +19 -21
- package/src/api/routes/application.ts +5 -0
package/builder/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
|
10
10
|
rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
12
|
-
<link rel="stylesheet" href="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.3dd3d237.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="/builder/assets/index.8469b14c.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
15
15
|
<body id="app">
|
package/dist/index.js
CHANGED
|
@@ -38288,7 +38288,7 @@ function checkAppName(ctx, apps2, name, currentAppId) {
|
|
|
38288
38288
|
ctx.throw(400, "App name is already in use.");
|
|
38289
38289
|
}
|
|
38290
38290
|
}
|
|
38291
|
-
async function createInstance(appId, template
|
|
38291
|
+
async function createInstance(appId, template) {
|
|
38292
38292
|
const db2 = context_exports.getAppDB();
|
|
38293
38293
|
await db2.put({
|
|
38294
38294
|
_id: "_design/database",
|
|
@@ -38308,16 +38308,9 @@ async function createInstance(appId, template, includeSampleData) {
|
|
|
38308
38308
|
await sdk_default.backups.importApp(appId, db2, template);
|
|
38309
38309
|
} else {
|
|
38310
38310
|
await db2.put(USERS_TABLE_SCHEMA);
|
|
38311
|
-
if (includeSampleData) {
|
|
38312
|
-
await addDefaultTables(db2);
|
|
38313
|
-
}
|
|
38314
38311
|
}
|
|
38315
38312
|
return { _id: appId };
|
|
38316
38313
|
}
|
|
38317
|
-
async function addDefaultTables(db2) {
|
|
38318
|
-
const defaultDbDocs = buildDefaultDocs();
|
|
38319
|
-
await db2.bulkDocs([...defaultDbDocs]);
|
|
38320
|
-
}
|
|
38321
38314
|
async function fetch30(ctx) {
|
|
38322
38315
|
const dev = ctx.query && ctx.query.status === AppStatus.DEV;
|
|
38323
38316
|
const all = ctx.query && ctx.query.status === AppStatus.ALL;
|
|
@@ -38390,15 +38383,10 @@ async function performAppCreate(ctx) {
|
|
|
38390
38383
|
if (ctx.request.files && ctx.request.files.templateFile) {
|
|
38391
38384
|
instanceConfig.file = ctx.request.files.templateFile;
|
|
38392
38385
|
}
|
|
38393
|
-
const includeSampleData = isQsTrue(ctx.request.body.sampleData);
|
|
38394
38386
|
const tenantId = tenancy.isMultiTenant() ? tenancy.getTenantId() : null;
|
|
38395
38387
|
const appId = generateDevAppID(generateAppID2(tenantId));
|
|
38396
38388
|
return await context_exports.doInAppContext(appId, async () => {
|
|
38397
|
-
const instance = await createInstance(
|
|
38398
|
-
appId,
|
|
38399
|
-
instanceConfig,
|
|
38400
|
-
includeSampleData
|
|
38401
|
-
);
|
|
38389
|
+
const instance = await createInstance(appId, instanceConfig);
|
|
38402
38390
|
const db2 = context_exports.getAppDB();
|
|
38403
38391
|
let newApplication = {
|
|
38404
38392
|
_id: DocumentType2.APP_METADATA,
|
|
@@ -38694,6 +38682,7 @@ async function migrateAppNavigation() {
|
|
|
38694
38682
|
return null;
|
|
38695
38683
|
}
|
|
38696
38684
|
}
|
|
38685
|
+
var addSampleData;
|
|
38697
38686
|
var init_application = __esm({
|
|
38698
38687
|
"src/api/controllers/application.ts"() {
|
|
38699
38688
|
init_environment3();
|
|
@@ -38714,6 +38703,16 @@ var init_application = __esm({
|
|
|
38714
38703
|
init_src();
|
|
38715
38704
|
init_layouts();
|
|
38716
38705
|
init_sdk3();
|
|
38706
|
+
addSampleData = async (ctx) => {
|
|
38707
|
+
const db2 = context_exports.getAppDB();
|
|
38708
|
+
try {
|
|
38709
|
+
await sdk_default.datasources.get(DEFAULT_BB_DATASOURCE_ID);
|
|
38710
|
+
} catch (err) {
|
|
38711
|
+
const defaultDbDocs = buildDefaultDocs();
|
|
38712
|
+
await db2.bulkDocs([...defaultDbDocs]);
|
|
38713
|
+
}
|
|
38714
|
+
ctx.status = 200;
|
|
38715
|
+
};
|
|
38717
38716
|
}
|
|
38718
38717
|
});
|
|
38719
38718
|
|
|
@@ -39367,6 +39366,10 @@ var init_application2 = __esm({
|
|
|
39367
39366
|
"/api/applications/:appId/client/revert",
|
|
39368
39367
|
authorized_default(permissions_exports.BUILDER),
|
|
39369
39368
|
revertClient
|
|
39369
|
+
).post(
|
|
39370
|
+
"/api/applications/:appId/sample",
|
|
39371
|
+
authorized_default(permissions_exports.BUILDER),
|
|
39372
|
+
addSampleData
|
|
39370
39373
|
).post(
|
|
39371
39374
|
"/api/applications/:appId/publish",
|
|
39372
39375
|
authorized_default(permissions_exports.BUILDER),
|