@kinotic-ai/persistence 1.0.10 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +121 -121
- package/dist/index.d.cts +311 -310
- package/dist/index.d.ts +311 -310
- package/dist/index.js +121 -121
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -90,188 +90,414 @@ import { C3Decorator } from "@kinotic-ai/idl";
|
|
|
90
90
|
* This class denotes {@link C3Decorator} that can be applied to an {@link EntityService} using the {@link EntityServiceDecoratorsDecorator}
|
|
91
91
|
*/
|
|
92
92
|
declare abstract class EntityServiceDecorator extends C3Decorator {}
|
|
93
|
-
import {
|
|
93
|
+
import { IEntityService } from "@/api/IEntityService";
|
|
94
|
+
type IfFunction<
|
|
95
|
+
T,
|
|
96
|
+
U
|
|
97
|
+
> = T extends (...args: any[]) => any ? U : never;
|
|
98
|
+
type MethodsOf<T> = { [K in keyof T] : IfFunction<T[K], K> }[keyof T];
|
|
99
|
+
type ExcludedMethods = "namedQuery" | "namedQueryPage";
|
|
100
|
+
type FilteredMethods<T> = Exclude<MethodsOf<T>, ExcludedMethods>;
|
|
101
|
+
type DecoratedFunction = FilteredMethods<IEntityService<any>> | "allCreate" | "allRead" | "allUpdate" | "allDelete";
|
|
102
|
+
/**
|
|
103
|
+
* Configuration for the {@link EntityServiceDecoratorsDecorator}
|
|
104
|
+
* This is a map of method names to an array of decorators that should be applied to that method
|
|
105
|
+
*/
|
|
106
|
+
type EntityServiceDecoratorsConfig = Partial<Record<DecoratedFunction, EntityServiceDecorator[]>>;
|
|
107
|
+
declare enum KinoticPersistenceDecorator {
|
|
108
|
+
Entity = "__structures-entity__",
|
|
109
|
+
Id = "__structures-id__",
|
|
110
|
+
AutoGeneratedId = "__structures-auto-generated-id__",
|
|
111
|
+
Flattened = "__structures-flattened__",
|
|
112
|
+
Nested = "__structures-nested__",
|
|
113
|
+
Text = "__structures-text__",
|
|
114
|
+
NotNull = "__structures-notnull__",
|
|
115
|
+
Precision = "__structures-precision__",
|
|
116
|
+
Discriminator = "__structures-discriminator__",
|
|
117
|
+
Query = "__structures-query__",
|
|
118
|
+
EntityServiceDecorators = "__structures-entity-service-decorators__"
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Signifies that a property is an auto-generated ID for the entity.
|
|
122
|
+
*/
|
|
123
|
+
declare function AutoGeneratedId(target: any, propertyKey: string): void;
|
|
124
|
+
declare class DiscriminatorConfig {
|
|
125
|
+
propertyName: string;
|
|
126
|
+
constructor(propertyName: string);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Signifies that a property is a discriminator for the entity.
|
|
130
|
+
* This is used to determine the type of the entity when deserializing from JSON.
|
|
131
|
+
* @param propertyName the name of the property to use as the discriminator
|
|
132
|
+
*/
|
|
133
|
+
declare function Discriminator(propertyName: string): (target: any, propertyKey: string) => void;
|
|
134
|
+
declare class EntityConfig {
|
|
135
|
+
multiTenancyType: MultiTenancyType;
|
|
136
|
+
entityType: EntityType;
|
|
137
|
+
constructor(multiTenancyType: MultiTenancyType, entityType?: EntityType);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Signifies that a class is a Structures Entity.
|
|
141
|
+
* This is required to define the class as an entity in the Structures framework.
|
|
142
|
+
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
143
|
+
* @param entityType the type of entity to use for this entity
|
|
144
|
+
*/
|
|
145
|
+
declare function Entity(multiTenancyType?: MultiTenancyType, entityType?: EntityType): (constructor: Function) => void;
|
|
146
|
+
/**
|
|
147
|
+
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
148
|
+
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
149
|
+
*/
|
|
150
|
+
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_constructor: Function) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Provides configuration for the Elasticsearch index.
|
|
153
|
+
* This can be used to override the default index settings and mappings used by Structures.
|
|
154
|
+
*/
|
|
155
|
+
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_constructor: Function) => void;
|
|
156
|
+
declare function Flattened(target: any, propertyKey: string): void;
|
|
157
|
+
/**
|
|
158
|
+
* Signifies that a property is the ID of the entity.
|
|
159
|
+
*/
|
|
160
|
+
declare function Id(target: any, propertyKey: string): void;
|
|
161
|
+
declare function Nested(target: any, propertyKey: string): void;
|
|
162
|
+
/**
|
|
163
|
+
* Signifies that a property is not indexed in Elasticsearch.
|
|
164
|
+
*/
|
|
165
|
+
declare function NotIndexed(_target: any, _propertyKey: string): void;
|
|
166
|
+
declare function NotNull(target: any, propertyKey: string): void;
|
|
167
|
+
declare function Policy(_policies: string[][]): (_target: any, _propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
|
168
|
+
declare class PrecisionConfig {
|
|
169
|
+
precisionType: PrecisionType;
|
|
170
|
+
constructor(precisionType: PrecisionType);
|
|
171
|
+
}
|
|
172
|
+
declare function Precision(precisionType?: PrecisionType): (target: any, propertyKey: string) => void;
|
|
173
|
+
declare function Query(statements: string): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
174
|
+
declare function Role(_roles: string[]): (_target: any, _propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
|
175
|
+
declare function Text(target: any, propertyKey: string): void;
|
|
176
|
+
/**
|
|
177
|
+
* This is used for data streams to signify the field that should be used as the time reference.
|
|
178
|
+
*/
|
|
179
|
+
declare function TimeReference(_target: any, _propertyKey: string): void;
|
|
180
|
+
declare function Version(_target: any, _propertyKey: string): void;
|
|
181
|
+
declare function TenantId(_target: any, _propertyKey: string): void;
|
|
182
|
+
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
183
|
+
/**
|
|
184
|
+
* Provides a way to add decorators to an entity service
|
|
185
|
+
*/
|
|
186
|
+
declare class EntityServiceDecoratorsDecorator extends C3Decorator2 {
|
|
187
|
+
config: EntityServiceDecoratorsConfig;
|
|
188
|
+
constructor();
|
|
189
|
+
}
|
|
190
|
+
declare class PolicyDecorator extends EntityServiceDecorator {
|
|
191
|
+
policies: string[][];
|
|
192
|
+
constructor(policies: string[][]);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Provides a mechanism to apply the @Policy decorator to an {@link EntityService}
|
|
196
|
+
* @param policies to be supplied
|
|
197
|
+
*/
|
|
198
|
+
declare function $Policy(policies: string[][]): PolicyDecorator;
|
|
199
|
+
declare class RoleDecorator extends EntityServiceDecorator {
|
|
200
|
+
roles: string[];
|
|
201
|
+
constructor(roles: string[]);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Provides a mechanism to apply the @Role decorator to an {@link EntityService}
|
|
205
|
+
* @param roles to be supplied
|
|
206
|
+
*/
|
|
207
|
+
declare function $Role(roles: string[]): RoleDecorator;
|
|
94
208
|
import { IKinotic } from "@kinotic-ai/core";
|
|
95
209
|
import { IServiceProxy, Page, Pageable, IterablePage } from "@kinotic-ai/core";
|
|
96
|
-
interface
|
|
210
|
+
interface IEntitiesRepository {
|
|
97
211
|
/**
|
|
98
212
|
* Saves all given entities.
|
|
99
|
-
* @param
|
|
213
|
+
* @param entityDefinitionId the id of the structure to save the entities for
|
|
100
214
|
* @param entities all the entities to save
|
|
101
215
|
* @return Promise that will complete when all entities have been saved
|
|
102
216
|
*/
|
|
103
|
-
bulkSave<T>(
|
|
217
|
+
bulkSave<T>(entityDefinitionId: string, entities: T[]): Promise<void>;
|
|
104
218
|
/**
|
|
105
219
|
* Updates all given entities.
|
|
106
|
-
* @param
|
|
220
|
+
* @param entityDefinitionId the id of the structure to update the entities for
|
|
107
221
|
* @param entities all the entities to save
|
|
108
222
|
* @return Promise that will complete when all entities have been saved
|
|
109
223
|
*/
|
|
110
|
-
bulkUpdate<T>(
|
|
224
|
+
bulkUpdate<T>(entityDefinitionId: string, entities: T[]): Promise<void>;
|
|
111
225
|
/**
|
|
112
226
|
* Returns the number of entities available.
|
|
113
|
-
* @param
|
|
227
|
+
* @param entityDefinitionId the id of the structure to count
|
|
114
228
|
* @return {@link Promise} emitting the number of entities.
|
|
115
229
|
*/
|
|
116
|
-
count(
|
|
230
|
+
count(entityDefinitionId: string): Promise<number>;
|
|
117
231
|
/**
|
|
118
232
|
* Returns the number of entities available for the given query.
|
|
119
233
|
*
|
|
120
|
-
* @param
|
|
234
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
121
235
|
* @param query the query used to limit result
|
|
122
236
|
* @return Promise emitting the number of entities
|
|
123
237
|
*/
|
|
124
|
-
countByQuery(
|
|
238
|
+
countByQuery(entityDefinitionId: string, query: string): Promise<number>;
|
|
125
239
|
/**
|
|
126
240
|
* Deletes the entity with the given id.
|
|
127
241
|
*
|
|
128
|
-
* @param
|
|
242
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
129
243
|
* @param id must not be {@literal null}
|
|
130
244
|
* @return {@link Promise} emitting when delete is complete
|
|
131
245
|
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
132
246
|
*/
|
|
133
|
-
deleteById(
|
|
247
|
+
deleteById(entityDefinitionId: string, id: string): Promise<void>;
|
|
134
248
|
/**
|
|
135
249
|
* Deletes the entity with the given id.
|
|
136
250
|
*
|
|
137
|
-
* @param
|
|
251
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
138
252
|
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
139
253
|
* @return Promise signaling when operation has completed
|
|
140
254
|
* @throws Error in case the given {@literal query} is {@literal null}
|
|
141
255
|
*/
|
|
142
|
-
deleteByQuery(
|
|
256
|
+
deleteByQuery(entityDefinitionId: string, query: string): Promise<void>;
|
|
143
257
|
/**
|
|
144
258
|
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
145
259
|
*
|
|
146
|
-
* @param
|
|
260
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
147
261
|
* @param pageable the page settings to be used
|
|
148
262
|
* @return a page of entities
|
|
149
263
|
*/
|
|
150
|
-
findAll<T>(
|
|
264
|
+
findAll<T>(entityDefinitionId: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
151
265
|
/**
|
|
152
266
|
* Returns a single {@link Page} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
153
|
-
* @param
|
|
267
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
154
268
|
* @param pageable the page settings to be used
|
|
155
269
|
*/
|
|
156
|
-
findAllSinglePage<T>(
|
|
270
|
+
findAllSinglePage<T>(entityDefinitionId: string, pageable: Pageable): Promise<Page<T>>;
|
|
157
271
|
/**
|
|
158
272
|
* Retrieves an entity by its id.
|
|
159
273
|
*
|
|
160
|
-
* @param
|
|
274
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
161
275
|
* @param id must not be {@literal null}
|
|
162
276
|
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
163
277
|
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
164
278
|
*/
|
|
165
|
-
findById<T>(
|
|
279
|
+
findById<T>(entityDefinitionId: string, id: string): Promise<T | null>;
|
|
166
280
|
/**
|
|
167
281
|
* Retrieves a list of entities by their id.
|
|
168
282
|
*
|
|
169
|
-
* @param
|
|
283
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
170
284
|
* @param ids must not be {@literal null}
|
|
171
285
|
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
172
286
|
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
173
287
|
*/
|
|
174
|
-
findByIds<T>(
|
|
288
|
+
findByIds<T>(entityDefinitionId: string, ids: string[]): Promise<T[]>;
|
|
175
289
|
/**
|
|
176
290
|
* Executes a named query.
|
|
177
|
-
* @param
|
|
291
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
178
292
|
* @param queryName the name of the function that defines the query
|
|
179
293
|
* @param parameters to pass to the query
|
|
180
294
|
* @returns Promise with the result of the query
|
|
181
295
|
*/
|
|
182
|
-
namedQuery<T>(
|
|
296
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
183
297
|
/**
|
|
184
298
|
* Executes a named query and returns a Page of results.
|
|
185
|
-
* @param
|
|
299
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
186
300
|
* @param queryName the name of the function that defines the query
|
|
187
301
|
* @param parameters to pass to the query
|
|
188
302
|
* @param pageable the page settings to be used
|
|
189
303
|
* @returns Promise with the result of the query
|
|
190
304
|
*/
|
|
191
|
-
namedQueryPage<T>(
|
|
305
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable): Promise<IterablePage<T>>;
|
|
192
306
|
/**
|
|
193
307
|
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
|
|
194
308
|
* entity instance completely.
|
|
195
309
|
*
|
|
196
|
-
* @param
|
|
310
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
197
311
|
* @param entity must not be {@literal null}
|
|
198
312
|
* @return {@link Promise} emitting the saved entity
|
|
199
313
|
* @throws IllegalArgumentException in case the given {@literal entity} is {@literal null}
|
|
200
314
|
*/
|
|
201
|
-
save<T>(
|
|
315
|
+
save<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
202
316
|
/**
|
|
203
317
|
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
204
318
|
*
|
|
205
|
-
* @param
|
|
319
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
206
320
|
* @param searchText the text to search for entities for
|
|
207
321
|
* @param pageable the page settings to be used
|
|
208
322
|
* @return a page of entities
|
|
209
323
|
*/
|
|
210
|
-
search<T>(
|
|
324
|
+
search<T>(entityDefinitionId: string, searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
211
325
|
/**
|
|
212
326
|
* Returns a single {@link Page} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
213
327
|
*
|
|
214
|
-
* @param
|
|
328
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
215
329
|
* @param searchText the text to search for entities for
|
|
216
330
|
* @param pageable the page settings to be used
|
|
217
331
|
* @return a page of entities
|
|
218
332
|
*/
|
|
219
|
-
searchSinglePage<T>(
|
|
333
|
+
searchSinglePage<T>(entityDefinitionId: string, searchText: string, pageable: Pageable): Promise<Page<T>>;
|
|
220
334
|
/**
|
|
221
335
|
* This operation makes all the recent writes immediately available for search.
|
|
222
|
-
* @param
|
|
336
|
+
* @param entityDefinitionId the id of the structure to sync the index for.
|
|
223
337
|
* @return a Promise that resolves when the operation is complete
|
|
224
338
|
*/
|
|
225
|
-
syncIndex(
|
|
339
|
+
syncIndex(entityDefinitionId: string): Promise<void>;
|
|
226
340
|
/**
|
|
227
341
|
* Updates a given entity. This will only override the fields that are present in the given entity.
|
|
228
342
|
* If any fields are not present in the given entity data, they will not be changed.
|
|
229
343
|
* If the entity does not exist, it will be created.
|
|
230
344
|
*
|
|
231
|
-
* @param
|
|
345
|
+
* @param entityDefinitionId the id of the structure to update the entity for
|
|
232
346
|
* @param entity must not be {@literal null}
|
|
233
347
|
* @return Promise emitting the saved entity
|
|
234
348
|
* @throws Error in case the given {@literal entity} is {@literal null}
|
|
235
349
|
*/
|
|
236
|
-
update<T>(
|
|
350
|
+
update<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
237
351
|
}
|
|
238
|
-
declare class
|
|
352
|
+
declare class EntitiesRepository implements IEntitiesRepository {
|
|
239
353
|
protected serviceProxy: IServiceProxy;
|
|
240
354
|
constructor(kinotic: IKinotic);
|
|
241
|
-
bulkSave<T>(
|
|
242
|
-
bulkUpdate<T>(
|
|
243
|
-
count(
|
|
244
|
-
countByQuery(
|
|
245
|
-
deleteById(
|
|
246
|
-
deleteByQuery(
|
|
247
|
-
findAll<T>(
|
|
248
|
-
findAllSinglePage<T>(
|
|
249
|
-
findById<T>(
|
|
250
|
-
findByIds<T>(
|
|
251
|
-
namedQuery<T>(
|
|
252
|
-
namedQueryPage<T>(
|
|
253
|
-
namedQuerySinglePage<T>(
|
|
254
|
-
save<T>(
|
|
255
|
-
search<T>(
|
|
256
|
-
searchSinglePage<T>(
|
|
257
|
-
syncIndex(
|
|
258
|
-
update<T>(
|
|
355
|
+
bulkSave<T>(entityDefinitionId: string, entities: T[]): Promise<void>;
|
|
356
|
+
bulkUpdate<T>(entityDefinitionId: string, entities: T[]): Promise<void>;
|
|
357
|
+
count(entityDefinitionId: string): Promise<number>;
|
|
358
|
+
countByQuery(entityDefinitionId: string, query: string): Promise<number>;
|
|
359
|
+
deleteById(entityDefinitionId: string, id: string): Promise<void>;
|
|
360
|
+
deleteByQuery(entityDefinitionId: string, query: string): Promise<void>;
|
|
361
|
+
findAll<T>(entityDefinitionId: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
362
|
+
findAllSinglePage<T>(entityDefinitionId: string, pageable: Pageable): Promise<Page<T>>;
|
|
363
|
+
findById<T>(entityDefinitionId: string, id: string): Promise<T | null>;
|
|
364
|
+
findByIds<T>(entityDefinitionId: string, ids: string[]): Promise<T[]>;
|
|
365
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
366
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable): Promise<IterablePage<T>>;
|
|
367
|
+
namedQuerySinglePage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable): Promise<Page<T>>;
|
|
368
|
+
save<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
369
|
+
search<T>(entityDefinitionId: string, searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
370
|
+
searchSinglePage<T>(entityDefinitionId: string, searchText: string, pageable: Pageable): Promise<Page<T>>;
|
|
371
|
+
syncIndex(entityDefinitionId: string): Promise<void>;
|
|
372
|
+
update<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
373
|
+
}
|
|
374
|
+
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
375
|
+
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable2, IterablePage as IterablePage2 } from "@kinotic-ai/core";
|
|
376
|
+
type TenantSelection = string[];
|
|
377
|
+
interface IAdminEntitiesRepository {
|
|
378
|
+
/**
|
|
379
|
+
* Returns the number of entities available.
|
|
380
|
+
* @param structureId the id of the structure to count
|
|
381
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
382
|
+
* @return {@link Promise} emitting the number of entities.
|
|
383
|
+
*/
|
|
384
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
385
|
+
/**
|
|
386
|
+
* Returns the number of entities available for the given query.
|
|
387
|
+
*
|
|
388
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
389
|
+
* @param query the query used to limit result
|
|
390
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
391
|
+
* @return Promise emitting the number of entities
|
|
392
|
+
*/
|
|
393
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
394
|
+
/**
|
|
395
|
+
* Deletes the entity with the given id.
|
|
396
|
+
*
|
|
397
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
398
|
+
* @param id must not be {@literal null}
|
|
399
|
+
* @return {@link Promise} emitting when delete is complete
|
|
400
|
+
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
401
|
+
*/
|
|
402
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
403
|
+
/**
|
|
404
|
+
* Deletes the entity with the given id.
|
|
405
|
+
*
|
|
406
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
407
|
+
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
408
|
+
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
409
|
+
* @return Promise signaling when operation has completed
|
|
410
|
+
* @throws Error in case the given {@literal query} is {@literal null}
|
|
411
|
+
*/
|
|
412
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
413
|
+
/**
|
|
414
|
+
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
415
|
+
*
|
|
416
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
417
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
418
|
+
* @param pageable the page settings to be used
|
|
419
|
+
* @return a page of entities
|
|
420
|
+
*/
|
|
421
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
422
|
+
/**
|
|
423
|
+
* Retrieves an entity by its id.
|
|
424
|
+
*
|
|
425
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
426
|
+
* @param id must not be {@literal null}
|
|
427
|
+
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
428
|
+
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
429
|
+
*/
|
|
430
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T | null>;
|
|
431
|
+
/**
|
|
432
|
+
* Retrieves a list of entities by their id.
|
|
433
|
+
*
|
|
434
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
435
|
+
* @param ids must not be {@literal null}
|
|
436
|
+
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
437
|
+
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
438
|
+
*/
|
|
439
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
440
|
+
/**
|
|
441
|
+
* Executes a named query.
|
|
442
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
443
|
+
* @param queryName the name of the function that defines the query
|
|
444
|
+
* @param parameters to pass to the query
|
|
445
|
+
* @returns Promise with the result of the query
|
|
446
|
+
*/
|
|
447
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
448
|
+
/**
|
|
449
|
+
* Executes a named query and returns a Page of results.
|
|
450
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
451
|
+
* @param queryName the name of the function that defines the query
|
|
452
|
+
* @param parameters to pass to the query
|
|
453
|
+
* @param pageable the page settings to be used
|
|
454
|
+
* @returns Promise with the result of the query
|
|
455
|
+
*/
|
|
456
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
457
|
+
/**
|
|
458
|
+
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
459
|
+
*
|
|
460
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
461
|
+
* @param searchText the text to search for entities for
|
|
462
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
463
|
+
* @param pageable the page settings to be used
|
|
464
|
+
* @return a page of entities
|
|
465
|
+
*/
|
|
466
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
467
|
+
}
|
|
468
|
+
declare class AdminEntitiesRepository implements IAdminEntitiesRepository {
|
|
469
|
+
protected serviceProxy: IServiceProxy2;
|
|
470
|
+
constructor(kinotic: IKinotic2);
|
|
471
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
472
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
473
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
474
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
475
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
476
|
+
findAllSinglePage<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<Page2<T>>;
|
|
477
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T>;
|
|
478
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
479
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
480
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
481
|
+
namedQuerySinglePage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<Page2<T>>;
|
|
482
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
483
|
+
searchSinglePage<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<Page2<T>>;
|
|
259
484
|
}
|
|
485
|
+
import { Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
260
486
|
/**
|
|
261
|
-
* This is the base interface for all entity
|
|
487
|
+
* This is the base interface for all entity repositories.
|
|
262
488
|
* It provides the basic CRUD operations for entities.
|
|
263
489
|
*/
|
|
264
|
-
interface
|
|
490
|
+
interface IEntityRepository<T> {
|
|
265
491
|
/**
|
|
266
|
-
* The applicationId of the Entity this
|
|
492
|
+
* The applicationId of the Entity this repository is for
|
|
267
493
|
*/
|
|
268
494
|
entityApplicationId: string;
|
|
269
495
|
/**
|
|
270
|
-
* The name of the Entity this
|
|
496
|
+
* The name of the Entity this repository is for
|
|
271
497
|
*/
|
|
272
498
|
entityName: string;
|
|
273
499
|
/**
|
|
274
|
-
* The id of the Entity this
|
|
500
|
+
* The id of the Entity this repository is for
|
|
275
501
|
* Which is the applicationId + '.' + name
|
|
276
502
|
*/
|
|
277
503
|
entityId: string;
|
|
@@ -322,7 +548,7 @@ interface IEntityService<T> {
|
|
|
322
548
|
* @param pageable the page settings to be used
|
|
323
549
|
* @return a page of entities
|
|
324
550
|
*/
|
|
325
|
-
findAll(pageable:
|
|
551
|
+
findAll(pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
326
552
|
/**
|
|
327
553
|
* Retrieves an entity by its id.
|
|
328
554
|
*
|
|
@@ -330,7 +556,7 @@ interface IEntityService<T> {
|
|
|
330
556
|
* @return Promise emitting the entity with the given id or Promise emitting null if none found
|
|
331
557
|
* @throws Error in case the given {@literal id} is {@literal null}
|
|
332
558
|
*/
|
|
333
|
-
findById(id: string): Promise<T>;
|
|
559
|
+
findById(id: string): Promise<T | null>;
|
|
334
560
|
/**
|
|
335
561
|
* Retrieves a list of entities by their id.
|
|
336
562
|
*
|
|
@@ -353,7 +579,7 @@ interface IEntityService<T> {
|
|
|
353
579
|
* @param pageable the page settings to be used
|
|
354
580
|
* @returns Promise with the result of the query
|
|
355
581
|
*/
|
|
356
|
-
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable:
|
|
582
|
+
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<U>>;
|
|
357
583
|
/**
|
|
358
584
|
* Saves a given entity. This will override all data if there is an existing entity with the same id.
|
|
359
585
|
* Use the returned instance for further operations as the save operation might have changed the entity instance.
|
|
@@ -370,7 +596,7 @@ interface IEntityService<T> {
|
|
|
370
596
|
* @param pageable the page settings to be used
|
|
371
597
|
* @return a page of entities
|
|
372
598
|
*/
|
|
373
|
-
search(searchText: string, pageable:
|
|
599
|
+
search(searchText: string, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
374
600
|
/**
|
|
375
601
|
* This operation makes all the recent writes immediately available for search.
|
|
376
602
|
* @return a Promise that resolves when the operation is complete
|
|
@@ -388,274 +614,49 @@ interface IEntityService<T> {
|
|
|
388
614
|
update(entity: T): Promise<T>;
|
|
389
615
|
}
|
|
390
616
|
/**
|
|
391
|
-
* This is the base class for all entity
|
|
617
|
+
* This is the base class for all entity repositories.
|
|
392
618
|
* It provides the basic CRUD operations for entities.
|
|
393
619
|
*/
|
|
394
|
-
declare class
|
|
620
|
+
declare class EntityRepository<T> implements IEntityRepository<T> {
|
|
395
621
|
entityApplicationId: string;
|
|
396
622
|
entityName: string;
|
|
397
623
|
entityId: string;
|
|
398
|
-
private readonly
|
|
399
|
-
constructor(
|
|
624
|
+
private readonly entitiesRepository;
|
|
625
|
+
constructor(entityApplicationId: string, entityName: string, entitiesRepository?: IEntitiesRepository);
|
|
400
626
|
bulkSave(entities: T[]): Promise<void>;
|
|
401
627
|
bulkUpdate(entities: T[]): Promise<void>;
|
|
402
628
|
count(): Promise<number>;
|
|
403
629
|
countByQuery(query: string): Promise<number>;
|
|
404
630
|
deleteById(id: string): Promise<void>;
|
|
405
631
|
deleteByQuery(query: string): Promise<void>;
|
|
406
|
-
findAll(pageable:
|
|
407
|
-
findById(id: string): Promise<T>;
|
|
632
|
+
findAll(pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
633
|
+
findById(id: string): Promise<T | null>;
|
|
408
634
|
findByIds(ids: string[]): Promise<T[]>;
|
|
409
635
|
namedQuery<U>(queryName: string, queryParameters: QueryParameter[]): Promise<U>;
|
|
410
|
-
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable:
|
|
636
|
+
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<U>>;
|
|
411
637
|
save(entity: T): Promise<T>;
|
|
412
|
-
search(searchText: string, pageable:
|
|
638
|
+
search(searchText: string, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
413
639
|
syncIndex(): Promise<void>;
|
|
414
640
|
update(entity: T): Promise<T>;
|
|
415
641
|
protected beforeBulkSaveOrUpdate(entities: T[]): Promise<T[]>;
|
|
416
642
|
protected beforeSaveOrUpdate(entity: T): Promise<T>;
|
|
417
643
|
}
|
|
418
|
-
type IfFunction<
|
|
419
|
-
T,
|
|
420
|
-
U
|
|
421
|
-
> = T extends (...args: any[]) => any ? U : never;
|
|
422
|
-
type MethodsOf<T> = { [K in keyof T] : IfFunction<T[K], K> }[keyof T];
|
|
423
|
-
type ExcludedMethods = "namedQuery" | "namedQueryPage";
|
|
424
|
-
type FilteredMethods<T> = Exclude<MethodsOf<T>, ExcludedMethods>;
|
|
425
|
-
type DecoratedFunction = FilteredMethods<IEntityService<any>> | "allCreate" | "allRead" | "allUpdate" | "allDelete";
|
|
426
|
-
/**
|
|
427
|
-
* Configuration for the {@link EntityServiceDecoratorsDecorator}
|
|
428
|
-
* This is a map of method names to an array of decorators that should be applied to that method
|
|
429
|
-
*/
|
|
430
|
-
type EntityServiceDecoratorsConfig = Partial<Record<DecoratedFunction, EntityServiceDecorator[]>>;
|
|
431
|
-
declare enum KinoticPersistenceDecorator {
|
|
432
|
-
Entity = "__structures-entity__",
|
|
433
|
-
Id = "__structures-id__",
|
|
434
|
-
AutoGeneratedId = "__structures-auto-generated-id__",
|
|
435
|
-
Flattened = "__structures-flattened__",
|
|
436
|
-
Nested = "__structures-nested__",
|
|
437
|
-
Text = "__structures-text__",
|
|
438
|
-
NotNull = "__structures-notnull__",
|
|
439
|
-
Precision = "__structures-precision__",
|
|
440
|
-
Discriminator = "__structures-discriminator__",
|
|
441
|
-
Query = "__structures-query__",
|
|
442
|
-
EntityServiceDecorators = "__structures-entity-service-decorators__"
|
|
443
|
-
}
|
|
444
|
-
/**
|
|
445
|
-
* Signifies that a property is an auto-generated ID for the entity.
|
|
446
|
-
*/
|
|
447
|
-
declare function AutoGeneratedId(target: any, propertyKey: string): void;
|
|
448
|
-
declare class DiscriminatorConfig {
|
|
449
|
-
propertyName: string;
|
|
450
|
-
constructor(propertyName: string);
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Signifies that a property is a discriminator for the entity.
|
|
454
|
-
* This is used to determine the type of the entity when deserializing from JSON.
|
|
455
|
-
* @param propertyName the name of the property to use as the discriminator
|
|
456
|
-
*/
|
|
457
|
-
declare function Discriminator(propertyName: string): (target: any, propertyKey: string) => void;
|
|
458
|
-
declare class EntityConfig {
|
|
459
|
-
multiTenancyType: MultiTenancyType;
|
|
460
|
-
entityType: EntityType;
|
|
461
|
-
constructor(multiTenancyType: MultiTenancyType, entityType?: EntityType);
|
|
462
|
-
}
|
|
463
|
-
/**
|
|
464
|
-
* Signifies that a class is a Structures Entity.
|
|
465
|
-
* This is required to define the class as an entity in the Structures framework.
|
|
466
|
-
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
467
|
-
* @param entityType the type of entity to use for this entity
|
|
468
|
-
*/
|
|
469
|
-
declare function Entity(multiTenancyType?: MultiTenancyType, entityType?: EntityType): (constructor: Function) => void;
|
|
470
|
-
/**
|
|
471
|
-
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
472
|
-
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
473
|
-
*/
|
|
474
|
-
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_constructor: Function) => void;
|
|
475
|
-
/**
|
|
476
|
-
* Provides configuration for the Elasticsearch index.
|
|
477
|
-
* This can be used to override the default index settings and mappings used by Structures.
|
|
478
|
-
*/
|
|
479
|
-
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_constructor: Function) => void;
|
|
480
|
-
declare function Flattened(target: any, propertyKey: string): void;
|
|
481
|
-
/**
|
|
482
|
-
* Signifies that a property is the ID of the entity.
|
|
483
|
-
*/
|
|
484
|
-
declare function Id(target: any, propertyKey: string): void;
|
|
485
|
-
declare function Nested(target: any, propertyKey: string): void;
|
|
486
|
-
/**
|
|
487
|
-
* Signifies that a property is not indexed in Elasticsearch.
|
|
488
|
-
*/
|
|
489
|
-
declare function NotIndexed(_target: any, _propertyKey: string): void;
|
|
490
|
-
declare function NotNull(target: any, propertyKey: string): void;
|
|
491
|
-
declare function Policy(_policies: string[][]): (_target: any, _propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
|
492
|
-
declare class PrecisionConfig {
|
|
493
|
-
precisionType: PrecisionType;
|
|
494
|
-
constructor(precisionType: PrecisionType);
|
|
495
|
-
}
|
|
496
|
-
declare function Precision(precisionType?: PrecisionType): (target: any, propertyKey: string) => void;
|
|
497
|
-
declare function Query(statements: string): (target: any, key: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
498
|
-
declare function Role(_roles: string[]): (_target: any, _propertyKey?: string, _descriptor?: PropertyDescriptor) => void;
|
|
499
|
-
declare function Text(target: any, propertyKey: string): void;
|
|
500
|
-
/**
|
|
501
|
-
* This is used for data streams to signify the field that should be used as the time reference.
|
|
502
|
-
*/
|
|
503
|
-
declare function TimeReference(_target: any, _propertyKey: string): void;
|
|
504
|
-
declare function Version(_target: any, _propertyKey: string): void;
|
|
505
|
-
declare function TenantId(_target: any, _propertyKey: string): void;
|
|
506
|
-
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
507
|
-
/**
|
|
508
|
-
* Provides a way to add decorators to an entity service
|
|
509
|
-
*/
|
|
510
|
-
declare class EntityServiceDecoratorsDecorator extends C3Decorator2 {
|
|
511
|
-
config: EntityServiceDecoratorsConfig;
|
|
512
|
-
constructor();
|
|
513
|
-
}
|
|
514
|
-
declare class PolicyDecorator extends EntityServiceDecorator {
|
|
515
|
-
policies: string[][];
|
|
516
|
-
constructor(policies: string[][]);
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Provides a mechanism to apply the @Policy decorator to an {@link EntityService}
|
|
520
|
-
* @param policies to be supplied
|
|
521
|
-
*/
|
|
522
|
-
declare function $Policy(policies: string[][]): PolicyDecorator;
|
|
523
|
-
declare class RoleDecorator extends EntityServiceDecorator {
|
|
524
|
-
roles: string[];
|
|
525
|
-
constructor(roles: string[]);
|
|
526
|
-
}
|
|
527
|
-
/**
|
|
528
|
-
* Provides a mechanism to apply the @Role decorator to an {@link EntityService}
|
|
529
|
-
* @param roles to be supplied
|
|
530
|
-
*/
|
|
531
|
-
declare function $Role(roles: string[]): RoleDecorator;
|
|
532
|
-
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
533
|
-
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
534
|
-
type TenantSelection = string[];
|
|
535
|
-
interface IAdminEntitiesService {
|
|
536
|
-
/**
|
|
537
|
-
* Returns the number of entities available.
|
|
538
|
-
* @param structureId the id of the structure to count
|
|
539
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
540
|
-
* @return {@link Promise} emitting the number of entities.
|
|
541
|
-
*/
|
|
542
|
-
count(structureId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
543
|
-
/**
|
|
544
|
-
* Returns the number of entities available for the given query.
|
|
545
|
-
*
|
|
546
|
-
* @param structureId the id of the structure to save the entity for
|
|
547
|
-
* @param query the query used to limit result
|
|
548
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
549
|
-
* @return Promise emitting the number of entities
|
|
550
|
-
*/
|
|
551
|
-
countByQuery(structureId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
552
|
-
/**
|
|
553
|
-
* Deletes the entity with the given id.
|
|
554
|
-
*
|
|
555
|
-
* @param structureId the id of the structure to save the entity for
|
|
556
|
-
* @param id must not be {@literal null}
|
|
557
|
-
* @return {@link Promise} emitting when delete is complete
|
|
558
|
-
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
559
|
-
*/
|
|
560
|
-
deleteById(structureId: string, id: TenantSpecificId): Promise<void>;
|
|
561
|
-
/**
|
|
562
|
-
* Deletes the entity with the given id.
|
|
563
|
-
*
|
|
564
|
-
* @param structureId the id of the structure to save the entity for
|
|
565
|
-
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
566
|
-
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
567
|
-
* @return Promise signaling when operation has completed
|
|
568
|
-
* @throws Error in case the given {@literal query} is {@literal null}
|
|
569
|
-
*/
|
|
570
|
-
deleteByQuery(structureId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
571
|
-
/**
|
|
572
|
-
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
573
|
-
*
|
|
574
|
-
* @param structureId the id of the structure to save the entity for
|
|
575
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
576
|
-
* @param pageable the page settings to be used
|
|
577
|
-
* @return a page of entities
|
|
578
|
-
*/
|
|
579
|
-
findAll<T>(structureId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
580
|
-
/**
|
|
581
|
-
* Retrieves an entity by its id.
|
|
582
|
-
*
|
|
583
|
-
* @param structureId the id of the structure to save the entity for
|
|
584
|
-
* @param id must not be {@literal null}
|
|
585
|
-
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
586
|
-
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
587
|
-
*/
|
|
588
|
-
findById<T>(structureId: string, id: TenantSpecificId): Promise<T>;
|
|
589
|
-
/**
|
|
590
|
-
* Retrieves a list of entities by their id.
|
|
591
|
-
*
|
|
592
|
-
* @param structureId the id of the structure to save the entity for
|
|
593
|
-
* @param ids must not be {@literal null}
|
|
594
|
-
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
595
|
-
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
596
|
-
*/
|
|
597
|
-
findByIds<T>(structureId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
598
|
-
/**
|
|
599
|
-
* Executes a named query.
|
|
600
|
-
* @param structureId the id of the structure that this named query is defined for
|
|
601
|
-
* @param queryName the name of the function that defines the query
|
|
602
|
-
* @param parameters to pass to the query
|
|
603
|
-
* @returns Promise with the result of the query
|
|
604
|
-
*/
|
|
605
|
-
namedQuery<T>(structureId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
606
|
-
/**
|
|
607
|
-
* Executes a named query and returns a Page of results.
|
|
608
|
-
* @param structureId the id of the structure that this named query is defined for
|
|
609
|
-
* @param queryName the name of the function that defines the query
|
|
610
|
-
* @param parameters to pass to the query
|
|
611
|
-
* @param pageable the page settings to be used
|
|
612
|
-
* @returns Promise with the result of the query
|
|
613
|
-
*/
|
|
614
|
-
namedQueryPage<T>(structureId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
615
|
-
/**
|
|
616
|
-
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
617
|
-
*
|
|
618
|
-
* @param structureId the id of the structure to save the entity for
|
|
619
|
-
* @param searchText the text to search for entities for
|
|
620
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
621
|
-
* @param pageable the page settings to be used
|
|
622
|
-
* @return a page of entities
|
|
623
|
-
*/
|
|
624
|
-
search<T>(structureId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
625
|
-
}
|
|
626
|
-
declare class AdminEntitiesService implements IAdminEntitiesService {
|
|
627
|
-
protected serviceProxy: IServiceProxy2;
|
|
628
|
-
constructor(kinotic: IKinotic2);
|
|
629
|
-
count(structureId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
630
|
-
countByQuery(structureId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
631
|
-
deleteById(structureId: string, id: TenantSpecificId): Promise<void>;
|
|
632
|
-
deleteByQuery(structureId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
633
|
-
findAll<T>(structureId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
634
|
-
findAllSinglePage<T>(structureId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<Page2<T>>;
|
|
635
|
-
findById<T>(structureId: string, id: TenantSpecificId): Promise<T>;
|
|
636
|
-
findByIds<T>(structureId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
637
|
-
namedQuery<T>(structureId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
638
|
-
namedQueryPage<T>(structureId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
639
|
-
namedQuerySinglePage<T>(structureId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<Page2<T>>;
|
|
640
|
-
search<T>(structureId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
641
|
-
searchSinglePage<T>(structureId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<Page2<T>>;
|
|
642
|
-
}
|
|
643
644
|
import { Pageable as Pageable4, IterablePage as IterablePage4 } from "@kinotic-ai/core";
|
|
644
645
|
/**
|
|
645
|
-
* This is the base interface for all admin entity
|
|
646
|
+
* This is the base interface for all admin entity repositories.
|
|
646
647
|
* It provides the basic CRUD operations for entities with multi-tenancy support.
|
|
647
648
|
*/
|
|
648
|
-
interface
|
|
649
|
+
interface IAdminEntityRepository<T> {
|
|
649
650
|
/**
|
|
650
|
-
* The application id of the Entity this
|
|
651
|
+
* The application id of the Entity this repository is for
|
|
651
652
|
*/
|
|
652
653
|
entityApplicationId: string;
|
|
653
654
|
/**
|
|
654
|
-
* The name of the Entity this
|
|
655
|
+
* The name of the Entity this repository is for
|
|
655
656
|
*/
|
|
656
657
|
entityName: string;
|
|
657
658
|
/**
|
|
658
|
-
* The id of the Entity this
|
|
659
|
+
* The id of the Entity this repository is for
|
|
659
660
|
* Which is the applicationId + '.' + name
|
|
660
661
|
*/
|
|
661
662
|
entityId: string;
|
|
@@ -706,7 +707,7 @@ interface IAdminEntityService<T> {
|
|
|
706
707
|
* @return Promise emitting the entity with the given id or Promise emitting null if none found
|
|
707
708
|
* @throws Error in case the given {@literal id} is {@literal null}
|
|
708
709
|
*/
|
|
709
|
-
findById(id: TenantSpecificId): Promise<T>;
|
|
710
|
+
findById(id: TenantSpecificId): Promise<T | null>;
|
|
710
711
|
/**
|
|
711
712
|
* Retrieves a list of entities by their id.
|
|
712
713
|
*
|
|
@@ -741,15 +742,15 @@ interface IAdminEntityService<T> {
|
|
|
741
742
|
search(searchText: string, tenantSelection: TenantSelection, pageable: Pageable4): Promise<IterablePage4<T>>;
|
|
742
743
|
}
|
|
743
744
|
/**
|
|
744
|
-
* This is the base class for all admin entity
|
|
745
|
+
* This is the base class for all admin entity repositories.
|
|
745
746
|
* It provides the basic CRUD operations for entities with multi-tenancy support.
|
|
746
747
|
*/
|
|
747
|
-
declare class
|
|
748
|
+
declare class AdminEntityRepository<T> implements IAdminEntityRepository<T> {
|
|
748
749
|
entityApplicationId: string;
|
|
749
750
|
entityName: string;
|
|
750
751
|
entityId: string;
|
|
751
|
-
private readonly
|
|
752
|
-
constructor(
|
|
752
|
+
private readonly adminEntitiesRepository;
|
|
753
|
+
constructor(entityApplicationId: string, entityName: string, adminEntitiesRepository?: IAdminEntitiesRepository);
|
|
753
754
|
count(tenantSelection: TenantSelection): Promise<number>;
|
|
754
755
|
countByQuery(query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
755
756
|
deleteById(id: TenantSpecificId): Promise<void>;
|
|
@@ -763,11 +764,11 @@ declare class AdminEntityService<T> implements IAdminEntityService<T> {
|
|
|
763
764
|
}
|
|
764
765
|
import { KinoticPlugin } from "@kinotic-ai/core";
|
|
765
766
|
interface IPersistenceExtension {
|
|
766
|
-
entities:
|
|
767
|
-
adminEntities:
|
|
767
|
+
entities: IEntitiesRepository;
|
|
768
|
+
adminEntities: IAdminEntitiesRepository;
|
|
768
769
|
}
|
|
769
770
|
declare const PersistencePlugin: KinoticPlugin<IPersistenceExtension>;
|
|
770
771
|
declare module "@kinotic-ai/core" {
|
|
771
772
|
interface KinoticSingleton extends IPersistenceExtension {}
|
|
772
773
|
}
|
|
773
|
-
export { Version, TimeReference, Text, TenantSpecificId, TenantSelection, TenantId, RoleDecorator, Role, QueryParameter, QueryOptions, Query, PrecisionType, PrecisionConfig, Precision, PolicyDecorator, Policy, PersistencePlugin, NotNull, NotIndexed, Nested, MultiTenancyType, KinoticPersistenceDecorator, Id, IPersistenceExtension,
|
|
774
|
+
export { Version, TimeReference, Text, TenantSpecificId, TenantSelection, TenantId, RoleDecorator, Role, QueryParameter, QueryOptions, Query, PrecisionType, PrecisionConfig, Precision, PolicyDecorator, Policy, PersistencePlugin, NotNull, NotIndexed, Nested, MultiTenancyType, KinoticPersistenceDecorator, Id, IPersistenceExtension, IEntityRepository, IEntitiesRepository, IAdminEntityRepository, IAdminEntitiesRepository, Flattened, EsIndexConfigurationData, EsIndexConfiguration, EntityType, EntityServiceDecoratorsDecorator, EntityServiceDecoratorsConfig, EntityServiceDecorators, EntityServiceDecorator, EntityRepository, EntityConfig, Entity, EntitiesRepository, DiscriminatorConfig, Discriminator, DecoratedFunction, AutoGeneratedId, AdminEntityRepository, AdminEntitiesRepository, $Role, $Policy };
|