@kinotic-ai/persistence 1.0.10 → 1.1.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 +47 -47
- package/dist/index.d.cts +256 -255
- package/dist/index.d.ts +256 -255
- package/dist/index.js +47 -47
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -68,15 +68,15 @@ __export(exports_src, {
|
|
|
68
68
|
EntityServiceDecoratorsDecorator: () => EntityServiceDecoratorsDecorator,
|
|
69
69
|
EntityServiceDecorators: () => EntityServiceDecorators,
|
|
70
70
|
EntityServiceDecorator: () => EntityServiceDecorator,
|
|
71
|
-
|
|
71
|
+
EntityRepository: () => EntityRepository,
|
|
72
72
|
EntityConfig: () => EntityConfig,
|
|
73
73
|
Entity: () => Entity,
|
|
74
|
-
|
|
74
|
+
EntitiesRepository: () => EntitiesRepository,
|
|
75
75
|
DiscriminatorConfig: () => DiscriminatorConfig,
|
|
76
76
|
Discriminator: () => Discriminator,
|
|
77
77
|
AutoGeneratedId: () => AutoGeneratedId,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
AdminEntityRepository: () => AdminEntityRepository,
|
|
79
|
+
AdminEntitiesRepository: () => AdminEntitiesRepository,
|
|
80
80
|
$Role: () => $Role,
|
|
81
81
|
$Policy: () => $Policy
|
|
82
82
|
});
|
|
@@ -260,13 +260,13 @@ class RoleDecorator extends EntityServiceDecorator {
|
|
|
260
260
|
function $Role(roles) {
|
|
261
261
|
return new RoleDecorator(roles);
|
|
262
262
|
}
|
|
263
|
-
// packages/persistence/src/api/
|
|
263
|
+
// packages/persistence/src/api/IEntitiesRepository.ts
|
|
264
264
|
var import_core = require("@kinotic-ai/core");
|
|
265
265
|
|
|
266
|
-
class
|
|
266
|
+
class EntitiesRepository {
|
|
267
267
|
serviceProxy;
|
|
268
268
|
constructor(kinotic) {
|
|
269
|
-
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.
|
|
269
|
+
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.JsonEntitiesRepository");
|
|
270
270
|
}
|
|
271
271
|
bulkSave(structureId, entities) {
|
|
272
272
|
return this.serviceProxy.invoke("bulkSave", [structureId, entities]);
|
|
@@ -326,13 +326,13 @@ class EntitiesService {
|
|
|
326
326
|
return this.serviceProxy.invoke("update", [structureId, entity]);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
// packages/persistence/src/api/
|
|
329
|
+
// packages/persistence/src/api/IAdminEntitiesRepository.ts
|
|
330
330
|
var import_core2 = require("@kinotic-ai/core");
|
|
331
331
|
|
|
332
|
-
class
|
|
332
|
+
class AdminEntitiesRepository {
|
|
333
333
|
serviceProxy;
|
|
334
334
|
constructor(kinotic) {
|
|
335
|
-
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.
|
|
335
|
+
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.AdminJsonEntitiesRepository");
|
|
336
336
|
}
|
|
337
337
|
count(structureId, tenantSelection) {
|
|
338
338
|
return this.serviceProxy.invoke("count", [structureId, tenantSelection]);
|
|
@@ -377,67 +377,67 @@ class AdminEntitiesService {
|
|
|
377
377
|
return this.serviceProxy.invoke("search", [structureId, searchText, tenantSelection, pageable]);
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
// packages/persistence/src/api/
|
|
380
|
+
// packages/persistence/src/api/IEntityRepository.ts
|
|
381
381
|
var import_core3 = require("@kinotic-ai/core");
|
|
382
|
-
class
|
|
382
|
+
class EntityRepository {
|
|
383
383
|
entityApplicationId;
|
|
384
384
|
entityName;
|
|
385
385
|
entityId;
|
|
386
|
-
|
|
387
|
-
constructor(structureApplicationId, structureName,
|
|
386
|
+
entitiesRepository;
|
|
387
|
+
constructor(structureApplicationId, structureName, entitiesRepository) {
|
|
388
388
|
this.entityApplicationId = structureApplicationId;
|
|
389
389
|
this.entityName = structureName;
|
|
390
390
|
this.entityId = (structureApplicationId + "." + structureName).toLowerCase();
|
|
391
|
-
this.
|
|
391
|
+
this.entitiesRepository = entitiesRepository ?? new EntitiesRepository(import_core3.Kinotic);
|
|
392
392
|
}
|
|
393
393
|
async bulkSave(entities) {
|
|
394
394
|
const entitiesToSave = await this.beforeBulkSaveOrUpdate(entities);
|
|
395
|
-
return this.
|
|
395
|
+
return this.entitiesRepository.bulkSave(this.entityId, entitiesToSave);
|
|
396
396
|
}
|
|
397
397
|
async bulkUpdate(entities) {
|
|
398
398
|
const entitiesToSave = await this.beforeBulkSaveOrUpdate(entities);
|
|
399
|
-
return this.
|
|
399
|
+
return this.entitiesRepository.bulkUpdate(this.entityId, entitiesToSave);
|
|
400
400
|
}
|
|
401
401
|
count() {
|
|
402
|
-
return this.
|
|
402
|
+
return this.entitiesRepository.count(this.entityId);
|
|
403
403
|
}
|
|
404
404
|
countByQuery(query) {
|
|
405
|
-
return this.
|
|
405
|
+
return this.entitiesRepository.countByQuery(this.entityId, query);
|
|
406
406
|
}
|
|
407
407
|
deleteById(id) {
|
|
408
|
-
return this.
|
|
408
|
+
return this.entitiesRepository.deleteById(this.entityId, id);
|
|
409
409
|
}
|
|
410
410
|
deleteByQuery(query) {
|
|
411
|
-
return this.
|
|
411
|
+
return this.entitiesRepository.deleteByQuery(this.entityId, query);
|
|
412
412
|
}
|
|
413
413
|
findAll(pageable) {
|
|
414
|
-
return this.
|
|
414
|
+
return this.entitiesRepository.findAll(this.entityId, pageable);
|
|
415
415
|
}
|
|
416
416
|
findById(id) {
|
|
417
|
-
return this.
|
|
417
|
+
return this.entitiesRepository.findById(this.entityId, id);
|
|
418
418
|
}
|
|
419
419
|
findByIds(ids) {
|
|
420
|
-
return this.
|
|
420
|
+
return this.entitiesRepository.findByIds(this.entityId, ids);
|
|
421
421
|
}
|
|
422
422
|
namedQuery(queryName, queryParameters) {
|
|
423
|
-
return this.
|
|
423
|
+
return this.entitiesRepository.namedQuery(this.entityId, queryName, queryParameters);
|
|
424
424
|
}
|
|
425
425
|
namedQueryPage(queryName, queryParameters, pageable) {
|
|
426
|
-
return this.
|
|
426
|
+
return this.entitiesRepository.namedQueryPage(this.entityId, queryName, queryParameters, pageable);
|
|
427
427
|
}
|
|
428
428
|
async save(entity) {
|
|
429
429
|
const entityToSave = await this.beforeSaveOrUpdate(entity);
|
|
430
|
-
return this.
|
|
430
|
+
return this.entitiesRepository.save(this.entityId, entityToSave);
|
|
431
431
|
}
|
|
432
432
|
search(searchText, pageable) {
|
|
433
|
-
return this.
|
|
433
|
+
return this.entitiesRepository.search(this.entityId, searchText, pageable);
|
|
434
434
|
}
|
|
435
435
|
async syncIndex() {
|
|
436
|
-
return this.
|
|
436
|
+
return this.entitiesRepository.syncIndex(this.entityId);
|
|
437
437
|
}
|
|
438
438
|
async update(entity) {
|
|
439
439
|
const entityToSave = await this.beforeSaveOrUpdate(entity);
|
|
440
|
-
return this.
|
|
440
|
+
return this.entitiesRepository.update(this.entityId, entityToSave);
|
|
441
441
|
}
|
|
442
442
|
async beforeBulkSaveOrUpdate(entities) {
|
|
443
443
|
return Promise.resolve(entities);
|
|
@@ -446,56 +446,56 @@ class EntityService {
|
|
|
446
446
|
return Promise.resolve(entity);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
// packages/persistence/src/api/
|
|
449
|
+
// packages/persistence/src/api/IAdminEntityRepository.ts
|
|
450
450
|
var import_core4 = require("@kinotic-ai/core");
|
|
451
|
-
class
|
|
451
|
+
class AdminEntityRepository {
|
|
452
452
|
entityApplicationId;
|
|
453
453
|
entityName;
|
|
454
454
|
entityId;
|
|
455
|
-
|
|
456
|
-
constructor(structureApplicationId, structureName,
|
|
455
|
+
adminEntitiesRepository;
|
|
456
|
+
constructor(structureApplicationId, structureName, adminEntitiesRepository) {
|
|
457
457
|
this.entityApplicationId = structureApplicationId;
|
|
458
458
|
this.entityName = structureName;
|
|
459
459
|
this.entityId = (structureApplicationId + "." + structureName).toLowerCase();
|
|
460
|
-
this.
|
|
460
|
+
this.adminEntitiesRepository = adminEntitiesRepository ?? new AdminEntitiesRepository(import_core4.Kinotic);
|
|
461
461
|
}
|
|
462
462
|
count(tenantSelection) {
|
|
463
|
-
return this.
|
|
463
|
+
return this.adminEntitiesRepository.count(this.entityId, tenantSelection);
|
|
464
464
|
}
|
|
465
465
|
countByQuery(query, tenantSelection) {
|
|
466
|
-
return this.
|
|
466
|
+
return this.adminEntitiesRepository.countByQuery(this.entityId, query, tenantSelection);
|
|
467
467
|
}
|
|
468
468
|
deleteById(id) {
|
|
469
|
-
return this.
|
|
469
|
+
return this.adminEntitiesRepository.deleteById(this.entityId, id);
|
|
470
470
|
}
|
|
471
471
|
deleteByQuery(query, tenantSelection) {
|
|
472
|
-
return this.
|
|
472
|
+
return this.adminEntitiesRepository.deleteByQuery(this.entityId, query, tenantSelection);
|
|
473
473
|
}
|
|
474
474
|
findAll(tenantSelection, pageable) {
|
|
475
|
-
return this.
|
|
475
|
+
return this.adminEntitiesRepository.findAll(this.entityId, tenantSelection, pageable);
|
|
476
476
|
}
|
|
477
477
|
findById(id) {
|
|
478
|
-
return this.
|
|
478
|
+
return this.adminEntitiesRepository.findById(this.entityId, id);
|
|
479
479
|
}
|
|
480
480
|
findByIds(ids) {
|
|
481
|
-
return this.
|
|
481
|
+
return this.adminEntitiesRepository.findByIds(this.entityId, ids);
|
|
482
482
|
}
|
|
483
483
|
namedQuery(queryName, queryParameters) {
|
|
484
|
-
return this.
|
|
484
|
+
return this.adminEntitiesRepository.namedQuery(this.entityId, queryName, queryParameters);
|
|
485
485
|
}
|
|
486
486
|
namedQueryPage(queryName, queryParameters, pageable) {
|
|
487
|
-
return this.
|
|
487
|
+
return this.adminEntitiesRepository.namedQueryPage(this.entityId, queryName, queryParameters, pageable);
|
|
488
488
|
}
|
|
489
489
|
search(searchText, tenantSelection, pageable) {
|
|
490
|
-
return this.
|
|
490
|
+
return this.adminEntitiesRepository.search(this.entityId, searchText, tenantSelection, pageable);
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
// packages/persistence/src/api/PersistencePlugin.ts
|
|
494
494
|
var PersistencePlugin = {
|
|
495
495
|
install(kinotic) {
|
|
496
496
|
return {
|
|
497
|
-
entities: new
|
|
498
|
-
adminEntities: new
|
|
497
|
+
entities: new EntitiesRepository(kinotic),
|
|
498
|
+
adminEntities: new AdminEntitiesRepository(kinotic)
|
|
499
499
|
};
|
|
500
500
|
}
|
|
501
501
|
};
|