@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.js
CHANGED
|
@@ -176,15 +176,15 @@ class RoleDecorator extends EntityServiceDecorator {
|
|
|
176
176
|
function $Role(roles) {
|
|
177
177
|
return new RoleDecorator(roles);
|
|
178
178
|
}
|
|
179
|
-
// packages/persistence/src/api/
|
|
179
|
+
// packages/persistence/src/api/IEntitiesRepository.ts
|
|
180
180
|
import {
|
|
181
181
|
FunctionalIterablePage
|
|
182
182
|
} from "@kinotic-ai/core";
|
|
183
183
|
|
|
184
|
-
class
|
|
184
|
+
class EntitiesRepository {
|
|
185
185
|
serviceProxy;
|
|
186
186
|
constructor(kinotic) {
|
|
187
|
-
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.
|
|
187
|
+
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.JsonEntitiesRepository");
|
|
188
188
|
}
|
|
189
189
|
bulkSave(structureId, entities) {
|
|
190
190
|
return this.serviceProxy.invoke("bulkSave", [structureId, entities]);
|
|
@@ -244,15 +244,15 @@ class EntitiesService {
|
|
|
244
244
|
return this.serviceProxy.invoke("update", [structureId, entity]);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
// packages/persistence/src/api/
|
|
247
|
+
// packages/persistence/src/api/IAdminEntitiesRepository.ts
|
|
248
248
|
import {
|
|
249
249
|
FunctionalIterablePage as FunctionalIterablePage2
|
|
250
250
|
} from "@kinotic-ai/core";
|
|
251
251
|
|
|
252
|
-
class
|
|
252
|
+
class AdminEntitiesRepository {
|
|
253
253
|
serviceProxy;
|
|
254
254
|
constructor(kinotic) {
|
|
255
|
-
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.
|
|
255
|
+
this.serviceProxy = kinotic.serviceProxy("org.kinotic.persistence.api.services.AdminJsonEntitiesRepository");
|
|
256
256
|
}
|
|
257
257
|
count(structureId, tenantSelection) {
|
|
258
258
|
return this.serviceProxy.invoke("count", [structureId, tenantSelection]);
|
|
@@ -297,67 +297,67 @@ class AdminEntitiesService {
|
|
|
297
297
|
return this.serviceProxy.invoke("search", [structureId, searchText, tenantSelection, pageable]);
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
// packages/persistence/src/api/
|
|
300
|
+
// packages/persistence/src/api/IEntityRepository.ts
|
|
301
301
|
import { Kinotic } from "@kinotic-ai/core";
|
|
302
|
-
class
|
|
302
|
+
class EntityRepository {
|
|
303
303
|
entityApplicationId;
|
|
304
304
|
entityName;
|
|
305
305
|
entityId;
|
|
306
|
-
|
|
307
|
-
constructor(structureApplicationId, structureName,
|
|
306
|
+
entitiesRepository;
|
|
307
|
+
constructor(structureApplicationId, structureName, entitiesRepository) {
|
|
308
308
|
this.entityApplicationId = structureApplicationId;
|
|
309
309
|
this.entityName = structureName;
|
|
310
310
|
this.entityId = (structureApplicationId + "." + structureName).toLowerCase();
|
|
311
|
-
this.
|
|
311
|
+
this.entitiesRepository = entitiesRepository ?? new EntitiesRepository(Kinotic);
|
|
312
312
|
}
|
|
313
313
|
async bulkSave(entities) {
|
|
314
314
|
const entitiesToSave = await this.beforeBulkSaveOrUpdate(entities);
|
|
315
|
-
return this.
|
|
315
|
+
return this.entitiesRepository.bulkSave(this.entityId, entitiesToSave);
|
|
316
316
|
}
|
|
317
317
|
async bulkUpdate(entities) {
|
|
318
318
|
const entitiesToSave = await this.beforeBulkSaveOrUpdate(entities);
|
|
319
|
-
return this.
|
|
319
|
+
return this.entitiesRepository.bulkUpdate(this.entityId, entitiesToSave);
|
|
320
320
|
}
|
|
321
321
|
count() {
|
|
322
|
-
return this.
|
|
322
|
+
return this.entitiesRepository.count(this.entityId);
|
|
323
323
|
}
|
|
324
324
|
countByQuery(query) {
|
|
325
|
-
return this.
|
|
325
|
+
return this.entitiesRepository.countByQuery(this.entityId, query);
|
|
326
326
|
}
|
|
327
327
|
deleteById(id) {
|
|
328
|
-
return this.
|
|
328
|
+
return this.entitiesRepository.deleteById(this.entityId, id);
|
|
329
329
|
}
|
|
330
330
|
deleteByQuery(query) {
|
|
331
|
-
return this.
|
|
331
|
+
return this.entitiesRepository.deleteByQuery(this.entityId, query);
|
|
332
332
|
}
|
|
333
333
|
findAll(pageable) {
|
|
334
|
-
return this.
|
|
334
|
+
return this.entitiesRepository.findAll(this.entityId, pageable);
|
|
335
335
|
}
|
|
336
336
|
findById(id) {
|
|
337
|
-
return this.
|
|
337
|
+
return this.entitiesRepository.findById(this.entityId, id);
|
|
338
338
|
}
|
|
339
339
|
findByIds(ids) {
|
|
340
|
-
return this.
|
|
340
|
+
return this.entitiesRepository.findByIds(this.entityId, ids);
|
|
341
341
|
}
|
|
342
342
|
namedQuery(queryName, queryParameters) {
|
|
343
|
-
return this.
|
|
343
|
+
return this.entitiesRepository.namedQuery(this.entityId, queryName, queryParameters);
|
|
344
344
|
}
|
|
345
345
|
namedQueryPage(queryName, queryParameters, pageable) {
|
|
346
|
-
return this.
|
|
346
|
+
return this.entitiesRepository.namedQueryPage(this.entityId, queryName, queryParameters, pageable);
|
|
347
347
|
}
|
|
348
348
|
async save(entity) {
|
|
349
349
|
const entityToSave = await this.beforeSaveOrUpdate(entity);
|
|
350
|
-
return this.
|
|
350
|
+
return this.entitiesRepository.save(this.entityId, entityToSave);
|
|
351
351
|
}
|
|
352
352
|
search(searchText, pageable) {
|
|
353
|
-
return this.
|
|
353
|
+
return this.entitiesRepository.search(this.entityId, searchText, pageable);
|
|
354
354
|
}
|
|
355
355
|
async syncIndex() {
|
|
356
|
-
return this.
|
|
356
|
+
return this.entitiesRepository.syncIndex(this.entityId);
|
|
357
357
|
}
|
|
358
358
|
async update(entity) {
|
|
359
359
|
const entityToSave = await this.beforeSaveOrUpdate(entity);
|
|
360
|
-
return this.
|
|
360
|
+
return this.entitiesRepository.update(this.entityId, entityToSave);
|
|
361
361
|
}
|
|
362
362
|
async beforeBulkSaveOrUpdate(entities) {
|
|
363
363
|
return Promise.resolve(entities);
|
|
@@ -366,56 +366,56 @@ class EntityService {
|
|
|
366
366
|
return Promise.resolve(entity);
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
|
-
// packages/persistence/src/api/
|
|
369
|
+
// packages/persistence/src/api/IAdminEntityRepository.ts
|
|
370
370
|
import { Kinotic as Kinotic2 } from "@kinotic-ai/core";
|
|
371
|
-
class
|
|
371
|
+
class AdminEntityRepository {
|
|
372
372
|
entityApplicationId;
|
|
373
373
|
entityName;
|
|
374
374
|
entityId;
|
|
375
|
-
|
|
376
|
-
constructor(structureApplicationId, structureName,
|
|
375
|
+
adminEntitiesRepository;
|
|
376
|
+
constructor(structureApplicationId, structureName, adminEntitiesRepository) {
|
|
377
377
|
this.entityApplicationId = structureApplicationId;
|
|
378
378
|
this.entityName = structureName;
|
|
379
379
|
this.entityId = (structureApplicationId + "." + structureName).toLowerCase();
|
|
380
|
-
this.
|
|
380
|
+
this.adminEntitiesRepository = adminEntitiesRepository ?? new AdminEntitiesRepository(Kinotic2);
|
|
381
381
|
}
|
|
382
382
|
count(tenantSelection) {
|
|
383
|
-
return this.
|
|
383
|
+
return this.adminEntitiesRepository.count(this.entityId, tenantSelection);
|
|
384
384
|
}
|
|
385
385
|
countByQuery(query, tenantSelection) {
|
|
386
|
-
return this.
|
|
386
|
+
return this.adminEntitiesRepository.countByQuery(this.entityId, query, tenantSelection);
|
|
387
387
|
}
|
|
388
388
|
deleteById(id) {
|
|
389
|
-
return this.
|
|
389
|
+
return this.adminEntitiesRepository.deleteById(this.entityId, id);
|
|
390
390
|
}
|
|
391
391
|
deleteByQuery(query, tenantSelection) {
|
|
392
|
-
return this.
|
|
392
|
+
return this.adminEntitiesRepository.deleteByQuery(this.entityId, query, tenantSelection);
|
|
393
393
|
}
|
|
394
394
|
findAll(tenantSelection, pageable) {
|
|
395
|
-
return this.
|
|
395
|
+
return this.adminEntitiesRepository.findAll(this.entityId, tenantSelection, pageable);
|
|
396
396
|
}
|
|
397
397
|
findById(id) {
|
|
398
|
-
return this.
|
|
398
|
+
return this.adminEntitiesRepository.findById(this.entityId, id);
|
|
399
399
|
}
|
|
400
400
|
findByIds(ids) {
|
|
401
|
-
return this.
|
|
401
|
+
return this.adminEntitiesRepository.findByIds(this.entityId, ids);
|
|
402
402
|
}
|
|
403
403
|
namedQuery(queryName, queryParameters) {
|
|
404
|
-
return this.
|
|
404
|
+
return this.adminEntitiesRepository.namedQuery(this.entityId, queryName, queryParameters);
|
|
405
405
|
}
|
|
406
406
|
namedQueryPage(queryName, queryParameters, pageable) {
|
|
407
|
-
return this.
|
|
407
|
+
return this.adminEntitiesRepository.namedQueryPage(this.entityId, queryName, queryParameters, pageable);
|
|
408
408
|
}
|
|
409
409
|
search(searchText, tenantSelection, pageable) {
|
|
410
|
-
return this.
|
|
410
|
+
return this.adminEntitiesRepository.search(this.entityId, searchText, tenantSelection, pageable);
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
// packages/persistence/src/api/PersistencePlugin.ts
|
|
414
414
|
var PersistencePlugin = {
|
|
415
415
|
install(kinotic) {
|
|
416
416
|
return {
|
|
417
|
-
entities: new
|
|
418
|
-
adminEntities: new
|
|
417
|
+
entities: new EntitiesRepository(kinotic),
|
|
418
|
+
adminEntities: new AdminEntitiesRepository(kinotic)
|
|
419
419
|
};
|
|
420
420
|
}
|
|
421
421
|
};
|
|
@@ -448,15 +448,15 @@ export {
|
|
|
448
448
|
EntityServiceDecoratorsDecorator,
|
|
449
449
|
EntityServiceDecorators,
|
|
450
450
|
EntityServiceDecorator,
|
|
451
|
-
|
|
451
|
+
EntityRepository,
|
|
452
452
|
EntityConfig,
|
|
453
453
|
Entity,
|
|
454
|
-
|
|
454
|
+
EntitiesRepository,
|
|
455
455
|
DiscriminatorConfig,
|
|
456
456
|
Discriminator,
|
|
457
457
|
AutoGeneratedId,
|
|
458
|
-
|
|
459
|
-
|
|
458
|
+
AdminEntityRepository,
|
|
459
|
+
AdminEntitiesRepository,
|
|
460
460
|
$Role,
|
|
461
461
|
$Policy
|
|
462
462
|
};
|