@ahoo-wang/fetcher-wow 1.2.8 → 1.2.9
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 +29 -9
- package/README.zh-CN.md +29 -9
- package/dist/command/commandClient.d.ts.map +1 -1
- package/dist/command/commandRequest.d.ts.map +1 -1
- package/dist/index.es.js +13 -3
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/query/condition.d.ts.map +1 -1
- package/dist/query/event/domainEventStream.d.ts.map +1 -1
- package/dist/query/event/eventStreamQueryApi.d.ts.map +1 -1
- package/dist/query/event/eventStreamQueryClient.d.ts.map +1 -1
- package/dist/query/pagination.d.ts +1 -1
- package/dist/query/pagination.d.ts.map +1 -1
- package/dist/query/projection.d.ts +1 -1
- package/dist/query/projection.d.ts.map +1 -1
- package/dist/query/queryApi.d.ts.map +1 -1
- package/dist/query/queryable.d.ts +1 -1
- package/dist/query/queryable.d.ts.map +1 -1
- package/dist/query/snapshot/snapshot.d.ts.map +1 -1
- package/dist/query/snapshot/snapshotQueryApi.d.ts.map +1 -1
- package/dist/query/snapshot/snapshotQueryClient.d.ts.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -64,14 +64,19 @@ HTTP client for sending commands to the Wow framework. The client provides metho
|
|
|
64
64
|
either synchronously or as a stream of events.
|
|
65
65
|
|
|
66
66
|
```typescript
|
|
67
|
-
import {
|
|
67
|
+
import {
|
|
68
|
+
Fetcher,
|
|
69
|
+
FetchExchange,
|
|
70
|
+
RequestInterceptor,
|
|
71
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
72
|
+
} from '@ahoo-wang/fetcher';
|
|
68
73
|
import '@ahoo-wang/fetcher-eventstream';
|
|
69
74
|
import {
|
|
70
75
|
CommandClient,
|
|
71
76
|
CommandRequest,
|
|
72
77
|
HttpMethod,
|
|
73
78
|
CommandHttpHeaders,
|
|
74
|
-
CommandStage
|
|
79
|
+
CommandStage,
|
|
75
80
|
} from '@ahoo-wang/fetcher-wow';
|
|
76
81
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
77
82
|
|
|
@@ -114,7 +119,7 @@ interface AddCartItem {
|
|
|
114
119
|
quantity: number;
|
|
115
120
|
}
|
|
116
121
|
|
|
117
|
-
type AddCartItemCommand = CommandRequest<AddCartItem
|
|
122
|
+
type AddCartItemCommand = CommandRequest<AddCartItem>;
|
|
118
123
|
|
|
119
124
|
// Create a command request
|
|
120
125
|
const addCartItemCommand: AddCartItemCommand = {
|
|
@@ -206,7 +211,12 @@ const dateConditions = [
|
|
|
206
211
|
Client for querying materialized snapshots with comprehensive query operations:
|
|
207
212
|
|
|
208
213
|
```typescript
|
|
209
|
-
import {
|
|
214
|
+
import {
|
|
215
|
+
Fetcher,
|
|
216
|
+
FetchExchange,
|
|
217
|
+
RequestInterceptor,
|
|
218
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
219
|
+
} from '@ahoo-wang/fetcher';
|
|
210
220
|
import '@ahoo-wang/fetcher-eventstream';
|
|
211
221
|
import {
|
|
212
222
|
SnapshotQueryClient,
|
|
@@ -321,7 +331,12 @@ const singleState = await cartSnapshotQueryClient.singleState(singleQuery);
|
|
|
321
331
|
Client for querying domain event streams with comprehensive query operations:
|
|
322
332
|
|
|
323
333
|
```typescript
|
|
324
|
-
import {
|
|
334
|
+
import {
|
|
335
|
+
Fetcher,
|
|
336
|
+
FetchExchange,
|
|
337
|
+
RequestInterceptor,
|
|
338
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
339
|
+
} from '@ahoo-wang/fetcher';
|
|
325
340
|
import '@ahoo-wang/fetcher-eventstream';
|
|
326
341
|
import {
|
|
327
342
|
EventStreamQueryClient,
|
|
@@ -397,7 +412,12 @@ const paged = await cartEventStreamQueryClient.paged(pagedQuery);
|
|
|
397
412
|
### Complete Example with Command and Query Flow
|
|
398
413
|
|
|
399
414
|
```typescript
|
|
400
|
-
import {
|
|
415
|
+
import {
|
|
416
|
+
Fetcher,
|
|
417
|
+
FetchExchange,
|
|
418
|
+
RequestInterceptor,
|
|
419
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
420
|
+
} from '@ahoo-wang/fetcher';
|
|
401
421
|
import '@ahoo-wang/fetcher-eventstream';
|
|
402
422
|
import {
|
|
403
423
|
CommandClient,
|
|
@@ -465,7 +485,7 @@ interface AddCartItem {
|
|
|
465
485
|
quantity: number;
|
|
466
486
|
}
|
|
467
487
|
|
|
468
|
-
type AddCartItemCommand = CommandRequest<AddCartItem
|
|
488
|
+
type AddCartItemCommand = CommandRequest<AddCartItem>;
|
|
469
489
|
|
|
470
490
|
// 1. Send command to add item to cart
|
|
471
491
|
const addItemCommand: AddCartItemCommand = {
|
|
@@ -481,7 +501,7 @@ const addItemCommand: AddCartItemCommand = {
|
|
|
481
501
|
|
|
482
502
|
const commandResult = await cartCommandClient.send(
|
|
483
503
|
CartCommandEndpoints.addCartItem,
|
|
484
|
-
addItemCommand
|
|
504
|
+
addItemCommand,
|
|
485
505
|
);
|
|
486
506
|
console.log('Command executed:', commandResult);
|
|
487
507
|
|
|
@@ -526,4 +546,4 @@ Apache-2.0
|
|
|
526
546
|
|
|
527
547
|
<p align="center">
|
|
528
548
|
Part of the <a href="https://github.com/Ahoo-Wang/fetcher">Fetcher</a> ecosystem
|
|
529
|
-
</p>
|
|
549
|
+
</p>
|
package/README.zh-CN.md
CHANGED
|
@@ -57,14 +57,19 @@ import { CommandResult, CommandStage } from '@ahoo-wang/fetcher-wow';
|
|
|
57
57
|
用于向 Wow 框架发送命令的 HTTP 客户端。该客户端提供了同步或流式接收命令结果的方法。
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
|
-
import {
|
|
60
|
+
import {
|
|
61
|
+
Fetcher,
|
|
62
|
+
FetchExchange,
|
|
63
|
+
RequestInterceptor,
|
|
64
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
65
|
+
} from '@ahoo-wang/fetcher';
|
|
61
66
|
import '@ahoo-wang/fetcher-eventstream';
|
|
62
67
|
import {
|
|
63
68
|
CommandClient,
|
|
64
69
|
CommandRequest,
|
|
65
70
|
HttpMethod,
|
|
66
71
|
CommandHttpHeaders,
|
|
67
|
-
CommandStage
|
|
72
|
+
CommandStage,
|
|
68
73
|
} from '@ahoo-wang/fetcher-wow';
|
|
69
74
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
70
75
|
|
|
@@ -107,7 +112,7 @@ interface AddCartItem {
|
|
|
107
112
|
quantity: number;
|
|
108
113
|
}
|
|
109
114
|
|
|
110
|
-
type AddCartItemCommand = CommandRequest<AddCartItem
|
|
115
|
+
type AddCartItemCommand = CommandRequest<AddCartItem>;
|
|
111
116
|
|
|
112
117
|
// 创建命令请求
|
|
113
118
|
const addCartItemCommand: AddCartItemCommand = {
|
|
@@ -198,7 +203,12 @@ const dateConditions = [
|
|
|
198
203
|
用于查询物化快照的客户端,支持全面的查询操作:
|
|
199
204
|
|
|
200
205
|
```typescript
|
|
201
|
-
import {
|
|
206
|
+
import {
|
|
207
|
+
Fetcher,
|
|
208
|
+
FetchExchange,
|
|
209
|
+
RequestInterceptor,
|
|
210
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
211
|
+
} from '@ahoo-wang/fetcher';
|
|
202
212
|
import '@ahoo-wang/fetcher-eventstream';
|
|
203
213
|
import {
|
|
204
214
|
SnapshotQueryClient,
|
|
@@ -310,7 +320,12 @@ const singleState = await cartSnapshotQueryClient.singleState(singleQuery);
|
|
|
310
320
|
用于查询领域事件流的客户端,支持全面的查询操作:
|
|
311
321
|
|
|
312
322
|
```typescript
|
|
313
|
-
import {
|
|
323
|
+
import {
|
|
324
|
+
Fetcher,
|
|
325
|
+
FetchExchange,
|
|
326
|
+
RequestInterceptor,
|
|
327
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
328
|
+
} from '@ahoo-wang/fetcher';
|
|
314
329
|
import '@ahoo-wang/fetcher-eventstream';
|
|
315
330
|
import {
|
|
316
331
|
EventStreamQueryClient,
|
|
@@ -384,7 +399,12 @@ const paged = await cartEventStreamQueryClient.paged(pagedQuery);
|
|
|
384
399
|
### 完整的命令和查询流程示例
|
|
385
400
|
|
|
386
401
|
```typescript
|
|
387
|
-
import {
|
|
402
|
+
import {
|
|
403
|
+
Fetcher,
|
|
404
|
+
FetchExchange,
|
|
405
|
+
RequestInterceptor,
|
|
406
|
+
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
407
|
+
} from '@ahoo-wang/fetcher';
|
|
388
408
|
import '@ahoo-wang/fetcher-eventstream';
|
|
389
409
|
import {
|
|
390
410
|
CommandClient,
|
|
@@ -452,7 +472,7 @@ interface AddCartItem {
|
|
|
452
472
|
quantity: number;
|
|
453
473
|
}
|
|
454
474
|
|
|
455
|
-
type AddCartItemCommand = CommandRequest<AddCartItem
|
|
475
|
+
type AddCartItemCommand = CommandRequest<AddCartItem>;
|
|
456
476
|
|
|
457
477
|
// 1. 发送命令添加商品到购物车
|
|
458
478
|
const addItemCommand: AddCartItemCommand = {
|
|
@@ -468,7 +488,7 @@ const addItemCommand: AddCartItemCommand = {
|
|
|
468
488
|
|
|
469
489
|
const commandResult = await cartCommandClient.send(
|
|
470
490
|
CartCommandEndpoints.addCartItem,
|
|
471
|
-
addItemCommand
|
|
491
|
+
addItemCommand,
|
|
472
492
|
);
|
|
473
493
|
console.log('命令执行完成:', commandResult);
|
|
474
494
|
|
|
@@ -513,4 +533,4 @@ Apache-2.0
|
|
|
513
533
|
|
|
514
534
|
<p align="center">
|
|
515
535
|
<a href="https://github.com/Ahoo-Wang/fetcher">Fetcher</a> 生态系统的一部分
|
|
516
|
-
</p>
|
|
536
|
+
</p>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandClient.d.ts","sourceRoot":"","sources":["../../src/command/commandClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"commandClient.d.ts","sourceRoot":"","sources":["../../src/command/commandClient.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC9B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,eAAe,EAErB,MAAM,8BAA8B,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,qBAAa,aAAa;IACZ,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa;gBAAtB,OAAO,EAAE,aAAa;IAGrD;;;;;;;;OAQG;cACa,WAAW,CAAC,CAAC,EAC3B,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,cAAc,EAClC,SAAS,GAAE,eAAuC,GACjD,OAAO,CAAC,CAAC,CAAC;IAUb;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CACF,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,cAAc,GACjC,OAAO,CAAC,aAAa,CAAC;IAIzB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,iBAAiB,CACrB,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,cAAc,GACjC,OAAO,CAAC,wBAAwB,CAAC;CAWrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandRequest.d.ts","sourceRoot":"","sources":["../../src/command/commandRequest.ts"],"names":[],"mappings":"AAaA,OAAO,
|
|
1
|
+
{"version":3,"file":"commandRequest.d.ts","sourceRoot":"","sources":["../../src/command/commandRequest.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,SAAS,EACV,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;CA4G5D;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IACzE,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CACvD,SAAQ,gBAAgB;IACxB,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,OAAO,CAAC,EAAE,qBAAqB,CAAC;IAChC;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;CACT"}
|
package/dist/index.es.js
CHANGED
|
@@ -254,20 +254,30 @@ const o = {
|
|
|
254
254
|
index: 1,
|
|
255
255
|
size: 10
|
|
256
256
|
};
|
|
257
|
-
function Ut({
|
|
257
|
+
function Ut({
|
|
258
|
+
index: t = o.index,
|
|
259
|
+
size: E = o.size
|
|
260
|
+
} = o) {
|
|
258
261
|
return {
|
|
259
262
|
index: t,
|
|
260
263
|
size: E
|
|
261
264
|
};
|
|
262
265
|
}
|
|
263
266
|
const q = {};
|
|
264
|
-
function Vt({
|
|
267
|
+
function Vt({
|
|
268
|
+
include: t,
|
|
269
|
+
exclude: E
|
|
270
|
+
} = q) {
|
|
265
271
|
return {
|
|
266
272
|
include: t,
|
|
267
273
|
exclude: E
|
|
268
274
|
};
|
|
269
275
|
}
|
|
270
|
-
function Xt({
|
|
276
|
+
function Xt({
|
|
277
|
+
condition: t = O(),
|
|
278
|
+
projection: E,
|
|
279
|
+
sort: T
|
|
280
|
+
} = {}) {
|
|
271
281
|
return {
|
|
272
282
|
condition: t,
|
|
273
283
|
projection: E,
|