@kinotic-ai/core 1.0.0-beta.0 → 1.0.0-beta.2
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 +62 -0
- package/dist/index.cjs +189 -280
- package/dist/index.d.cts +446 -517
- package/dist/index.d.ts +446 -517
- package/dist/index.js +189 -280
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -33,14 +33,27 @@ declare class ConnectionInfo extends ServerInfo {
|
|
|
33
33
|
*/
|
|
34
34
|
disableStickySession?: boolean | null;
|
|
35
35
|
}
|
|
36
|
+
import { IEvent } from "./IEventBus";
|
|
36
37
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
38
|
+
* Interface for the service context, extendable by users for type-safe context data.
|
|
39
|
+
*
|
|
40
|
+
* @author Navid Mitchell 🤝Grok
|
|
41
|
+
* @since 3/25/2025
|
|
39
42
|
*/
|
|
40
|
-
interface
|
|
41
|
-
|
|
43
|
+
interface ServiceContext {
|
|
44
|
+
[key: string]: any;
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
47
|
+
* Interface for interceptors that create or modify the ServiceContext before service method invocation.
|
|
48
|
+
*
|
|
49
|
+
* @author Navid Mitchell 🤝Grok
|
|
50
|
+
* @since 3/25/2025
|
|
51
|
+
*/
|
|
52
|
+
interface ContextInterceptor<T extends ServiceContext> {
|
|
53
|
+
intercept(event: IEvent, context: T): Promise<T> | T;
|
|
54
|
+
}
|
|
55
|
+
import { Identifiable } from "@/api/Identifiable";
|
|
56
|
+
/**
|
|
44
57
|
* Created by Navíd Mitchell 🤪on 6/16/23.
|
|
45
58
|
*/
|
|
46
59
|
interface IParticipant extends Identifiable<string> {
|
|
@@ -87,291 +100,6 @@ declare class ConnectedInfo {
|
|
|
87
100
|
replyToId: string;
|
|
88
101
|
participant: Participant;
|
|
89
102
|
}
|
|
90
|
-
/**
|
|
91
|
-
* A page is a sublist of a list of objects.
|
|
92
|
-
* @author Navid Mitchell
|
|
93
|
-
*/
|
|
94
|
-
interface Page<T> {
|
|
95
|
-
/**
|
|
96
|
-
* @return the total number of elements or null or undefined if not known.
|
|
97
|
-
*/
|
|
98
|
-
readonly totalElements: number | null | undefined;
|
|
99
|
-
/**
|
|
100
|
-
* The cursor to be used for subsequent retrieval of data.
|
|
101
|
-
* @return an opaque string representation of the cursor, or null if this is the last page, or undefined if cursor paging is not being used.
|
|
102
|
-
*/
|
|
103
|
-
readonly cursor: string | null | undefined;
|
|
104
|
-
/**
|
|
105
|
-
* @return the page content as {@link Array} or null or undefined if no data is available.
|
|
106
|
-
*/
|
|
107
|
-
readonly content: T[] | null | undefined;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Enumeration for sort directions.
|
|
111
|
-
*
|
|
112
|
-
* Adapted from the Spring Data Commons Package
|
|
113
|
-
*
|
|
114
|
-
* @author Oliver Gierke
|
|
115
|
-
* @author Navid Mitchell
|
|
116
|
-
*/
|
|
117
|
-
declare enum Direction {
|
|
118
|
-
ASC = "ASC",
|
|
119
|
-
DESC = "DESC"
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Enumeration for null handling hints that can be used in {@link Order} expressions.
|
|
123
|
-
*
|
|
124
|
-
* Adapted from the Spring Data Commons Package
|
|
125
|
-
*
|
|
126
|
-
* @author Thomas Darimont
|
|
127
|
-
* @author Navid Mitchell
|
|
128
|
-
* @since 1.8
|
|
129
|
-
*/
|
|
130
|
-
declare enum NullHandling {
|
|
131
|
-
/**
|
|
132
|
-
* Lets the data store decide what to do with nulls.
|
|
133
|
-
*/
|
|
134
|
-
NATIVE = "NATIVE",
|
|
135
|
-
/**
|
|
136
|
-
* A hint to the used data store to order entries with null values before non-null entries.
|
|
137
|
-
*/
|
|
138
|
-
NULLS_FIRST = "NULLS_FIRST",
|
|
139
|
-
/**
|
|
140
|
-
* A hint to the used data store to order entries with null values after non-null entries.
|
|
141
|
-
*/
|
|
142
|
-
NULLS_LAST = "NULLS_LAST"
|
|
143
|
-
}
|
|
144
|
-
declare class Order {
|
|
145
|
-
property: string;
|
|
146
|
-
direction: Direction;
|
|
147
|
-
nullHandling: NullHandling;
|
|
148
|
-
constructor(property: string, direction: Direction | null);
|
|
149
|
-
/**
|
|
150
|
-
* Returns whether sorting for this property shall be ascending.
|
|
151
|
-
*/
|
|
152
|
-
isAscending(): boolean;
|
|
153
|
-
/**
|
|
154
|
-
* Returns whether sorting for this property shall be descending.
|
|
155
|
-
*/
|
|
156
|
-
isDescending(): boolean;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Sort option for queries. You have to provide at least a list of properties to sort for that must not include
|
|
160
|
-
* {@literal null} or empty strings. The direction defaults to {@link Sort#DEFAULT_DIRECTION}.
|
|
161
|
-
*
|
|
162
|
-
* Adapted from the Spring Data Commons Package
|
|
163
|
-
*
|
|
164
|
-
* @author Oliver Gierke
|
|
165
|
-
* @author Thomas Darimont
|
|
166
|
-
* @author Mark Paluch
|
|
167
|
-
* @author Navid Mitchell
|
|
168
|
-
*/
|
|
169
|
-
declare class Sort {
|
|
170
|
-
orders: Order[];
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Abstract interface for pagination information.
|
|
174
|
-
*
|
|
175
|
-
* Adapted from the Spring Data Commons Package
|
|
176
|
-
*
|
|
177
|
-
* @author Oliver Gierke
|
|
178
|
-
* @author Navid Mitchell
|
|
179
|
-
*/
|
|
180
|
-
declare abstract class Pageable {
|
|
181
|
-
/**
|
|
182
|
-
* Returns the sorting parameters (optional).
|
|
183
|
-
*/
|
|
184
|
-
sort?: Sort | null | undefined;
|
|
185
|
-
/**
|
|
186
|
-
* Returns the number of items to be returned.
|
|
187
|
-
*/
|
|
188
|
-
pageSize: number;
|
|
189
|
-
/**
|
|
190
|
-
* Creates a {@link Pageable} that uses Offset based pagination.
|
|
191
|
-
* @param pageNumber zero based page index.
|
|
192
|
-
* @param pageSize the size of the page to be returned.
|
|
193
|
-
* @param sort the sorting parameters (optional).
|
|
194
|
-
*/
|
|
195
|
-
static create(pageNumber: number, pageSize: number, sort?: Sort | null): OffsetPageable;
|
|
196
|
-
/**
|
|
197
|
-
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
198
|
-
* @param cursor the cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
199
|
-
* @param pageSize the size of the page to be returned.
|
|
200
|
-
* @param sort the sorting parameters (optional).
|
|
201
|
-
*/
|
|
202
|
-
static createWithCursor(cursor: string | null, pageSize: number, sort?: Sort | null): CursorPageable;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Implementation of {@link Pageable} that uses Offset based pagination.
|
|
206
|
-
*/
|
|
207
|
-
declare class OffsetPageable extends Pageable {
|
|
208
|
-
/**
|
|
209
|
-
* Returns the page to be returned.
|
|
210
|
-
*/
|
|
211
|
-
pageNumber: number;
|
|
212
|
-
/**
|
|
213
|
-
* Creates a {@link Pageable} that uses Offset based pagination.
|
|
214
|
-
* @param pageNumber zero based page index.
|
|
215
|
-
* @param pageSize the size of the page to be returned.
|
|
216
|
-
* @param sort the sorting parameters (optional).
|
|
217
|
-
*/
|
|
218
|
-
constructor(pageNumber: number, pageSize: number, sort?: Sort | null);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Implementation of {@link Pageable} that uses Cursor based pagination.
|
|
222
|
-
*/
|
|
223
|
-
declare class CursorPageable extends Pageable {
|
|
224
|
-
/**
|
|
225
|
-
* The cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
226
|
-
*/
|
|
227
|
-
cursor: string | null;
|
|
228
|
-
/**
|
|
229
|
-
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
230
|
-
* @param cursor the cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
231
|
-
* @param pageSize the size of the page to be returned.
|
|
232
|
-
* @param sort the sorting parameters (optional).
|
|
233
|
-
*/
|
|
234
|
-
constructor(cursor: string | null, pageSize: number, sort?: Sort | null);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* {@link IDataSource} provides an abstract way to retrieve data from various sources
|
|
238
|
-
*/
|
|
239
|
-
interface IDataSource<T> {
|
|
240
|
-
/**
|
|
241
|
-
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
|
|
242
|
-
*
|
|
243
|
-
* @param pageable the page settings to be used
|
|
244
|
-
* @return a {@link Promise} emitting the page of entities
|
|
245
|
-
*/
|
|
246
|
-
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
247
|
-
/**
|
|
248
|
-
* Returns a {@link Page} of entities matching the search text and paging restriction provided in the {@code Pageable} object.
|
|
249
|
-
*
|
|
250
|
-
* @param searchText the text to search for entities for
|
|
251
|
-
* @param pageable the page settings to be used
|
|
252
|
-
* @return a {@link Promise} emitting the page of entities
|
|
253
|
-
*/
|
|
254
|
-
search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
255
|
-
}
|
|
256
|
-
interface IEditableDataSource<T extends Identifiable<string>> extends IDataSource<T> {
|
|
257
|
-
/**
|
|
258
|
-
* Creates a new entity if one does not already exist for the given id
|
|
259
|
-
* @param entity to create if one does not already exist
|
|
260
|
-
* @return a {@link Promise} containing the new entity or an error if an exception occurred
|
|
261
|
-
*/
|
|
262
|
-
create(entity: T): Promise<T>;
|
|
263
|
-
/**
|
|
264
|
-
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
|
|
265
|
-
* entity instance completely.
|
|
266
|
-
*
|
|
267
|
-
* @param entity must not be {@literal null}.
|
|
268
|
-
* @return a {@link Promise} emitting the saved entity.
|
|
269
|
-
* @throws Error in case the given {@literal entity} is {@literal null}.
|
|
270
|
-
*/
|
|
271
|
-
save(entity: T): Promise<T>;
|
|
272
|
-
/**
|
|
273
|
-
* Retrieves an entity by its id.
|
|
274
|
-
*
|
|
275
|
-
* @param id must not be {@literal null}.
|
|
276
|
-
* @return a {@link Promise} emitting the entity with the given id or {@link Promise#empty()} if none found.
|
|
277
|
-
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
278
|
-
*/
|
|
279
|
-
findById(id: string): Promise<T>;
|
|
280
|
-
/**
|
|
281
|
-
* Deletes the entity with the given id.
|
|
282
|
-
*
|
|
283
|
-
* @param id must not be {@literal null}.
|
|
284
|
-
* @return a {@link Promise} signaling when operation has completed.
|
|
285
|
-
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
286
|
-
*/
|
|
287
|
-
deleteById(id: string): Promise<void>;
|
|
288
|
-
/**
|
|
289
|
-
* Returns a {@link Page} of entities not in the ids list and meeting the paging restriction provided in the {@code Pageable} object.
|
|
290
|
-
*
|
|
291
|
-
* @param ids not to be returned in the Page
|
|
292
|
-
* @param pageable the page settings to be used
|
|
293
|
-
* @return a {@link Promise} emitting the page of entities
|
|
294
|
-
*/
|
|
295
|
-
findByIdNotIn(ids: string[], pageable: Pageable): Promise<Page<Identifiable<string>>>;
|
|
296
|
-
}
|
|
297
|
-
declare class DataSourceUtils {
|
|
298
|
-
static instanceOfEditableDataSource(datasource: IDataSource<any> | IEditableDataSource<any>): datasource is IEditableDataSource<any>;
|
|
299
|
-
}
|
|
300
|
-
/**
|
|
301
|
-
* A {@link ICrudServiceProxy} is a proxy for a remote CRUD service
|
|
302
|
-
*/
|
|
303
|
-
interface ICrudServiceProxy<T extends Identifiable<string>> extends IEditableDataSource<T> {
|
|
304
|
-
/**
|
|
305
|
-
* Creates a new entity if one does not already exist for the given id
|
|
306
|
-
* @param entity to create if one does not already exist
|
|
307
|
-
* @return a {@link Promise} containing the new entity or an error if an exception occurred
|
|
308
|
-
*/
|
|
309
|
-
create(entity: T): Promise<T>;
|
|
310
|
-
/**
|
|
311
|
-
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
|
|
312
|
-
* entity instance completely.
|
|
313
|
-
*
|
|
314
|
-
* @param entity must not be {@literal null}.
|
|
315
|
-
* @return a {@link Promise} emitting the saved entity.
|
|
316
|
-
* @throws Error in case the given {@literal entity} is {@literal null}.
|
|
317
|
-
*/
|
|
318
|
-
save(entity: T): Promise<T>;
|
|
319
|
-
/**
|
|
320
|
-
* Retrieves an entity by its id.
|
|
321
|
-
*
|
|
322
|
-
* @param id must not be {@literal null}.
|
|
323
|
-
* @return a {@link Promise} emitting the entity with the given id or {@link Promise#empty()} if none found.
|
|
324
|
-
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
325
|
-
*/
|
|
326
|
-
findById(id: string): Promise<T>;
|
|
327
|
-
/**s
|
|
328
|
-
* Returns the number of entities available.
|
|
329
|
-
*
|
|
330
|
-
* @return a {@link Promise} emitting the number of entities.
|
|
331
|
-
*/
|
|
332
|
-
count(): Promise<number>;
|
|
333
|
-
/**
|
|
334
|
-
* Deletes the entity with the given id.
|
|
335
|
-
*
|
|
336
|
-
* @param id must not be {@literal null}.
|
|
337
|
-
* @return a {@link Promise} signaling when operation has completed.
|
|
338
|
-
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
339
|
-
*/
|
|
340
|
-
deleteById(id: string): Promise<void>;
|
|
341
|
-
/**
|
|
342
|
-
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
|
|
343
|
-
*
|
|
344
|
-
* @param pageable the page settings to be used
|
|
345
|
-
* @return a {@link Promise} emitting the page of entities
|
|
346
|
-
*/
|
|
347
|
-
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
348
|
-
/**
|
|
349
|
-
* Returns a {@link Page} of entities not in the ids list and meeting the paging restriction provided in the {@code Pageable} object.
|
|
350
|
-
*
|
|
351
|
-
* @param ids not to be returned in the Page
|
|
352
|
-
* @param pageable the page settings to be used
|
|
353
|
-
* @return a {@link Promise} emitting the page of entities
|
|
354
|
-
*/
|
|
355
|
-
findByIdNotIn(ids: string[], pageable: Pageable): Promise<Page<Identifiable<string>>>;
|
|
356
|
-
/**
|
|
357
|
-
* Returns a {@link Page} of entities matching the search text and paging restriction provided in the {@code Pageable} object.
|
|
358
|
-
*
|
|
359
|
-
* @param searchText the text to search for entities for
|
|
360
|
-
* @param pageable the page settings to be used
|
|
361
|
-
* @return a {@link Promise} emitting the page of entities
|
|
362
|
-
*/
|
|
363
|
-
search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* Produces {@link ICrudServiceProxy} Proxies for a known remote CRUD service
|
|
367
|
-
*/
|
|
368
|
-
interface ICrudServiceProxyFactory {
|
|
369
|
-
/**
|
|
370
|
-
* Produces a {@link ICrudServiceProxy} for the given serviceIdentifier
|
|
371
|
-
* @param serviceIdentifier the service identifier to produce a proxy for
|
|
372
|
-
*/
|
|
373
|
-
crudServiceProxy<T extends Identifiable<string>>(serviceIdentifier: string): ICrudServiceProxy<T>;
|
|
374
|
-
}
|
|
375
103
|
import { Optional } from "typescript-optional";
|
|
376
104
|
import { Observable } from "rxjs";
|
|
377
105
|
/**
|
|
@@ -388,7 +116,7 @@ declare class KinoticError extends Error {
|
|
|
388
116
|
*
|
|
389
117
|
* Created by Navid Mitchell on 2019-01-04.
|
|
390
118
|
*/
|
|
391
|
-
interface
|
|
119
|
+
interface IEvent2 {
|
|
392
120
|
/**
|
|
393
121
|
* The cri that specifies where the event should be routed
|
|
394
122
|
*/
|
|
@@ -491,14 +219,14 @@ interface IEventBus {
|
|
|
491
219
|
* Creates a subscription for all {@link IEvent}'s for the given destination
|
|
492
220
|
* @param cri to subscribe to
|
|
493
221
|
*/
|
|
494
|
-
observe(cri: string): Observable<
|
|
222
|
+
observe(cri: string): Observable<IEvent2>;
|
|
495
223
|
/**
|
|
496
224
|
* Sends an {@link IEvent} expecting a response
|
|
497
225
|
* All response correlation will be handled internally
|
|
498
226
|
* @param event to send as the request
|
|
499
227
|
* @return a Promise that will resolve when the response is received
|
|
500
228
|
*/
|
|
501
|
-
request(event:
|
|
229
|
+
request(event: IEvent2): Promise<IEvent2>;
|
|
502
230
|
/**
|
|
503
231
|
* Sends an {@link IEvent} expecting multiple responses
|
|
504
232
|
* All response correlation will be handled internally
|
|
@@ -507,12 +235,12 @@ interface IEventBus {
|
|
|
507
235
|
* @return an {@link Observable<IEvent} that will provide the response stream
|
|
508
236
|
* NOTE: the naming here is similar to RSocket https://www.baeldung.com/rsocket#3-requeststream
|
|
509
237
|
*/
|
|
510
|
-
requestStream(event:
|
|
238
|
+
requestStream(event: IEvent2, sendControlEvents: boolean): Observable<IEvent2>;
|
|
511
239
|
/**
|
|
512
240
|
* Send a single {@link IEvent} to the connected server
|
|
513
241
|
* @param event to send
|
|
514
242
|
*/
|
|
515
|
-
send(event:
|
|
243
|
+
send(event: IEvent2): void;
|
|
516
244
|
}
|
|
517
245
|
/**
|
|
518
246
|
* Constants used within {@link IEvent}'s to control the flow of events
|
|
@@ -572,36 +300,18 @@ declare enum EventConstants {
|
|
|
572
300
|
/**
|
|
573
301
|
* The traceparent HTTP header field identifies the incoming request in a tracing system. It has four fields:
|
|
574
302
|
*
|
|
575
|
-
* version
|
|
576
|
-
* trace-id
|
|
577
|
-
* parent-id
|
|
578
|
-
* trace-flags
|
|
579
|
-
* @see https://www.w3.org/TR/trace-context/#traceparent-header
|
|
580
|
-
*/
|
|
581
|
-
TRACEPARENT_HEADER = "traceparent",
|
|
582
|
-
/**
|
|
583
|
-
* The main purpose of the tracestate header is to provide additional vendor-specific trace identification information across different distributed tracing systems and is a companion header for the traceparent field. It also conveys information about the request’s position in multiple distributed tracing graphs.
|
|
584
|
-
* @see https://www.w3.org/TR/trace-context/#tracestate-header
|
|
585
|
-
*/
|
|
586
|
-
TRACESTATE_HEADER = "tracestate"
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Interface for the service context, extendable by users for type-safe context data.
|
|
590
|
-
*
|
|
591
|
-
* @author Navid Mitchell 🤝Grok
|
|
592
|
-
* @since 3/25/2025
|
|
593
|
-
*/
|
|
594
|
-
interface ServiceContext {
|
|
595
|
-
[key: string]: any;
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Interface for interceptors that create or modify the ServiceContext before service method invocation.
|
|
599
|
-
*
|
|
600
|
-
* @author Navid Mitchell 🤝Grok
|
|
601
|
-
* @since 3/25/2025
|
|
602
|
-
*/
|
|
603
|
-
interface ContextInterceptor<T extends ServiceContext> {
|
|
604
|
-
intercept(event: IEvent, context: T): Promise<T> | T;
|
|
303
|
+
* version
|
|
304
|
+
* trace-id
|
|
305
|
+
* parent-id
|
|
306
|
+
* trace-flags
|
|
307
|
+
* @see https://www.w3.org/TR/trace-context/#traceparent-header
|
|
308
|
+
*/
|
|
309
|
+
TRACEPARENT_HEADER = "traceparent",
|
|
310
|
+
/**
|
|
311
|
+
* The main purpose of the tracestate header is to provide additional vendor-specific trace identification information across different distributed tracing systems and is a companion header for the traceparent field. It also conveys information about the request’s position in multiple distributed tracing graphs.
|
|
312
|
+
* @see https://www.w3.org/TR/trace-context/#tracestate-header
|
|
313
|
+
*/
|
|
314
|
+
TRACESTATE_HEADER = "tracestate"
|
|
605
315
|
}
|
|
606
316
|
/**
|
|
607
317
|
* `CRI` is a Kinoitc Resource Identifier used by Kinoitc to route requests appropriately.
|
|
@@ -745,11 +455,12 @@ declare class ServiceIdentifier {
|
|
|
745
455
|
cri(): CRI;
|
|
746
456
|
}
|
|
747
457
|
import { Observable as Observable2 } from "rxjs";
|
|
458
|
+
import { IEvent as IEvent3 } from "./IEventBus";
|
|
748
459
|
/**
|
|
749
460
|
* Provides an interface to allow the {@link IServiceProxy} creator the ability to have fine grain control of the outgoing {@link IEvent}
|
|
750
461
|
*/
|
|
751
462
|
interface IEventFactory {
|
|
752
|
-
create(cri: string, args: any[] | null | undefined):
|
|
463
|
+
create(cri: string, args: any[] | null | undefined): IEvent3;
|
|
753
464
|
}
|
|
754
465
|
/**
|
|
755
466
|
* {@link IServiceProxy} provides the ability to access a remote service
|
|
@@ -816,24 +527,16 @@ interface IServiceRegistry {
|
|
|
816
527
|
registerContextInterceptor<T extends ServiceContext>(interceptor: ContextInterceptor<T> | null): void;
|
|
817
528
|
}
|
|
818
529
|
/**
|
|
819
|
-
* Default implementation of {@link ICrudServiceProxyFactory}
|
|
820
|
-
*/
|
|
821
|
-
declare class CrudServiceProxyFactory implements ICrudServiceProxyFactory {
|
|
822
|
-
private serviceRegistry;
|
|
823
|
-
constructor(serviceRegistry: IServiceRegistry);
|
|
824
|
-
crudServiceProxy<T extends Identifiable<string>>(serviceIdentifier: string): ICrudServiceProxy<T>;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
530
|
* An implementation of a {@link IEventFactory} which uses JSON content
|
|
828
531
|
*/
|
|
829
532
|
declare class JsonEventFactory implements IEventFactory {
|
|
830
|
-
create(cri: string, args: any[] | null | undefined):
|
|
533
|
+
create(cri: string, args: any[] | null | undefined): IEvent2;
|
|
831
534
|
}
|
|
832
535
|
/**
|
|
833
536
|
* An implementation of a {@link IEventFactory} which uses text content
|
|
834
537
|
*/
|
|
835
538
|
declare class TextEventFactory implements IEventFactory {
|
|
836
|
-
create(cri: string, args: any[] | null | undefined):
|
|
539
|
+
create(cri: string, args: any[] | null | undefined): IEvent2;
|
|
837
540
|
}
|
|
838
541
|
/**
|
|
839
542
|
* The default implementation of {@link IServiceRegistry}
|
|
@@ -851,142 +554,435 @@ declare class ServiceRegistry implements IServiceRegistry {
|
|
|
851
554
|
unRegister(serviceIdentifier: ServiceIdentifier): void;
|
|
852
555
|
registerContextInterceptor<T extends ServiceContext>(interceptor: ContextInterceptor<T> | null): void;
|
|
853
556
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
557
|
+
/**
|
|
558
|
+
* A plugin that can be installed into a {@link IKinotic} instance to extend it with additional services.
|
|
559
|
+
*/
|
|
560
|
+
interface KinoticPlugin<TExtension extends object> {
|
|
561
|
+
install(kinotic: IKinotic): TExtension;
|
|
562
|
+
}
|
|
563
|
+
interface IKinotic {
|
|
564
|
+
serviceRegistry: IServiceRegistry;
|
|
565
|
+
eventBus: IEventBus;
|
|
566
|
+
/**
|
|
567
|
+
* Requests a connection to the given Stomp url
|
|
568
|
+
* @param connectionInfo provides the information needed to connect to the kinoitc server
|
|
569
|
+
* @return Promise containing the result of the initial connection attempt
|
|
570
|
+
*/
|
|
571
|
+
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
572
|
+
/**
|
|
573
|
+
* Disconnects the client from the server
|
|
574
|
+
* This will clear any subscriptions and close the connection
|
|
575
|
+
*/
|
|
576
|
+
disconnect(force?: boolean): Promise<void>;
|
|
577
|
+
/**
|
|
578
|
+
* Creates a new service proxy that can be used to access the desired service.
|
|
579
|
+
* @param serviceIdentifier the identifier of the service to be accessed
|
|
580
|
+
* @return the {@link IServiceProxy} that can be used to access the service
|
|
581
|
+
*/
|
|
582
|
+
serviceProxy(serviceIdentifier: string): IServiceProxy;
|
|
583
|
+
/**
|
|
584
|
+
* Installs a plugin into this Kinotic instance, extending it with additional typed properties.
|
|
585
|
+
* @param plugin the plugin to install
|
|
586
|
+
* @return this instance extended with the plugin's properties
|
|
587
|
+
*/
|
|
588
|
+
use<TExtension extends object>(plugin: KinoticPlugin<TExtension>): this & TExtension;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Provides a simplified way to connect to Kinotic and access services.
|
|
592
|
+
* All methods use a single connection to the Kinotic Services
|
|
593
|
+
*/
|
|
594
|
+
declare class KinoticSingleton implements IKinotic {
|
|
595
|
+
/**
|
|
596
|
+
* The {@link IEventBus} that is used to communicate with the Kinotic server
|
|
597
|
+
*/
|
|
598
|
+
private _eventBus;
|
|
599
|
+
/**
|
|
600
|
+
* The {@link ServiceRegistry} that is used to manage the services that are available
|
|
601
|
+
*/
|
|
602
|
+
readonly serviceRegistry: ServiceRegistry;
|
|
603
|
+
constructor();
|
|
604
|
+
get eventBus(): IEventBus;
|
|
605
|
+
set eventBus(eventBus: IEventBus);
|
|
606
|
+
/**
|
|
607
|
+
* Requests a connection to the given Stomp url
|
|
608
|
+
* @param connectionInfo provides the information needed to connect to the kinoitc server
|
|
609
|
+
* @return Promise containing the result of the initial connection attempt
|
|
610
|
+
*/
|
|
611
|
+
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
612
|
+
/**
|
|
613
|
+
* Disconnects the client from the server
|
|
614
|
+
* This will clear any subscriptions and close the connection
|
|
615
|
+
*/
|
|
616
|
+
disconnect(force?: boolean): Promise<void>;
|
|
617
|
+
/**
|
|
618
|
+
* Creates a new service proxy that can be used to access the desired service.
|
|
619
|
+
* @param serviceIdentifier the identifier of the service to be accessed
|
|
620
|
+
* @return the {@link IServiceProxy} that can be used to access the service
|
|
621
|
+
*/
|
|
622
|
+
serviceProxy(serviceIdentifier: string): IServiceProxy;
|
|
623
|
+
/**
|
|
624
|
+
* Installs a plugin into this Kinotic instance, extending it with additional typed properties.
|
|
625
|
+
* @param plugin the plugin to install
|
|
626
|
+
* @return this instance extended with the plugin's properties
|
|
627
|
+
*/
|
|
628
|
+
use<TExtension extends object>(plugin: KinoticPlugin<TExtension>): this & TExtension;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* The default {@link IKinotic} instance that can be used to access Kinotic services
|
|
632
|
+
*/
|
|
633
|
+
declare const Kinotic: KinoticSingleton;
|
|
634
|
+
declare const CONTEXT_METADATA_KEY: unique symbol;
|
|
635
|
+
declare function Scope(target: any, propertyKey: string, descriptor?: PropertyDescriptor): void;
|
|
636
|
+
declare function Version(version: string): (target: Function) => void;
|
|
637
|
+
declare function Context(): (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
638
|
+
declare function Publish(namespace: string, name?: string): (target: Function) => any;
|
|
639
|
+
/**
|
|
640
|
+
* A page is a sublist of a list of objects.
|
|
641
|
+
* @author Navid Mitchell
|
|
642
|
+
*/
|
|
643
|
+
interface Page<T> {
|
|
644
|
+
/**
|
|
645
|
+
* @return the total number of elements or null or undefined if not known.
|
|
646
|
+
*/
|
|
647
|
+
readonly totalElements: number | null | undefined;
|
|
648
|
+
/**
|
|
649
|
+
* The cursor to be used for subsequent retrieval of data.
|
|
650
|
+
* @return an opaque string representation of the cursor, or null if this is the last page, or undefined if cursor paging is not being used.
|
|
651
|
+
*/
|
|
652
|
+
readonly cursor: string | null | undefined;
|
|
653
|
+
/**
|
|
654
|
+
* @return the page content as {@link Array} or null or undefined if no data is available.
|
|
655
|
+
*/
|
|
656
|
+
readonly content: T[] | null | undefined;
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Defines a page that is also an async iterator.
|
|
660
|
+
* This allows for easy iteration over all pages of a result set.
|
|
661
|
+
*/
|
|
662
|
+
interface IterablePage<T> extends Page<T>, AsyncIterableIterator<IterablePage<T>> {
|
|
663
|
+
/**
|
|
664
|
+
* @return true if this is the last page, false otherwise.
|
|
665
|
+
*/
|
|
666
|
+
isLastPage(): boolean;
|
|
667
|
+
/**
|
|
668
|
+
* @return true if this page has content, false otherwise.
|
|
669
|
+
*/
|
|
670
|
+
hasContent(): boolean;
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Enumeration for sort directions.
|
|
674
|
+
*
|
|
675
|
+
* Adapted from the Spring Data Commons Package
|
|
676
|
+
*
|
|
677
|
+
* @author Oliver Gierke
|
|
678
|
+
* @author Navid Mitchell
|
|
679
|
+
*/
|
|
680
|
+
declare enum Direction {
|
|
681
|
+
ASC = "ASC",
|
|
682
|
+
DESC = "DESC"
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Enumeration for null handling hints that can be used in {@link Order} expressions.
|
|
686
|
+
*
|
|
687
|
+
* Adapted from the Spring Data Commons Package
|
|
688
|
+
*
|
|
689
|
+
* @author Thomas Darimont
|
|
690
|
+
* @author Navid Mitchell
|
|
691
|
+
* @since 1.8
|
|
692
|
+
*/
|
|
693
|
+
declare enum NullHandling {
|
|
694
|
+
/**
|
|
695
|
+
* Lets the data store decide what to do with nulls.
|
|
696
|
+
*/
|
|
697
|
+
NATIVE = "NATIVE",
|
|
698
|
+
/**
|
|
699
|
+
* A hint to the used data store to order entries with null values before non-null entries.
|
|
700
|
+
*/
|
|
701
|
+
NULLS_FIRST = "NULLS_FIRST",
|
|
702
|
+
/**
|
|
703
|
+
* A hint to the used data store to order entries with null values after non-null entries.
|
|
704
|
+
*/
|
|
705
|
+
NULLS_LAST = "NULLS_LAST"
|
|
706
|
+
}
|
|
707
|
+
declare class Order {
|
|
708
|
+
property: string;
|
|
709
|
+
direction: Direction;
|
|
710
|
+
nullHandling: NullHandling;
|
|
711
|
+
constructor(property: string, direction: Direction | null);
|
|
712
|
+
/**
|
|
713
|
+
* Returns whether sorting for this property shall be ascending.
|
|
714
|
+
*/
|
|
715
|
+
isAscending(): boolean;
|
|
716
|
+
/**
|
|
717
|
+
* Returns whether sorting for this property shall be descending.
|
|
718
|
+
*/
|
|
719
|
+
isDescending(): boolean;
|
|
720
|
+
}
|
|
721
|
+
/**
|
|
722
|
+
* Sort option for queries. You have to provide at least a list of properties to sort for that must not include
|
|
723
|
+
* {@literal null} or empty strings. The direction defaults to {@link Sort#DEFAULT_DIRECTION}.
|
|
724
|
+
*
|
|
725
|
+
* Adapted from the Spring Data Commons Package
|
|
726
|
+
*
|
|
727
|
+
* @author Oliver Gierke
|
|
728
|
+
* @author Thomas Darimont
|
|
729
|
+
* @author Mark Paluch
|
|
730
|
+
* @author Navid Mitchell
|
|
731
|
+
*/
|
|
732
|
+
declare class Sort {
|
|
733
|
+
orders: Order[];
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Abstract interface for pagination information.
|
|
737
|
+
*
|
|
738
|
+
* Adapted from the Spring Data Commons Package
|
|
739
|
+
*
|
|
740
|
+
* @author Oliver Gierke
|
|
741
|
+
* @author Navid Mitchell
|
|
742
|
+
*/
|
|
743
|
+
declare abstract class Pageable {
|
|
744
|
+
/**
|
|
745
|
+
* Returns the sorting parameters (optional).
|
|
746
|
+
*/
|
|
747
|
+
sort?: Sort | null | undefined;
|
|
748
|
+
/**
|
|
749
|
+
* Returns the number of items to be returned.
|
|
750
|
+
*/
|
|
751
|
+
pageSize: number;
|
|
752
|
+
/**
|
|
753
|
+
* Creates a {@link Pageable} that uses Offset based pagination.
|
|
754
|
+
* @param pageNumber zero based page index.
|
|
755
|
+
* @param pageSize the size of the page to be returned.
|
|
756
|
+
* @param sort the sorting parameters (optional).
|
|
757
|
+
*/
|
|
758
|
+
static create(pageNumber: number, pageSize: number, sort?: Sort | null): OffsetPageable;
|
|
759
|
+
/**
|
|
760
|
+
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
761
|
+
* @param cursor the cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
762
|
+
* @param pageSize the size of the page to be returned.
|
|
763
|
+
* @param sort the sorting parameters (optional).
|
|
764
|
+
*/
|
|
765
|
+
static createWithCursor(cursor: string | null, pageSize: number, sort?: Sort | null): CursorPageable;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Implementation of {@link Pageable} that uses Offset based pagination.
|
|
769
|
+
*/
|
|
770
|
+
declare class OffsetPageable extends Pageable {
|
|
771
|
+
/**
|
|
772
|
+
* Returns the page to be returned.
|
|
773
|
+
*/
|
|
774
|
+
pageNumber: number;
|
|
775
|
+
/**
|
|
776
|
+
* Creates a {@link Pageable} that uses Offset based pagination.
|
|
777
|
+
* @param pageNumber zero based page index.
|
|
778
|
+
* @param pageSize the size of the page to be returned.
|
|
779
|
+
* @param sort the sorting parameters (optional).
|
|
780
|
+
*/
|
|
781
|
+
constructor(pageNumber: number, pageSize: number, sort?: Sort | null);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Implementation of {@link Pageable} that uses Cursor based pagination.
|
|
785
|
+
*/
|
|
786
|
+
declare class CursorPageable extends Pageable {
|
|
787
|
+
/**
|
|
788
|
+
* The cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
789
|
+
*/
|
|
790
|
+
cursor: string | null;
|
|
791
|
+
/**
|
|
792
|
+
* Creates a {@link Pageable} that uses Cursor based pagination.
|
|
793
|
+
* @param cursor the cursor to be used for subsequent retrieval of data, or null if this is the first page.
|
|
794
|
+
* @param pageSize the size of the page to be returned.
|
|
795
|
+
* @param sort the sorting parameters (optional).
|
|
796
|
+
*/
|
|
797
|
+
constructor(cursor: string | null, pageSize: number, sort?: Sort | null);
|
|
798
|
+
}
|
|
799
|
+
declare abstract class AbstractIterablePage<T> implements IterablePage<T> {
|
|
800
|
+
private readonly pageable;
|
|
801
|
+
private currentPage;
|
|
802
|
+
private firstPage;
|
|
803
|
+
protected constructor(pageable: Pageable, page: Page<T>);
|
|
804
|
+
next(): Promise<IteratorResult<IterablePage<T>>>;
|
|
805
|
+
[Symbol.asyncIterator](): AsyncIterableIterator<IterablePage<T>>;
|
|
806
|
+
hasContent(): boolean;
|
|
807
|
+
isLastPage(): boolean;
|
|
808
|
+
private isOffsetPageable;
|
|
809
|
+
get totalElements(): number | null | undefined;
|
|
810
|
+
get cursor(): string | null | undefined;
|
|
811
|
+
get content(): T[] | null | undefined;
|
|
812
|
+
}
|
|
813
|
+
/**
|
|
814
|
+
* {@link IDataSource} provides an abstract way to retrieve data from various sources
|
|
815
|
+
*/
|
|
816
|
+
interface IDataSource<T> {
|
|
858
817
|
/**
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
* @
|
|
818
|
+
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
|
|
819
|
+
*
|
|
820
|
+
* @param pageable the page settings to be used
|
|
821
|
+
* @return a {@link Promise} emitting the page of entities
|
|
862
822
|
*/
|
|
863
|
-
|
|
823
|
+
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
864
824
|
/**
|
|
865
|
-
*
|
|
866
|
-
*
|
|
825
|
+
* Returns a {@link Page} of entities matching the search text and paging restriction provided in the {@code Pageable} object.
|
|
826
|
+
*
|
|
827
|
+
* @param searchText the text to search for entities for
|
|
828
|
+
* @param pageable the page settings to be used
|
|
829
|
+
* @return a {@link Promise} emitting the page of entities
|
|
867
830
|
*/
|
|
868
|
-
|
|
831
|
+
search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
832
|
+
}
|
|
833
|
+
interface IEditableDataSource<T extends Identifiable2<string>> extends IDataSource<T> {
|
|
869
834
|
/**
|
|
870
|
-
* Creates a new
|
|
871
|
-
* @param
|
|
872
|
-
* @return
|
|
835
|
+
* Creates a new entity if one does not already exist for the given id
|
|
836
|
+
* @param entity to create if one does not already exist
|
|
837
|
+
* @return a {@link Promise} containing the new entity or an error if an exception occurred
|
|
873
838
|
*/
|
|
874
|
-
|
|
839
|
+
create(entity: T): Promise<T>;
|
|
875
840
|
/**
|
|
876
|
-
*
|
|
877
|
-
*
|
|
841
|
+
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
|
|
842
|
+
* entity instance completely.
|
|
843
|
+
*
|
|
844
|
+
* @param entity must not be {@literal null}.
|
|
845
|
+
* @return a {@link Promise} emitting the saved entity.
|
|
846
|
+
* @throws Error in case the given {@literal entity} is {@literal null}.
|
|
847
|
+
*/
|
|
848
|
+
save(entity: T): Promise<T>;
|
|
849
|
+
/**
|
|
850
|
+
* Retrieves an entity by its id.
|
|
851
|
+
*
|
|
852
|
+
* @param id must not be {@literal null}.
|
|
853
|
+
* @return a {@link Promise} emitting the entity with the given id or {@link Promise#empty()} if none found.
|
|
854
|
+
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
855
|
+
*/
|
|
856
|
+
findById(id: string): Promise<T>;
|
|
857
|
+
/**
|
|
858
|
+
* Deletes the entity with the given id.
|
|
859
|
+
*
|
|
860
|
+
* @param id must not be {@literal null}.
|
|
861
|
+
* @return a {@link Promise} signaling when operation has completed.
|
|
862
|
+
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
878
863
|
*/
|
|
879
|
-
|
|
864
|
+
deleteById(id: string): Promise<void>;
|
|
865
|
+
/**
|
|
866
|
+
* Returns a {@link Page} of entities not in the ids list and meeting the paging restriction provided in the {@code Pageable} object.
|
|
867
|
+
*
|
|
868
|
+
* @param ids not to be returned in the Page
|
|
869
|
+
* @param pageable the page settings to be used
|
|
870
|
+
* @return a {@link Promise} emitting the page of entities
|
|
871
|
+
*/
|
|
872
|
+
findByIdNotIn(ids: string[], pageable: Pageable): Promise<Page<Identifiable2<string>>>;
|
|
873
|
+
}
|
|
874
|
+
declare class DataSourceUtils {
|
|
875
|
+
static instanceOfEditableDataSource(datasource: IDataSource<any> | IEditableDataSource<any>): datasource is IEditableDataSource<any>;
|
|
880
876
|
}
|
|
881
877
|
/**
|
|
882
|
-
*
|
|
883
|
-
* All methods use a single connection to the Kinotic Services
|
|
878
|
+
* A {@link ICrudServiceProxy} is a proxy for a remote CRUD service
|
|
884
879
|
*/
|
|
885
|
-
|
|
880
|
+
interface ICrudServiceProxy<T extends Identifiable2<string>> extends IEditableDataSource<T> {
|
|
886
881
|
/**
|
|
887
|
-
*
|
|
882
|
+
* Creates a new entity if one does not already exist for the given id
|
|
883
|
+
* @param entity to create if one does not already exist
|
|
884
|
+
* @return a {@link Promise} containing the new entity or an error if an exception occurred
|
|
888
885
|
*/
|
|
889
|
-
|
|
886
|
+
create(entity: T): Promise<T>;
|
|
890
887
|
/**
|
|
891
|
-
*
|
|
888
|
+
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
|
|
889
|
+
* entity instance completely.
|
|
890
|
+
*
|
|
891
|
+
* @param entity must not be {@literal null}.
|
|
892
|
+
* @return a {@link Promise} emitting the saved entity.
|
|
893
|
+
* @throws Error in case the given {@literal entity} is {@literal null}.
|
|
892
894
|
*/
|
|
893
|
-
|
|
895
|
+
save(entity: T): Promise<T>;
|
|
894
896
|
/**
|
|
895
|
-
*
|
|
897
|
+
* Retrieves an entity by its id.
|
|
898
|
+
*
|
|
899
|
+
* @param id must not be {@literal null}.
|
|
900
|
+
* @return a {@link Promise} emitting the entity with the given id or {@link Promise#empty()} if none found.
|
|
901
|
+
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
896
902
|
*/
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
903
|
+
findById(id: string): Promise<T>;
|
|
904
|
+
/**s
|
|
905
|
+
* Returns the number of entities available.
|
|
906
|
+
*
|
|
907
|
+
* @return a {@link Promise} emitting the number of entities.
|
|
908
|
+
*/
|
|
909
|
+
count(): Promise<number>;
|
|
901
910
|
/**
|
|
902
|
-
*
|
|
903
|
-
*
|
|
904
|
-
* @
|
|
911
|
+
* Deletes the entity with the given id.
|
|
912
|
+
*
|
|
913
|
+
* @param id must not be {@literal null}.
|
|
914
|
+
* @return a {@link Promise} signaling when operation has completed.
|
|
915
|
+
* @throws IllegalArgumentException in case the given {@literal identity} is {@literal null}.
|
|
905
916
|
*/
|
|
906
|
-
|
|
917
|
+
deleteById(id: string): Promise<void>;
|
|
907
918
|
/**
|
|
908
|
-
*
|
|
909
|
-
*
|
|
919
|
+
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
|
|
920
|
+
*
|
|
921
|
+
* @param pageable the page settings to be used
|
|
922
|
+
* @return a {@link Promise} emitting the page of entities
|
|
910
923
|
*/
|
|
911
|
-
|
|
924
|
+
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
912
925
|
/**
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* @
|
|
926
|
+
* Returns a {@link Page} of entities not in the ids list and meeting the paging restriction provided in the {@code Pageable} object.
|
|
927
|
+
*
|
|
928
|
+
* @param ids not to be returned in the Page
|
|
929
|
+
* @param pageable the page settings to be used
|
|
930
|
+
* @return a {@link Promise} emitting the page of entities
|
|
916
931
|
*/
|
|
917
|
-
|
|
932
|
+
findByIdNotIn(ids: string[], pageable: Pageable): Promise<Page<Identifiable2<string>>>;
|
|
918
933
|
/**
|
|
919
|
-
* Returns a {@link
|
|
920
|
-
*
|
|
934
|
+
* Returns a {@link Page} of entities matching the search text and paging restriction provided in the {@code Pageable} object.
|
|
935
|
+
*
|
|
936
|
+
* @param searchText the text to search for entities for
|
|
937
|
+
* @param pageable the page settings to be used
|
|
938
|
+
* @return a {@link Promise} emitting the page of entities
|
|
921
939
|
*/
|
|
922
|
-
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* The default {@link IKinotic} instance that can be used to access Kinotic services
|
|
926
|
-
*/
|
|
927
|
-
declare const Kinotic: IKinotic;
|
|
928
|
-
declare const CONTEXT_METADATA_KEY: unique symbol;
|
|
929
|
-
declare function Scope(target: any, propertyKey: string, descriptor?: PropertyDescriptor): void;
|
|
930
|
-
declare function Version(version: string): (target: Function) => void;
|
|
931
|
-
declare function Context(): (target: any, propertyKey: string, parameterIndex: number) => void;
|
|
932
|
-
declare function Publish(namespace: string, name?: string): (target: Function) => any;
|
|
933
|
-
declare enum LogLevel {
|
|
934
|
-
TRACE = "TRACE",
|
|
935
|
-
DEBUG = "DEBUG",
|
|
936
|
-
INFO = "INFO",
|
|
937
|
-
WARN = "WARN",
|
|
938
|
-
ERROR = "ERROR",
|
|
939
|
-
FATAL = "FATAL",
|
|
940
|
-
OFF = "OFF"
|
|
941
|
-
}
|
|
942
|
-
declare class LoggerLevelsDescriptor {
|
|
943
|
-
configuredLevel?: LogLevel;
|
|
944
|
-
}
|
|
945
|
-
declare class GroupLoggerLevelsDescriptor extends LoggerLevelsDescriptor {
|
|
946
|
-
members: string[];
|
|
940
|
+
search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
947
941
|
}
|
|
948
|
-
declare class
|
|
949
|
-
|
|
942
|
+
declare class CrudServiceProxy<T extends Identifiable2<string>> implements ICrudServiceProxy<T> {
|
|
943
|
+
protected serviceProxy: IServiceProxy;
|
|
944
|
+
constructor(serviceProxy: IServiceProxy);
|
|
945
|
+
count(): Promise<number>;
|
|
946
|
+
create(entity: T): Promise<T>;
|
|
947
|
+
deleteById(id: string): Promise<void>;
|
|
948
|
+
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
949
|
+
findAllSinglePage(pageable: Pageable): Promise<Page<T>>;
|
|
950
|
+
findById(id: string): Promise<T>;
|
|
951
|
+
save(entity: T): Promise<T>;
|
|
952
|
+
findByIdNotIn(ids: string[], page: Pageable): Promise<Page<Identifiable2<string>>>;
|
|
953
|
+
search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
954
|
+
searchSinglePage(searchText: string, pageable: Pageable): Promise<Page<T>>;
|
|
950
955
|
}
|
|
951
956
|
/**
|
|
952
|
-
*
|
|
957
|
+
* Instances of this interface have a unique id (identity) and are therefore "Identifiable"
|
|
958
|
+
* Created by navid on 2/3/20
|
|
953
959
|
*/
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
loggerLevels: Map<string, SingleLoggerLevelsDescriptor>;
|
|
957
|
-
groups: Map<string, GroupLoggerLevelsDescriptor>;
|
|
960
|
+
interface Identifiable2<T> {
|
|
961
|
+
id: T | null;
|
|
958
962
|
}
|
|
959
963
|
/**
|
|
960
|
-
*
|
|
964
|
+
* Produces {@link ICrudServiceProxy} Proxies for a known remote CRUD service
|
|
961
965
|
*/
|
|
962
|
-
interface
|
|
963
|
-
/**
|
|
964
|
-
* @param nodeId the kinoitc node to get the LoggersDescriptor from
|
|
965
|
-
* @return a {@link LoggersDescriptor} containing all the loggers and their levels
|
|
966
|
-
*/
|
|
967
|
-
loggers(nodeId: string): Promise<LoggersDescriptor>;
|
|
968
|
-
/**
|
|
969
|
-
* @param nodeId the kinoitc node to get the LoggerLevelsDescriptor from
|
|
970
|
-
* @param name the name of the logger to get
|
|
971
|
-
* @return a {@link LoggerLevelsDescriptor} containing the logger and its levels
|
|
972
|
-
*/
|
|
973
|
-
loggerLevels(nodeId: string, name: string): Promise<LoggerLevelsDescriptor>;
|
|
966
|
+
interface ICrudServiceProxyFactory {
|
|
974
967
|
/**
|
|
975
|
-
*
|
|
976
|
-
* @param
|
|
977
|
-
* @param name the name of the logger to set
|
|
978
|
-
* @param level the {@link LogLevel} to set for the logger with the given name
|
|
968
|
+
* Produces a {@link ICrudServiceProxy} for the given serviceIdentifier
|
|
969
|
+
* @param serviceIdentifier the service identifier to produce a proxy for
|
|
979
970
|
*/
|
|
980
|
-
|
|
971
|
+
crudServiceProxy<T extends Identifiable2<string>>(serviceIdentifier: string): ICrudServiceProxy<T>;
|
|
981
972
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
973
|
+
/**
|
|
974
|
+
* Default implementation of {@link ICrudServiceProxyFactory}
|
|
975
|
+
*/
|
|
976
|
+
declare class CrudServiceProxyFactory implements ICrudServiceProxyFactory {
|
|
977
|
+
private serviceRegistry;
|
|
978
|
+
constructor(serviceRegistry: IServiceRegistry);
|
|
979
|
+
crudServiceProxy<T extends Identifiable2<string>>(serviceIdentifier: string): ICrudServiceProxy<T>;
|
|
980
|
+
}
|
|
981
|
+
declare class FunctionalIterablePage<T> extends AbstractIterablePage<T> {
|
|
982
|
+
private readonly pageFunction;
|
|
983
|
+
constructor(pageable: Pageable, page: Page<T>, pageFunction: (pageable: Pageable) => Promise<Page<T>>);
|
|
984
|
+
protected findNext(pageable: Pageable): Promise<Page<T>>;
|
|
988
985
|
}
|
|
989
|
-
declare const logManager: ILogManager;
|
|
990
986
|
declare class AuthenticationError extends KinoticError {
|
|
991
987
|
constructor(message: string);
|
|
992
988
|
}
|
|
@@ -994,18 +990,6 @@ declare class AuthorizationError extends KinoticError {
|
|
|
994
990
|
constructor(message: string);
|
|
995
991
|
}
|
|
996
992
|
/**
|
|
997
|
-
* Some common constants used for the {@link Participant} and {@link Participant#getMetadata()}
|
|
998
|
-
* Created by navid on 2/3/20
|
|
999
|
-
*/
|
|
1000
|
-
declare class ParticipantConstants {
|
|
1001
|
-
static readonly PARTICIPANT_TYPE_METADATA_KEY: string;
|
|
1002
|
-
static readonly PARTICIPANT_TYPE_DEVICE: string;
|
|
1003
|
-
static readonly PARTICIPANT_TYPE_CLI: string;
|
|
1004
|
-
static readonly PARTICIPANT_TYPE_USER: string;
|
|
1005
|
-
static readonly PARTICIPANT_TYPE_NODE: string;
|
|
1006
|
-
static readonly CLI_PARTICIPANT_ID: string;
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
993
|
* Default implementation of the `CRI` interface.
|
|
1010
994
|
*
|
|
1011
995
|
* @author Navid Mitchell
|
|
@@ -1041,7 +1025,7 @@ import { Optional as Optional2 } from "typescript-optional";
|
|
|
1041
1025
|
/**
|
|
1042
1026
|
* Default IEvent implementation
|
|
1043
1027
|
*/
|
|
1044
|
-
declare class Event implements
|
|
1028
|
+
declare class Event implements IEvent2 {
|
|
1045
1029
|
cri: string;
|
|
1046
1030
|
headers: Map<string, string>;
|
|
1047
1031
|
data: Optional2<Uint8Array>;
|
|
@@ -1071,11 +1055,11 @@ declare class EventBus implements IEventBus {
|
|
|
1071
1055
|
isConnected(): boolean;
|
|
1072
1056
|
connect(connectionInfo: ConnectionInfo): Promise<ConnectedInfo>;
|
|
1073
1057
|
disconnect(force?: boolean): Promise<void>;
|
|
1074
|
-
send(event:
|
|
1075
|
-
request(event:
|
|
1076
|
-
requestStream(event:
|
|
1058
|
+
send(event: IEvent2): void;
|
|
1059
|
+
request(event: IEvent2): Promise<IEvent2>;
|
|
1060
|
+
requestStream(event: IEvent2, sendControlEvents?: boolean): Observable3<IEvent2>;
|
|
1077
1061
|
listen(_serverInfo: ServerInfo): Promise<void>;
|
|
1078
|
-
observe(cri: string): Observable3<
|
|
1062
|
+
observe(cri: string): Observable3<IEvent2>;
|
|
1079
1063
|
private cleanup;
|
|
1080
1064
|
/**
|
|
1081
1065
|
* Creates the proper error to return if this.stompConnectionManager?.rxStomp is not available on a send request
|
|
@@ -1089,71 +1073,16 @@ declare class EventBus implements IEventBus {
|
|
|
1089
1073
|
*/
|
|
1090
1074
|
private _observe;
|
|
1091
1075
|
}
|
|
1092
|
-
declare enum StreamOperation {
|
|
1093
|
-
EXISTING = "EXISTING",
|
|
1094
|
-
UPDATE = "UPDATE",
|
|
1095
|
-
REMOVE = "REMOVE"
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* Holder for domain objects that will be returned as a stream of changes to a data set
|
|
1099
|
-
*
|
|
1100
|
-
* Created by Navid Mitchell on 6/3/20
|
|
1101
|
-
*/
|
|
1102
|
-
declare class StreamData<
|
|
1103
|
-
I,
|
|
1104
|
-
T
|
|
1105
|
-
> implements Identifiable<I> {
|
|
1106
|
-
streamOperation: StreamOperation;
|
|
1107
|
-
id: I;
|
|
1108
|
-
value: T;
|
|
1109
|
-
constructor(streamOperation: StreamOperation, id: I, value: T);
|
|
1110
|
-
isSet(): boolean;
|
|
1111
|
-
}
|
|
1112
1076
|
/**
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1077
|
+
* Some common constants used for the {@link Participant} and {@link Participant#getMetadata()}
|
|
1078
|
+
* Created by navid on 2/3/20
|
|
1115
1079
|
*/
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
*/
|
|
1124
|
-
hasContent(): boolean;
|
|
1125
|
-
}
|
|
1126
|
-
declare abstract class AbstractIterablePage<T> implements IterablePage<T> {
|
|
1127
|
-
private readonly pageable;
|
|
1128
|
-
private currentPage;
|
|
1129
|
-
private firstPage;
|
|
1130
|
-
protected constructor(pageable: Pageable, page: Page<T>);
|
|
1131
|
-
next(): Promise<IteratorResult<IterablePage<T>>>;
|
|
1132
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<IterablePage<T>>;
|
|
1133
|
-
hasContent(): boolean;
|
|
1134
|
-
isLastPage(): boolean;
|
|
1135
|
-
private isOffsetPageable;
|
|
1136
|
-
get totalElements(): number | null | undefined;
|
|
1137
|
-
get cursor(): string | null | undefined;
|
|
1138
|
-
get content(): T[] | null | undefined;
|
|
1139
|
-
}
|
|
1140
|
-
declare class CrudServiceProxy<T extends Identifiable<string>> implements ICrudServiceProxy<T> {
|
|
1141
|
-
protected serviceProxy: IServiceProxy;
|
|
1142
|
-
constructor(serviceProxy: IServiceProxy);
|
|
1143
|
-
count(): Promise<number>;
|
|
1144
|
-
create(entity: T): Promise<T>;
|
|
1145
|
-
deleteById(id: string): Promise<void>;
|
|
1146
|
-
findAll(pageable: Pageable): Promise<IterablePage<T>>;
|
|
1147
|
-
findAllSinglePage(pageable: Pageable): Promise<Page<T>>;
|
|
1148
|
-
findById(id: string): Promise<T>;
|
|
1149
|
-
save(entity: T): Promise<T>;
|
|
1150
|
-
findByIdNotIn(ids: string[], page: Pageable): Promise<Page<Identifiable<string>>>;
|
|
1151
|
-
search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
1152
|
-
searchSinglePage(searchText: string, pageable: Pageable): Promise<Page<T>>;
|
|
1153
|
-
}
|
|
1154
|
-
declare class FunctionalIterablePage<T> extends AbstractIterablePage<T> {
|
|
1155
|
-
private readonly pageFunction;
|
|
1156
|
-
constructor(pageable: Pageable, page: Page<T>, pageFunction: (pageable: Pageable) => Promise<Page<T>>);
|
|
1157
|
-
protected findNext(pageable: Pageable): Promise<Page<T>>;
|
|
1080
|
+
declare class ParticipantConstants {
|
|
1081
|
+
static readonly PARTICIPANT_TYPE_METADATA_KEY: string;
|
|
1082
|
+
static readonly PARTICIPANT_TYPE_DEVICE: string;
|
|
1083
|
+
static readonly PARTICIPANT_TYPE_CLI: string;
|
|
1084
|
+
static readonly PARTICIPANT_TYPE_USER: string;
|
|
1085
|
+
static readonly PARTICIPANT_TYPE_NODE: string;
|
|
1086
|
+
static readonly CLI_PARTICIPANT_ID: string;
|
|
1158
1087
|
}
|
|
1159
|
-
export {
|
|
1088
|
+
export { createCRI, Version, TextEventFactory, Sort, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticPlugin, KinoticError, Kinotic, JsonEventFactory, IterablePage, Identifiable2 as Identifiable, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent2 as IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, ConnectHeaders, CRI, CONTEXT_METADATA_KEY, AuthorizationError, AuthenticationError, AbstractIterablePage };
|