Updates
This commit is contained in:
@@ -19,5 +19,7 @@ export default function grabDirNames(param?: Param): {
|
||||
userPrivateTempJSONSchemaFilePath: string | undefined;
|
||||
userPrivateDbExportZipFileName: string;
|
||||
userPrivateDbExportZipFilePath: string | undefined;
|
||||
userPrivateDbImportZipFileName: string;
|
||||
userPrivateDbImportZipFilePath: string | undefined;
|
||||
};
|
||||
export {};
|
||||
|
||||
@@ -15,7 +15,7 @@ function grabDirNames(param) {
|
||||
if (!schemasDir)
|
||||
throw new Error("Please provide the `DSQL_DB_SCHEMA_DIR` env variable.");
|
||||
const pakageSharedDir = path_1.default.join(appDir, `package-shared`);
|
||||
const mainDbTypeDefFile = path_1.default.join(appDir, `types/dsql.ts`);
|
||||
const mainDbTypeDefFile = path_1.default.join(pakageSharedDir, `types/dsql.ts`);
|
||||
const mainShemaJSONFilePath = path_1.default.join(schemasDir, `main.json`);
|
||||
const defaultTableFieldsJSONFilePath = path_1.default.join(pakageSharedDir, `data/defaultFields.json`);
|
||||
const usersSchemaDir = path_1.default.join(schemasDir, `users`);
|
||||
@@ -46,6 +46,10 @@ function grabDirNames(param) {
|
||||
const userPrivateDbExportZipFilePath = userPrivateSQLExportsDir
|
||||
? path_1.default.join(userPrivateSQLExportsDir, userPrivateDbExportZipFileName)
|
||||
: undefined;
|
||||
const userPrivateDbImportZipFileName = `db-export.zip`;
|
||||
const userPrivateDbImportZipFilePath = userPrivateSQLExportsDir
|
||||
? path_1.default.join(userPrivateSQLExportsDir, userPrivateDbImportZipFileName)
|
||||
: undefined;
|
||||
return {
|
||||
schemasDir,
|
||||
userDirPath,
|
||||
@@ -62,5 +66,7 @@ function grabDirNames(param) {
|
||||
userPrivateTempJSONSchemaFilePath,
|
||||
userPrivateDbExportZipFileName,
|
||||
userPrivateDbExportZipFilePath,
|
||||
userPrivateDbImportZipFileName,
|
||||
userPrivateDbImportZipFilePath,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
type Param = {
|
||||
str: string;
|
||||
userId: string | number;
|
||||
};
|
||||
export default function replaceDatasquirelDbName({ str, userId, }: Param): string;
|
||||
export {};
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = replaceDatasquirelDbName;
|
||||
function replaceDatasquirelDbName({ str, userId, }) {
|
||||
const dbNamePrefix = process.env.DSQL_USER_DB_PREFIX;
|
||||
const userNameRegex = new RegExp(`${dbNamePrefix}\\d+_`, "g");
|
||||
const newPrefix = `${dbNamePrefix}${userId}_`;
|
||||
return str.replace(userNameRegex, newPrefix);
|
||||
}
|
||||
Reference in New Issue
Block a user