@sgedda/mockifyer-fetch 1.8.4 → 1.8.6
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/dist/index.js +9 -2
- package/package.json +2 -2
- package/src/index.ts +10 -2
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ class MockifyerClass {
|
|
|
44
44
|
this.SESSION_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
|
|
45
45
|
// Validate database provider - filesystem, expo-filesystem, hybrid, and memory are supported
|
|
46
46
|
if (config.databaseProvider && config.databaseProvider.type) {
|
|
47
|
-
const supportedTypes = ['filesystem', 'expo-filesystem', 'hybrid', 'memory'];
|
|
47
|
+
const supportedTypes = ['filesystem', 'expo-filesystem', 'hybrid', 'memory', 'redis', 'sqlite'];
|
|
48
48
|
if (!supportedTypes.includes(config.databaseProvider.type)) {
|
|
49
49
|
throw new Error(`Database provider type '${config.databaseProvider.type}' is not yet available for use. ` +
|
|
50
50
|
`Supported types: ${supportedTypes.join(', ')}. ` +
|
|
@@ -88,7 +88,14 @@ class MockifyerClass {
|
|
|
88
88
|
}
|
|
89
89
|
// Initialize database provider if specified
|
|
90
90
|
if (config.databaseProvider && config.databaseProvider.type) {
|
|
91
|
-
|
|
91
|
+
const providerConfig = {
|
|
92
|
+
...config.databaseProvider,
|
|
93
|
+
options: {
|
|
94
|
+
...config.databaseProvider.options,
|
|
95
|
+
mockDataPath: config.databaseProvider.options?.mockDataPath ?? config.mockDataPath,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
this.databaseProvider = (0, mockifyer_core_1.createProvider)(config.databaseProvider.type, providerConfig);
|
|
92
99
|
const initResult = this.databaseProvider.initialize();
|
|
93
100
|
// Handle async initialization (expo-filesystem / hybrid providers)
|
|
94
101
|
if (initResult instanceof Promise) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sgedda/mockifyer-fetch",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6",
|
|
4
4
|
"description": "Mockifyer for Fetch - API mocking and logging utility for storing and replaying API responses",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"author": "sgedda",
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@sgedda/mockifyer-core": "^1.8.
|
|
49
|
+
"@sgedda/mockifyer-core": "^1.8.6"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^20.11.24",
|
package/src/index.ts
CHANGED
|
@@ -55,7 +55,7 @@ class MockifyerClass {
|
|
|
55
55
|
constructor(config: MockifyerConfig) {
|
|
56
56
|
// Validate database provider - filesystem, expo-filesystem, hybrid, and memory are supported
|
|
57
57
|
if (config.databaseProvider && config.databaseProvider.type) {
|
|
58
|
-
const supportedTypes = ['filesystem', 'expo-filesystem', 'hybrid', 'memory'];
|
|
58
|
+
const supportedTypes = ['filesystem', 'expo-filesystem', 'hybrid', 'memory', 'redis', 'sqlite'];
|
|
59
59
|
if (!supportedTypes.includes(config.databaseProvider.type)) {
|
|
60
60
|
throw new Error(
|
|
61
61
|
`Database provider type '${config.databaseProvider.type}' is not yet available for use. ` +
|
|
@@ -112,7 +112,15 @@ class MockifyerClass {
|
|
|
112
112
|
|
|
113
113
|
// Initialize database provider if specified
|
|
114
114
|
if (config.databaseProvider && config.databaseProvider.type) {
|
|
115
|
-
|
|
115
|
+
const providerConfig = {
|
|
116
|
+
...config.databaseProvider,
|
|
117
|
+
options: {
|
|
118
|
+
...config.databaseProvider.options,
|
|
119
|
+
mockDataPath:
|
|
120
|
+
config.databaseProvider.options?.mockDataPath ?? config.mockDataPath,
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
this.databaseProvider = createProvider(config.databaseProvider.type, providerConfig);
|
|
116
124
|
const initResult = this.databaseProvider.initialize();
|
|
117
125
|
// Handle async initialization (expo-filesystem / hybrid providers)
|
|
118
126
|
if (initResult instanceof Promise) {
|