@ahoo-wang/fetcher-wow 3.17.0 → 3.18.0
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 +150 -62
- package/README.zh-CN.md +133 -51
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1014 -355
- package/dist/index.es.js.map +1 -1
- package/dist/query/aggregation.d.ts +131 -0
- package/dist/query/aggregation.d.ts.map +1 -0
- package/dist/query/condition.d.ts +52 -0
- package/dist/query/condition.d.ts.map +1 -1
- package/dist/query/cursorQuery.d.ts +10 -1
- package/dist/query/cursorQuery.d.ts.map +1 -1
- package/dist/query/event/eventStreamQueryClient.d.ts +21 -21
- package/dist/query/event/eventStreamQueryClient.d.ts.map +1 -1
- package/dist/query/filter.d.ts +224 -0
- package/dist/query/filter.d.ts.map +1 -0
- package/dist/query/index.d.ts +2 -0
- package/dist/query/index.d.ts.map +1 -1
- package/dist/query/locale/en_US.cjs.js.map +1 -1
- package/dist/query/locale/en_US.d.ts +1 -0
- package/dist/query/locale/en_US.d.ts.map +1 -1
- package/dist/query/locale/en_US.es.js.map +1 -1
- package/dist/query/locale/operatorLocale.d.ts +1 -0
- package/dist/query/locale/operatorLocale.d.ts.map +1 -1
- package/dist/query/locale/zh_CN.cjs.js.map +1 -1
- package/dist/query/locale/zh_CN.d.ts +1 -0
- package/dist/query/locale/zh_CN.d.ts.map +1 -1
- package/dist/query/locale/zh_CN.es.js.map +1 -1
- package/dist/query/operator.d.ts +3 -0
- package/dist/query/operator.d.ts.map +1 -1
- package/dist/query/queryApi.d.ts +9 -8
- package/dist/query/queryApi.d.ts.map +1 -1
- package/dist/query/queryable.d.ts +34 -4
- package/dist/query/queryable.d.ts.map +1 -1
- package/dist/query/snapshot/snapshotQueryApi.d.ts +12 -5
- package/dist/query/snapshot/snapshotQueryApi.d.ts.map +1 -1
- package/dist/query/snapshot/snapshotQueryClient.d.ts +46 -42
- package/dist/query/snapshot/snapshotQueryClient.d.ts.map +1 -1
- package/package.json +9 -8
package/README.zh-CN.md
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
- **📦 完整的 TypeScript 支持**:为所有 Wow 框架实体提供完整的类型定义,包括命令、事件和查询
|
|
17
17
|
- **🚀 命令客户端**:用于向 Wow 服务发送命令的高级客户端,支持同步和流式响应
|
|
18
|
-
- **🔍 强大的查询 DSL
|
|
18
|
+
- **🔍 强大的查询 DSL**:类型安全的 `FilterExpression` 构建器,支持完整的查询操作符
|
|
19
|
+
- **📊 快照聚合**:使用类型安全的查询对快照数据进行分组和聚合
|
|
19
20
|
- **📡 实时事件流**:内置对服务器发送事件的支持,用于接收实时命令结果和数据更新
|
|
20
21
|
- **🔄 CQRS 模式实现**:对命令查询责任分离架构模式的一流支持
|
|
21
22
|
- **🧱 DDD 基础构件**:基本的领域驱动设计构建块,包括聚合、事件和值对象
|
|
@@ -61,6 +62,7 @@ import { CommandResult, CommandStage } from '@ahoo-wang/fetcher-wow';
|
|
|
61
62
|
import {
|
|
62
63
|
Fetcher,
|
|
63
64
|
FetchExchange,
|
|
65
|
+
HttpMethod,
|
|
64
66
|
RequestInterceptor,
|
|
65
67
|
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
66
68
|
} from '@ahoo-wang/fetcher';
|
|
@@ -68,8 +70,7 @@ import '@ahoo-wang/fetcher-eventstream';
|
|
|
68
70
|
import {
|
|
69
71
|
CommandClient,
|
|
70
72
|
CommandRequest,
|
|
71
|
-
|
|
72
|
-
CommandHttpHeaders,
|
|
73
|
+
CommandHeaders,
|
|
73
74
|
CommandStage,
|
|
74
75
|
} from '@ahoo-wang/fetcher-wow';
|
|
75
76
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
@@ -119,7 +120,7 @@ type AddCartItemCommand = CommandRequest<AddCartItem>;
|
|
|
119
120
|
const addCartItemCommand: AddCartItemCommand = {
|
|
120
121
|
method: HttpMethod.POST,
|
|
121
122
|
headers: {
|
|
122
|
-
[
|
|
123
|
+
[CommandHeaders.WAIT_STAGE]: CommandStage.SNAPSHOT,
|
|
123
124
|
},
|
|
124
125
|
body: {
|
|
125
126
|
productId: 'productId',
|
|
@@ -151,9 +152,42 @@ for await (const commandResultEvent of commandResultStream) {
|
|
|
151
152
|
|
|
152
153
|
### 查询模块
|
|
153
154
|
|
|
154
|
-
####
|
|
155
|
+
#### FilterExpression 构建器
|
|
156
|
+
|
|
157
|
+
Wow 8.11+ 查询使用 `FilterExpression`:
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import {
|
|
161
|
+
DeletionState,
|
|
162
|
+
filter,
|
|
163
|
+
SearchMode,
|
|
164
|
+
TimeUnit,
|
|
165
|
+
} from '@ahoo-wang/fetcher-wow';
|
|
166
|
+
|
|
167
|
+
const expression = filter.and([
|
|
168
|
+
filter.deletion(DeletionState.ACTIVE),
|
|
169
|
+
filter.eq('state.status', 'PAID'),
|
|
170
|
+
filter.elementMatch('state.items', filter.gt('quantity', 0)),
|
|
171
|
+
filter.search('event sourcing', {
|
|
172
|
+
mode: SearchMode.PHRASE,
|
|
173
|
+
fields: ['state.title', 'state.description'],
|
|
174
|
+
}),
|
|
175
|
+
filter.yesterday('state.createdAt', {
|
|
176
|
+
zoneId: 'Asia/Shanghai',
|
|
177
|
+
timeUnit: TimeUnit.MILLISECONDS,
|
|
178
|
+
}),
|
|
179
|
+
]);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
所有构建器集中在 `filter`:`matchAll`、`matchNone`、`and`、`or`、`nor`、
|
|
183
|
+
比较、字符串/集合谓词、存在性检查、`elementMatch`、`search`、删除范围和相对时间过滤器。
|
|
184
|
+
`and`、`or`、`nor`、`ids`、`aggregateIds`、`isIn`、`notIn` 和
|
|
185
|
+
`containsAll` 接收一个非空 `readonly` 数组;传入空数组时抛出 `TypeError`。
|
|
186
|
+
|
|
187
|
+
#### 条件构建器(已弃用)
|
|
155
188
|
|
|
156
|
-
|
|
189
|
+
旧 Condition API 仅为兼容旧版 Wow 服务保留。新代码应使用
|
|
190
|
+
`FilterExpression` 和 `filter.*`。
|
|
157
191
|
|
|
158
192
|
```typescript
|
|
159
193
|
import {
|
|
@@ -238,7 +272,7 @@ const arrayConditions = [
|
|
|
238
272
|
// 日期条件
|
|
239
273
|
const dateConditions = [
|
|
240
274
|
today('createdAt'),
|
|
241
|
-
beforeToday('lastLogin',
|
|
275
|
+
beforeToday('lastLogin', '09:30'),
|
|
242
276
|
tomorrow('scheduledDate'),
|
|
243
277
|
thisWeek('updatedAt'),
|
|
244
278
|
nextWeek('startDate'),
|
|
@@ -274,7 +308,7 @@ const rawCondition = raw({ $text: { $search: 'keywords' } });
|
|
|
274
308
|
| 字符串 | `contains`, `startsWith`, `endsWith`, `match` |
|
|
275
309
|
| 集合 | `isIn`, `notIn`, `allIn`, `elemMatch` |
|
|
276
310
|
| 空值/布尔 | `isNull`, `notNull`, `isTrue`, `isFalse`, `exists` |
|
|
277
|
-
| 日期 | `today`, `beforeToday(
|
|
311
|
+
| 日期 | `today`, `beforeToday(time)`, `tomorrow`, `thisWeek`, `nextWeek`, `lastWeek`, `thisMonth`, `lastMonth`, `recentDays(days)`, `earlierDays(days)` |
|
|
278
312
|
| ID | `id`, `ids`, `aggregateId`, `aggregateIds`, `tenantId`, `ownerId` |
|
|
279
313
|
| 状态 | `active`, `all`, `deleted` |
|
|
280
314
|
| 特殊 | `raw`(用于高级数据库特定查询) |
|
|
@@ -292,20 +326,25 @@ import {
|
|
|
292
326
|
} from '@ahoo-wang/fetcher';
|
|
293
327
|
import '@ahoo-wang/fetcher-eventstream';
|
|
294
328
|
import {
|
|
329
|
+
aggregation,
|
|
295
330
|
SnapshotQueryClient,
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
331
|
+
filter,
|
|
332
|
+
FilterListQuery,
|
|
333
|
+
FilterPagedQuery,
|
|
334
|
+
FilterSingleQuery,
|
|
335
|
+
type AggregationQuery,
|
|
336
|
+
Identifier,
|
|
300
337
|
} from '@ahoo-wang/fetcher-wow';
|
|
301
338
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
302
339
|
|
|
303
340
|
interface CartItem {
|
|
304
341
|
productId: string;
|
|
342
|
+
price: number;
|
|
305
343
|
quantity: number;
|
|
306
344
|
}
|
|
307
345
|
|
|
308
346
|
interface CartState extends Identifier {
|
|
347
|
+
status: string;
|
|
309
348
|
items: CartItem[];
|
|
310
349
|
}
|
|
311
350
|
|
|
@@ -338,11 +377,11 @@ const cartSnapshotQueryClient = new SnapshotQueryClient<CartState>({
|
|
|
338
377
|
});
|
|
339
378
|
|
|
340
379
|
// 统计快照数量
|
|
341
|
-
const count = await cartSnapshotQueryClient.count(
|
|
380
|
+
const count = await cartSnapshotQueryClient.count(filter.matchAll());
|
|
342
381
|
|
|
343
382
|
// 列出快照
|
|
344
|
-
const listQuery:
|
|
345
|
-
|
|
383
|
+
const listQuery: FilterListQuery = {
|
|
384
|
+
filter: filter.matchAll(),
|
|
346
385
|
};
|
|
347
386
|
const list = await cartSnapshotQueryClient.list(listQuery);
|
|
348
387
|
|
|
@@ -364,8 +403,8 @@ for await (const event of stateStream) {
|
|
|
364
403
|
}
|
|
365
404
|
|
|
366
405
|
// 分页查询快照
|
|
367
|
-
const pagedQuery:
|
|
368
|
-
|
|
406
|
+
const pagedQuery: FilterPagedQuery = {
|
|
407
|
+
filter: filter.matchAll(),
|
|
369
408
|
};
|
|
370
409
|
const paged = await cartSnapshotQueryClient.paged(pagedQuery);
|
|
371
410
|
|
|
@@ -373,28 +412,71 @@ const paged = await cartSnapshotQueryClient.paged(pagedQuery);
|
|
|
373
412
|
const pagedState = await cartSnapshotQueryClient.pagedState(pagedQuery);
|
|
374
413
|
|
|
375
414
|
// 查询单个快照
|
|
376
|
-
const singleQuery:
|
|
377
|
-
|
|
415
|
+
const singleQuery: FilterSingleQuery = {
|
|
416
|
+
filter: filter.matchAll(),
|
|
378
417
|
};
|
|
379
418
|
const single = await cartSnapshotQueryClient.single(singleQuery);
|
|
380
419
|
|
|
381
420
|
// 查询单个快照状态
|
|
382
421
|
const singleState = await cartSnapshotQueryClient.singleState(singleQuery);
|
|
422
|
+
|
|
423
|
+
type CartFields = 'state.status' | 'state.items';
|
|
424
|
+
type ItemFields = 'productId' | 'price' | 'quantity';
|
|
425
|
+
|
|
426
|
+
type ProductSummary = {
|
|
427
|
+
product: string;
|
|
428
|
+
representativeProduct: string | null;
|
|
429
|
+
itemCount: number;
|
|
430
|
+
revenue: number;
|
|
431
|
+
};
|
|
432
|
+
|
|
433
|
+
const revenue = aggregation.multiply(
|
|
434
|
+
aggregation.field<ItemFields>('price'),
|
|
435
|
+
aggregation.field<ItemFields>('quantity'),
|
|
436
|
+
);
|
|
437
|
+
|
|
438
|
+
const aggregationQuery: AggregationQuery<CartFields, ItemFields> = {
|
|
439
|
+
filter: filter.eq('state.status', 'COMPLETED'),
|
|
440
|
+
elements: [aggregation.element('state.items', filter.gt('quantity', 0))],
|
|
441
|
+
groupBy: [aggregation.terms('productId', 'product')],
|
|
442
|
+
metrics: [
|
|
443
|
+
aggregation.any('productId', 'representativeProduct'),
|
|
444
|
+
aggregation.count('itemCount'),
|
|
445
|
+
aggregation.sum(revenue, 'revenue'),
|
|
446
|
+
],
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
const summaries =
|
|
450
|
+
await cartSnapshotQueryClient.aggregate<ProductSummary>(aggregationQuery);
|
|
451
|
+
const summaryStream =
|
|
452
|
+
await cartSnapshotQueryClient.aggregateStream<ProductSummary>(
|
|
453
|
+
aggregationQuery,
|
|
454
|
+
);
|
|
455
|
+
for await (const event of summaryStream) {
|
|
456
|
+
console.log(event.data);
|
|
457
|
+
}
|
|
383
458
|
```
|
|
384
459
|
|
|
460
|
+
`aggregation.any(field, alias)` 增加的是指标,不是新的分组。它从当前分组返回一个
|
|
461
|
+
非空标量;没有值时返回 `null`。具体选择哪个值不属于契约,可能随后端或执行变化;
|
|
462
|
+
只有候选值可互换时才应使用。字段相对最内层 Element,集合字段或不具备 terms 聚合
|
|
463
|
+
能力的字段由 Wow 在运行时拒绝。按 `ANY` alias 排序属于昂贵的指标排序。
|
|
464
|
+
|
|
385
465
|
##### 方法
|
|
386
466
|
|
|
387
|
-
- `count(
|
|
388
|
-
- `list(listQuery:
|
|
389
|
-
- `listStream(listQuery:
|
|
467
|
+
- `count(filter: FilterExpression): Promise<number>` - 统计匹配过滤表达式的快照数量。
|
|
468
|
+
- `list(listQuery: FilterListQuery): Promise<Partial<MaterializedSnapshot<S>>[]>` - 检索物化快照列表。
|
|
469
|
+
- `listStream(listQuery: FilterListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<MaterializedSnapshot<S>>>>>` -
|
|
390
470
|
以服务器发送事件的形式检索物化快照流。
|
|
391
|
-
- `listState(listQuery:
|
|
392
|
-
- `listStateStream(listQuery:
|
|
471
|
+
- `listState(listQuery: FilterListQuery): Promise<Partial<S>[]>` - 检索快照状态列表。
|
|
472
|
+
- `listStateStream(listQuery: FilterListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<S>>>>` -
|
|
393
473
|
以服务器发送事件的形式检索快照状态流。
|
|
394
|
-
- `paged(pagedQuery:
|
|
395
|
-
- `pagedState(pagedQuery:
|
|
396
|
-
- `single(singleQuery:
|
|
397
|
-
- `singleState(singleQuery:
|
|
474
|
+
- `paged(pagedQuery: FilterPagedQuery): Promise<PagedList<Partial<MaterializedSnapshot<S>>>>` - 检索物化快照的分页列表。
|
|
475
|
+
- `pagedState(pagedQuery: FilterPagedQuery): Promise<PagedList<Partial<S>>>` - 检索快照状态的分页列表。
|
|
476
|
+
- `single(singleQuery: FilterSingleQuery): Promise<Partial<MaterializedSnapshot<S>>>` - 检索单个物化快照。
|
|
477
|
+
- `singleState(singleQuery: FilterSingleQuery): Promise<Partial<S>>` - 检索单个快照状态。
|
|
478
|
+
- `aggregate<Row extends DynamicDocument = DynamicDocument, AGGREGATION_FIELDS extends string = string>(query: AggregationQuery<FIELDS, AGGREGATION_FIELDS>): Promise<Row[]>` - 执行快照聚合并请求 `snapshot/aggregation`。
|
|
479
|
+
- `aggregateStream<Row extends DynamicDocument = DynamicDocument, AGGREGATION_FIELDS extends string = string>(query: AggregationQuery<FIELDS, AGGREGATION_FIELDS>): Promise<ReadableStream<JsonServerSentEvent<Row>>>` - 执行快照聚合并通过服务器发送事件(SSE)请求 `snapshot/aggregation`。
|
|
398
480
|
|
|
399
481
|
#### QueryClientFactory
|
|
400
482
|
|
|
@@ -402,9 +484,9 @@ const singleState = await cartSnapshotQueryClient.singleState(singleQuery);
|
|
|
402
484
|
|
|
403
485
|
```typescript
|
|
404
486
|
import {
|
|
487
|
+
filter,
|
|
405
488
|
QueryClientFactory,
|
|
406
489
|
ResourceAttributionPathSpec,
|
|
407
|
-
all,
|
|
408
490
|
} from '@ahoo-wang/fetcher-wow';
|
|
409
491
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
410
492
|
|
|
@@ -420,7 +502,7 @@ const factory = new QueryClientFactory({
|
|
|
420
502
|
const snapshotClient = factory.createSnapshotQueryClient({
|
|
421
503
|
aggregateName: 'cart',
|
|
422
504
|
});
|
|
423
|
-
const carts = await snapshotClient.listState({
|
|
505
|
+
const carts = await snapshotClient.listState({ filter: filter.matchAll() });
|
|
424
506
|
|
|
425
507
|
// 创建状态聚合客户端
|
|
426
508
|
const stateClient = factory.createLoadStateAggregateClient({
|
|
@@ -432,7 +514,7 @@ const cart = await stateClient.load('cart-123');
|
|
|
432
514
|
const eventClient = factory.createEventStreamQueryClient({
|
|
433
515
|
aggregateName: 'cart',
|
|
434
516
|
});
|
|
435
|
-
const events = await eventClient.list({
|
|
517
|
+
const events = await eventClient.list({ filter: filter.matchAll() });
|
|
436
518
|
```
|
|
437
519
|
|
|
438
520
|
**方法:**
|
|
@@ -456,9 +538,9 @@ import {
|
|
|
456
538
|
import '@ahoo-wang/fetcher-eventstream';
|
|
457
539
|
import {
|
|
458
540
|
EventStreamQueryClient,
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
541
|
+
filter,
|
|
542
|
+
FilterListQuery,
|
|
543
|
+
FilterPagedQuery,
|
|
462
544
|
} from '@ahoo-wang/fetcher-wow';
|
|
463
545
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
464
546
|
|
|
@@ -491,11 +573,11 @@ const cartEventStreamQueryClient = new EventStreamQueryClient({
|
|
|
491
573
|
});
|
|
492
574
|
|
|
493
575
|
// 统计事件流数量
|
|
494
|
-
const count = await cartEventStreamQueryClient.count(
|
|
576
|
+
const count = await cartEventStreamQueryClient.count(filter.matchAll());
|
|
495
577
|
|
|
496
578
|
// 列出事件流
|
|
497
|
-
const listQuery:
|
|
498
|
-
|
|
579
|
+
const listQuery: FilterListQuery = {
|
|
580
|
+
filter: filter.matchAll(),
|
|
499
581
|
};
|
|
500
582
|
const list = await cartEventStreamQueryClient.list(listQuery);
|
|
501
583
|
|
|
@@ -507,19 +589,19 @@ for await (const event of listStream) {
|
|
|
507
589
|
}
|
|
508
590
|
|
|
509
591
|
// 分页查询事件流
|
|
510
|
-
const pagedQuery:
|
|
511
|
-
|
|
592
|
+
const pagedQuery: FilterPagedQuery = {
|
|
593
|
+
filter: filter.matchAll(),
|
|
512
594
|
};
|
|
513
595
|
const paged = await cartEventStreamQueryClient.paged(pagedQuery);
|
|
514
596
|
```
|
|
515
597
|
|
|
516
598
|
##### 方法
|
|
517
599
|
|
|
518
|
-
- `count(
|
|
519
|
-
- `list(listQuery:
|
|
520
|
-
- `listStream(listQuery:
|
|
600
|
+
- `count(filter: FilterExpression): Promise<number>` - 统计匹配过滤表达式的领域事件流数量。
|
|
601
|
+
- `list(listQuery: FilterListQuery): Promise<Partial<DomainEventStream>[]>` - 检索领域事件流列表。
|
|
602
|
+
- `listStream(listQuery: FilterListQuery): Promise<ReadableStream<JsonServerSentEvent<Partial<DomainEventStream>>>>` -
|
|
521
603
|
以服务器发送事件的形式检索领域事件流。
|
|
522
|
-
- `paged(pagedQuery:
|
|
604
|
+
- `paged(pagedQuery: FilterPagedQuery): Promise<PagedList<Partial<DomainEventStream>>>` - 检索领域事件流的分页列表。
|
|
523
605
|
|
|
524
606
|
## 🛠️ 高级用法
|
|
525
607
|
|
|
@@ -529,6 +611,7 @@ const paged = await cartEventStreamQueryClient.paged(pagedQuery);
|
|
|
529
611
|
import {
|
|
530
612
|
Fetcher,
|
|
531
613
|
FetchExchange,
|
|
614
|
+
HttpMethod,
|
|
532
615
|
RequestInterceptor,
|
|
533
616
|
URL_RESOLVE_INTERCEPTOR_ORDER,
|
|
534
617
|
} from '@ahoo-wang/fetcher';
|
|
@@ -536,12 +619,11 @@ import '@ahoo-wang/fetcher-eventstream';
|
|
|
536
619
|
import {
|
|
537
620
|
CommandClient,
|
|
538
621
|
CommandRequest,
|
|
539
|
-
|
|
622
|
+
CommandHeaders,
|
|
540
623
|
CommandStage,
|
|
541
|
-
HttpMethod,
|
|
542
624
|
SnapshotQueryClient,
|
|
543
|
-
|
|
544
|
-
|
|
625
|
+
filter,
|
|
626
|
+
FilterListQuery,
|
|
545
627
|
} from '@ahoo-wang/fetcher-wow';
|
|
546
628
|
import { idGenerator } from '@ahoo-wang/fetcher-cosec';
|
|
547
629
|
|
|
@@ -605,7 +687,7 @@ type AddCartItemCommand = CommandRequest<AddCartItem>;
|
|
|
605
687
|
const addItemCommand: AddCartItemCommand = {
|
|
606
688
|
method: HttpMethod.POST,
|
|
607
689
|
headers: {
|
|
608
|
-
[
|
|
690
|
+
[CommandHeaders.WAIT_STAGE]: CommandStage.SNAPSHOT,
|
|
609
691
|
},
|
|
610
692
|
body: {
|
|
611
693
|
productId: 'product-123',
|
|
@@ -620,8 +702,8 @@ const commandResult = await cartCommandClient.send(
|
|
|
620
702
|
console.log('命令执行完成:', commandResult);
|
|
621
703
|
|
|
622
704
|
// 2. 查询更新后的购物车
|
|
623
|
-
const listQuery:
|
|
624
|
-
|
|
705
|
+
const listQuery: FilterListQuery = {
|
|
706
|
+
filter: filter.matchAll(),
|
|
625
707
|
};
|
|
626
708
|
const carts = await cartSnapshotQueryClient.list(listQuery);
|
|
627
709
|
|
|
@@ -650,7 +732,7 @@ pnpm test --coverage
|
|
|
650
732
|
## 🤝 贡献
|
|
651
733
|
|
|
652
734
|
欢迎贡献!请查看
|
|
653
|
-
[贡献指南](https://github.com/Ahoo-Wang/fetcher/blob/main/
|
|
735
|
+
[贡献指南](https://github.com/Ahoo-Wang/fetcher/blob/main/wiki/guide/contributing.md) 获取更多详情。
|
|
654
736
|
|
|
655
737
|
## 📄 许可证
|
|
656
738
|
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@ahoo-wang/fetcher"),t=require("@ahoo-wang/fetcher-eventstream"),n=require("@ahoo-wang/fetcher-decorator");function r(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function i(e,t){return function(n,r){t(n,r,e)}}function a(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var o=class{constructor(e){this.apiMetadata=e}send(e,t){throw(0,n.autoGeneratedError)(e,t)}sendAndWaitStream(e,t){throw(0,n.autoGeneratedError)(e,t)}};a([(0,n.endpoint)(),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`send`,null),a([(0,n.endpoint)(void 0,void 0,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`sendAndWaitStream`,null),o=a([(0,n.api)(),r(`design:paramtypes`,[Object])],o);var s=class e{static{this.COMMAND_HEADERS_PREFIX=`Command-`}static{this.TENANT_ID=`${e.COMMAND_HEADERS_PREFIX}Tenant-Id`}static{this.OWNER_ID=`${e.COMMAND_HEADERS_PREFIX}Owner-Id`}static{this.SPACE_ID=`${e.COMMAND_HEADERS_PREFIX}Space-Id`}static{this.AGGREGATE_ID=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Id`}static{this.AGGREGATE_VERSION=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Version`}static{this.WAIT_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Wait-`}static{this.WAIT_TIME_OUT=`${e.WAIT_PREFIX}Timeout`}static{this.WAIT_STAGE=`${e.WAIT_PREFIX}Stage`}static{this.WAIT_CONTEXT=`${e.WAIT_PREFIX}Context`}static{this.WAIT_PROCESSOR=`${e.WAIT_PREFIX}Processor`}static{this.WAIT_FUNCTION=`${e.WAIT_PREFIX}Function`}static{this.WAIT_TAIL_PREFIX=`${e.WAIT_PREFIX}Tail-`}static{this.WAIT_TAIL_STAGE=`${e.WAIT_TAIL_PREFIX}Stage`}static{this.WAIT_TAIL_CONTEXT=`${e.WAIT_TAIL_PREFIX}Context`}static{this.WAIT_TAIL_PROCESSOR=`${e.WAIT_TAIL_PREFIX}Processor`}static{this.WAIT_TAIL_FUNCTION=`${e.WAIT_TAIL_PREFIX}Function`}static{this.REQUEST_ID=`${e.COMMAND_HEADERS_PREFIX}Request-Id`}static{this.LOCAL_FIRST=`${e.COMMAND_HEADERS_PREFIX}Local-First`}static{this.COMMAND_AGGREGATE_CONTEXT=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Context`}static{this.COMMAND_AGGREGATE_NAME=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Name`}static{this.COMMAND_TYPE=`${e.COMMAND_HEADERS_PREFIX}Type`}static{this.COMMAND_HEADER_X_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Header-`}},ee=function(e){return e.SENT=`SENT`,e.PROCESSED=`PROCESSED`,e.SNAPSHOT=`SNAPSHOT`,e.PROJECTED=`PROJECTED`,e.EVENT_HANDLED=`EVENT_HANDLED`,e.SAGA_HANDLED=`SAGA_HANDLED`,e}({}),c=function(e){return e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.DELETED=`DELETED`,e.ALL=`ALL`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.LT=`LT`,e.GTE=`GTE`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.ALL_IN=`ALL_IN`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.ELEM_MATCH=`ELEM_MATCH`,e.NULL=`NULL`,e.NOT_NULL=`NOT_NULL`,e.TRUE=`TRUE`,e.FALSE=`FALSE`,e.EXISTS=`EXISTS`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e.MATCH=`MATCH`,e.RAW=`RAW`,e}({}),te=new Set([`AND`,`OR`,`NOR`]),ne=new Set([`NULL`,`NOT_NULL`,`TRUE`,`FALSE`,`EXISTS`,`TODAY`,`TOMORROW`,`THIS_WEEK`,`NEXT_WEEK`,`LAST_WEEK`,`THIS_MONTH`,`LAST_MONTH`]);function l(e){return!!e}var re=class{static{this.IGNORE_CASE_OPTION_KEY=`ignoreCase`}static{this.ZONE_ID_OPTION_KEY=`zoneId`}static{this.DATE_PATTERN_OPTION_KEY=`datePattern`}};function u(e){if(e!==void 0)return{ignoreCase:e}}function d(e,t){if(e===void 0&&t===void 0)return;let n={};return e!==void 0&&(n.datePattern=e),t!==void 0&&(n.zoneId=t),n}var ie=function(e){return e.ACTIVE=`ACTIVE`,e.DELETED=`DELETED`,e.ALL=`ALL`,e}({});function f(...e){if(e.length===0)return g();if(e.length===1)return l(e[0])?e[0]:g();let t=[];return e.forEach(e=>{e?.operator===c.ALL||!l(e)||(e.operator===c.AND&&e.children?t.push(...e.children):t.push(e))}),t.length===0?g():{operator:c.AND,children:t}}function ae(...e){let t=e?.filter(e=>l(e));return t.length===0?g():{operator:c.OR,children:t}}function oe(...e){return e.length===0?g():{operator:c.NOR,children:e}}function se(e){return{operator:c.ID,value:e}}function ce(e){return{operator:c.IDS,value:e}}function p(e){return{operator:c.AGGREGATE_ID,value:e}}function m(e){return{operator:c.AGGREGATE_IDS,value:e}}function le(e){return{operator:c.TENANT_ID,value:e}}function ue(e){return{operator:c.OWNER_ID,value:e}}function de(e){return{operator:c.SPACE_ID,value:e}}function h(e){return{operator:c.DELETED,value:e}}function fe(){return h(`ACTIVE`)}function g(){return{operator:c.ALL}}function pe(e,t){return{field:e,operator:c.EQ,value:t}}function me(e,t){return{field:e,operator:c.NE,value:t}}function _(e,t){return{field:e,operator:c.GT,value:t}}function v(e,t){return{field:e,operator:c.LT,value:t}}function he(e,t){return{field:e,operator:c.GTE,value:t}}function ge(e,t){return{field:e,operator:c.LTE,value:t}}function _e(e,t,n){let r=u(n);return{field:e,operator:c.CONTAINS,value:t,options:r}}function ve(e,...t){return{field:e,operator:c.IN,value:t}}function ye(e,...t){return{field:e,operator:c.NOT_IN,value:t}}function y(e,t,n){return{field:e,operator:c.BETWEEN,value:[t,n]}}function b(e,...t){return{field:e,operator:c.ALL_IN,value:t}}function x(e,t,n){let r=u(n);return{field:e,operator:c.STARTS_WITH,value:t,options:r}}function S(e,t){return{field:e,operator:c.MATCH,value:t}}function C(e,t,n){let r=u(n);return{field:e,operator:c.ENDS_WITH,value:t,options:r}}function w(e,t){return{field:e,operator:c.ELEM_MATCH,children:[t]}}function T(e){return{field:e,operator:c.NULL}}function E(e){return{field:e,operator:c.NOT_NULL}}function D(e){return{field:e,operator:c.TRUE}}function O(e){return{field:e,operator:c.FALSE}}function k(e,t=!0){return{field:e,operator:c.EXISTS,value:t}}function A(e,t,n){let r=d(t,n);return{field:e,operator:c.TODAY,options:r}}function j(e,t,n,r){let i=d(n,r);return{field:e,operator:c.BEFORE_TODAY,value:t,options:i}}function M(e,t,n){let r=d(t,n);return{field:e,operator:c.TOMORROW,options:r}}function N(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_WEEK,options:r}}function P(e,t,n){let r=d(t,n);return{field:e,operator:c.NEXT_WEEK,options:r}}function be(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_WEEK,options:r}}function xe(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_MONTH,options:r}}function Se(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_MONTH,options:r}}function Ce(e,t,n,r){let i=d(n,r);return{field:e,operator:c.RECENT_DAYS,value:t,options:i}}function we(e,t,n,r){let i=d(n,r);return{field:e,operator:c.EARLIER_DAYS,value:t,options:i}}function Te(e){return{operator:c.RAW,value:e}}var F={index:1,size:10};function Ee({index:e=F.index,size:t=F.size}=F){return{index:e,size:t}}var I={};function L(){return I}function De({include:e,exclude:t}=L()){return{include:e,exclude:t}}function R({condition:e=g(),projection:t,sort:n}={}){return{condition:e,projection:t,sort:n}}function z({condition:e=g(),projection:t,sort:n,limit:r=F.size}={}){return{condition:e,projection:t,sort:n,limit:r}}function Oe({condition:e=g(),projection:t,sort:n,pagination:r=F}={}){return{condition:e,projection:t,sort:n,pagination:r}}var B={total:0,list:[]};function ke({total:e,list:t=[]}=B){return e===void 0&&(e=t.length),{total:e,list:t}}var V=function(e){return e.ASC=`ASC`,e.DESC=`DESC`,e}({});function Ae(e){return{field:e,direction:`ASC`}}function je(e){return{field:e,direction:`DESC`}}var Me=class e{static{this.HEADER=`header`}static{this.COMMAND_OPERATOR=`${e.HEADER}.command_operator`}static{this.AGGREGATE_ID=`aggregateId`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.COMMAND_ID=`commandId`}static{this.REQUEST_ID=`requestId`}static{this.VERSION=`version`}static{this.BODY=`body`}static{this.BODY_ID=`${e.BODY}.id`}static{this.BODY_NAME=`${e.BODY}.name`}static{this.BODY_TYPE=`${e.BODY}.bodyType`}static{this.BODY_REVISION=`${e.BODY}.revision`}static{this.BODY_BODY=`${e.BODY}.body`}static{this.CREATE_TIME=`createTime`}},H=class e{static{this.EVENT_STREAM_RESOURCE_NAME=`event`}static{this.COUNT=`${e.EVENT_STREAM_RESOURCE_NAME}/count`}static{this.LIST=`${e.EVENT_STREAM_RESOURCE_NAME}/list`}static{this.PAGED=`${e.EVENT_STREAM_RESOURCE_NAME}/paged`}},U=class{constructor(e){this.apiMetadata=e}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.post)(H.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],U.prototype,`count`,null),a([(0,n.post)(H.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],U.prototype,`list`,null),a([(0,n.post)(H.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],U.prototype,`listStream`,null),a([(0,n.post)(H.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],U.prototype,`paged`,null),U=a([(0,n.api)(),r(`design:paramtypes`,[Object])],U);var Ne=class{static{this.VERSION=`version`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.EVENT_ID=`eventId`}static{this.FIRST_EVENT_TIME=`firstEventTime`}static{this.EVENT_TIME=`eventTime`}static{this.FIRST_OPERATOR=`firstOperator`}static{this.OPERATOR=`operator`}static{this.SNAPSHOT_TIME=`snapshotTime`}static{this.TAGS=`tags`}static{this.DELETED=`deleted`}static{this.STATE=`state`}},W=class e{static{this.SNAPSHOT_RESOURCE_NAME=`snapshot`}static{this.COUNT=`${e.SNAPSHOT_RESOURCE_NAME}/count`}static{this.LIST=`${e.SNAPSHOT_RESOURCE_NAME}/list`}static{this.LIST_STATE=`${e.LIST}/state`}static{this.PAGED=`${e.SNAPSHOT_RESOURCE_NAME}/paged`}static{this.PAGED_STATE=`${e.PAGED}/state`}static{this.SINGLE=`${e.SNAPSHOT_RESOURCE_NAME}/single`}static{this.SINGLE_STATE=`${e.SINGLE}/state`}},G=class{constructor(e){this.apiMetadata=e}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}pagedState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}single(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}singleState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}getById(e,t,n){let r=R({condition:p(e)});return this.single(r,t,n)}getStateById(e,t,n){let r=R({condition:p(e)});return this.singleState(r,t,n)}getByIds(e,t,n){let r=z({condition:m(e),limit:e.length});return this.list(r,t,n)}getStateByIds(e,t,n){let r=z({condition:m(e),limit:e.length});return this.listState(r,t,n)}};a([(0,n.post)(W.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`count`,null),a([(0,n.post)(W.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`list`,null),a([(0,n.post)(W.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`listStream`,null),a([(0,n.post)(W.LIST_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`listState`,null),a([(0,n.post)(W.LIST_STATE,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`listStateStream`,null),a([(0,n.post)(W.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`paged`,null),a([(0,n.post)(W.PAGED_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`pagedState`,null),a([(0,n.post)(W.SINGLE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`single`,null),a([(0,n.post)(W.SINGLE_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`singleState`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`getById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`getStateById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`getByIds`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],G.prototype,`getStateByIds`,null),G=a([(0,n.api)(),r(`design:paramtypes`,[Object])],G);var K=class e{static{this.LOAD=`{id}/state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},q=class{constructor(e){this.apiMetadata=e}load(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadVersioned(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}loadTimeBased(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}};a([(0,n.get)(K.LOAD),i(0,(0,n.path)(`id`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],q.prototype,`load`,null),a([(0,n.get)(K.LOAD_VERSIONED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`version`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],q.prototype,`loadVersioned`,null),a([(0,n.get)(K.LOAD_TIME_BASED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`createTime`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],q.prototype,`loadTimeBased`,null),q=a([(0,n.api)(),r(`design:paramtypes`,[Object])],q);var J=class e{static{this.LOAD=`state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},Y=class{constructor(e){this.apiMetadata=e}load(e,t){throw(0,n.autoGeneratedError)(e,t)}loadVersioned(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadTimeBased(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.get)(J.LOAD),i(0,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Y.prototype,`load`,null),a([(0,n.get)(J.LOAD_VERSIONED),i(0,(0,n.path)(`version`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Y.prototype,`loadVersioned`,null),a([(0,n.get)(J.LOAD_TIME_BASED),i(0,(0,n.path)(`createTime`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Y.prototype,`loadTimeBased`,null),Y=a([(0,n.api)(),r(`design:paramtypes`,[Object])],Y);var Pe=`~`;function X({field:e,cursorId:t=`~`,direction:n=V.DESC}){return n===V.ASC?_(e,t):v(e,t)}function Z({field:e,direction:t=V.DESC}){return{field:e,direction:t}}function Fe(e){let t=e.query,n=f(X(e),t.condition),r=Z(e);return{...t,condition:n,sort:[r]}}function Q(t){let n=(0,e.combineURLs)(t.resourceAttribution??``,t.aggregateName??``);return t.contextAlias&&(n=(0,e.combineURLs)(t.contextAlias,n)),{...t,basePath:n}}var Ie=class{constructor(e){this.defaultOptions=e}createSnapshotQueryClient(e){let t=Q({...this.defaultOptions,...e});return new G(t)}createLoadStateAggregateClient(e){let t=Q({...this.defaultOptions,...e});return new q(t)}createOwnerLoadStateAggregateClient(e){let t=Q({...this.defaultOptions,...e});return new Y(t)}createEventStreamQueryClient(e){let t=Q({...this.defaultOptions,...e});return new U(t)}},Le={},$=[`*`],Re=function(e){return e.NONE=``,e.TENANT=`/tenant/{tenantId}`,e.OWNER=`/owner/{ownerId}`,e.TENANT_OWNER=`/tenant/{tenantId}/owner/{ownerId}`,e}({}),ze=function(e){return e.RECOVERABLE=`RECOVERABLE`,e.UNKNOWN=`UNKNOWN`,e.UNRECOVERABLE=`UNRECOVERABLE`,e}({}),Be=class e{static{this.SUCCEEDED=`Ok`}static{this.SUCCEEDED_MESSAGE=``}static{this.NOT_FOUND=`NotFound`}static{this.NOT_FOUND_MESSAGE=`Not found resource!`}static{this.BAD_REQUEST=`BadRequest`}static{this.ILLEGAL_ARGUMENT=`IllegalArgument`}static{this.ILLEGAL_STATE=`IllegalState`}static{this.REQUEST_TIMEOUT=`RequestTimeout`}static{this.TOO_MANY_REQUESTS=`TooManyRequests`}static{this.DUPLICATE_REQUEST_ID=`DuplicateRequestId`}static{this.COMMAND_VALIDATION=`CommandValidation`}static{this.REWRITE_NO_COMMAND=`RewriteNoCommand`}static{this.EVENT_VERSION_CONFLICT=`EventVersionConflict`}static{this.DUPLICATE_AGGREGATE_ID=`DuplicateAggregateId`}static{this.COMMAND_EXPECT_VERSION_CONFLICT=`CommandExpectVersionConflict`}static{this.SOURCING_VERSION_CONFLICT=`SourcingVersionConflict`}static{this.ILLEGAL_ACCESS_DELETED_AGGREGATE=`IllegalAccessDeletedAggregate`}static{this.ILLEGAL_ACCESS_OWNER_AGGREGATE=`IllegalAccessOwnerAggregate`}static{this.ILLEGAL_ACCESS_SPACE_AGGREGATE=`IllegalAccessSpaceAggregate`}static{this.INTERNAL_SERVER_ERROR=`InternalServerError`}static isSucceeded(t){return t===e.SUCCEEDED}static isError(t){return!e.isSucceeded(t)}},Ve=function(e){return e.COMMAND=`COMMAND`,e.ERROR=`ERROR`,e.EVENT=`EVENT`,e.SOURCING=`SOURCING`,e.STATE_EVENT=`STATE_EVENT`,e}({}),He=``,Ue=function(e){return e.MAP=`MAP`,e.STRING=`STRING`,e}({});function We(e,t,n){if(e==null)return n;let r=Array.isArray(t)?t:t.split(`.`).filter(Boolean);if(r.length===0)return e;let i=e;for(let e of r){if(Array.isArray(i)){let t=parseInt(e,10);if(isNaN(t)||t<0||!Number.isInteger(t))return n;i=i[t]}else if(typeof i==`object`)i=i[e];else return n;if(i==null)return n}return i}exports.CURSOR_ID_START=Pe,Object.defineProperty(exports,"CommandClient",{enumerable:!0,get:function(){return o}}),exports.CommandHeaders=s,exports.CommandStage=ee,exports.ConditionOptionKey=re,exports.DEFAULT_OWNER_ID=He,exports.DEFAULT_PAGINATION=F,exports.DEFAULT_PROJECTION=I,exports.DeletionState=ie,exports.DomainEventStreamMetadataFields=Me,exports.EMPTY_ABAC_TAGS=Le,exports.EMPTY_PAGED_LIST=B,exports.EMPTY_VALUE_OPERATORS=ne,exports.ErrorCodes=Be,Object.defineProperty(exports,"EventStreamQueryClient",{enumerable:!0,get:function(){return U}}),exports.EventStreamQueryEndpointPaths=H,exports.FunctionKind=Ve,exports.LOGICAL_OPERATORS=te,Object.defineProperty(exports,"LoadOwnerStateAggregateClient",{enumerable:!0,get:function(){return Y}}),exports.LoadOwnerStateAggregateEndpointPaths=J,Object.defineProperty(exports,"LoadStateAggregateClient",{enumerable:!0,get:function(){return q}}),exports.LoadStateAggregateEndpointPaths=K,exports.MessageHeaderSqlType=Ue,exports.Operator=c,exports.QueryClientFactory=Ie,exports.RecoverableType=ze,exports.ResourceAttributionPathSpec=Re,exports.SnapshotMetadataFields=Ne,Object.defineProperty(exports,"SnapshotQueryClient",{enumerable:!0,get:function(){return G}}),exports.SnapshotQueryEndpointPaths=W,exports.SortDirection=V,exports.WILDCARD_ABAC_TAG_VALUES=$,exports.active=fe,exports.aggregateId=p,exports.aggregateIds=m,exports.all=g,exports.allIn=b,exports.and=f,exports.asc=Ae,exports.beforeToday=j,exports.between=y,exports.contains=_e,exports.createQueryApiMetadata=Q,exports.cursorCondition=X,exports.cursorQuery=Fe,exports.cursorSort=Z,exports.dateOptions=d,exports.defaultProjection=L,exports.deleted=h,exports.desc=je,exports.earlierDays=we,exports.elemMatch=w,exports.endsWith=C,exports.eq=pe,exports.exists=k,exports.getPropertyValue=We,exports.gt=_,exports.gte=he,exports.id=se,exports.ids=ce,exports.ignoreCaseOptions=u,exports.isFalse=O,exports.isIn=ve,exports.isNull=T,exports.isTrue=D,exports.isValidateCondition=l,exports.lastMonth=Se,exports.lastWeek=be,exports.listQuery=z,exports.lt=v,exports.lte=ge,exports.match=S,exports.ne=me,exports.nextWeek=P,exports.nor=oe,exports.notIn=ye,exports.notNull=E,exports.or=ae,exports.ownerId=ue,exports.pagedList=ke,exports.pagedQuery=Oe,exports.pagination=Ee,exports.projection=De,exports.raw=Te,exports.recentDays=Ce,exports.singleQuery=R,exports.spaceId=de,exports.startsWith=x,exports.tenantId=le,exports.thisMonth=xe,exports.thisWeek=N,exports.today=A,exports.tomorrow=M;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@ahoo-wang/fetcher"),t=require("@ahoo-wang/fetcher-eventstream"),n=require("@ahoo-wang/fetcher-decorator");function r(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function i(e,t){return function(n,r){t(n,r,e)}}function a(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var o=class{constructor(e){this.apiMetadata=e}send(e,t){throw(0,n.autoGeneratedError)(e,t)}sendAndWaitStream(e,t){throw(0,n.autoGeneratedError)(e,t)}};a([(0,n.endpoint)(),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`send`,null),a([(0,n.endpoint)(void 0,void 0,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.request)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],o.prototype,`sendAndWaitStream`,null),o=a([(0,n.api)(),r(`design:paramtypes`,[Object])],o);var s=class e{static{this.COMMAND_HEADERS_PREFIX=`Command-`}static{this.TENANT_ID=`${e.COMMAND_HEADERS_PREFIX}Tenant-Id`}static{this.OWNER_ID=`${e.COMMAND_HEADERS_PREFIX}Owner-Id`}static{this.SPACE_ID=`${e.COMMAND_HEADERS_PREFIX}Space-Id`}static{this.AGGREGATE_ID=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Id`}static{this.AGGREGATE_VERSION=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Version`}static{this.WAIT_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Wait-`}static{this.WAIT_TIME_OUT=`${e.WAIT_PREFIX}Timeout`}static{this.WAIT_STAGE=`${e.WAIT_PREFIX}Stage`}static{this.WAIT_CONTEXT=`${e.WAIT_PREFIX}Context`}static{this.WAIT_PROCESSOR=`${e.WAIT_PREFIX}Processor`}static{this.WAIT_FUNCTION=`${e.WAIT_PREFIX}Function`}static{this.WAIT_TAIL_PREFIX=`${e.WAIT_PREFIX}Tail-`}static{this.WAIT_TAIL_STAGE=`${e.WAIT_TAIL_PREFIX}Stage`}static{this.WAIT_TAIL_CONTEXT=`${e.WAIT_TAIL_PREFIX}Context`}static{this.WAIT_TAIL_PROCESSOR=`${e.WAIT_TAIL_PREFIX}Processor`}static{this.WAIT_TAIL_FUNCTION=`${e.WAIT_TAIL_PREFIX}Function`}static{this.REQUEST_ID=`${e.COMMAND_HEADERS_PREFIX}Request-Id`}static{this.LOCAL_FIRST=`${e.COMMAND_HEADERS_PREFIX}Local-First`}static{this.COMMAND_AGGREGATE_CONTEXT=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Context`}static{this.COMMAND_AGGREGATE_NAME=`${e.COMMAND_HEADERS_PREFIX}Aggregate-Name`}static{this.COMMAND_TYPE=`${e.COMMAND_HEADERS_PREFIX}Type`}static{this.COMMAND_HEADER_X_PREFIX=`${e.COMMAND_HEADERS_PREFIX}Header-`}},ee=function(e){return e.SENT=`SENT`,e.PROCESSED=`PROCESSED`,e.SNAPSHOT=`SNAPSHOT`,e.PROJECTED=`PROJECTED`,e.EVENT_HANDLED=`EVENT_HANDLED`,e.SAGA_HANDLED=`SAGA_HANDLED`,e}({}),c=function(e){return e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.DELETED=`DELETED`,e.ALL=`ALL`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.LT=`LT`,e.GTE=`GTE`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.ALL_IN=`ALL_IN`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.ELEM_MATCH=`ELEM_MATCH`,e.NULL=`NULL`,e.NOT_NULL=`NOT_NULL`,e.TRUE=`TRUE`,e.FALSE=`FALSE`,e.EXISTS=`EXISTS`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e.MATCH=`MATCH`,e.RAW=`RAW`,e}({}),te=new Set([`AND`,`OR`,`NOR`]),ne=new Set([`NULL`,`NOT_NULL`,`TRUE`,`FALSE`,`EXISTS`,`TODAY`,`TOMORROW`,`THIS_WEEK`,`NEXT_WEEK`,`LAST_WEEK`,`THIS_MONTH`,`LAST_MONTH`]);function l(e){return!!e}var re=class{static{this.IGNORE_CASE_OPTION_KEY=`ignoreCase`}static{this.ZONE_ID_OPTION_KEY=`zoneId`}static{this.DATE_PATTERN_OPTION_KEY=`datePattern`}};function u(e){if(e!==void 0)return{ignoreCase:e}}function d(e,t){if(e===void 0&&t===void 0)return;let n={};return e!==void 0&&(n.datePattern=e),t!==void 0&&(n.zoneId=t),n}var f=function(e){return e.ACTIVE=`ACTIVE`,e.DELETED=`DELETED`,e.ALL=`ALL`,e}({});function p(...e){if(e.length===0)return g();if(e.length===1)return l(e[0])?e[0]:g();let t=[];return e.forEach(e=>{e?.operator===c.ALL||!l(e)||(e.operator===c.AND&&e.children?t.push(...e.children):t.push(e))}),t.length===0?g():{operator:c.AND,children:t}}function ie(...e){let t=e?.filter(e=>l(e));return t.length===0?g():{operator:c.OR,children:t}}function ae(...e){return e.length===0?g():{operator:c.NOR,children:e}}function oe(e){return{operator:c.ID,value:e}}function se(e){return{operator:c.IDS,value:e}}function m(e){return{operator:c.AGGREGATE_ID,value:e}}function ce(e){return{operator:c.AGGREGATE_IDS,value:e}}function le(e){return{operator:c.TENANT_ID,value:e}}function ue(e){return{operator:c.OWNER_ID,value:e}}function de(e){return{operator:c.SPACE_ID,value:e}}function h(e){return{operator:c.DELETED,value:e}}function fe(){return h(`ACTIVE`)}function g(){return{operator:c.ALL}}function pe(e,t){return{field:e,operator:c.EQ,value:t}}function me(e,t){return{field:e,operator:c.NE,value:t}}function _(e,t){return{field:e,operator:c.GT,value:t}}function v(e,t){return{field:e,operator:c.LT,value:t}}function he(e,t){return{field:e,operator:c.GTE,value:t}}function ge(e,t){return{field:e,operator:c.LTE,value:t}}function _e(e,t,n){let r=u(n);return{field:e,operator:c.CONTAINS,value:t,options:r}}function ve(e,...t){return{field:e,operator:c.IN,value:t}}function ye(e,...t){return{field:e,operator:c.NOT_IN,value:t}}function be(e,t,n){return{field:e,operator:c.BETWEEN,value:[t,n]}}function xe(e,...t){return{field:e,operator:c.ALL_IN,value:t}}function Se(e,t,n){let r=u(n);return{field:e,operator:c.STARTS_WITH,value:t,options:r}}function Ce(e,t){return{field:e,operator:c.MATCH,value:t}}function we(e,t,n){let r=u(n);return{field:e,operator:c.ENDS_WITH,value:t,options:r}}function Te(e,t){return{field:e,operator:c.ELEM_MATCH,children:[t]}}function Ee(e){return{field:e,operator:c.NULL}}function De(e){return{field:e,operator:c.NOT_NULL}}function Oe(e){return{field:e,operator:c.TRUE}}function ke(e){return{field:e,operator:c.FALSE}}function Ae(e,t=!0){return{field:e,operator:c.EXISTS,value:t}}function je(e,t,n){let r=d(t,n);return{field:e,operator:c.TODAY,options:r}}function Me(e,t,n,r){let i=d(n,r);return{field:e,operator:c.BEFORE_TODAY,value:t,options:i}}function Ne(e,t,n){let r=d(t,n);return{field:e,operator:c.TOMORROW,options:r}}function Pe(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_WEEK,options:r}}function Fe(e,t,n){let r=d(t,n);return{field:e,operator:c.NEXT_WEEK,options:r}}function Ie(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_WEEK,options:r}}function Le(e,t,n){let r=d(t,n);return{field:e,operator:c.THIS_MONTH,options:r}}function Re(e,t,n){let r=d(t,n);return{field:e,operator:c.LAST_MONTH,options:r}}function ze(e,t,n,r){let i=d(n,r);return{field:e,operator:c.RECENT_DAYS,value:t,options:i}}function Be(e,t,n,r){let i=d(n,r);return{field:e,operator:c.EARLIER_DAYS,value:t,options:i}}function Ve(e){return{operator:c.RAW,value:e}}var He=function(e){return e.MATCH_ALL=`MATCH_ALL`,e.MATCH_NONE=`MATCH_NONE`,e.ID=`ID`,e.IDS=`IDS`,e.AGGREGATE_ID=`AGGREGATE_ID`,e.AGGREGATE_IDS=`AGGREGATE_IDS`,e.TENANT_ID=`TENANT_ID`,e.OWNER_ID=`OWNER_ID`,e.SPACE_ID=`SPACE_ID`,e.AND=`AND`,e.OR=`OR`,e.NOR=`NOR`,e.EQ=`EQ`,e.NE=`NE`,e.GT=`GT`,e.GTE=`GTE`,e.LT=`LT`,e.LTE=`LTE`,e.CONTAINS=`CONTAINS`,e.STARTS_WITH=`STARTS_WITH`,e.ENDS_WITH=`ENDS_WITH`,e.IN=`IN`,e.NOT_IN=`NOT_IN`,e.BETWEEN=`BETWEEN`,e.CONTAINS_ALL=`CONTAINS_ALL`,e.IS_EMPTY=`IS_EMPTY`,e.IS_NULL=`IS_NULL`,e.IS_NOT_NULL=`IS_NOT_NULL`,e.EXISTS=`EXISTS`,e.NOT_EXISTS=`NOT_EXISTS`,e.DELETION=`DELETION`,e.ELEMENT_MATCH=`ELEMENT_MATCH`,e.SEARCH=`SEARCH`,e.TODAY=`TODAY`,e.BEFORE_TODAY=`BEFORE_TODAY`,e.TOMORROW=`TOMORROW`,e.THIS_WEEK=`THIS_WEEK`,e.NEXT_WEEK=`NEXT_WEEK`,e.LAST_WEEK=`LAST_WEEK`,e.THIS_MONTH=`THIS_MONTH`,e.LAST_MONTH=`LAST_MONTH`,e.YESTERDAY=`YESTERDAY`,e.NEXT_MONTH=`NEXT_MONTH`,e.LAST_YEAR=`LAST_YEAR`,e.THIS_YEAR=`THIS_YEAR`,e.NEXT_YEAR=`NEXT_YEAR`,e.RECENT_DAYS=`RECENT_DAYS`,e.EARLIER_DAYS=`EARLIER_DAYS`,e}({}),Ue=function(e){return e.CASE_SENSITIVE=`CASE_SENSITIVE`,e.CASE_INSENSITIVE=`CASE_INSENSITIVE`,e}({}),y=function(e){return e.TERMS=`TERMS`,e.PHRASE=`PHRASE`,e}({}),b=function(e){return e.NANOSECONDS=`NANOSECONDS`,e.MICROSECONDS=`MICROSECONDS`,e.MILLISECONDS=`MILLISECONDS`,e.SECONDS=`SECONDS`,e.MINUTES=`MINUTES`,e.HOURS=`HOURS`,e.DAYS=`DAYS`,e}({}),We=/^([01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?$/,Ge=/^@?[A-Za-z_][A-Za-z0-9_-]*(\.(?:@?[A-Za-z_][A-Za-z0-9_-]*|[0-9]+))*$/,Ke=/^(?:UTC|GMT|UT)?[+-](\d{1,2}|\d{4}|\d{6}|\d{2}:\d{2}|\d{2}:\d{2}:\d{2})$/,qe=/^(?:UTC|GMT|UT)?[+-]/,Je={G:5,u:19,y:19,Q:5,q:5,M:5,L:5,D:3,d:2,F:1,E:5,e:5,c:[1,3,4,5],a:1,B:[1,4,5],h:2,H:2,k:2,K:2,m:2,s:2,S:9,A:19,n:19,N:19,V:[2],v:[1,4],z:4,O:[1,4],X:5,x:5,Z:5,W:1,w:2,Y:1/0,g:19};function x(e){if(typeof e!=`string`||!Ge.test(e))throw TypeError(`Logical field is invalid: [${String(e)}].`);return e}function S(e,t){if(!(e===null?t:typeof e==`string`||typeof e==`boolean`||typeof e==`number`&&Number.isFinite(e)))throw TypeError(`Filter value must be a JSON scalar.`);return e}function C(e){return Array.isArray(e)?(e.forEach(e=>S(e,!0)),e):S(e,!0)}function w(e,t){if(typeof t!=`string`)throw TypeError(`${e} must be a string.`);return t}function T(e){if(e!==`CASE_SENSITIVE`&&e!==`CASE_INSENSITIVE`)throw TypeError(`String comparison is invalid: [${String(e)}].`)}function E(e,t){if(t.length===0)throw TypeError(`${e} cannot be empty.`);if(t.some(e=>e==null))throw TypeError(`${e} cannot contain null.`)}function Ye(e){let t=Ke.exec(e);if(!t)return!1;let n=t[1],[r,i=0,a=0]=(n.includes(`:`)?n.split(`:`):n.length<=2?[n]:[n.slice(0,2),n.slice(2,4),n.slice(4,6)]).map(Number);return i<=59&&a<=59&&(r<18||r===18&&i===0&&a===0)}function D({zoneId:e,datePattern:t,timeUnit:n=`MILLISECONDS`}){if(e!==void 0){if(typeof e!=`string`||!e.trim())throw TypeError(`zoneId cannot be blank.`);if(qe.test(e)&&!Ye(e))throw TypeError(`zoneId is invalid: [${e}].`)}if(t!==void 0&&Ze(t),!Object.values(b).includes(n))throw TypeError(`timeUnit is invalid: [${String(n)}].`);return{...e===void 0?{}:{zoneId:e},...t===void 0?{}:{datePattern:t},timeUnit:n}}function Xe(e,t,n){let r=Je[t];if(!(typeof r==`number`?n<=r:r?.includes(n)===!0))throw TypeError(`datePattern is invalid: [${e}].`)}function O(e,t){return e!==void 0&&(`uyDFdhHkKmsSgAnNWwY`.includes(e)||e===`c`&&t===1||`eMLQq`.includes(e)&&t<=2)}function Ze(e){if(typeof e!=`string`||!e.trim())throw TypeError(`datePattern cannot be blank.`);let t=!1,n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i===`'`){e[r+1]===`'`?r++:t=!t;continue}if(!t){if(/[A-Za-z]/.test(i)){let t=i,n=r+1;for(;e[n]===t;)n++;let a=n-r,o=!1;if(t===`p`){if(o=!0,t=e[n],!t||!/[A-Za-z]/.test(t)||t===`p`)throw TypeError(`datePattern is invalid: [${e}].`);let r=n++;for(;e[n]===t;)n++;a=n-r}if(Xe(e,t,a),o&&O(t,a)){let t=e[n],r=n;for(;r<e.length&&e[r]===t;)r++;if(O(t,r-n))throw TypeError(`datePattern is invalid: [${e}].`)}r=n-1}else if(i===`[`)n++;else if(i===`]`){if(n===0)throw TypeError(`datePattern is invalid: [${e}].`);n--}else if(`{}#`.includes(i))throw TypeError(`datePattern is invalid: [${e}].`)}}if(t)throw TypeError(`datePattern is invalid: [${e}].`)}function k(e,t){if(!Number.isInteger(t)||t<1||t>2147483647)throw TypeError(`${e} days must be a positive JVM Int.`)}function A(e){switch(e.op){case`ID`:case`IDS`:case`AGGREGATE_ID`:case`AGGREGATE_IDS`:case`TENANT_ID`:case`OWNER_ID`:case`SPACE_ID`:case`DELETION`:case`SEARCH`:throw TypeError(`ELEMENT_MATCH predicate cannot contain root filters.`);case`AND`:case`OR`:case`NOR`:E(`${e.op} operands`,e.operands),e.operands.forEach(A);break;case`ELEMENT_MATCH`:A(e.predicate)}}function Qe(e){return E(`AND operands`,e),{op:`AND`,operands:[...e]}}function $e(e){return E(`OR operands`,e),{op:`OR`,operands:[...e]}}function et(e){return E(`NOR operands`,e),{op:`NOR`,operands:[...e]}}var j={matchAll(){return{op:`MATCH_ALL`}},matchNone(){return{op:`MATCH_NONE`}},id(e){return{op:`ID`,value:w(`ID value`,e)}},ids(e){return E(`IDS values`,e),e.forEach(e=>w(`IDS value`,e)),{op:`IDS`,values:[...e]}},aggregateId(e){return{op:`AGGREGATE_ID`,value:w(`AGGREGATE_ID value`,e)}},aggregateIds(e){return E(`AGGREGATE_IDS values`,e),e.forEach(e=>w(`AGGREGATE_IDS value`,e)),{op:`AGGREGATE_IDS`,values:[...e]}},tenantId(e){return{op:`TENANT_ID`,value:w(`TENANT_ID value`,e)}},ownerId(e){return{op:`OWNER_ID`,value:w(`OWNER_ID value`,e)}},spaceId(e){return{op:`SPACE_ID`,value:w(`SPACE_ID value`,e)}},and:Qe,or:$e,nor:et,eq(e,t){return{op:`EQ`,field:x(e),value:C(t)}},ne(e,t){return{op:`NE`,field:x(e),value:C(t)}},gt(e,t){return{op:`GT`,field:x(e),value:S(t,!1)}},gte(e,t){return{op:`GTE`,field:x(e),value:S(t,!1)}},lt(e,t){return{op:`LT`,field:x(e),value:S(t,!1)}},lte(e,t){return{op:`LTE`,field:x(e),value:S(t,!1)}},contains(e,t,n=`CASE_SENSITIVE`){return T(n),{op:`CONTAINS`,field:x(e),value:w(`CONTAINS value`,t),stringComparison:n}},startsWith(e,t,n=`CASE_SENSITIVE`){return T(n),{op:`STARTS_WITH`,field:x(e),value:w(`STARTS_WITH value`,t),stringComparison:n}},endsWith(e,t,n=`CASE_SENSITIVE`){return T(n),{op:`ENDS_WITH`,field:x(e),value:w(`ENDS_WITH value`,t),stringComparison:n}},isIn(e,t){return E(`IN values`,t),t.forEach(e=>S(e,!1)),{op:`IN`,field:x(e),values:[...t]}},notIn(e,t){return E(`NOT_IN values`,t),t.forEach(e=>S(e,!1)),{op:`NOT_IN`,field:x(e),values:[...t]}},containsAll(e,t){return E(`CONTAINS_ALL values`,t),t.forEach(e=>S(e,!1)),{op:`CONTAINS_ALL`,field:x(e),values:[...t]}},between(e,t,n){return{op:`BETWEEN`,field:x(e),lowerBound:S(t,!1),upperBound:S(n,!1)}},isEmpty(e){return{op:`IS_EMPTY`,field:x(e)}},isNull(e){return{op:`IS_NULL`,field:x(e)}},isNotNull(e){return{op:`IS_NOT_NULL`,field:x(e)}},exists(e){return{op:`EXISTS`,field:x(e)}},notExists(e){return{op:`NOT_EXISTS`,field:x(e)}},deletion(e){if(e!==f.ACTIVE&&e!==f.DELETED&&e!==f.ALL)throw TypeError(`Deletion state is invalid: [${String(e)}].`);return{op:`DELETION`,state:e}},elementMatch(e,t){return A(t),{op:`ELEMENT_MATCH`,field:x(e),predicate:t}},search(e,t){if(typeof e!=`string`||!e.trim())throw TypeError(`SEARCH query cannot be blank.`);if(t!==void 0&&(typeof t!=`object`||!t||Array.isArray(t)))throw TypeError(`SEARCH options must be a non-null object.`);let{fields:n=[],mode:r=`TERMS`}=t??{};if(!Object.values(y).includes(r))throw TypeError(`SEARCH mode is invalid: [${String(r)}].`);return{op:`SEARCH`,query:e,mode:r,fields:n.map(x)}},today(e,t={}){return{...D(t),op:`TODAY`,field:x(e)}},beforeToday(e,t,n={}){if(typeof t!=`string`||!We.test(t))throw TypeError(`BEFORE_TODAY time is invalid.`);return{...D(n),op:`BEFORE_TODAY`,field:x(e),time:t}},tomorrow(e,t={}){return{...D(t),op:`TOMORROW`,field:x(e)}},thisWeek(e,t={}){return{...D(t),op:`THIS_WEEK`,field:x(e)}},nextWeek(e,t={}){return{...D(t),op:`NEXT_WEEK`,field:x(e)}},lastWeek(e,t={}){return{...D(t),op:`LAST_WEEK`,field:x(e)}},thisMonth(e,t={}){return{...D(t),op:`THIS_MONTH`,field:x(e)}},lastMonth(e,t={}){return{...D(t),op:`LAST_MONTH`,field:x(e)}},yesterday(e,t={}){return{...D(t),op:`YESTERDAY`,field:x(e)}},nextMonth(e,t={}){return{...D(t),op:`NEXT_MONTH`,field:x(e)}},lastYear(e,t={}){return{...D(t),op:`LAST_YEAR`,field:x(e)}},thisYear(e,t={}){return{...D(t),op:`THIS_YEAR`,field:x(e)}},nextYear(e,t={}){return{...D(t),op:`NEXT_YEAR`,field:x(e)}},recentDays(e,t,n={}){return k(`RECENT_DAYS`,t),{...D(n),op:`RECENT_DAYS`,field:x(e),days:t}},earlierDays(e,t,n={}){return k(`EARLIER_DAYS`,t),{...D(n),op:`EARLIER_DAYS`,field:x(e),days:t}}},tt=function(e){return e.TERMS=`TERMS`,e.HISTOGRAM=`HISTOGRAM`,e.DATE_HISTOGRAM=`DATE_HISTOGRAM`,e}({}),nt=function(e){return e.COUNT=`COUNT`,e.NUMERIC=`NUMERIC`,e.ANY=`ANY`,e}({}),rt=function(e){return e.FIELD=`FIELD`,e.CONSTANT=`CONSTANT`,e.BINARY=`BINARY`,e}({}),it=function(e){return e.ADD=`ADD`,e.SUBTRACT=`SUBTRACT`,e.MULTIPLY=`MULTIPLY`,e.DIVIDE=`DIVIDE`,e}({}),M=function(e){return e.YEAR=`YEAR`,e.QUARTER=`QUARTER`,e.MONTH=`MONTH`,e.WEEK=`WEEK`,e.DAY=`DAY`,e.HOUR=`HOUR`,e.MINUTE=`MINUTE`,e.SECOND=`SECOND`,e}({}),at=function(e){return e.SUM=`SUM`,e.AVG=`AVG`,e.MIN=`MIN`,e.MAX=`MAX`,e}({});function N(e){return j.exists(e).field}function P(e){if(N(e),e.includes(`.`))throw TypeError(`aggregation alias must contain one segment.`);if(e.startsWith(`__wow`))throw TypeError(`aggregation alias must not use the reserved __wow prefix.`);return e}function F(e,t,n){return{type:`BINARY`,operator:e,left:t,right:n}}function I(e,t,n){return{type:`NUMERIC`,function:e,expression:t,alias:P(n)}}var ot={element(e,t){let n=N(e);return t===void 0?{path:n}:(j.elementMatch(e,t),{path:n,filter:t})},field(e){return{type:`FIELD`,field:N(e)}},constant(e){if(!Number.isFinite(e))throw TypeError(`aggregation constant must be finite.`);return{type:`CONSTANT`,value:e}},add:(e,t)=>F(`ADD`,e,t),subtract:(e,t)=>F(`SUBTRACT`,e,t),multiply:(e,t)=>F(`MULTIPLY`,e,t),divide:(e,t)=>F(`DIVIDE`,e,t),terms(e,t){return{type:`TERMS`,field:N(e),alias:P(t)}},histogram(e,{interval:t,alias:n}){if(!Number.isFinite(t)||t<=0)throw TypeError(`histogram interval must be finite and greater than 0.`);return{type:`HISTOGRAM`,field:N(e),interval:t,alias:P(n)}},dateHistogram(e,{unit:t,alias:n,timeZone:r=`UTC`}){if(!Object.values(M).includes(t))throw TypeError(`date histogram unit is invalid.`);if(typeof r!=`string`||!r.trim())throw TypeError(`date histogram timeZone cannot be blank.`);return{type:`DATE_HISTOGRAM`,field:N(e),unit:t,alias:P(n),timeZone:r}},any(e,t){return{type:`ANY`,field:N(e),alias:P(t)}},count(e){return{type:`COUNT`,alias:P(e)}},sum:(e,t)=>I(`SUM`,e,t),avg:(e,t)=>I(`AVG`,e,t),min:(e,t)=>I(`MIN`,e,t),max:(e,t)=>I(`MAX`,e,t)},L={index:1,size:10};function st({index:e=L.index,size:t=L.size}=L){return{index:e,size:t}}var R={};function z(){return R}function ct({include:e,exclude:t}=z()){return{include:e,exclude:t}}function B({condition:e,filter:t}){if(t===null)throw TypeError(`filter cannot be null.`);if(t!==void 0)return{filter:t};if(e===null)throw TypeError(`condition cannot be null.`);return{condition:e===void 0?g():e}}function V({condition:e,filter:t,projection:n,sort:r}={}){return{...B({condition:e,filter:t}),projection:n,sort:r}}function H({condition:e,filter:t,projection:n,sort:r,limit:i}={}){return{...B({condition:e,filter:t}),projection:n,sort:r,limit:i??(t===void 0?L.size:0)}}function lt({condition:e,filter:t,projection:n,sort:r,pagination:i=L}={}){return{...B({condition:e,filter:t}),projection:n,sort:r,pagination:i}}var U={total:0,list:[]};function ut({total:e,list:t=[]}=U){return e===void 0&&(e=t.length),{total:e,list:t}}var W=function(e){return e.ASC=`ASC`,e.DESC=`DESC`,e}({});function dt(e){return{field:e,direction:`ASC`}}function ft(e){return{field:e,direction:`DESC`}}var pt=class e{static{this.HEADER=`header`}static{this.COMMAND_OPERATOR=`${e.HEADER}.command_operator`}static{this.AGGREGATE_ID=`aggregateId`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.COMMAND_ID=`commandId`}static{this.REQUEST_ID=`requestId`}static{this.VERSION=`version`}static{this.BODY=`body`}static{this.BODY_ID=`${e.BODY}.id`}static{this.BODY_NAME=`${e.BODY}.name`}static{this.BODY_TYPE=`${e.BODY}.bodyType`}static{this.BODY_REVISION=`${e.BODY}.revision`}static{this.BODY_BODY=`${e.BODY}.body`}static{this.CREATE_TIME=`createTime`}},G=class e{static{this.EVENT_STREAM_RESOURCE_NAME=`event`}static{this.COUNT=`${e.EVENT_STREAM_RESOURCE_NAME}/count`}static{this.LIST=`${e.EVENT_STREAM_RESOURCE_NAME}/list`}static{this.PAGED=`${e.EVENT_STREAM_RESOURCE_NAME}/paged`}},K=class{constructor(e){this.apiMetadata=e}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.post)(G.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`count`,null),a([(0,n.post)(G.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`list`,null),a([(0,n.post)(G.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`listStream`,null),a([(0,n.post)(G.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],K.prototype,`paged`,null),K=a([(0,n.api)(),r(`design:paramtypes`,[Object])],K);var mt=class{static{this.VERSION=`version`}static{this.TENANT_ID=`tenantId`}static{this.OWNER_ID=`ownerId`}static{this.SPACE_ID=`spaceId`}static{this.EVENT_ID=`eventId`}static{this.FIRST_EVENT_TIME=`firstEventTime`}static{this.EVENT_TIME=`eventTime`}static{this.FIRST_OPERATOR=`firstOperator`}static{this.OPERATOR=`operator`}static{this.SNAPSHOT_TIME=`snapshotTime`}static{this.TAGS=`tags`}static{this.DELETED=`deleted`}static{this.STATE=`state`}},q=class e{static{this.SNAPSHOT_RESOURCE_NAME=`snapshot`}static{this.AGGREGATION=`${e.SNAPSHOT_RESOURCE_NAME}/aggregation`}static{this.COUNT=`${e.SNAPSHOT_RESOURCE_NAME}/count`}static{this.LIST=`${e.SNAPSHOT_RESOURCE_NAME}/list`}static{this.LIST_STATE=`${e.LIST}/state`}static{this.PAGED=`${e.SNAPSHOT_RESOURCE_NAME}/paged`}static{this.PAGED_STATE=`${e.PAGED}/state`}static{this.SINGLE=`${e.SNAPSHOT_RESOURCE_NAME}/single`}static{this.SINGLE_STATE=`${e.SINGLE}/state`}},J=class{constructor(e){this.apiMetadata=e}aggregate(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}aggregateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}count(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}list(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}listStateStream(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}paged(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}pagedState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}single(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}singleState(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}getById(e,t,n){let r=V({condition:m(e)});return this.single(r,t,n)}getStateById(e,t,n){let r=V({condition:m(e)});return this.singleState(r,t,n)}getByIds(e,t,n){if(e.length===0)return Promise.resolve([]);let r=H({filter:j.aggregateIds(e),limit:e.length});return this.list(r,t,n)}getStateByIds(e,t,n){if(e.length===0)return Promise.resolve([]);let r=H({filter:j.aggregateIds(e),limit:e.length});return this.listState(r,t,n)}};a([(0,n.post)(q.AGGREGATION),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`aggregate`,null),a([(0,n.post)(q.AGGREGATION,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`aggregateStream`,null),a([(0,n.post)(q.COUNT),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`count`,null),a([(0,n.post)(q.LIST),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`list`,null),a([(0,n.post)(q.LIST,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`listStream`,null),a([(0,n.post)(q.LIST_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`listState`,null),a([(0,n.post)(q.LIST_STATE,{headers:{Accept:e.ContentTypeValues.TEXT_EVENT_STREAM},resultExtractor:t.JsonEventStreamResultExtractor}),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`listStateStream`,null),a([(0,n.post)(q.PAGED),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`paged`,null),a([(0,n.post)(q.PAGED_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`pagedState`,null),a([(0,n.post)(q.SINGLE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`single`,null),a([(0,n.post)(q.SINGLE_STATE),i(0,(0,n.body)()),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Object,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`singleState`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getStateById`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getByIds`,null),a([i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Array,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],J.prototype,`getStateByIds`,null),J=a([(0,n.api)(),r(`design:paramtypes`,[Object])],J);var Y=class e{static{this.LOAD=`{id}/state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},X=class{constructor(e){this.apiMetadata=e}load(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadVersioned(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}loadTimeBased(e,t,r,i){throw(0,n.autoGeneratedError)(e,t,r,i)}};a([(0,n.get)(Y.LOAD),i(0,(0,n.path)(`id`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`load`,null),a([(0,n.get)(Y.LOAD_VERSIONED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`version`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`loadVersioned`,null),a([(0,n.get)(Y.LOAD_TIME_BASED),i(0,(0,n.path)(`id`)),i(1,(0,n.path)(`createTime`)),i(2,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[String,Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],X.prototype,`loadTimeBased`,null),X=a([(0,n.api)(),r(`design:paramtypes`,[Object])],X);var Z=class e{static{this.LOAD=`state`}static{this.LOAD_VERSIONED=`${e.LOAD}/{version}`}static{this.LOAD_TIME_BASED=`${e.LOAD}/time/{createTime}`}},Q=class{constructor(e){this.apiMetadata=e}load(e,t){throw(0,n.autoGeneratedError)(e,t)}loadVersioned(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}loadTimeBased(e,t,r){throw(0,n.autoGeneratedError)(e,t,r)}};a([(0,n.get)(Z.LOAD),i(0,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Q.prototype,`load`,null),a([(0,n.get)(Z.LOAD_VERSIONED),i(0,(0,n.path)(`version`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Q.prototype,`loadVersioned`,null),a([(0,n.get)(Z.LOAD_TIME_BASED),i(0,(0,n.path)(`createTime`)),i(1,(0,n.attribute)()),r(`design:type`,Function),r(`design:paramtypes`,[Number,typeof Record>`u`?Object:Record,typeof AbortController>`u`?Object:AbortController]),r(`design:returntype`,typeof Promise>`u`?Object:Promise)],Q.prototype,`loadTimeBased`,null),Q=a([(0,n.api)(),r(`design:paramtypes`,[Object])],Q);var ht=`~`;function gt({field:e,cursorId:t=`~`,direction:n=W.DESC}){return n===W.ASC?_(e,t):v(e,t)}function _t({field:e,cursorId:t=`~`,direction:n=W.DESC}){return n===W.ASC?j.gt(e,t):j.lt(e,t)}function vt({field:e,direction:t=W.DESC}){return{field:e,direction:t}}function yt(e){let t=e.query,n=vt(e),r=`filter`in t?t.filter:void 0;if(r!==void 0)return{...t,filter:j.and([_t(e),r]),sort:[n]};let i=t;return{...t,condition:p(gt(e),i.condition),sort:[n]}}function $(t){let n=(0,e.combineURLs)(t.resourceAttribution??``,t.aggregateName??``);return t.contextAlias&&(n=(0,e.combineURLs)(t.contextAlias,n)),{...t,basePath:n}}var bt=class{constructor(e){this.defaultOptions=e}createSnapshotQueryClient(e){let t=$({...this.defaultOptions,...e});return new J(t)}createLoadStateAggregateClient(e){let t=$({...this.defaultOptions,...e});return new X(t)}createOwnerLoadStateAggregateClient(e){let t=$({...this.defaultOptions,...e});return new Q(t)}createEventStreamQueryClient(e){let t=$({...this.defaultOptions,...e});return new K(t)}},xt={},St=[`*`],Ct=function(e){return e.NONE=``,e.TENANT=`/tenant/{tenantId}`,e.OWNER=`/owner/{ownerId}`,e.TENANT_OWNER=`/tenant/{tenantId}/owner/{ownerId}`,e}({}),wt=function(e){return e.RECOVERABLE=`RECOVERABLE`,e.UNKNOWN=`UNKNOWN`,e.UNRECOVERABLE=`UNRECOVERABLE`,e}({}),Tt=class e{static{this.SUCCEEDED=`Ok`}static{this.SUCCEEDED_MESSAGE=``}static{this.NOT_FOUND=`NotFound`}static{this.NOT_FOUND_MESSAGE=`Not found resource!`}static{this.BAD_REQUEST=`BadRequest`}static{this.ILLEGAL_ARGUMENT=`IllegalArgument`}static{this.ILLEGAL_STATE=`IllegalState`}static{this.REQUEST_TIMEOUT=`RequestTimeout`}static{this.TOO_MANY_REQUESTS=`TooManyRequests`}static{this.DUPLICATE_REQUEST_ID=`DuplicateRequestId`}static{this.COMMAND_VALIDATION=`CommandValidation`}static{this.REWRITE_NO_COMMAND=`RewriteNoCommand`}static{this.EVENT_VERSION_CONFLICT=`EventVersionConflict`}static{this.DUPLICATE_AGGREGATE_ID=`DuplicateAggregateId`}static{this.COMMAND_EXPECT_VERSION_CONFLICT=`CommandExpectVersionConflict`}static{this.SOURCING_VERSION_CONFLICT=`SourcingVersionConflict`}static{this.ILLEGAL_ACCESS_DELETED_AGGREGATE=`IllegalAccessDeletedAggregate`}static{this.ILLEGAL_ACCESS_OWNER_AGGREGATE=`IllegalAccessOwnerAggregate`}static{this.ILLEGAL_ACCESS_SPACE_AGGREGATE=`IllegalAccessSpaceAggregate`}static{this.INTERNAL_SERVER_ERROR=`InternalServerError`}static isSucceeded(t){return t===e.SUCCEEDED}static isError(t){return!e.isSucceeded(t)}},Et=function(e){return e.COMMAND=`COMMAND`,e.ERROR=`ERROR`,e.EVENT=`EVENT`,e.SOURCING=`SOURCING`,e.STATE_EVENT=`STATE_EVENT`,e}({}),Dt=``,Ot=function(e){return e.MAP=`MAP`,e.STRING=`STRING`,e}({});function kt(e,t,n){if(e==null)return n;let r=Array.isArray(t)?t:t.split(`.`).filter(Boolean);if(r.length===0)return e;let i=e;for(let e of r){if(Array.isArray(i)){let t=parseInt(e,10);if(isNaN(t)||t<0||!Number.isInteger(t))return n;i=i[t]}else if(typeof i==`object`)i=i[e];else return n;if(i==null)return n}return i}exports.AggregationDateUnit=M,exports.AggregationExpressionOperator=it,exports.AggregationExpressionType=rt,exports.AggregationFunction=at,exports.AggregationGroupType=tt,exports.AggregationMetricType=nt,exports.CURSOR_ID_START=ht,Object.defineProperty(exports,"CommandClient",{enumerable:!0,get:function(){return o}}),exports.CommandHeaders=s,exports.CommandStage=ee,exports.ConditionOptionKey=re,exports.DEFAULT_OWNER_ID=Dt,exports.DEFAULT_PAGINATION=L,exports.DEFAULT_PROJECTION=R,exports.DeletionState=f,exports.DomainEventStreamMetadataFields=pt,exports.EMPTY_ABAC_TAGS=xt,exports.EMPTY_PAGED_LIST=U,exports.EMPTY_VALUE_OPERATORS=ne,exports.ErrorCodes=Tt,Object.defineProperty(exports,"EventStreamQueryClient",{enumerable:!0,get:function(){return K}}),exports.EventStreamQueryEndpointPaths=G,exports.FilterOperator=He,exports.FunctionKind=Et,exports.LOGICAL_OPERATORS=te,Object.defineProperty(exports,"LoadOwnerStateAggregateClient",{enumerable:!0,get:function(){return Q}}),exports.LoadOwnerStateAggregateEndpointPaths=Z,Object.defineProperty(exports,"LoadStateAggregateClient",{enumerable:!0,get:function(){return X}}),exports.LoadStateAggregateEndpointPaths=Y,exports.MessageHeaderSqlType=Ot,exports.Operator=c,exports.QueryClientFactory=bt,exports.RecoverableType=wt,exports.ResourceAttributionPathSpec=Ct,exports.SearchMode=y,exports.SnapshotMetadataFields=mt,Object.defineProperty(exports,"SnapshotQueryClient",{enumerable:!0,get:function(){return J}}),exports.SnapshotQueryEndpointPaths=q,exports.SortDirection=W,exports.StringComparison=Ue,exports.TimeUnit=b,exports.WILDCARD_ABAC_TAG_VALUES=St,exports.active=fe,exports.aggregateId=m,exports.aggregateIds=ce,exports.aggregation=ot,exports.all=g,exports.allIn=xe,exports.and=p,exports.asc=dt,exports.beforeToday=Me,exports.between=be,exports.contains=_e,exports.createQueryApiMetadata=$,exports.cursorCondition=gt,exports.cursorFilter=_t,exports.cursorQuery=yt,exports.cursorSort=vt,exports.dateOptions=d,exports.defaultProjection=z,exports.deleted=h,exports.desc=ft,exports.earlierDays=Be,exports.elemMatch=Te,exports.endsWith=we,exports.eq=pe,exports.exists=Ae,exports.filter=j,exports.getPropertyValue=kt,exports.gt=_,exports.gte=he,exports.id=oe,exports.ids=se,exports.ignoreCaseOptions=u,exports.isFalse=ke,exports.isIn=ve,exports.isNull=Ee,exports.isTrue=Oe,exports.isValidateCondition=l,exports.lastMonth=Re,exports.lastWeek=Ie,exports.listQuery=H,exports.lt=v,exports.lte=ge,exports.match=Ce,exports.ne=me,exports.nextWeek=Fe,exports.nor=ae,exports.notIn=ye,exports.notNull=De,exports.or=ie,exports.ownerId=ue,exports.pagedList=ut,exports.pagedQuery=lt,exports.pagination=st,exports.projection=ct,exports.raw=Ve,exports.recentDays=ze,exports.singleQuery=V,exports.spaceId=de,exports.startsWith=Se,exports.tenantId=le,exports.thisMonth=Le,exports.thisWeek=Pe,exports.today=je,exports.tomorrow=Ne;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|