@event-driven-io/emmett-expressjs 0.43.0-beta.13 → 0.43.0-beta.14
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 +316 -1236
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -59
- package/dist/index.d.ts +69 -59
- package/dist/index.js +227 -1216
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import express, {
|
|
2
|
-
import http from
|
|
3
|
-
import { ProblemDocument } from
|
|
4
|
-
import { Brand, Event,
|
|
5
|
-
import supertest, {
|
|
6
|
-
import TestAgent from
|
|
1
|
+
import express, { Application, NextFunction, Request, Response, Router } from "express";
|
|
2
|
+
import http from "http";
|
|
3
|
+
import { ProblemDocument } from "http-problem-details";
|
|
4
|
+
import { Brand, Event, EventStore, InMemoryEventStore, TestEventStream } from "@event-driven-io/emmett";
|
|
5
|
+
import supertest, { Response as Response$1, Test } from "supertest";
|
|
6
|
+
import TestAgent from "supertest/lib/agent.js";
|
|
7
7
|
|
|
8
|
+
//#region src/etag.d.ts
|
|
8
9
|
declare const HeaderNames: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
IF_MATCH: string;
|
|
11
|
+
IF_NOT_MATCH: string;
|
|
12
|
+
ETag: string;
|
|
12
13
|
};
|
|
13
14
|
type WeakETag = Brand<`W/${string}`, 'ETag'>;
|
|
14
15
|
type ETag = Brand<string, 'ETag'>;
|
|
15
16
|
declare const WeakETagRegex: RegExp;
|
|
16
17
|
declare const enum ETagErrors {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
WRONG_WEAK_ETAG_FORMAT = "WRONG_WEAK_ETAG_FORMAT",
|
|
19
|
+
MISSING_IF_MATCH_HEADER = "MISSING_IF_MATCH_HEADER",
|
|
20
|
+
MISSING_IF_NOT_MATCH_HEADER = "MISSING_IF_NOT_MATCH_HEADER"
|
|
20
21
|
}
|
|
21
22
|
declare const isWeakETag: (etag: ETag) => etag is WeakETag;
|
|
22
23
|
declare const getWeakETagValue: (etag: ETag) => string;
|
|
@@ -25,61 +26,67 @@ declare const getETagFromIfMatch: (request: Request) => ETag;
|
|
|
25
26
|
declare const getETagFromIfNotMatch: (request: Request) => ETag;
|
|
26
27
|
declare const setETag: (response: Response, etag: ETag) => void;
|
|
27
28
|
declare const getETagValueFromIfMatch: (request: Request) => string;
|
|
28
|
-
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/responses.d.ts
|
|
29
31
|
type ErrorToProblemDetailsMapping = (error: Error, request: Request) => ProblemDocument | undefined;
|
|
30
32
|
type HttpResponseOptions = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
body?: unknown;
|
|
34
|
+
location?: string;
|
|
35
|
+
eTag?: ETag;
|
|
34
36
|
};
|
|
35
37
|
declare const DefaultHttpResponseOptions: HttpResponseOptions;
|
|
36
38
|
type HttpProblemResponseOptions = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
location?: string;
|
|
40
|
+
eTag?: ETag;
|
|
39
41
|
} & Omit<HttpResponseOptions, 'body'> & ({
|
|
40
|
-
|
|
42
|
+
problem: ProblemDocument;
|
|
41
43
|
} | {
|
|
42
|
-
|
|
44
|
+
problemDetails: string;
|
|
43
45
|
});
|
|
44
46
|
declare const DefaultHttpProblemResponseOptions: HttpProblemResponseOptions;
|
|
45
47
|
type CreatedHttpResponseOptions = ({
|
|
46
|
-
|
|
48
|
+
createdId: string;
|
|
47
49
|
} | {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
createdId?: string;
|
|
51
|
+
url: string;
|
|
50
52
|
}) & HttpResponseOptions;
|
|
51
|
-
declare const sendCreated: (response: Response, {
|
|
53
|
+
declare const sendCreated: (response: Response, {
|
|
54
|
+
eTag,
|
|
55
|
+
...options
|
|
56
|
+
}: CreatedHttpResponseOptions) => void;
|
|
52
57
|
type AcceptedHttpResponseOptions = {
|
|
53
|
-
|
|
58
|
+
location: string;
|
|
54
59
|
} & HttpResponseOptions;
|
|
55
60
|
declare const sendAccepted: (response: Response, options: AcceptedHttpResponseOptions) => void;
|
|
56
61
|
type NoContentHttpResponseOptions = Omit<HttpResponseOptions, 'body'>;
|
|
57
62
|
declare const sendNoContent: (response: Response, options?: NoContentHttpResponseOptions) => void;
|
|
58
63
|
declare const send: (response: Response, statusCode: number, options?: HttpResponseOptions) => void;
|
|
59
64
|
declare const sendProblem: (response: Response, statusCode: number, options?: HttpProblemResponseOptions) => void;
|
|
60
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/application.d.ts
|
|
61
67
|
type WebApiSetup = (router: Router) => void;
|
|
62
68
|
type ApplicationOptions = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
apis: WebApiSetup[];
|
|
70
|
+
mapError?: ErrorToProblemDetailsMapping;
|
|
71
|
+
enableDefaultExpressEtag?: boolean;
|
|
72
|
+
disableJsonMiddleware?: boolean;
|
|
73
|
+
disableUrlEncodingMiddleware?: boolean;
|
|
74
|
+
disableProblemDetailsMiddleware?: boolean;
|
|
69
75
|
};
|
|
70
76
|
declare const getApplication: (options: ApplicationOptions) => express.Application;
|
|
71
77
|
type StartApiOptions = {
|
|
72
|
-
|
|
78
|
+
port?: number;
|
|
73
79
|
};
|
|
74
80
|
declare const startAPI: (app: Application, options?: StartApiOptions) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
75
|
-
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/handler.d.ts
|
|
83
|
+
type HttpResponse = (response: Response) => void;
|
|
76
84
|
type HttpHandler<RequestType extends Request> = (request: RequestType) => Promise<HttpResponse> | HttpResponse;
|
|
77
85
|
declare const on: <RequestType extends Request>(handle: HttpHandler<RequestType>) => (request: RequestType, response: Response, _next: NextFunction) => Promise<void>;
|
|
78
86
|
declare const OK: (options?: HttpResponseOptions) => HttpResponse;
|
|
79
87
|
declare const Created: (options: CreatedHttpResponseOptions) => HttpResponse;
|
|
80
88
|
declare const Accepted: (options: AcceptedHttpResponseOptions) => HttpResponse;
|
|
81
89
|
declare const NoContent: (options?: NoContentHttpResponseOptions) => HttpResponse;
|
|
82
|
-
type HttpResponse = (response: Response) => void;
|
|
83
90
|
declare const HttpResponse: (statusCode: number, options?: HttpResponseOptions) => HttpResponse;
|
|
84
91
|
declare const BadRequest: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
85
92
|
declare const Forbidden: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
@@ -87,7 +94,8 @@ declare const NotFound: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
|
87
94
|
declare const Conflict: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
88
95
|
declare const PreconditionFailed: (options: HttpProblemResponseOptions) => HttpResponse;
|
|
89
96
|
declare const HttpProblem: (statusCode: number, options?: HttpProblemResponseOptions) => HttpResponse;
|
|
90
|
-
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/testing/apiSpecification.d.ts
|
|
91
99
|
type TestRequest = (request: TestAgent<supertest.Test>) => Test;
|
|
92
100
|
declare const existingStream: <EventType extends Event = Event>(streamId: string, events: EventType[]) => TestEventStream<EventType>;
|
|
93
101
|
type ResponseAssert = (response: Response$1) => boolean | void;
|
|
@@ -95,42 +103,44 @@ type ApiSpecificationAssert<EventType extends Event = Event> = TestEventStream<E
|
|
|
95
103
|
declare const expect: <EventType extends Event = Event>(streamId: string, events: EventType[]) => TestEventStream<EventType>;
|
|
96
104
|
declare const expectNewEvents: <EventType extends Event = Event>(streamId: string, events: EventType[]) => TestEventStream<EventType>;
|
|
97
105
|
declare const expectResponse: <Body = unknown>(statusCode: number, options?: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
body?: Body;
|
|
107
|
+
headers?: {
|
|
108
|
+
[index: string]: string;
|
|
109
|
+
};
|
|
102
110
|
}) => (response: Response$1) => void;
|
|
103
111
|
declare const expectError: (errorCode: number, problemDetails?: Partial<ProblemDocument>) => (response: Response$1) => void;
|
|
112
|
+
type ApiSpecification<EventType extends Event = Event> = (...givenStreams: TestEventStream<EventType>[]) => {
|
|
113
|
+
when: (setupRequest: TestRequest) => {
|
|
114
|
+
then: (verify: ApiSpecificationAssert<EventType>) => Promise<void>;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
104
117
|
declare function apiSpecificationFor<EventType extends Event = Event, Store extends EventStore = EventStore>(options: {
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
getEventStore: () => Store;
|
|
119
|
+
getApplication: (eventStore: Store) => Application;
|
|
107
120
|
}): ApiSpecification<EventType>;
|
|
108
121
|
/** @deprecated Use `ApiSpecification.for({ getEventStore, getApplication })` instead */
|
|
109
122
|
declare function apiSpecificationFor<EventType extends Event = Event, Store extends EventStore = EventStore>(getEventStore: () => Store, getApplication: (eventStore: Store) => Application): ApiSpecification<EventType>;
|
|
110
|
-
type ApiSpecification<EventType extends Event = Event> = (...givenStreams: TestEventStream<EventType>[]) => {
|
|
111
|
-
when: (setupRequest: TestRequest) => {
|
|
112
|
-
then: (verify: ApiSpecificationAssert<EventType>) => Promise<void>;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
123
|
declare const ApiSpecification: {
|
|
116
|
-
|
|
124
|
+
for: typeof apiSpecificationFor;
|
|
117
125
|
};
|
|
118
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/testing/apiE2ESpecification.d.ts
|
|
119
128
|
type E2EResponseAssert = (response: Response$1) => boolean | void;
|
|
120
129
|
type ApiE2ESpecificationAssert = [E2EResponseAssert];
|
|
130
|
+
type ApiE2ESpecification = (...givenRequests: TestRequest[]) => {
|
|
131
|
+
when: (setupRequest: TestRequest) => {
|
|
132
|
+
then: (verify: ApiE2ESpecificationAssert) => Promise<void>;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
121
135
|
declare function apiE2ESpecificationFor<Store extends EventStore = InMemoryEventStore>(options: {
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
getEventStore?: () => Store;
|
|
137
|
+
getApplication: (eventStore: Store) => Application;
|
|
124
138
|
}): ApiE2ESpecification;
|
|
125
139
|
/** @deprecated Use `ApiE2ESpecification.for({ getEventStore, getApplication })` instead */
|
|
126
140
|
declare function apiE2ESpecificationFor<Store extends EventStore = InMemoryEventStore>(getEventStore: () => Store, getApplication: (eventStore: Store) => Application): ApiE2ESpecification;
|
|
127
|
-
type ApiE2ESpecification = (...givenRequests: TestRequest[]) => {
|
|
128
|
-
when: (setupRequest: TestRequest) => {
|
|
129
|
-
then: (verify: ApiE2ESpecificationAssert) => Promise<void>;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
141
|
declare const ApiE2ESpecification: {
|
|
133
|
-
|
|
142
|
+
for: typeof apiE2ESpecificationFor;
|
|
134
143
|
};
|
|
135
|
-
|
|
136
|
-
export { Accepted,
|
|
144
|
+
//#endregion
|
|
145
|
+
export { Accepted, AcceptedHttpResponseOptions, ApiE2ESpecification, ApiE2ESpecificationAssert, ApiSpecification, ApiSpecificationAssert, ApplicationOptions, BadRequest, Conflict, Created, CreatedHttpResponseOptions, DefaultHttpProblemResponseOptions, DefaultHttpResponseOptions, E2EResponseAssert, ETag, ETagErrors, ErrorToProblemDetailsMapping, Forbidden, HeaderNames, HttpHandler, HttpProblem, HttpProblemResponseOptions, HttpResponse, HttpResponseOptions, NoContent, NoContentHttpResponseOptions, NotFound, OK, PreconditionFailed, ResponseAssert, StartApiOptions, TestRequest, WeakETag, WeakETagRegex, WebApiSetup, existingStream, expect, expectError, expectNewEvents, expectResponse, getApplication, getETagFromIfMatch, getETagFromIfNotMatch, getETagValueFromIfMatch, getWeakETagValue, isWeakETag, on, send, sendAccepted, sendCreated, sendNoContent, sendProblem, setETag, startAPI, toWeakETag };
|
|
146
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import express, {
|
|
2
|
-
import http from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import supertest, {
|
|
6
|
-
import TestAgent from
|
|
1
|
+
import express, { Application, NextFunction, Request, Response, Router } from "express";
|
|
2
|
+
import http from "http";
|
|
3
|
+
import { Brand, Event, EventStore, InMemoryEventStore, TestEventStream } from "@event-driven-io/emmett";
|
|
4
|
+
import { ProblemDocument } from "http-problem-details";
|
|
5
|
+
import supertest, { Response as Response$1, Test } from "supertest";
|
|
6
|
+
import TestAgent from "supertest/lib/agent.js";
|
|
7
7
|
|
|
8
|
+
//#region src/etag.d.ts
|
|
8
9
|
declare const HeaderNames: {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
IF_MATCH: string;
|
|
11
|
+
IF_NOT_MATCH: string;
|
|
12
|
+
ETag: string;
|
|
12
13
|
};
|
|
13
14
|
type WeakETag = Brand<`W/${string}`, 'ETag'>;
|
|
14
15
|
type ETag = Brand<string, 'ETag'>;
|
|
15
16
|
declare const WeakETagRegex: RegExp;
|
|
16
17
|
declare const enum ETagErrors {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
WRONG_WEAK_ETAG_FORMAT = "WRONG_WEAK_ETAG_FORMAT",
|
|
19
|
+
MISSING_IF_MATCH_HEADER = "MISSING_IF_MATCH_HEADER",
|
|
20
|
+
MISSING_IF_NOT_MATCH_HEADER = "MISSING_IF_NOT_MATCH_HEADER"
|
|
20
21
|
}
|
|
21
22
|
declare const isWeakETag: (etag: ETag) => etag is WeakETag;
|
|
22
23
|
declare const getWeakETagValue: (etag: ETag) => string;
|
|
@@ -25,61 +26,67 @@ declare const getETagFromIfMatch: (request: Request) => ETag;
|
|
|
25
26
|
declare const getETagFromIfNotMatch: (request: Request) => ETag;
|
|
26
27
|
declare const setETag: (response: Response, etag: ETag) => void;
|
|
27
28
|
declare const getETagValueFromIfMatch: (request: Request) => string;
|
|
28
|
-
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/responses.d.ts
|
|
29
31
|
type ErrorToProblemDetailsMapping = (error: Error, request: Request) => ProblemDocument | undefined;
|
|
30
32
|
type HttpResponseOptions = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
body?: unknown;
|
|
34
|
+
location?: string;
|
|
35
|
+
eTag?: ETag;
|
|
34
36
|
};
|
|
35
37
|
declare const DefaultHttpResponseOptions: HttpResponseOptions;
|
|
36
38
|
type HttpProblemResponseOptions = {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
+
location?: string;
|
|
40
|
+
eTag?: ETag;
|
|
39
41
|
} & Omit<HttpResponseOptions, 'body'> & ({
|
|
40
|
-
|
|
42
|
+
problem: ProblemDocument;
|
|
41
43
|
} | {
|
|
42
|
-
|
|
44
|
+
problemDetails: string;
|
|
43
45
|
});
|
|
44
46
|
declare const DefaultHttpProblemResponseOptions: HttpProblemResponseOptions;
|
|
45
47
|
type CreatedHttpResponseOptions = ({
|
|
46
|
-
|
|
48
|
+
createdId: string;
|
|
47
49
|
} | {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
createdId?: string;
|
|
51
|
+
url: string;
|
|
50
52
|
}) & HttpResponseOptions;
|
|
51
|
-
declare const sendCreated: (response: Response, {
|
|
53
|
+
declare const sendCreated: (response: Response, {
|
|
54
|
+
eTag,
|
|
55
|
+
...options
|
|
56
|
+
}: CreatedHttpResponseOptions) => void;
|
|
52
57
|
type AcceptedHttpResponseOptions = {
|
|
53
|
-
|
|
58
|
+
location: string;
|
|
54
59
|
} & HttpResponseOptions;
|
|
55
60
|
declare const sendAccepted: (response: Response, options: AcceptedHttpResponseOptions) => void;
|
|
56
61
|
type NoContentHttpResponseOptions = Omit<HttpResponseOptions, 'body'>;
|
|
57
62
|
declare const sendNoContent: (response: Response, options?: NoContentHttpResponseOptions) => void;
|
|
58
63
|
declare const send: (response: Response, statusCode: number, options?: HttpResponseOptions) => void;
|
|
59
64
|
declare const sendProblem: (response: Response, statusCode: number, options?: HttpProblemResponseOptions) => void;
|
|
60
|
-
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/application.d.ts
|
|
61
67
|
type WebApiSetup = (router: Router) => void;
|
|
62
68
|
type ApplicationOptions = {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
apis: WebApiSetup[];
|
|
70
|
+
mapError?: ErrorToProblemDetailsMapping;
|
|
71
|
+
enableDefaultExpressEtag?: boolean;
|
|
72
|
+
disableJsonMiddleware?: boolean;
|
|
73
|
+
disableUrlEncodingMiddleware?: boolean;
|
|
74
|
+
disableProblemDetailsMiddleware?: boolean;
|
|
69
75
|
};
|
|
70
76
|
declare const getApplication: (options: ApplicationOptions) => express.Application;
|
|
71
77
|
type StartApiOptions = {
|
|
72
|
-
|
|
78
|
+
port?: number;
|
|
73
79
|
};
|
|
74
80
|
declare const startAPI: (app: Application, options?: StartApiOptions) => http.Server<typeof http.IncomingMessage, typeof http.ServerResponse>;
|
|
75
|
-
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/handler.d.ts
|
|
83
|
+
type HttpResponse = (response: Response) => void;
|
|
76
84
|
type HttpHandler<RequestType extends Request> = (request: RequestType) => Promise<HttpResponse> | HttpResponse;
|
|
77
85
|
declare const on: <RequestType extends Request>(handle: HttpHandler<RequestType>) => (request: RequestType, response: Response, _next: NextFunction) => Promise<void>;
|
|
78
86
|
declare const OK: (options?: HttpResponseOptions) => HttpResponse;
|
|
79
87
|
declare const Created: (options: CreatedHttpResponseOptions) => HttpResponse;
|
|
80
88
|
declare const Accepted: (options: AcceptedHttpResponseOptions) => HttpResponse;
|
|
81
89
|
declare const NoContent: (options?: NoContentHttpResponseOptions) => HttpResponse;
|
|
82
|
-
type HttpResponse = (response: Response) => void;
|
|
83
90
|
declare const HttpResponse: (statusCode: number, options?: HttpResponseOptions) => HttpResponse;
|
|
84
91
|
declare const BadRequest: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
85
92
|
declare const Forbidden: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
@@ -87,7 +94,8 @@ declare const NotFound: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
|
87
94
|
declare const Conflict: (options?: HttpProblemResponseOptions) => HttpResponse;
|
|
88
95
|
declare const PreconditionFailed: (options: HttpProblemResponseOptions) => HttpResponse;
|
|
89
96
|
declare const HttpProblem: (statusCode: number, options?: HttpProblemResponseOptions) => HttpResponse;
|
|
90
|
-
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/testing/apiSpecification.d.ts
|
|
91
99
|
type TestRequest = (request: TestAgent<supertest.Test>) => Test;
|
|
92
100
|
declare const existingStream: <EventType extends Event = Event>(streamId: string, events: EventType[]) => TestEventStream<EventType>;
|
|
93
101
|
type ResponseAssert = (response: Response$1) => boolean | void;
|
|
@@ -95,42 +103,44 @@ type ApiSpecificationAssert<EventType extends Event = Event> = TestEventStream<E
|
|
|
95
103
|
declare const expect: <EventType extends Event = Event>(streamId: string, events: EventType[]) => TestEventStream<EventType>;
|
|
96
104
|
declare const expectNewEvents: <EventType extends Event = Event>(streamId: string, events: EventType[]) => TestEventStream<EventType>;
|
|
97
105
|
declare const expectResponse: <Body = unknown>(statusCode: number, options?: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
106
|
+
body?: Body;
|
|
107
|
+
headers?: {
|
|
108
|
+
[index: string]: string;
|
|
109
|
+
};
|
|
102
110
|
}) => (response: Response$1) => void;
|
|
103
111
|
declare const expectError: (errorCode: number, problemDetails?: Partial<ProblemDocument>) => (response: Response$1) => void;
|
|
112
|
+
type ApiSpecification<EventType extends Event = Event> = (...givenStreams: TestEventStream<EventType>[]) => {
|
|
113
|
+
when: (setupRequest: TestRequest) => {
|
|
114
|
+
then: (verify: ApiSpecificationAssert<EventType>) => Promise<void>;
|
|
115
|
+
};
|
|
116
|
+
};
|
|
104
117
|
declare function apiSpecificationFor<EventType extends Event = Event, Store extends EventStore = EventStore>(options: {
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
getEventStore: () => Store;
|
|
119
|
+
getApplication: (eventStore: Store) => Application;
|
|
107
120
|
}): ApiSpecification<EventType>;
|
|
108
121
|
/** @deprecated Use `ApiSpecification.for({ getEventStore, getApplication })` instead */
|
|
109
122
|
declare function apiSpecificationFor<EventType extends Event = Event, Store extends EventStore = EventStore>(getEventStore: () => Store, getApplication: (eventStore: Store) => Application): ApiSpecification<EventType>;
|
|
110
|
-
type ApiSpecification<EventType extends Event = Event> = (...givenStreams: TestEventStream<EventType>[]) => {
|
|
111
|
-
when: (setupRequest: TestRequest) => {
|
|
112
|
-
then: (verify: ApiSpecificationAssert<EventType>) => Promise<void>;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
123
|
declare const ApiSpecification: {
|
|
116
|
-
|
|
124
|
+
for: typeof apiSpecificationFor;
|
|
117
125
|
};
|
|
118
|
-
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/testing/apiE2ESpecification.d.ts
|
|
119
128
|
type E2EResponseAssert = (response: Response$1) => boolean | void;
|
|
120
129
|
type ApiE2ESpecificationAssert = [E2EResponseAssert];
|
|
130
|
+
type ApiE2ESpecification = (...givenRequests: TestRequest[]) => {
|
|
131
|
+
when: (setupRequest: TestRequest) => {
|
|
132
|
+
then: (verify: ApiE2ESpecificationAssert) => Promise<void>;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
121
135
|
declare function apiE2ESpecificationFor<Store extends EventStore = InMemoryEventStore>(options: {
|
|
122
|
-
|
|
123
|
-
|
|
136
|
+
getEventStore?: () => Store;
|
|
137
|
+
getApplication: (eventStore: Store) => Application;
|
|
124
138
|
}): ApiE2ESpecification;
|
|
125
139
|
/** @deprecated Use `ApiE2ESpecification.for({ getEventStore, getApplication })` instead */
|
|
126
140
|
declare function apiE2ESpecificationFor<Store extends EventStore = InMemoryEventStore>(getEventStore: () => Store, getApplication: (eventStore: Store) => Application): ApiE2ESpecification;
|
|
127
|
-
type ApiE2ESpecification = (...givenRequests: TestRequest[]) => {
|
|
128
|
-
when: (setupRequest: TestRequest) => {
|
|
129
|
-
then: (verify: ApiE2ESpecificationAssert) => Promise<void>;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
141
|
declare const ApiE2ESpecification: {
|
|
133
|
-
|
|
142
|
+
for: typeof apiE2ESpecificationFor;
|
|
134
143
|
};
|
|
135
|
-
|
|
136
|
-
export { Accepted,
|
|
144
|
+
//#endregion
|
|
145
|
+
export { Accepted, AcceptedHttpResponseOptions, ApiE2ESpecification, ApiE2ESpecificationAssert, ApiSpecification, ApiSpecificationAssert, ApplicationOptions, BadRequest, Conflict, Created, CreatedHttpResponseOptions, DefaultHttpProblemResponseOptions, DefaultHttpResponseOptions, E2EResponseAssert, ETag, ETagErrors, ErrorToProblemDetailsMapping, Forbidden, HeaderNames, HttpHandler, HttpProblem, HttpProblemResponseOptions, HttpResponse, HttpResponseOptions, NoContent, NoContentHttpResponseOptions, NotFound, OK, PreconditionFailed, ResponseAssert, StartApiOptions, TestRequest, WeakETag, WeakETagRegex, WebApiSetup, existingStream, expect, expectError, expectNewEvents, expectResponse, getApplication, getETagFromIfMatch, getETagFromIfNotMatch, getETagValueFromIfMatch, getWeakETagValue, isWeakETag, on, send, sendAccepted, sendCreated, sendNoContent, sendProblem, setETag, startAPI, toWeakETag };
|
|
146
|
+
//# sourceMappingURL=index.d.ts.map
|