fauxbase 0.5.4 → 0.5.5
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.cjs +12 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -244,6 +244,13 @@ var Service = class {
|
|
|
244
244
|
};
|
|
245
245
|
}
|
|
246
246
|
async request(path, options) {
|
|
247
|
+
if (options?.local) {
|
|
248
|
+
try {
|
|
249
|
+
return this.driver.request(this.resourceName, path, options);
|
|
250
|
+
} catch {
|
|
251
|
+
return options.local();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
247
254
|
return this.driver.request(this.resourceName, path, options);
|
|
248
255
|
}
|
|
249
256
|
emitEvent(action, extra) {
|
|
@@ -890,9 +897,12 @@ var LocalDriver = class {
|
|
|
890
897
|
}
|
|
891
898
|
return { data: { count } };
|
|
892
899
|
}
|
|
893
|
-
async request(_resource, _path,
|
|
900
|
+
async request(_resource, _path, options) {
|
|
901
|
+
if (options?.local) {
|
|
902
|
+
return options.local();
|
|
903
|
+
}
|
|
894
904
|
throw new Error(
|
|
895
|
-
"service.request() is only available with the HTTP driver.
|
|
905
|
+
"service.request() is only available with the HTTP driver. Provide a `local` handler or switch to HTTP driver."
|
|
896
906
|
);
|
|
897
907
|
}
|
|
898
908
|
// --- Seed management (synchronous) ---
|