@schmock/angular 1.0.2 → 1.0.4
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.d.ts +56 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -35112
- package/package.json +8 -11
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { HttpInterceptor, HttpRequest } from "@angular/common/http";
|
|
2
|
+
import type { CallableMockInstance, ResponseResult } from "@schmock/core";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for Angular adapter
|
|
5
|
+
*/
|
|
6
|
+
export interface AngularAdapterOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Base URL to intercept (e.g., '/api')
|
|
9
|
+
* If not provided, intercepts all requests
|
|
10
|
+
*/
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether to pass through requests that don't match any route
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
passthrough?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Custom error formatter
|
|
19
|
+
* @param error - The error that occurred
|
|
20
|
+
* @param request - Angular HTTP request
|
|
21
|
+
* @returns Custom error response
|
|
22
|
+
*/
|
|
23
|
+
errorFormatter?: (error: Error, request: HttpRequest<any>) => any;
|
|
24
|
+
/**
|
|
25
|
+
* Request transformer - modify request before passing to Schmock
|
|
26
|
+
* @param request - Angular HTTP request
|
|
27
|
+
* @returns Modified request data
|
|
28
|
+
*/
|
|
29
|
+
transformRequest?: (request: HttpRequest<any>) => {
|
|
30
|
+
method?: string;
|
|
31
|
+
path?: string;
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
body?: any;
|
|
34
|
+
query?: Record<string, string>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Response transformer - modify Schmock response before returning
|
|
38
|
+
* @param response - Response from Schmock
|
|
39
|
+
* @param request - Original Angular request
|
|
40
|
+
* @returns Modified response
|
|
41
|
+
*/
|
|
42
|
+
transformResponse?: (response: ResponseResult, request: HttpRequest<any>) => ResponseResult;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create an Angular HTTP interceptor from a Schmock instance
|
|
46
|
+
*/
|
|
47
|
+
export declare function createSchmockInterceptor(mock: CallableMockInstance, options?: AngularAdapterOptions): new () => HttpInterceptor;
|
|
48
|
+
/**
|
|
49
|
+
* Provider configuration for Angular module
|
|
50
|
+
*/
|
|
51
|
+
export declare function provideSchmockInterceptor(mock: CallableMockInstance, options?: AngularAdapterOptions): {
|
|
52
|
+
provide: string;
|
|
53
|
+
useClass: new () => HttpInterceptor;
|
|
54
|
+
multi: boolean;
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,eAAe,EACf,WAAW,EACZ,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EACV,oBAAoB,EAEpB,cAAc,EACf,MAAM,eAAe,CAAC;AAwBvB;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC;IAElE;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,CAAC,KAAK;QAChD,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC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