@ahoo-wang/fetcher-wow 1.1.0 → 1.2.1
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/README.md +275 -357
- package/README.zh-CN.md +283 -279
- package/dist/command/commandClient.d.ts +146 -0
- package/dist/command/commandClient.d.ts.map +1 -0
- package/dist/command/{commandHeaders.d.ts → commandHttpHeaders.d.ts} +6 -7
- package/dist/command/commandHttpHeaders.d.ts.map +1 -0
- package/dist/command/commandRequest.d.ts +26 -62
- package/dist/command/commandRequest.d.ts.map +1 -1
- package/dist/command/index.d.ts +2 -3
- package/dist/command/index.d.ts.map +1 -1
- package/dist/index.es.js +467 -226
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/query/event/domainEventStream.d.ts +49 -4
- package/dist/query/event/domainEventStream.d.ts.map +1 -1
- package/dist/query/event/eventStreamQueryApi.d.ts +6 -0
- package/dist/query/event/eventStreamQueryApi.d.ts.map +1 -1
- package/dist/query/event/eventStreamQueryClient.d.ts +46 -0
- package/dist/query/event/eventStreamQueryClient.d.ts.map +1 -0
- package/dist/query/event/index.d.ts +1 -0
- package/dist/query/event/index.d.ts.map +1 -1
- package/dist/query/queryApi.d.ts +62 -0
- package/dist/query/queryApi.d.ts.map +1 -1
- package/dist/query/snapshot/index.d.ts +1 -0
- package/dist/query/snapshot/index.d.ts.map +1 -1
- package/dist/query/snapshot/snapshot.d.ts +2 -2
- package/dist/query/snapshot/snapshot.d.ts.map +1 -1
- package/dist/query/snapshot/snapshotQueryApi.d.ts +28 -0
- package/dist/query/snapshot/snapshotQueryApi.d.ts.map +1 -1
- package/dist/query/snapshot/snapshotQueryClient.d.ts +74 -0
- package/dist/query/snapshot/snapshotQueryClient.d.ts.map +1 -0
- package/dist/query/sort.d.ts +4 -0
- package/dist/query/sort.d.ts.map +1 -1
- package/dist/types/client.d.ts +15 -0
- package/dist/types/client.d.ts.map +1 -0
- package/dist/types/endpoints.d.ts +28 -0
- package/dist/types/endpoints.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/command/commandHeaders.d.ts.map +0 -1
- package/dist/command/commandHttpClient.d.ts +0 -133
- package/dist/command/commandHttpClient.d.ts.map +0 -1
- package/dist/command/commandHttpRequest.d.ts +0 -48
- package/dist/command/commandHttpRequest.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventStreamQueryClient.d.ts","sourceRoot":"","sources":["../../../src/query/event/eventStreamQueryClient.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,mBAAmB,EAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C;;;;;GAKG;AACH,qBAAa,sBACX,SAAQ,WACR,YAAW,mBAAmB;IAC9B;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAI5C;;;;OAIG;IACH,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;IAIjE;;;;;OAKG;IACH,UAAU,CACR,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC;IAS3E;;;;OAIG;IACH,KAAK,CACH,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;CAGlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query/event/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query/event/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC"}
|
package/dist/query/queryApi.d.ts
CHANGED
|
@@ -1,11 +1,73 @@
|
|
|
1
1
|
import { ListQuery, PagedList, PagedQuery, SingleQuery } from './queryable';
|
|
2
2
|
import { JsonServerSentEvent } from '@ahoo-wang/fetcher-eventstream';
|
|
3
3
|
import { Condition } from './condition';
|
|
4
|
+
import { ClientOptions } from '../types';
|
|
5
|
+
import { ResultExtractor } from '@ahoo-wang/fetcher-decorator';
|
|
6
|
+
/**
|
|
7
|
+
* Interface for generic query API operations.
|
|
8
|
+
* Provides methods for querying resources in different ways including single item retrieval,
|
|
9
|
+
* list retrieval, streaming lists, paged retrieval, and counting.
|
|
10
|
+
*
|
|
11
|
+
* @see {@link EventStreamQueryApi}
|
|
12
|
+
* @see {@link SnapshotQueryApi}
|
|
13
|
+
* @template R - The type of resource being queried
|
|
14
|
+
*/
|
|
4
15
|
export interface QueryApi<R> {
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves a single resource based on the provided query parameters.
|
|
18
|
+
* @param singleQuery - The query parameters for retrieving a single resource
|
|
19
|
+
* @returns A promise that resolves to a partial resource
|
|
20
|
+
*/
|
|
5
21
|
single(singleQuery: SingleQuery): Promise<Partial<R>>;
|
|
22
|
+
/**
|
|
23
|
+
* Retrieves a list of resources based on the provided query parameters.
|
|
24
|
+
* @param listQuery - The query parameters for listing resources
|
|
25
|
+
* @returns A promise that resolves to an array of partial resources
|
|
26
|
+
*/
|
|
6
27
|
list(listQuery: ListQuery): Promise<Partial<R>[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves a stream of resources based on the provided query parameters.
|
|
30
|
+
* @param listQuery - The query parameters for listing resources
|
|
31
|
+
* @returns A promise that resolves to a readable stream of JSON server-sent events containing partial resources
|
|
32
|
+
*/
|
|
7
33
|
listStream(listQuery: ListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<R>>>>;
|
|
34
|
+
/**
|
|
35
|
+
* Retrieves a paged list of resources based on the provided query parameters.
|
|
36
|
+
* @param pagedQuery - The query parameters for paging resources
|
|
37
|
+
* @returns A promise that resolves to a paged list of partial resources
|
|
38
|
+
*/
|
|
8
39
|
paged(pagedQuery: PagedQuery): Promise<PagedList<Partial<R>>>;
|
|
40
|
+
/**
|
|
41
|
+
* Counts the number of resources that match the given condition.
|
|
42
|
+
* @param condition - The condition to filter resources
|
|
43
|
+
* @returns A promise that resolves to the count of matching resources
|
|
44
|
+
*/
|
|
9
45
|
count(condition: Condition): Promise<number>;
|
|
10
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Base client for performing query operations.
|
|
49
|
+
* Provides a generic query method that handles the common logic for sending requests
|
|
50
|
+
* and processing responses for different types of queries.
|
|
51
|
+
*
|
|
52
|
+
* @see {@link EventStreamQueryClient}
|
|
53
|
+
* @see {@link SnapshotQueryClient}
|
|
54
|
+
*/
|
|
55
|
+
export declare class QueryClient {
|
|
56
|
+
protected readonly options: ClientOptions;
|
|
57
|
+
/**
|
|
58
|
+
* Creates a new QueryClient instance.
|
|
59
|
+
* @param options - The client configuration options including fetcher and base path
|
|
60
|
+
*/
|
|
61
|
+
constructor(options: ClientOptions);
|
|
62
|
+
/**
|
|
63
|
+
* Performs a generic query operation by sending a request to the specified path.
|
|
64
|
+
* @template R The return type of the query
|
|
65
|
+
* @param path - The endpoint path to query
|
|
66
|
+
* @param query - The query parameters to send
|
|
67
|
+
* @param accept - The content type to accept from the server, defaults to application/json
|
|
68
|
+
* @param extractor - Function to extract the result from the response, defaults to JSON extractor
|
|
69
|
+
* @returns A promise that resolves to the query result
|
|
70
|
+
*/
|
|
71
|
+
protected query<R>(path: string, query: Condition | ListQuery | PagedQuery | SingleQuery, accept?: string, extractor?: ResultExtractor): Promise<R>;
|
|
72
|
+
}
|
|
11
73
|
//# sourceMappingURL=queryApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryApi.d.ts","sourceRoot":"","sources":["../../src/query/queryApi.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"queryApi.d.ts","sourceRoot":"","sources":["../../src/query/queryApi.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EACL,eAAe,EAEhB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAEtD;;;;OAIG;IACH,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAElD;;;;OAIG;IACH,UAAU,CACR,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5D;;;;OAIG;IACH,KAAK,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9D;;;;OAIG;IACH,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,qBAAa,WAAW;IAKV,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa;IAJrD;;;OAGG;gBAC4B,OAAO,EAAE,aAAa;IAGrD;;;;;;;;OAQG;cACa,KAAK,CAAC,CAAC,EACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,EACvD,MAAM,GAAE,MAA2C,EACnD,SAAS,GAAE,eAAuC,GACjD,OAAO,CAAC,CAAC,CAAC;CAad"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DeletedCapable, EventIdCapable, EventTimeCapable, FirstEventTimeCapable, FirstOperatorCapable, NamedAggregate, OperatorCapable, OwnerId, SnapshotTimeCapable, StateCapable, TenantId, Version } from '../../types';
|
|
1
|
+
import { AggregateId, DeletedCapable, EventIdCapable, EventTimeCapable, FirstEventTimeCapable, FirstOperatorCapable, NamedAggregate, OperatorCapable, OwnerId, SnapshotTimeCapable, StateCapable, TenantId, Version } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Interface for materialized snapshots with full capabilities.
|
|
4
4
|
*/
|
|
5
|
-
export interface MaterializedSnapshot<S> extends StateCapable<S>,
|
|
5
|
+
export interface MaterializedSnapshot<S> extends StateCapable<S>, AggregateId, TenantId, OwnerId, Version, EventIdCapable, FirstOperatorCapable, OperatorCapable, FirstEventTimeCapable, EventTimeCapable, SnapshotTimeCapable, DeletedCapable {
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* Interface for materialized snapshots with medium capabilities.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/snapshot.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,OAAO,EACR,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,CACrC,SAAQ,YAAY,CAAC,CAAC,CAAC,EACrB,
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/snapshot.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,QAAQ,EACR,OAAO,EACR,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,CACrC,SAAQ,YAAY,CAAC,CAAC,CAAC,EACrB,WAAW,EACX,QAAQ,EACR,OAAO,EACP,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc;CACjB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,CACrC,SAAQ,YAAY,CAAC,CAAC,CAAC,EACrB,cAAc,EACd,QAAQ,EACR,OAAO,EACP,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,qBAAqB,EACrB,gBAAgB;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB,CAAC,CAAC,CAC1C,SAAQ,YAAY,CAAC,CAAC,CAAC,EACrB,cAAc,EACd,OAAO,EACP,qBAAqB;CACxB;AAED;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,SAAS,cAAc;IACvC,MAAM,CAAC,QAAQ,CAAC,QAAQ,aAAa;IACrC,MAAM,CAAC,QAAQ,CAAC,QAAQ,aAAa;IACrC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,oBAAoB;IACpD,MAAM,CAAC,QAAQ,CAAC,UAAU,eAAe;IACzC,MAAM,CAAC,QAAQ,CAAC,cAAc,mBAAmB;IACjD,MAAM,CAAC,QAAQ,CAAC,QAAQ,cAAc;IACtC,MAAM,CAAC,QAAQ,CAAC,aAAa,kBAAkB;IAC/C,MAAM,CAAC,QAAQ,CAAC,OAAO,aAAa;IACpC,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAW;CACjC"}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { QueryApi } from '../queryApi';
|
|
2
2
|
import { MaterializedSnapshot } from './snapshot';
|
|
3
3
|
import { ListQuery, PagedList, PagedQuery, SingleQuery } from '../queryable';
|
|
4
|
+
import { JsonServerSentEvent } from '@ahoo-wang/fetcher-eventstream';
|
|
5
|
+
/**
|
|
6
|
+
* Interface for snapshot query API operations.
|
|
7
|
+
* Extends the base QueryApi interface for MaterializedSnapshot and adds methods
|
|
8
|
+
* for querying snapshot states directly without the full MaterializedSnapshot wrapper.
|
|
9
|
+
* @template S - The type of the snapshot state
|
|
10
|
+
*/
|
|
4
11
|
export interface SnapshotQueryApi<S> extends QueryApi<MaterializedSnapshot<S>> {
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves a single snapshot state based on the provided query parameters.
|
|
14
|
+
* @param singleQuery - The query parameters for retrieving a single snapshot state
|
|
15
|
+
* @returns A promise that resolves to a partial snapshot state
|
|
16
|
+
*/
|
|
5
17
|
singleState(singleQuery: SingleQuery): Promise<Partial<S>>;
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves a list of snapshot states based on the provided query parameters.
|
|
20
|
+
* @param listQuery - The query parameters for listing snapshot states
|
|
21
|
+
* @returns A promise that resolves to an array of partial snapshot states
|
|
22
|
+
*/
|
|
6
23
|
listState(listQuery: ListQuery): Promise<Partial<S>[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Retrieves a stream of snapshot states based on the provided query parameters.
|
|
26
|
+
* @param listQuery - The query parameters for listing snapshot states
|
|
27
|
+
* @returns A promise that resolves to a readable stream of JSON server-sent events containing partial snapshot states
|
|
28
|
+
*/
|
|
29
|
+
listStateStream(listQuery: ListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<S>>>>;
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves a paged list of snapshot states based on the provided query parameters.
|
|
32
|
+
* @param pagedQuery - The query parameters for paging snapshot states
|
|
33
|
+
* @returns A promise that resolves to a paged list of partial snapshot states
|
|
34
|
+
*/
|
|
7
35
|
pagedState(pagedQuery: PagedQuery): Promise<PagedList<Partial<S>>>;
|
|
8
36
|
}
|
|
9
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotQueryApi.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/snapshotQueryApi.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"snapshotQueryApi.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/snapshotQueryApi.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,QAAQ,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAC5E;;;;OAIG;IACH,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3D;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAEvD;;;;OAIG;IACH,eAAe,CACb,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAE5D;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACpE;AAED;;;;;;GAMG;AACH,qBAAa,0BAA0B;IACrC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,cAAc;IACpD,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAgE;IACrF,MAAM,CAAC,QAAQ,CAAC,IAAI,SAA+D;IACnF,MAAM,CAAC,QAAQ,CAAC,UAAU,SAA8C;IACxE,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAgE;IACrF,MAAM,CAAC,QAAQ,CAAC,WAAW,SAA+C;IAC1E,MAAM,CAAC,QAAQ,CAAC,MAAM,SAAiE;IACvF,MAAM,CAAC,QAAQ,CAAC,YAAY,SAAgD;CAC7E"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SnapshotQueryApi } from './snapshotQueryApi';
|
|
2
|
+
import { Condition } from '../condition';
|
|
3
|
+
import { ListQuery, PagedList, PagedQuery, SingleQuery } from '../queryable';
|
|
4
|
+
import { MaterializedSnapshot } from './snapshot';
|
|
5
|
+
import { JsonServerSentEvent } from '@ahoo-wang/fetcher-eventstream';
|
|
6
|
+
import { ClientOptions } from '../../types';
|
|
7
|
+
import { QueryClient } from '../queryApi';
|
|
8
|
+
/**
|
|
9
|
+
* A client for querying snapshot data through HTTP endpoints.
|
|
10
|
+
* Provides methods for various query operations such as counting, listing, paging, and retrieving single snapshots.
|
|
11
|
+
* @template S The type of the snapshot state
|
|
12
|
+
*/
|
|
13
|
+
export declare class SnapshotQueryClient<S> extends QueryClient implements SnapshotQueryApi<S> {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new SnapshotQueryClient instance.
|
|
16
|
+
* @param options - The configuration options for the client
|
|
17
|
+
*/
|
|
18
|
+
constructor(options: ClientOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Counts the number of snapshots that match the given condition.
|
|
21
|
+
* @param condition - The condition to match snapshots against
|
|
22
|
+
* @returns A promise that resolves to the count of matching snapshots
|
|
23
|
+
*/
|
|
24
|
+
count(condition: Condition): Promise<number>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves a list of materialized snapshots based on the provided query parameters.
|
|
27
|
+
* @param listQuery - The query parameters for listing snapshots
|
|
28
|
+
* @returns A promise that resolves to an array of partial materialized snapshots
|
|
29
|
+
*/
|
|
30
|
+
list(listQuery: ListQuery): Promise<Partial<MaterializedSnapshot<S>>[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves a stream of materialized snapshots based on the provided query parameters.
|
|
33
|
+
* @param listQuery - The query parameters for listing snapshots
|
|
34
|
+
* @returns A promise that resolves to a readable stream of JSON server-sent events containing partial materialized snapshots
|
|
35
|
+
*/
|
|
36
|
+
listStream(listQuery: ListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<MaterializedSnapshot<S>>>>>;
|
|
37
|
+
/**
|
|
38
|
+
* Retrieves a list of snapshot states based on the provided query parameters.
|
|
39
|
+
* @param listQuery - The query parameters for listing snapshot states
|
|
40
|
+
* @returns A promise that resolves to an array of partial snapshot states
|
|
41
|
+
*/
|
|
42
|
+
listState(listQuery: ListQuery): Promise<Partial<S>[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Retrieves a stream of snapshot states based on the provided query parameters.
|
|
45
|
+
* @param listQuery - The query parameters for listing snapshot states
|
|
46
|
+
* @returns A promise that resolves to a readable stream of JSON server-sent events containing partial snapshot states
|
|
47
|
+
*/
|
|
48
|
+
listStateStream(listQuery: ListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<S>>>>;
|
|
49
|
+
/**
|
|
50
|
+
* Retrieves a paged list of materialized snapshots based on the provided query parameters.
|
|
51
|
+
* @param pagedQuery - The query parameters for paging snapshots
|
|
52
|
+
* @returns A promise that resolves to a paged list of partial materialized snapshots
|
|
53
|
+
*/
|
|
54
|
+
paged(pagedQuery: PagedQuery): Promise<PagedList<Partial<MaterializedSnapshot<S>>>>;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves a paged list of snapshot states based on the provided query parameters.
|
|
57
|
+
* @param pagedQuery - The query parameters for paging snapshot states
|
|
58
|
+
* @returns A promise that resolves to a paged list of partial snapshot states
|
|
59
|
+
*/
|
|
60
|
+
pagedState(pagedQuery: PagedQuery): Promise<PagedList<Partial<S>>>;
|
|
61
|
+
/**
|
|
62
|
+
* Retrieves a single materialized snapshot based on the provided query parameters.
|
|
63
|
+
* @param singleQuery - The query parameters for retrieving a single snapshot
|
|
64
|
+
* @returns A promise that resolves to a partial materialized snapshot
|
|
65
|
+
*/
|
|
66
|
+
single(singleQuery: SingleQuery): Promise<Partial<MaterializedSnapshot<S>>>;
|
|
67
|
+
/**
|
|
68
|
+
* Retrieves a single snapshot state based on the provided query parameters.
|
|
69
|
+
* @param singleQuery - The query parameters for retrieving a single snapshot state
|
|
70
|
+
* @returns A promise that resolves to a partial snapshot state
|
|
71
|
+
*/
|
|
72
|
+
singleState(singleQuery: SingleQuery): Promise<Partial<S>>;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=snapshotQueryClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotQueryClient.d.ts","sourceRoot":"","sources":["../../../src/query/snapshot/snapshotQueryClient.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGrE,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;GAIG;AACH,qBAAa,mBAAmB,CAAC,CAAC,CAChC,SAAQ,WACR,YAAW,gBAAgB,CAAC,CAAC,CAAC;IAC9B;;;OAGG;gBACS,OAAO,EAAE,aAAa;IAIlC;;;;OAIG;IACG,KAAK,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC;IAIlD;;;;OAIG;IACH,IAAI,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAIvE;;;;OAIG;IACH,UAAU,CACR,SAAS,EAAE,SAAS,GACnB,OAAO,CACR,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACtE;IASD;;;;OAIG;IACH,SAAS,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAItD;;;;OAIG;IACH,eAAe,CACb,SAAS,EAAE,SAAS,GACnB,OAAO,CAAC,cAAc,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAS3D;;;;OAIG;IACH,KAAK,CACH,UAAU,EAAE,UAAU,GACrB,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAIvD;;;;OAIG;IACH,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAIlE;;;;OAIG;IACH,MAAM,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC;IAI3E;;;;OAIG;IACH,WAAW,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAG3D"}
|
package/dist/query/sort.d.ts
CHANGED
package/dist/query/sort.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/query/sort.ts"],"names":[],"mappings":"AAaA,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKvC;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKxC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;CACf"}
|
|
1
|
+
{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/query/sort.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,IAAI,SAAS;CACd;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,aAAa,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKvC;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKxC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;CACf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Fetcher } from '@ahoo-wang/fetcher';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for the Client.
|
|
4
|
+
*/
|
|
5
|
+
export interface ClientOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The fetcher instance used to make HTTP requests.
|
|
8
|
+
*/
|
|
9
|
+
fetcher: Fetcher;
|
|
10
|
+
/**
|
|
11
|
+
* The base URL path for all endpoints.
|
|
12
|
+
*/
|
|
13
|
+
basePath: string;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface for path parameters used in URL construction.
|
|
3
|
+
* Defines common path parameters and allows for additional custom parameters.
|
|
4
|
+
* This interface is used to provide path variables for URL templating.
|
|
5
|
+
*/
|
|
6
|
+
export interface PathParams {
|
|
7
|
+
/**
|
|
8
|
+
* Tenant identifier parameter.
|
|
9
|
+
* Used in multi-tenant applications to identify the tenant context.
|
|
10
|
+
*/
|
|
11
|
+
tenantId?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Owner identifier parameter.
|
|
14
|
+
* Used to identify the owner or user context for the resource.
|
|
15
|
+
*/
|
|
16
|
+
ownerId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Generic identifier parameter.
|
|
19
|
+
* Used as a general purpose ID for resources when tenantId or ownerId are not appropriate.
|
|
20
|
+
*/
|
|
21
|
+
id?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Index signature for additional custom path parameters.
|
|
24
|
+
* Allows for any additional string key-value pairs to be included as path parameters.
|
|
25
|
+
*/
|
|
26
|
+
[key: string]: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../src/types/endpoints.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ahoo-wang/fetcher-wow",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Support for Wow(https://github.com/Ahoo-Wang/Wow) in Fetcher",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fetch",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@ahoo-wang/fetcher": "1.1
|
|
42
|
-
"@ahoo-wang/fetcher-
|
|
43
|
-
"@ahoo-wang/fetcher
|
|
41
|
+
"@ahoo-wang/fetcher-eventstream": "1.2.1",
|
|
42
|
+
"@ahoo-wang/fetcher-decorator": "1.2.1",
|
|
43
|
+
"@ahoo-wang/fetcher": "1.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@vitest/coverage-v8": "^3.2.4",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandHeaders.d.ts","sourceRoot":"","sources":["../../src/command/commandHeaders.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,sBAAsB,cAAc;IAEpD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,SAAS,SAAuD;IAEhF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,SAAsD;IAE9E;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,SAA0D;IAEtF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAA+D;IAEhG;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAmD;IAE9E;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,SAA0C;IAGvE;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,SAAwC;IAElE;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,SAA0C;IAEtE;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,SAA4C;IAE1E;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,aAAa,SAA2C;IAIxE;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,gBAAgB,SAAwC;IAExE;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,eAAe,SAA6C;IAE5E;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,iBAAiB,SAA+C;IAEhF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,mBAAmB,SAAiD;IAEpF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,kBAAkB,SAAgD;IAGlF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,UAAU,SAAwD;IAElF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAyD;IAEpF;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,yBAAyB,SAA+D;IAExG;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,sBAAsB,SAA4D;IAElG;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,YAAY,SAAkD;IAE9E;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,uBAAuB,SAAqD;CAC7F"}
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { Fetcher } from '@ahoo-wang/fetcher';
|
|
2
|
-
import { CommandResult, CommandResultEventStream } from './commandResult';
|
|
3
|
-
import { CommandHttpRequest } from './commandHttpRequest';
|
|
4
|
-
/**
|
|
5
|
-
* HTTP client for sending commands to the Wow framework.
|
|
6
|
-
*
|
|
7
|
-
* This client provides methods to send commands and receive results either
|
|
8
|
-
* synchronously or as a stream of events. It uses the fetcher-decorator
|
|
9
|
-
* library to handle HTTP communication with appropriate headers and
|
|
10
|
-
* result extraction.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* // Create a fetcher instance with base configuration
|
|
15
|
-
* const wowFetcher = new Fetcher({
|
|
16
|
-
* baseURL: 'http://localhost:8080/',
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* // Add EventStreamInterceptor to handle Server-Sent Events
|
|
20
|
-
* wowFetcher.interceptors.response.use(new EventStreamInterceptor());
|
|
21
|
-
*
|
|
22
|
-
* // Create CommandHttpClient instance
|
|
23
|
-
* const commandHttpClient = new CommandHttpClient(wowFetcher);
|
|
24
|
-
*
|
|
25
|
-
* // Define a command
|
|
26
|
-
* const command: CommandHttpRequest = {
|
|
27
|
-
* path: 'owner/{ownerId}/cart/add_cart_item',
|
|
28
|
-
* method: HttpMethod.POST,
|
|
29
|
-
* headers: {
|
|
30
|
-
* [CommandHeaders.WAIT_STAGE]: CommandStage.SNAPSHOT,
|
|
31
|
-
* },
|
|
32
|
-
* urlParams: {
|
|
33
|
-
* path: {
|
|
34
|
-
* ownerId: 'ownerId',
|
|
35
|
-
* },
|
|
36
|
-
* },
|
|
37
|
-
* body: {
|
|
38
|
-
* productId: 'productId',
|
|
39
|
-
* quantity: 1,
|
|
40
|
-
* },
|
|
41
|
-
* };
|
|
42
|
-
*
|
|
43
|
-
* // Send command and wait for result
|
|
44
|
-
* const commandResult = await commandHttpClient.send(command);
|
|
45
|
-
*
|
|
46
|
-
* // Send command and receive result as stream
|
|
47
|
-
* const commandResultStream = await commandHttpClient.sendAndWaitStream(command);
|
|
48
|
-
* for await (const commandResultEvent of commandResultStream) {
|
|
49
|
-
* console.log('Received:', commandResultEvent.data);
|
|
50
|
-
* }
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
export declare class CommandHttpClient {
|
|
54
|
-
readonly fetcher: Fetcher;
|
|
55
|
-
/**
|
|
56
|
-
* Creates a new CommandHttpClient instance.
|
|
57
|
-
*
|
|
58
|
-
* @param fetcher - The Fetcher instance to use for HTTP requests
|
|
59
|
-
*/
|
|
60
|
-
constructor(fetcher: Fetcher);
|
|
61
|
-
/**
|
|
62
|
-
* Sends a command and waits for the result.
|
|
63
|
-
*
|
|
64
|
-
* This method sends a command to the Wow framework and waits for the processing
|
|
65
|
-
* to complete before returning the result. The command is sent as an HTTP request
|
|
66
|
-
* with the specified path, method, headers, and body.
|
|
67
|
-
*
|
|
68
|
-
* @param commandHttpRequest - The command HTTP request to send
|
|
69
|
-
* @returns A promise that resolves to the command result
|
|
70
|
-
*
|
|
71
|
-
* @example
|
|
72
|
-
* ```typescript
|
|
73
|
-
* const command: CommandHttpRequest = {
|
|
74
|
-
* path: 'owner/{ownerId}/cart/add_cart_item',
|
|
75
|
-
* method: HttpMethod.POST,
|
|
76
|
-
* headers: {
|
|
77
|
-
* [CommandHeaders.WAIT_STAGE]: CommandStage.SNAPSHOT,
|
|
78
|
-
* },
|
|
79
|
-
* urlParams: {
|
|
80
|
-
* path: {
|
|
81
|
-
* ownerId: 'ownerId',
|
|
82
|
-
* },
|
|
83
|
-
* },
|
|
84
|
-
* body: {
|
|
85
|
-
* productId: 'productId',
|
|
86
|
-
* quantity: 1,
|
|
87
|
-
* },
|
|
88
|
-
* };
|
|
89
|
-
*
|
|
90
|
-
* const result = await commandHttpClient.send(command);
|
|
91
|
-
* console.log('Command result:', result);
|
|
92
|
-
* ```
|
|
93
|
-
*/
|
|
94
|
-
send(commandHttpRequest: CommandHttpRequest): Promise<CommandResult>;
|
|
95
|
-
/**
|
|
96
|
-
* Sends a command and returns a stream of results as events.
|
|
97
|
-
*
|
|
98
|
-
* This method sets the Accept header to text/event-stream to receive
|
|
99
|
-
* Server-Sent Events, and uses a JSON event stream result extractor
|
|
100
|
-
* to parse the response. It's useful for long-running commands where
|
|
101
|
-
* you want to receive progress updates or multiple results.
|
|
102
|
-
*
|
|
103
|
-
* @param commandHttpRequest - The command HTTP request to send
|
|
104
|
-
* @returns A promise that resolves to a stream of command results
|
|
105
|
-
*
|
|
106
|
-
* @example
|
|
107
|
-
* ```typescript
|
|
108
|
-
* const command: CommandHttpRequest = {
|
|
109
|
-
* path: 'owner/{ownerId}/cart/add_cart_item',
|
|
110
|
-
* method: HttpMethod.POST,
|
|
111
|
-
* headers: {
|
|
112
|
-
* [CommandHeaders.WAIT_STAGE]: CommandStage.SNAPSHOT,
|
|
113
|
-
* },
|
|
114
|
-
* urlParams: {
|
|
115
|
-
* path: {
|
|
116
|
-
* ownerId: 'ownerId',
|
|
117
|
-
* },
|
|
118
|
-
* },
|
|
119
|
-
* body: {
|
|
120
|
-
* productId: 'productId',
|
|
121
|
-
* quantity: 1,
|
|
122
|
-
* },
|
|
123
|
-
* };
|
|
124
|
-
*
|
|
125
|
-
* const stream = await commandHttpClient.sendAndWaitStream(command);
|
|
126
|
-
* for await (const event of stream) {
|
|
127
|
-
* console.log('Command result event:', event.data);
|
|
128
|
-
* }
|
|
129
|
-
* ```
|
|
130
|
-
*/
|
|
131
|
-
sendAndWaitStream(commandHttpRequest: CommandHttpRequest): Promise<CommandResultEventStream>;
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=commandHttpClient.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandHttpClient.d.ts","sourceRoot":"","sources":["../../src/command/commandHttpClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAqB,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAQ1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,qBACa,iBAAiB;aAMA,OAAO,EAAE,OAAO;IAL5C;;;;OAIG;gBACyB,OAAO,EAAE,OAAO;IAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IAEH,IAAI,CACS,kBAAkB,EAAE,kBAAkB,GAChD,OAAO,CAAC,aAAa,CAAC;IAIzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IAOG,iBAAiB,CACV,kBAAkB,EAAE,kBAAkB,GAChD,OAAO,CAAC,wBAAwB,CAAC;CAGrC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { RequestHeaders, UrlParams } from '@ahoo-wang/fetcher';
|
|
2
|
-
import { ParameterRequest } from '@ahoo-wang/fetcher-decorator';
|
|
3
|
-
/**
|
|
4
|
-
* Command HTTP Headers Interface
|
|
5
|
-
*
|
|
6
|
-
* Defines the HTTP header fields used in command processing within the Wow framework.
|
|
7
|
-
* This interface extends RequestHeaders to provide type-safe access to all command-related headers.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```typescript
|
|
11
|
-
* // Using CommandHttpHeaders in a request
|
|
12
|
-
* const headers: CommandHttpHeaders = {
|
|
13
|
-
* [CommandHeaders.TENANT_ID]: 'tenant-123',
|
|
14
|
-
* [CommandHeaders.AGGREGATE_ID]: 'aggregate-456',
|
|
15
|
-
* [CommandHeaders.REQUEST_ID]: 'request-789'
|
|
16
|
-
* };
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export interface CommandHttpHeaders extends RequestHeaders {
|
|
20
|
-
}
|
|
21
|
-
export interface CommandPathParams {
|
|
22
|
-
tenantId?: string;
|
|
23
|
-
ownerId?: string;
|
|
24
|
-
id?: string;
|
|
25
|
-
[key: string]: string | undefined;
|
|
26
|
-
}
|
|
27
|
-
export interface CommandUrlParams extends Omit<UrlParams, 'path' | 'query'> {
|
|
28
|
-
path?: CommandPathParams;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Command HTTP Request Interface
|
|
32
|
-
*
|
|
33
|
-
* Extends RequestHeaders to provide type-safe access to command-related HTTP headers.
|
|
34
|
-
* This interface includes only the essential command headers commonly used in HTTP requests.
|
|
35
|
-
*/
|
|
36
|
-
export interface CommandHttpRequest extends ParameterRequest {
|
|
37
|
-
/**
|
|
38
|
-
* Path for the command endpoint (relative to class base path).
|
|
39
|
-
*/
|
|
40
|
-
path: string;
|
|
41
|
-
urlParams?: CommandUrlParams;
|
|
42
|
-
headers?: CommandHttpHeaders;
|
|
43
|
-
/**
|
|
44
|
-
* The body of the command request.
|
|
45
|
-
*/
|
|
46
|
-
body: any;
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=commandHttpRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandHttpRequest.d.ts","sourceRoot":"","sources":["../../src/command/commandHttpRequest.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;CA4GzD;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACzE,IAAI,CAAC,EAAE,iBAAiB,CAAC;CAC1B;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAmB,SAAQ,gBAAgB;IAC1D;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B;;OAEG;IACH,IAAI,EAAE,GAAG,CAAC;CACX"}
|