tsondb 0.19.13 → 0.19.15
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.
|
@@ -38,15 +38,15 @@ export declare const validateConfigForGeneration: (config: Config) => asserts co
|
|
|
38
38
|
/**
|
|
39
39
|
* The configuration type required for any commands that need to read data stored in the database.
|
|
40
40
|
*/
|
|
41
|
-
export type DataConfig = Config & {
|
|
42
|
-
schema: Schema
|
|
41
|
+
export type DataConfig<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> = Config<T> & {
|
|
42
|
+
schema: Schema<T>;
|
|
43
43
|
dataRootPath: string;
|
|
44
44
|
};
|
|
45
45
|
export declare const validateConfigForData: (config: Config) => asserts config is DataConfig;
|
|
46
46
|
/**
|
|
47
47
|
* The configuration type required for running the server for the editor.
|
|
48
48
|
*/
|
|
49
|
-
export type ServerConfig = DataConfig & {
|
|
49
|
+
export type ServerConfig<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> = DataConfig<T> & {
|
|
50
50
|
serverOptions?: ServerOptions;
|
|
51
51
|
locales: string[];
|
|
52
52
|
homeLayoutSections?: HomeLayoutSection[];
|
|
@@ -57,14 +57,14 @@ export type ServerConfig = DataConfig & {
|
|
|
57
57
|
/**
|
|
58
58
|
* The configuration type required for validating the contents of the database.
|
|
59
59
|
*/
|
|
60
|
-
export type TestingConfig = DataConfig & {
|
|
60
|
+
export type TestingConfig<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> = DataConfig<T> & {
|
|
61
61
|
locales: string[];
|
|
62
62
|
validationOptions?: Partial<ValidationOptions>;
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* The configuration type required for formatting the contents of the database.
|
|
66
66
|
*/
|
|
67
|
-
export type FormattingConfig = DataConfig
|
|
67
|
+
export type FormattingConfig<T extends DefaultTSONDBTypes = DefaultTSONDBTypes> = DataConfig<T>;
|
|
68
68
|
export declare const validateConfigForServer: (config: Config) => asserts config is ServerConfig;
|
|
69
69
|
export declare const validateConfigForTesting: (config: Config) => asserts config is TestingConfig;
|
|
70
70
|
export declare const validateConfigForFormatting: (config: Config) => asserts config is FormattingConfig;
|
|
@@ -21,13 +21,20 @@ export class DatabaseInMemory {
|
|
|
21
21
|
const instanceFileNames = await readdir(entityDir);
|
|
22
22
|
const instances = await mapAsync(instanceFileNames, async (instanceFileName) => {
|
|
23
23
|
const id = basename(instanceFileName, extname(instanceFileName));
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
{
|
|
24
|
+
try {
|
|
25
|
+
return [
|
|
27
26
|
id,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
{
|
|
28
|
+
id,
|
|
29
|
+
content: JSON.parse(await readFile(join(entityDir, instanceFileName), "utf-8")),
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
throw new Error(`Failed to load instance "${id}" of entity "${entity.name}"`, {
|
|
35
|
+
cause: error,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
31
38
|
}, ulimit);
|
|
32
39
|
const instancesById = Dictionary.fromEntries(instances);
|
|
33
40
|
return [entity.name, instancesById];
|