@kinotic-ai/persistence 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +80 -76
- package/dist/index.d.cts +101 -91
- package/dist/index.d.ts +101 -91
- package/dist/index.js +80 -76
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -210,166 +210,166 @@ import { IServiceProxy, Page, Pageable, IterablePage } from "@kinotic-ai/core";
|
|
|
210
210
|
interface IEntitiesRepository {
|
|
211
211
|
/**
|
|
212
212
|
* Saves all given entities.
|
|
213
|
-
* @param
|
|
213
|
+
* @param entityDefinitionId the id of the structure to save the entities for
|
|
214
214
|
* @param entities all the entities to save
|
|
215
215
|
* @return Promise that will complete when all entities have been saved
|
|
216
216
|
*/
|
|
217
|
-
bulkSave<T>(
|
|
217
|
+
bulkSave<T>(entityDefinitionId: string, entities: T[]): Promise<void>;
|
|
218
218
|
/**
|
|
219
219
|
* Updates all given entities.
|
|
220
|
-
* @param
|
|
220
|
+
* @param entityDefinitionId the id of the structure to update the entities for
|
|
221
221
|
* @param entities all the entities to save
|
|
222
222
|
* @return Promise that will complete when all entities have been saved
|
|
223
223
|
*/
|
|
224
|
-
bulkUpdate<T>(
|
|
224
|
+
bulkUpdate<T>(entityDefinitionId: string, entities: T[]): Promise<void>;
|
|
225
225
|
/**
|
|
226
226
|
* Returns the number of entities available.
|
|
227
|
-
* @param
|
|
227
|
+
* @param entityDefinitionId the id of the structure to count
|
|
228
228
|
* @return {@link Promise} emitting the number of entities.
|
|
229
229
|
*/
|
|
230
|
-
count(
|
|
230
|
+
count(entityDefinitionId: string): Promise<number>;
|
|
231
231
|
/**
|
|
232
232
|
* Returns the number of entities available for the given query.
|
|
233
233
|
*
|
|
234
|
-
* @param
|
|
234
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
235
235
|
* @param query the query used to limit result
|
|
236
236
|
* @return Promise emitting the number of entities
|
|
237
237
|
*/
|
|
238
|
-
countByQuery(
|
|
238
|
+
countByQuery(entityDefinitionId: string, query: string): Promise<number>;
|
|
239
239
|
/**
|
|
240
240
|
* Deletes the entity with the given id.
|
|
241
241
|
*
|
|
242
|
-
* @param
|
|
242
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
243
243
|
* @param id must not be {@literal null}
|
|
244
244
|
* @return {@link Promise} emitting when delete is complete
|
|
245
245
|
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
246
246
|
*/
|
|
247
|
-
deleteById(
|
|
247
|
+
deleteById(entityDefinitionId: string, id: string): Promise<void>;
|
|
248
248
|
/**
|
|
249
249
|
* Deletes the entity with the given id.
|
|
250
250
|
*
|
|
251
|
-
* @param
|
|
251
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
252
252
|
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
253
253
|
* @return Promise signaling when operation has completed
|
|
254
254
|
* @throws Error in case the given {@literal query} is {@literal null}
|
|
255
255
|
*/
|
|
256
|
-
deleteByQuery(
|
|
256
|
+
deleteByQuery(entityDefinitionId: string, query: string): Promise<void>;
|
|
257
257
|
/**
|
|
258
258
|
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
259
259
|
*
|
|
260
|
-
* @param
|
|
260
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
261
261
|
* @param pageable the page settings to be used
|
|
262
262
|
* @return a page of entities
|
|
263
263
|
*/
|
|
264
|
-
findAll<T>(
|
|
264
|
+
findAll<T>(entityDefinitionId: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
265
265
|
/**
|
|
266
266
|
* Returns a single {@link Page} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
267
|
-
* @param
|
|
267
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
268
268
|
* @param pageable the page settings to be used
|
|
269
269
|
*/
|
|
270
|
-
findAllSinglePage<T>(
|
|
270
|
+
findAllSinglePage<T>(entityDefinitionId: string, pageable: Pageable): Promise<Page<T>>;
|
|
271
271
|
/**
|
|
272
272
|
* Retrieves an entity by its id.
|
|
273
273
|
*
|
|
274
|
-
* @param
|
|
274
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
275
275
|
* @param id must not be {@literal null}
|
|
276
276
|
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
277
277
|
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
278
278
|
*/
|
|
279
|
-
findById<T>(
|
|
279
|
+
findById<T>(entityDefinitionId: string, id: string): Promise<T | null>;
|
|
280
280
|
/**
|
|
281
281
|
* Retrieves a list of entities by their id.
|
|
282
282
|
*
|
|
283
|
-
* @param
|
|
283
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
284
284
|
* @param ids must not be {@literal null}
|
|
285
285
|
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
286
286
|
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
287
287
|
*/
|
|
288
|
-
findByIds<T>(
|
|
288
|
+
findByIds<T>(entityDefinitionId: string, ids: string[]): Promise<T[]>;
|
|
289
289
|
/**
|
|
290
290
|
* Executes a named query.
|
|
291
|
-
* @param
|
|
291
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
292
292
|
* @param queryName the name of the function that defines the query
|
|
293
293
|
* @param parameters to pass to the query
|
|
294
294
|
* @returns Promise with the result of the query
|
|
295
295
|
*/
|
|
296
|
-
namedQuery<T>(
|
|
296
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
297
297
|
/**
|
|
298
298
|
* Executes a named query and returns a Page of results.
|
|
299
|
-
* @param
|
|
299
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
300
300
|
* @param queryName the name of the function that defines the query
|
|
301
301
|
* @param parameters to pass to the query
|
|
302
302
|
* @param pageable the page settings to be used
|
|
303
303
|
* @returns Promise with the result of the query
|
|
304
304
|
*/
|
|
305
|
-
namedQueryPage<T>(
|
|
305
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable): Promise<IterablePage<T>>;
|
|
306
306
|
/**
|
|
307
307
|
* Saves a given entity. Use the returned instance for further operations as the save operation might have changed the
|
|
308
308
|
* entity instance completely.
|
|
309
309
|
*
|
|
310
|
-
* @param
|
|
310
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
311
311
|
* @param entity must not be {@literal null}
|
|
312
312
|
* @return {@link Promise} emitting the saved entity
|
|
313
313
|
* @throws IllegalArgumentException in case the given {@literal entity} is {@literal null}
|
|
314
314
|
*/
|
|
315
|
-
save<T>(
|
|
315
|
+
save<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
316
316
|
/**
|
|
317
317
|
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
318
318
|
*
|
|
319
|
-
* @param
|
|
319
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
320
320
|
* @param searchText the text to search for entities for
|
|
321
321
|
* @param pageable the page settings to be used
|
|
322
322
|
* @return a page of entities
|
|
323
323
|
*/
|
|
324
|
-
search<T>(
|
|
324
|
+
search<T>(entityDefinitionId: string, searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
|
|
325
325
|
/**
|
|
326
326
|
* Returns a single {@link Page} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
327
327
|
*
|
|
328
|
-
* @param
|
|
328
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
329
329
|
* @param searchText the text to search for entities for
|
|
330
330
|
* @param pageable the page settings to be used
|
|
331
331
|
* @return a page of entities
|
|
332
332
|
*/
|
|
333
|
-
searchSinglePage<T>(
|
|
333
|
+
searchSinglePage<T>(entityDefinitionId: string, searchText: string, pageable: Pageable): Promise<Page<T>>;
|
|
334
334
|
/**
|
|
335
335
|
* This operation makes all the recent writes immediately available for search.
|
|
336
|
-
* @param
|
|
336
|
+
* @param entityDefinitionId the id of the structure to sync the index for.
|
|
337
337
|
* @return a Promise that resolves when the operation is complete
|
|
338
338
|
*/
|
|
339
|
-
syncIndex(
|
|
339
|
+
syncIndex(entityDefinitionId: string): Promise<void>;
|
|
340
340
|
/**
|
|
341
341
|
* Updates a given entity. This will only override the fields that are present in the given entity.
|
|
342
342
|
* If any fields are not present in the given entity data, they will not be changed.
|
|
343
343
|
* If the entity does not exist, it will be created.
|
|
344
344
|
*
|
|
345
|
-
* @param
|
|
345
|
+
* @param entityDefinitionId the id of the structure to update the entity for
|
|
346
346
|
* @param entity must not be {@literal null}
|
|
347
347
|
* @return Promise emitting the saved entity
|
|
348
348
|
* @throws Error in case the given {@literal entity} is {@literal null}
|
|
349
349
|
*/
|
|
350
|
-
update<T>(
|
|
350
|
+
update<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
351
351
|
}
|
|
352
352
|
declare class EntitiesRepository implements IEntitiesRepository {
|
|
353
353
|
protected serviceProxy: IServiceProxy;
|
|
354
354
|
constructor(kinotic: IKinotic);
|
|
355
|
-
bulkSave<T>(
|
|
356
|
-
bulkUpdate<T>(
|
|
357
|
-
count(
|
|
358
|
-
countByQuery(
|
|
359
|
-
deleteById(
|
|
360
|
-
deleteByQuery(
|
|
361
|
-
findAll<T>(
|
|
362
|
-
findAllSinglePage<T>(
|
|
363
|
-
findById<T>(
|
|
364
|
-
findByIds<T>(
|
|
365
|
-
namedQuery<T>(
|
|
366
|
-
namedQueryPage<T>(
|
|
367
|
-
namedQuerySinglePage<T>(
|
|
368
|
-
save<T>(
|
|
369
|
-
search<T>(
|
|
370
|
-
searchSinglePage<T>(
|
|
371
|
-
syncIndex(
|
|
372
|
-
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
373
|
}
|
|
374
374
|
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
375
375
|
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable2, IterablePage as IterablePage2 } from "@kinotic-ai/core";
|
|
@@ -381,106 +381,106 @@ interface IAdminEntitiesRepository {
|
|
|
381
381
|
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
382
382
|
* @return {@link Promise} emitting the number of entities.
|
|
383
383
|
*/
|
|
384
|
-
count(
|
|
384
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
385
385
|
/**
|
|
386
386
|
* Returns the number of entities available for the given query.
|
|
387
387
|
*
|
|
388
|
-
* @param
|
|
388
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
389
389
|
* @param query the query used to limit result
|
|
390
390
|
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
391
391
|
* @return Promise emitting the number of entities
|
|
392
392
|
*/
|
|
393
|
-
countByQuery(
|
|
393
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
394
394
|
/**
|
|
395
395
|
* Deletes the entity with the given id.
|
|
396
396
|
*
|
|
397
|
-
* @param
|
|
397
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
398
398
|
* @param id must not be {@literal null}
|
|
399
399
|
* @return {@link Promise} emitting when delete is complete
|
|
400
400
|
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
401
401
|
*/
|
|
402
|
-
deleteById(
|
|
402
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
403
403
|
/**
|
|
404
404
|
* Deletes the entity with the given id.
|
|
405
405
|
*
|
|
406
|
-
* @param
|
|
406
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
407
407
|
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
408
408
|
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
409
409
|
* @return Promise signaling when operation has completed
|
|
410
410
|
* @throws Error in case the given {@literal query} is {@literal null}
|
|
411
411
|
*/
|
|
412
|
-
deleteByQuery(
|
|
412
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
413
413
|
/**
|
|
414
414
|
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
415
415
|
*
|
|
416
|
-
* @param
|
|
416
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
417
417
|
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
418
418
|
* @param pageable the page settings to be used
|
|
419
419
|
* @return a page of entities
|
|
420
420
|
*/
|
|
421
|
-
findAll<T>(
|
|
421
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
422
422
|
/**
|
|
423
423
|
* Retrieves an entity by its id.
|
|
424
424
|
*
|
|
425
|
-
* @param
|
|
425
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
426
426
|
* @param id must not be {@literal null}
|
|
427
427
|
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
428
428
|
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
429
429
|
*/
|
|
430
|
-
findById<T>(
|
|
430
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T | null>;
|
|
431
431
|
/**
|
|
432
432
|
* Retrieves a list of entities by their id.
|
|
433
433
|
*
|
|
434
|
-
* @param
|
|
434
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
435
435
|
* @param ids must not be {@literal null}
|
|
436
436
|
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
437
437
|
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
438
438
|
*/
|
|
439
|
-
findByIds<T>(
|
|
439
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
440
440
|
/**
|
|
441
441
|
* Executes a named query.
|
|
442
|
-
* @param
|
|
442
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
443
443
|
* @param queryName the name of the function that defines the query
|
|
444
444
|
* @param parameters to pass to the query
|
|
445
445
|
* @returns Promise with the result of the query
|
|
446
446
|
*/
|
|
447
|
-
namedQuery<T>(
|
|
447
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
448
448
|
/**
|
|
449
449
|
* Executes a named query and returns a Page of results.
|
|
450
|
-
* @param
|
|
450
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
451
451
|
* @param queryName the name of the function that defines the query
|
|
452
452
|
* @param parameters to pass to the query
|
|
453
453
|
* @param pageable the page settings to be used
|
|
454
454
|
* @returns Promise with the result of the query
|
|
455
455
|
*/
|
|
456
|
-
namedQueryPage<T>(
|
|
456
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
457
457
|
/**
|
|
458
458
|
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
459
459
|
*
|
|
460
|
-
* @param
|
|
460
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
461
461
|
* @param searchText the text to search for entities for
|
|
462
462
|
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
463
463
|
* @param pageable the page settings to be used
|
|
464
464
|
* @return a page of entities
|
|
465
465
|
*/
|
|
466
|
-
search<T>(
|
|
466
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
467
467
|
}
|
|
468
468
|
declare class AdminEntitiesRepository implements IAdminEntitiesRepository {
|
|
469
469
|
protected serviceProxy: IServiceProxy2;
|
|
470
470
|
constructor(kinotic: IKinotic2);
|
|
471
|
-
count(
|
|
472
|
-
countByQuery(
|
|
473
|
-
deleteById(
|
|
474
|
-
deleteByQuery(
|
|
475
|
-
findAll<T>(
|
|
476
|
-
findAllSinglePage<T>(
|
|
477
|
-
findById<T>(
|
|
478
|
-
findByIds<T>(
|
|
479
|
-
namedQuery<T>(
|
|
480
|
-
namedQueryPage<T>(
|
|
481
|
-
namedQuerySinglePage<T>(
|
|
482
|
-
search<T>(
|
|
483
|
-
searchSinglePage<T>(
|
|
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>>;
|
|
484
484
|
}
|
|
485
485
|
import { Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
486
486
|
/**
|
|
@@ -488,6 +488,10 @@ import { Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-a
|
|
|
488
488
|
* It provides the basic CRUD operations for entities.
|
|
489
489
|
*/
|
|
490
490
|
interface IEntityRepository<T> {
|
|
491
|
+
/**
|
|
492
|
+
* The organizationId of the Entity this repository is for
|
|
493
|
+
*/
|
|
494
|
+
entityOrganizationId: string;
|
|
491
495
|
/**
|
|
492
496
|
* The applicationId of the Entity this repository is for
|
|
493
497
|
*/
|
|
@@ -498,7 +502,7 @@ interface IEntityRepository<T> {
|
|
|
498
502
|
entityName: string;
|
|
499
503
|
/**
|
|
500
504
|
* The id of the Entity this repository is for
|
|
501
|
-
* Which is the applicationId + '.' + name
|
|
505
|
+
* Which is the organizationId + '.' + applicationId + '.' + name
|
|
502
506
|
*/
|
|
503
507
|
entityId: string;
|
|
504
508
|
/**
|
|
@@ -556,7 +560,7 @@ interface IEntityRepository<T> {
|
|
|
556
560
|
* @return Promise emitting the entity with the given id or Promise emitting null if none found
|
|
557
561
|
* @throws Error in case the given {@literal id} is {@literal null}
|
|
558
562
|
*/
|
|
559
|
-
findById(id: string): Promise<T>;
|
|
563
|
+
findById(id: string): Promise<T | null>;
|
|
560
564
|
/**
|
|
561
565
|
* Retrieves a list of entities by their id.
|
|
562
566
|
*
|
|
@@ -618,11 +622,12 @@ interface IEntityRepository<T> {
|
|
|
618
622
|
* It provides the basic CRUD operations for entities.
|
|
619
623
|
*/
|
|
620
624
|
declare class EntityRepository<T> implements IEntityRepository<T> {
|
|
625
|
+
entityOrganizationId: string;
|
|
621
626
|
entityApplicationId: string;
|
|
622
627
|
entityName: string;
|
|
623
628
|
entityId: string;
|
|
624
629
|
private readonly entitiesRepository;
|
|
625
|
-
constructor(
|
|
630
|
+
constructor(entityOrganizationId: string, entityApplicationId: string, entityName: string, entitiesRepository?: IEntitiesRepository);
|
|
626
631
|
bulkSave(entities: T[]): Promise<void>;
|
|
627
632
|
bulkUpdate(entities: T[]): Promise<void>;
|
|
628
633
|
count(): Promise<number>;
|
|
@@ -630,7 +635,7 @@ declare class EntityRepository<T> implements IEntityRepository<T> {
|
|
|
630
635
|
deleteById(id: string): Promise<void>;
|
|
631
636
|
deleteByQuery(query: string): Promise<void>;
|
|
632
637
|
findAll(pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
633
|
-
findById(id: string): Promise<T>;
|
|
638
|
+
findById(id: string): Promise<T | null>;
|
|
634
639
|
findByIds(ids: string[]): Promise<T[]>;
|
|
635
640
|
namedQuery<U>(queryName: string, queryParameters: QueryParameter[]): Promise<U>;
|
|
636
641
|
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<U>>;
|
|
@@ -647,6 +652,10 @@ import { Pageable as Pageable4, IterablePage as IterablePage4 } from "@kinotic-a
|
|
|
647
652
|
* It provides the basic CRUD operations for entities with multi-tenancy support.
|
|
648
653
|
*/
|
|
649
654
|
interface IAdminEntityRepository<T> {
|
|
655
|
+
/**
|
|
656
|
+
* The organization id of the Entity this repository is for
|
|
657
|
+
*/
|
|
658
|
+
entityOrganizationId: string;
|
|
650
659
|
/**
|
|
651
660
|
* The application id of the Entity this repository is for
|
|
652
661
|
*/
|
|
@@ -657,7 +666,7 @@ interface IAdminEntityRepository<T> {
|
|
|
657
666
|
entityName: string;
|
|
658
667
|
/**
|
|
659
668
|
* The id of the Entity this repository is for
|
|
660
|
-
* Which is the applicationId + '.' + name
|
|
669
|
+
* Which is the organizationId + '.' + applicationId + '.' + name
|
|
661
670
|
*/
|
|
662
671
|
entityId: string;
|
|
663
672
|
/**
|
|
@@ -707,7 +716,7 @@ interface IAdminEntityRepository<T> {
|
|
|
707
716
|
* @return Promise emitting the entity with the given id or Promise emitting null if none found
|
|
708
717
|
* @throws Error in case the given {@literal id} is {@literal null}
|
|
709
718
|
*/
|
|
710
|
-
findById(id: TenantSpecificId): Promise<T>;
|
|
719
|
+
findById(id: TenantSpecificId): Promise<T | null>;
|
|
711
720
|
/**
|
|
712
721
|
* Retrieves a list of entities by their id.
|
|
713
722
|
*
|
|
@@ -746,11 +755,12 @@ interface IAdminEntityRepository<T> {
|
|
|
746
755
|
* It provides the basic CRUD operations for entities with multi-tenancy support.
|
|
747
756
|
*/
|
|
748
757
|
declare class AdminEntityRepository<T> implements IAdminEntityRepository<T> {
|
|
758
|
+
entityOrganizationId: string;
|
|
749
759
|
entityApplicationId: string;
|
|
750
760
|
entityName: string;
|
|
751
761
|
entityId: string;
|
|
752
762
|
private readonly adminEntitiesRepository;
|
|
753
|
-
constructor(
|
|
763
|
+
constructor(entityOrganizationId: string, entityApplicationId: string, entityName: string, adminEntitiesRepository?: IAdminEntitiesRepository);
|
|
754
764
|
count(tenantSelection: TenantSelection): Promise<number>;
|
|
755
765
|
countByQuery(query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
756
766
|
deleteById(id: TenantSpecificId): Promise<void>;
|