@ahoo-wang/fetcher-wow 1.6.2 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +200 -179
- 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/cursorQuery.d.ts +53 -0
- package/dist/query/cursorQuery.d.ts.map +1 -0
- package/dist/query/index.d.ts +1 -0
- package/dist/query/index.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
import { ResultExtractors as
|
|
1
|
+
import { ResultExtractors as y, ContentTypeValues as L, combineURLs as X, HttpMethod as B, mergeRequestOptions as O } from "@ahoo-wang/fetcher";
|
|
2
2
|
import { JsonEventStreamResultExtractor as h } from "@ahoo-wang/fetcher-eventstream";
|
|
3
3
|
var s = /* @__PURE__ */ ((t) => (t.AND = "AND", t.OR = "OR", t.NOR = "NOR", t.ID = "ID", t.IDS = "IDS", t.AGGREGATE_ID = "AGGREGATE_ID", t.AGGREGATE_IDS = "AGGREGATE_IDS", t.TENANT_ID = "TENANT_ID", t.OWNER_ID = "OWNER_ID", t.DELETED = "DELETED", t.ALL = "ALL", t.EQ = "EQ", t.NE = "NE", t.GT = "GT", t.LT = "LT", t.GTE = "GTE", t.LTE = "LTE", t.CONTAINS = "CONTAINS", t.IN = "IN", t.NOT_IN = "NOT_IN", t.BETWEEN = "BETWEEN", t.ALL_IN = "ALL_IN", t.STARTS_WITH = "STARTS_WITH", t.ENDS_WITH = "ENDS_WITH", t.ELEM_MATCH = "ELEM_MATCH", t.NULL = "NULL", t.NOT_NULL = "NOT_NULL", t.TRUE = "TRUE", t.FALSE = "FALSE", t.EXISTS = "EXISTS", t.TODAY = "TODAY", t.BEFORE_TODAY = "BEFORE_TODAY", t.TOMORROW = "TOMORROW", t.THIS_WEEK = "THIS_WEEK", t.NEXT_WEEK = "NEXT_WEEK", t.LAST_WEEK = "LAST_WEEK", t.THIS_MONTH = "THIS_MONTH", t.LAST_MONTH = "LAST_MONTH", t.RECENT_DAYS = "RECENT_DAYS", t.EARLIER_DAYS = "EARLIER_DAYS", t.RAW = "RAW", t))(s || {});
|
|
4
|
-
function
|
|
4
|
+
function C(t) {
|
|
5
5
|
return !!t;
|
|
6
6
|
}
|
|
7
7
|
const _ = class _ {
|
|
8
8
|
};
|
|
9
9
|
_.IGNORE_CASE_OPTION_KEY = "ignoreCase", _.ZONE_ID_OPTION_KEY = "zoneId", _.DATE_PATTERN_OPTION_KEY = "datePattern";
|
|
10
|
-
let
|
|
10
|
+
let W = _;
|
|
11
11
|
function M(t) {
|
|
12
12
|
if (!(typeof t > "u"))
|
|
13
13
|
return { ignoreCase: t };
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function N(t, E) {
|
|
16
16
|
if (typeof t > "u" && typeof E > "u")
|
|
17
17
|
return;
|
|
18
18
|
const T = {};
|
|
19
19
|
return typeof t < "u" && (T.datePattern = t), typeof E < "u" && (T.zoneId = E), T;
|
|
20
20
|
}
|
|
21
|
-
var
|
|
22
|
-
function
|
|
21
|
+
var a = /* @__PURE__ */ ((t) => (t.ACTIVE = "ACTIVE", t.DELETED = "DELETED", t.ALL = "ALL", t))(a || {});
|
|
22
|
+
function x(...t) {
|
|
23
23
|
if (t.length === 0)
|
|
24
24
|
return S();
|
|
25
25
|
if (t.length === 1)
|
|
26
|
-
return
|
|
26
|
+
return C(t[0]) ? t[0] : S();
|
|
27
27
|
const E = [];
|
|
28
28
|
return t.forEach((T) => {
|
|
29
|
-
T?.operator === s.ALL || !
|
|
29
|
+
T?.operator === s.ALL || !C(T) || (T.operator === s.AND && T.children ? E.push(...T.children) : E.push(T));
|
|
30
30
|
}), { operator: s.AND, children: E };
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function m(...t) {
|
|
33
33
|
const E = t?.filter(
|
|
34
|
-
(T) =>
|
|
34
|
+
(T) => C(T)
|
|
35
35
|
);
|
|
36
36
|
return E.length === 0 ? S() : { operator: s.OR, children: E };
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function d(...t) {
|
|
39
39
|
return t.length === 0 ? S() : { operator: s.NOR, children: t };
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function tt(t) {
|
|
42
42
|
return { operator: s.ID, value: t };
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Et(t) {
|
|
45
45
|
return { operator: s.IDS, value: t };
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Tt(t) {
|
|
48
48
|
return { operator: s.AGGREGATE_ID, value: t };
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function it(...t) {
|
|
51
51
|
return { operator: s.AGGREGATE_IDS, value: t };
|
|
52
52
|
}
|
|
53
|
-
function
|
|
53
|
+
function st(t) {
|
|
54
54
|
return { operator: s.TENANT_ID, value: t };
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function At(t) {
|
|
57
57
|
return { operator: s.OWNER_ID, value: t };
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function F(t) {
|
|
60
60
|
return { operator: s.DELETED, value: t };
|
|
61
61
|
}
|
|
62
|
-
function
|
|
63
|
-
return
|
|
62
|
+
function nt() {
|
|
63
|
+
return F(
|
|
64
64
|
"ACTIVE"
|
|
65
65
|
/* ACTIVE */
|
|
66
66
|
);
|
|
@@ -70,114 +70,114 @@ function S() {
|
|
|
70
70
|
operator: s.ALL
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function ct(t, E) {
|
|
74
74
|
return { field: t, operator: s.EQ, value: E };
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function rt(t, E) {
|
|
77
77
|
return { field: t, operator: s.NE, value: E };
|
|
78
78
|
}
|
|
79
|
-
function
|
|
79
|
+
function w(t, E) {
|
|
80
80
|
return { field: t, operator: s.GT, value: E };
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function J(t, E) {
|
|
83
83
|
return { field: t, operator: s.LT, value: E };
|
|
84
84
|
}
|
|
85
|
-
function
|
|
85
|
+
function ut(t, E) {
|
|
86
86
|
return { field: t, operator: s.GTE, value: E };
|
|
87
87
|
}
|
|
88
|
-
function
|
|
88
|
+
function It(t, E) {
|
|
89
89
|
return { field: t, operator: s.LTE, value: E };
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function Nt(t, E, T) {
|
|
92
92
|
const A = M(T);
|
|
93
93
|
return { field: t, operator: s.CONTAINS, value: E, options: A };
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function Rt(t, ...E) {
|
|
96
96
|
return { field: t, operator: s.IN, value: E };
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function et(t, ...E) {
|
|
99
99
|
return { field: t, operator: s.NOT_IN, value: E };
|
|
100
100
|
}
|
|
101
|
-
function
|
|
101
|
+
function St(t, E, T) {
|
|
102
102
|
return { field: t, operator: s.BETWEEN, value: [E, T] };
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function Dt(t, ...E) {
|
|
105
105
|
return { field: t, operator: s.ALL_IN, value: E };
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function Ot(t, E, T) {
|
|
108
108
|
const A = M(T);
|
|
109
109
|
return { field: t, operator: s.STARTS_WITH, value: E, options: A };
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function ot(t, E, T) {
|
|
112
112
|
const A = M(T);
|
|
113
113
|
return { field: t, operator: s.ENDS_WITH, value: E, options: A };
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function _t(t, E) {
|
|
116
116
|
return { field: t, operator: s.ELEM_MATCH, children: [E] };
|
|
117
117
|
}
|
|
118
|
-
function
|
|
118
|
+
function Lt(t) {
|
|
119
119
|
return { field: t, operator: s.NULL };
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ht(t) {
|
|
122
122
|
return { field: t, operator: s.NOT_NULL };
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function ft(t) {
|
|
125
125
|
return { field: t, operator: s.TRUE };
|
|
126
126
|
}
|
|
127
|
-
function
|
|
127
|
+
function Gt(t) {
|
|
128
128
|
return { field: t, operator: s.FALSE };
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Ct(t, E = !0) {
|
|
131
131
|
return { field: t, operator: s.EXISTS, value: E };
|
|
132
132
|
}
|
|
133
|
-
function
|
|
134
|
-
const A =
|
|
133
|
+
function Mt(t, E, T) {
|
|
134
|
+
const A = N(E, T);
|
|
135
135
|
return { field: t, operator: s.TODAY, options: A };
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
const R =
|
|
137
|
+
function lt(t, E, T, A) {
|
|
138
|
+
const R = N(T, A);
|
|
139
139
|
return { field: t, operator: s.BEFORE_TODAY, value: E, options: R };
|
|
140
140
|
}
|
|
141
|
-
function
|
|
142
|
-
const A =
|
|
141
|
+
function Wt(t, E, T) {
|
|
142
|
+
const A = N(E, T);
|
|
143
143
|
return { field: t, operator: s.TOMORROW, options: A };
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
const A =
|
|
145
|
+
function Pt(t, E, T) {
|
|
146
|
+
const A = N(E, T);
|
|
147
147
|
return { field: t, operator: s.THIS_WEEK, options: A };
|
|
148
148
|
}
|
|
149
|
-
function
|
|
150
|
-
const A =
|
|
149
|
+
function Ut(t, E, T) {
|
|
150
|
+
const A = N(E, T);
|
|
151
151
|
return { field: t, operator: s.NEXT_WEEK, options: A };
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
const A =
|
|
153
|
+
function gt(t, E, T) {
|
|
154
|
+
const A = N(E, T);
|
|
155
155
|
return { field: t, operator: s.LAST_WEEK, options: A };
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
const A =
|
|
157
|
+
function Vt(t, E, T) {
|
|
158
|
+
const A = N(E, T);
|
|
159
159
|
return { field: t, operator: s.THIS_MONTH, options: A };
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
const A =
|
|
161
|
+
function Xt(t, E, T) {
|
|
162
|
+
const A = N(E, T);
|
|
163
163
|
return { field: t, operator: s.LAST_MONTH, options: A };
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
const R =
|
|
165
|
+
function $t(t, E, T, A) {
|
|
166
|
+
const R = N(T, A);
|
|
167
167
|
return { field: t, operator: s.RECENT_DAYS, value: E, options: R };
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
const R =
|
|
169
|
+
function Yt(t, E, T, A) {
|
|
170
|
+
const R = N(T, A);
|
|
171
171
|
return { field: t, operator: s.EARLIER_DAYS, value: E, options: R };
|
|
172
172
|
}
|
|
173
|
-
function
|
|
173
|
+
function qt(t) {
|
|
174
174
|
return { operator: s.RAW, value: t };
|
|
175
175
|
}
|
|
176
176
|
const o = {
|
|
177
177
|
index: 1,
|
|
178
178
|
size: 10
|
|
179
179
|
};
|
|
180
|
-
function
|
|
180
|
+
function yt({
|
|
181
181
|
index: t = o.index,
|
|
182
182
|
size: E = o.size
|
|
183
183
|
} = o) {
|
|
@@ -186,17 +186,17 @@ function $t({
|
|
|
186
186
|
size: E
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
const
|
|
190
|
-
function
|
|
189
|
+
const b = {};
|
|
190
|
+
function Bt({
|
|
191
191
|
include: t,
|
|
192
192
|
exclude: E
|
|
193
|
-
} =
|
|
193
|
+
} = b) {
|
|
194
194
|
return {
|
|
195
195
|
include: t,
|
|
196
196
|
exclude: E
|
|
197
197
|
};
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function at({
|
|
200
200
|
condition: t = S(),
|
|
201
201
|
projection: E,
|
|
202
202
|
sort: T
|
|
@@ -207,7 +207,7 @@ function qt({
|
|
|
207
207
|
sort: T
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
-
function
|
|
210
|
+
function xt({
|
|
211
211
|
condition: t = S(),
|
|
212
212
|
projection: E,
|
|
213
213
|
sort: T,
|
|
@@ -220,7 +220,7 @@ function Bt({
|
|
|
220
220
|
limit: A
|
|
221
221
|
};
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function Ft({
|
|
224
224
|
condition: t = S(),
|
|
225
225
|
projection: E,
|
|
226
226
|
sort: T,
|
|
@@ -233,25 +233,25 @@ function yt({
|
|
|
233
233
|
pagination: A
|
|
234
234
|
};
|
|
235
235
|
}
|
|
236
|
-
const
|
|
236
|
+
const K = {
|
|
237
237
|
total: 0,
|
|
238
238
|
list: []
|
|
239
239
|
};
|
|
240
|
-
function
|
|
240
|
+
function wt({
|
|
241
241
|
total: t,
|
|
242
242
|
list: E = []
|
|
243
|
-
} =
|
|
243
|
+
} = K) {
|
|
244
244
|
return t === void 0 && (t = E.length), {
|
|
245
245
|
total: t,
|
|
246
246
|
list: E
|
|
247
247
|
};
|
|
248
248
|
}
|
|
249
|
-
const
|
|
250
|
-
resultExtractor:
|
|
249
|
+
const $ = {
|
|
250
|
+
resultExtractor: y.Json
|
|
251
251
|
}, f = {
|
|
252
252
|
resultExtractor: h
|
|
253
253
|
};
|
|
254
|
-
class
|
|
254
|
+
class Y {
|
|
255
255
|
/**
|
|
256
256
|
* Creates a new QueryClient instance.
|
|
257
257
|
* @param options - The client configuration options including fetcher and base path
|
|
@@ -274,41 +274,41 @@ class $ {
|
|
|
274
274
|
* @returns A promise that resolves to the query result
|
|
275
275
|
*/
|
|
276
276
|
async query(E, T, A, R = L.APPLICATION_JSON) {
|
|
277
|
-
const
|
|
278
|
-
url:
|
|
277
|
+
const q = {
|
|
278
|
+
url: X(this.options.basePath, E),
|
|
279
279
|
method: B.POST,
|
|
280
280
|
headers: {
|
|
281
281
|
Accept: R
|
|
282
282
|
},
|
|
283
283
|
body: T
|
|
284
284
|
};
|
|
285
|
-
return await this.options.fetcher.request(
|
|
285
|
+
return await this.options.fetcher.request(q, O($, A));
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
var
|
|
289
|
-
function
|
|
288
|
+
var G = /* @__PURE__ */ ((t) => (t.ASC = "ASC", t.DESC = "DESC", t))(G || {});
|
|
289
|
+
function Jt(t) {
|
|
290
290
|
return {
|
|
291
291
|
field: t,
|
|
292
292
|
direction: "ASC"
|
|
293
293
|
/* ASC */
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function bt(t) {
|
|
297
297
|
return {
|
|
298
298
|
field: t,
|
|
299
299
|
direction: "DESC"
|
|
300
300
|
/* DESC */
|
|
301
301
|
};
|
|
302
302
|
}
|
|
303
|
-
const
|
|
303
|
+
const n = class n {
|
|
304
304
|
};
|
|
305
|
-
|
|
306
|
-
let
|
|
305
|
+
n.HEADER = "header", n.COMMAND_OPERATOR = `${n.HEADER}.command_operator`, n.AGGREGATE_ID = "aggregateId", n.TENANT_ID = "tenantId", n.OWNER_ID = "ownerId", n.COMMAND_ID = "commandId", n.REQUEST_ID = "requestId", n.VERSION = "version", n.BODY = "body", n.BODY_ID = `${n.BODY}.id`, n.BODY_NAME = `${n.BODY}.name`, n.BODY_TYPE = `${n.BODY}.bodyType`, n.BODY_REVISION = `${n.BODY}.revision`, n.BODY_BODY = `${n.BODY}.body`, n.CREATE_TIME = "createTime";
|
|
306
|
+
let P = n;
|
|
307
307
|
const e = class e {
|
|
308
308
|
};
|
|
309
309
|
e.EVENT_STREAM_RESOURCE_NAME = "event", e.COUNT = `${e.EVENT_STREAM_RESOURCE_NAME}/count`, e.LIST = `${e.EVENT_STREAM_RESOURCE_NAME}/list`, e.PAGED = `${e.EVENT_STREAM_RESOURCE_NAME}/paged`;
|
|
310
310
|
let D = e;
|
|
311
|
-
class
|
|
311
|
+
class Kt extends Y {
|
|
312
312
|
/**
|
|
313
313
|
* Creates a new EventStreamQueryClient instance.
|
|
314
314
|
* @param options - The client configuration options including fetcher and base path
|
|
@@ -417,15 +417,15 @@ class wt extends $ {
|
|
|
417
417
|
return this.query(D.PAGED, E, { attributes: T });
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
|
-
const
|
|
420
|
+
const u = class u {
|
|
421
421
|
};
|
|
422
|
-
|
|
423
|
-
let
|
|
422
|
+
u.VERSION = "version", u.TENANT_ID = "tenantId", u.OWNER_ID = "ownerId", u.EVENT_ID = "eventId", u.FIRST_EVENT_TIME = "firstEventTime", u.EVENT_TIME = "eventTime", u.FIRST_OPERATOR = "firstOperator", u.OPERATOR = "operator", u.SNAPSHOT_TIME = "snapshotTime", u.DELETED = "deleted", u.STATE = "state";
|
|
423
|
+
let U = u;
|
|
424
424
|
const r = class r {
|
|
425
425
|
};
|
|
426
426
|
r.SNAPSHOT_RESOURCE_NAME = "snapshot", r.COUNT = `${r.SNAPSHOT_RESOURCE_NAME}/count`, r.LIST = `${r.SNAPSHOT_RESOURCE_NAME}/list`, r.LIST_STATE = `${r.LIST}/state`, r.PAGED = `${r.SNAPSHOT_RESOURCE_NAME}/paged`, r.PAGED_STATE = `${r.PAGED}/state`, r.SINGLE = `${r.SNAPSHOT_RESOURCE_NAME}/single`, r.SINGLE_STATE = `${r.SINGLE}/state`;
|
|
427
|
-
let
|
|
428
|
-
class
|
|
427
|
+
let I = r;
|
|
428
|
+
class Qt extends Y {
|
|
429
429
|
/**
|
|
430
430
|
* Creates a new SnapshotQueryClient instance.
|
|
431
431
|
* @param options - The configuration options for the client
|
|
@@ -449,7 +449,7 @@ class Jt extends $ {
|
|
|
449
449
|
* ```
|
|
450
450
|
*/
|
|
451
451
|
async count(E, T) {
|
|
452
|
-
return this.query(
|
|
452
|
+
return this.query(I.COUNT, E, { attributes: T });
|
|
453
453
|
}
|
|
454
454
|
/**
|
|
455
455
|
* Retrieves a list of materialized snapshots based on the provided query parameters.
|
|
@@ -472,7 +472,7 @@ class Jt extends $ {
|
|
|
472
472
|
* ```
|
|
473
473
|
*/
|
|
474
474
|
list(E, T) {
|
|
475
|
-
return this.query(
|
|
475
|
+
return this.query(I.LIST, E, { attributes: T });
|
|
476
476
|
}
|
|
477
477
|
/**
|
|
478
478
|
* Retrieves a stream of materialized snapshots based on the provided query parameters.
|
|
@@ -497,7 +497,7 @@ class Jt extends $ {
|
|
|
497
497
|
*/
|
|
498
498
|
listStream(E, T) {
|
|
499
499
|
return this.query(
|
|
500
|
-
|
|
500
|
+
I.LIST,
|
|
501
501
|
E,
|
|
502
502
|
O(f, {
|
|
503
503
|
resultExtractor: h,
|
|
@@ -527,7 +527,7 @@ class Jt extends $ {
|
|
|
527
527
|
* ```
|
|
528
528
|
*/
|
|
529
529
|
listState(E, T) {
|
|
530
|
-
return this.query(
|
|
530
|
+
return this.query(I.LIST_STATE, E, { attributes: T });
|
|
531
531
|
}
|
|
532
532
|
/**
|
|
533
533
|
* Retrieves a stream of snapshot states based on the provided query parameters.
|
|
@@ -552,7 +552,7 @@ class Jt extends $ {
|
|
|
552
552
|
*/
|
|
553
553
|
listStateStream(E, T) {
|
|
554
554
|
return this.query(
|
|
555
|
-
|
|
555
|
+
I.LIST_STATE,
|
|
556
556
|
E,
|
|
557
557
|
O(f, {
|
|
558
558
|
resultExtractor: h,
|
|
@@ -585,7 +585,7 @@ class Jt extends $ {
|
|
|
585
585
|
* ```
|
|
586
586
|
*/
|
|
587
587
|
paged(E, T) {
|
|
588
|
-
return this.query(
|
|
588
|
+
return this.query(I.PAGED, E, { attributes: T });
|
|
589
589
|
}
|
|
590
590
|
/**
|
|
591
591
|
* Retrieves a paged list of snapshot states based on the provided query parameters.
|
|
@@ -610,7 +610,7 @@ class Jt extends $ {
|
|
|
610
610
|
* ```
|
|
611
611
|
*/
|
|
612
612
|
pagedState(E, T) {
|
|
613
|
-
return this.query(
|
|
613
|
+
return this.query(I.PAGED_STATE, E, { attributes: T });
|
|
614
614
|
}
|
|
615
615
|
/**
|
|
616
616
|
* Retrieves a single materialized snapshot based on the provided query parameters.
|
|
@@ -631,7 +631,7 @@ class Jt extends $ {
|
|
|
631
631
|
* ```
|
|
632
632
|
*/
|
|
633
633
|
single(E, T) {
|
|
634
|
-
return this.query(
|
|
634
|
+
return this.query(I.SINGLE, E, { attributes: T });
|
|
635
635
|
}
|
|
636
636
|
/**
|
|
637
637
|
* Retrieves a single snapshot state based on the provided query parameters.
|
|
@@ -652,10 +652,27 @@ class Jt extends $ {
|
|
|
652
652
|
* ```
|
|
653
653
|
*/
|
|
654
654
|
singleState(E, T) {
|
|
655
|
-
return this.query(
|
|
655
|
+
return this.query(I.SINGLE_STATE, E, { attributes: T });
|
|
656
656
|
}
|
|
657
657
|
}
|
|
658
|
-
|
|
658
|
+
const Q = "~";
|
|
659
|
+
function v({
|
|
660
|
+
field: t,
|
|
661
|
+
cursorId: E = Q,
|
|
662
|
+
direction: T = G.DESC
|
|
663
|
+
}) {
|
|
664
|
+
return T === G.ASC ? w(t, E) : J(t, E);
|
|
665
|
+
}
|
|
666
|
+
function k({ field: t, direction: E = G.DESC }) {
|
|
667
|
+
return { field: t, direction: E };
|
|
668
|
+
}
|
|
669
|
+
function vt(t) {
|
|
670
|
+
const E = t.query;
|
|
671
|
+
return E.condition = x(v(t), E.condition), E.sort = [
|
|
672
|
+
k(t)
|
|
673
|
+
], E;
|
|
674
|
+
}
|
|
675
|
+
class kt {
|
|
659
676
|
constructor(E) {
|
|
660
677
|
this.options = E;
|
|
661
678
|
}
|
|
@@ -674,11 +691,11 @@ class bt {
|
|
|
674
691
|
* @returns A promise that resolves to the extracted result of type R
|
|
675
692
|
*/
|
|
676
693
|
async sendCommand(E, T, A) {
|
|
677
|
-
const R =
|
|
694
|
+
const R = X(this.options.basePath, E), l = {
|
|
678
695
|
...T,
|
|
679
696
|
url: R
|
|
680
697
|
};
|
|
681
|
-
return await this.options.fetcher.request(l, O(
|
|
698
|
+
return await this.options.fetcher.request(l, O($, A));
|
|
682
699
|
}
|
|
683
700
|
/**
|
|
684
701
|
* Send a command to the server and wait for the result.
|
|
@@ -750,9 +767,9 @@ class bt {
|
|
|
750
767
|
const i = class i {
|
|
751
768
|
};
|
|
752
769
|
i.COMMAND_HEADERS_PREFIX = "Command-", i.TENANT_ID = `${i.COMMAND_HEADERS_PREFIX}Tenant-Id`, i.OWNER_ID = `${i.COMMAND_HEADERS_PREFIX}Owner-Id`, i.AGGREGATE_ID = `${i.COMMAND_HEADERS_PREFIX}Aggregate-Id`, i.AGGREGATE_VERSION = `${i.COMMAND_HEADERS_PREFIX}Aggregate-Version`, i.WAIT_PREFIX = `${i.COMMAND_HEADERS_PREFIX}Wait-`, i.WAIT_TIME_OUT = `${i.WAIT_PREFIX}Timeout`, i.WAIT_STAGE = `${i.WAIT_PREFIX}Stage`, i.WAIT_CONTEXT = `${i.WAIT_PREFIX}Context`, i.WAIT_PROCESSOR = `${i.WAIT_PREFIX}Processor`, i.WAIT_FUNCTION = `${i.WAIT_PREFIX}Function`, i.WAIT_TAIL_PREFIX = `${i.WAIT_PREFIX}Tail-`, i.WAIT_TAIL_STAGE = `${i.WAIT_TAIL_PREFIX}Stage`, i.WAIT_TAIL_CONTEXT = `${i.WAIT_TAIL_PREFIX}Context`, i.WAIT_TAIL_PROCESSOR = `${i.WAIT_TAIL_PREFIX}Processor`, i.WAIT_TAIL_FUNCTION = `${i.WAIT_TAIL_PREFIX}Function`, i.REQUEST_ID = `${i.COMMAND_HEADERS_PREFIX}Request-Id`, i.LOCAL_FIRST = `${i.COMMAND_HEADERS_PREFIX}Local-First`, i.COMMAND_AGGREGATE_CONTEXT = `${i.COMMAND_HEADERS_PREFIX}Aggregate-Context`, i.COMMAND_AGGREGATE_NAME = `${i.COMMAND_HEADERS_PREFIX}Aggregate-Name`, i.COMMAND_TYPE = `${i.COMMAND_HEADERS_PREFIX}Type`, i.COMMAND_HEADER_X_PREFIX = `${i.COMMAND_HEADERS_PREFIX}Header-`;
|
|
753
|
-
let
|
|
754
|
-
var
|
|
755
|
-
const
|
|
770
|
+
let g = i;
|
|
771
|
+
var z = /* @__PURE__ */ ((t) => (t.SENT = "SENT", t.PROCESSED = "PROCESSED", t.SNAPSHOT = "SNAPSHOT", t.PROJECTED = "PROJECTED", t.EVENT_HANDLED = "EVENT_HANDLED", t.SAGA_HANDLED = "SAGA_HANDLED", t))(z || {}), H = /* @__PURE__ */ ((t) => (t.RECOVERABLE = "RECOVERABLE", t.UNKNOWN = "UNKNOWN", t.UNRECOVERABLE = "UNRECOVERABLE", t))(H || {});
|
|
772
|
+
const c = class c {
|
|
756
773
|
/**
|
|
757
774
|
* Checks if the provided error code represents a successful operation.
|
|
758
775
|
*
|
|
@@ -760,7 +777,7 @@ const n = class n {
|
|
|
760
777
|
* @returns true if the error code is 'Ok', false otherwise
|
|
761
778
|
*/
|
|
762
779
|
static isSucceeded(E) {
|
|
763
|
-
return E ===
|
|
780
|
+
return E === c.SUCCEEDED;
|
|
764
781
|
}
|
|
765
782
|
/**
|
|
766
783
|
* Checks if the provided error code represents an error condition.
|
|
@@ -769,89 +786,93 @@ const n = class n {
|
|
|
769
786
|
* @returns true if the error code is not 'Ok', false otherwise
|
|
770
787
|
*/
|
|
771
788
|
static isError(E) {
|
|
772
|
-
return !
|
|
789
|
+
return !c.isSucceeded(E);
|
|
773
790
|
}
|
|
774
791
|
};
|
|
775
|
-
|
|
776
|
-
let
|
|
777
|
-
var
|
|
778
|
-
const
|
|
792
|
+
c.SUCCEEDED = "Ok", c.SUCCEEDED_MESSAGE = "", c.NOT_FOUND = "NotFound", c.NOT_FOUND_MESSAGE = "Not found resource!", c.BAD_REQUEST = "BadRequest", c.ILLEGAL_ARGUMENT = "IllegalArgument", c.ILLEGAL_STATE = "IllegalState", c.REQUEST_TIMEOUT = "RequestTimeout", c.TOO_MANY_REQUESTS = "TooManyRequests", c.DUPLICATE_REQUEST_ID = "DuplicateRequestId", c.COMMAND_VALIDATION = "CommandValidation", c.REWRITE_NO_COMMAND = "RewriteNoCommand", c.EVENT_VERSION_CONFLICT = "EventVersionConflict", c.DUPLICATE_AGGREGATE_ID = "DuplicateAggregateId", c.COMMAND_EXPECT_VERSION_CONFLICT = "CommandExpectVersionConflict", c.SOURCING_VERSION_CONFLICT = "SourcingVersionConflict", c.ILLEGAL_ACCESS_DELETED_AGGREGATE = "IllegalAccessDeletedAggregate", c.ILLEGAL_ACCESS_OWNER_AGGREGATE = "IllegalAccessOwnerAggregate", c.INTERNAL_SERVER_ERROR = "InternalServerError";
|
|
793
|
+
let V = c;
|
|
794
|
+
var j = /* @__PURE__ */ ((t) => (t.COMMAND = "COMMAND", t.ERROR = "ERROR", t.EVENT = "EVENT", t.SOURCING = "SOURCING", t.STATE_EVENT = "STATE_EVENT", t))(j || {});
|
|
795
|
+
const zt = "";
|
|
779
796
|
export {
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
797
|
+
Q as CURSOR_ID_START,
|
|
798
|
+
kt as CommandClient,
|
|
799
|
+
g as CommandHttpHeaders,
|
|
800
|
+
z as CommandStage,
|
|
801
|
+
W as ConditionOptionKey,
|
|
802
|
+
zt as DEFAULT_OWNER_ID,
|
|
785
803
|
o as DEFAULT_PAGINATION,
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
804
|
+
b as DEFAULT_PROJECTION,
|
|
805
|
+
a as DeletionState,
|
|
806
|
+
P as DomainEventStreamMetadataFields,
|
|
807
|
+
K as EMPTY_PAGED_LIST,
|
|
808
|
+
V as ErrorCodes,
|
|
809
|
+
Kt as EventStreamQueryClient,
|
|
792
810
|
D as EventStreamQueryEndpointPaths,
|
|
793
|
-
|
|
811
|
+
j as FunctionKind,
|
|
794
812
|
f as JSON_EVENT_STREAM_QUERY_REQUEST_OPTIONS,
|
|
795
|
-
|
|
813
|
+
$ as JSON_QUERY_REQUEST_OPTIONS,
|
|
796
814
|
s as Operator,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
815
|
+
Y as QueryClient,
|
|
816
|
+
H as RecoverableType,
|
|
817
|
+
U as SnapshotMetadataFields,
|
|
818
|
+
Qt as SnapshotQueryClient,
|
|
819
|
+
I as SnapshotQueryEndpointPaths,
|
|
820
|
+
G as SortDirection,
|
|
821
|
+
nt as active,
|
|
822
|
+
Tt as aggregateId,
|
|
823
|
+
it as aggregateIds,
|
|
806
824
|
S as all,
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
ct as
|
|
823
|
-
|
|
824
|
-
|
|
825
|
+
Dt as allIn,
|
|
826
|
+
x as and,
|
|
827
|
+
Jt as asc,
|
|
828
|
+
lt as beforeToday,
|
|
829
|
+
St as between,
|
|
830
|
+
Nt as contains,
|
|
831
|
+
v as cursorCondition,
|
|
832
|
+
vt as cursorQuery,
|
|
833
|
+
k as cursorSort,
|
|
834
|
+
N as dateOptions,
|
|
835
|
+
F as deleted,
|
|
836
|
+
bt as desc,
|
|
837
|
+
Yt as earlierDays,
|
|
838
|
+
_t as elemMatch,
|
|
839
|
+
ot as endsWith,
|
|
840
|
+
ct as eq,
|
|
841
|
+
Ct as exists,
|
|
842
|
+
w as gt,
|
|
843
|
+
ut as gte,
|
|
844
|
+
tt as id,
|
|
845
|
+
Et as ids,
|
|
825
846
|
M as ignoreCaseOptions,
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
847
|
+
Gt as isFalse,
|
|
848
|
+
Rt as isIn,
|
|
849
|
+
Lt as isNull,
|
|
850
|
+
ft as isTrue,
|
|
851
|
+
C as isValidateCondition,
|
|
852
|
+
Xt as lastMonth,
|
|
853
|
+
gt as lastWeek,
|
|
854
|
+
xt as listQuery,
|
|
855
|
+
J as lt,
|
|
856
|
+
It as lte,
|
|
857
|
+
rt as ne,
|
|
858
|
+
Ut as nextWeek,
|
|
859
|
+
d as nor,
|
|
860
|
+
et as notIn,
|
|
861
|
+
ht as notNull,
|
|
862
|
+
m as or,
|
|
863
|
+
At as ownerId,
|
|
864
|
+
wt as pagedList,
|
|
865
|
+
Ft as pagedQuery,
|
|
866
|
+
yt as pagination,
|
|
867
|
+
Bt as projection,
|
|
868
|
+
qt as raw,
|
|
869
|
+
$t as recentDays,
|
|
870
|
+
at as singleQuery,
|
|
871
|
+
Ot as startsWith,
|
|
872
|
+
st as tenantId,
|
|
873
|
+
Vt as thisMonth,
|
|
874
|
+
Pt as thisWeek,
|
|
875
|
+
Mt as today,
|
|
876
|
+
Wt as tomorrow
|
|
856
877
|
};
|
|
857
878
|
//# sourceMappingURL=index.es.js.map
|