@kinotic-ai/persistence 3.0.0 → 4.0.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 +3 -3
- package/dist/index.d.cts +208 -209
- package/dist/index.d.ts +208 -209
- package/dist/index.js +3 -3
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -198,12 +198,12 @@ function $Role(roles) {
|
|
|
198
198
|
}
|
|
199
199
|
// packages/persistence/src/api/IEntitiesRepository.ts
|
|
200
200
|
var import_core = require("@kinotic-ai/core");
|
|
201
|
-
var APP_API_ZONE = "
|
|
201
|
+
var APP_API_ZONE = "app-api";
|
|
202
202
|
|
|
203
203
|
class EntitiesRepository {
|
|
204
204
|
serviceProxy;
|
|
205
205
|
constructor(kinotic) {
|
|
206
|
-
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}
|
|
206
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}~org.kinotic.persistence.api.services.JsonEntitiesRepository`);
|
|
207
207
|
}
|
|
208
208
|
bulkSave(entityDefinitionId, entities) {
|
|
209
209
|
return this.serviceProxy.invoke("bulkSave", [entityDefinitionId, entities]);
|
|
@@ -269,7 +269,7 @@ var import_core2 = require("@kinotic-ai/core");
|
|
|
269
269
|
class AdminEntitiesRepository {
|
|
270
270
|
serviceProxy;
|
|
271
271
|
constructor(kinotic) {
|
|
272
|
-
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}
|
|
272
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}~org.kinotic.persistence.api.services.AdminJsonEntitiesRepository`);
|
|
273
273
|
}
|
|
274
274
|
count(entityDefinitionId, tenantSelection) {
|
|
275
275
|
return this.serviceProxy.invoke("count", [entityDefinitionId, tenantSelection]);
|
package/dist/index.d.cts
CHANGED
|
@@ -90,102 +90,14 @@ 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 {
|
|
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
|
-
/**
|
|
108
|
-
* Signifies that a property is an auto-generated ID for the entity.
|
|
109
|
-
*/
|
|
110
|
-
declare function AutoGeneratedId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
111
|
-
/**
|
|
112
|
-
* Signifies that a property is a discriminator for the entity.
|
|
113
|
-
* This is used to determine the type of the entity when deserializing from JSON.
|
|
114
|
-
* @param propertyName the name of the property to use as the discriminator
|
|
115
|
-
*/
|
|
116
|
-
declare function Discriminator(_propertyName: string): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
117
|
-
/**
|
|
118
|
-
* Signifies that a class is a Entity.
|
|
119
|
-
* This is required to define the class as an entity in the Kinotic framework.
|
|
120
|
-
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
121
|
-
* @param entityType the type of entity to use for this entity
|
|
122
|
-
*/
|
|
123
|
-
declare function Entity(_multiTenancyType?: MultiTenancyType, _entityType?: EntityType): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
124
|
-
/**
|
|
125
|
-
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
126
|
-
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
127
|
-
*/
|
|
128
|
-
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
129
|
-
/**
|
|
130
|
-
* Provides configuration for the Elasticsearch index.
|
|
131
|
-
* This can be used to override the default index settings and mappings used by Kinotic.
|
|
132
|
-
*/
|
|
133
|
-
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_target: Function, _context: ClassDecoratorContext<any>) => void;
|
|
134
|
-
declare function Flattened(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
135
|
-
/**
|
|
136
|
-
* Signifies that a property is the ID of the entity.
|
|
137
|
-
*/
|
|
138
|
-
declare function Id(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
139
|
-
declare function Nested(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
140
|
-
/**
|
|
141
|
-
* Signifies that a property is not indexed in Elasticsearch.
|
|
142
|
-
*/
|
|
143
|
-
declare function NotIndexed(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
144
|
-
declare function NotNull(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
145
|
-
declare function Policy(_policies: string[][]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
146
|
-
declare function Precision(_precisionType?: PrecisionType): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
147
|
-
declare function Query(_statements: string): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
148
|
-
declare function Role(_roles: string[]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
149
|
-
declare function Text(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
150
|
-
/**
|
|
151
|
-
* This is used for data streams to signify the field that should be used as the time reference.
|
|
152
|
-
*/
|
|
153
|
-
declare function TimeReference(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
154
|
-
declare function Version(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
155
|
-
declare function TenantId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
156
|
-
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
157
|
-
/**
|
|
158
|
-
* Provides a way to add decorators to an entity service
|
|
159
|
-
*/
|
|
160
|
-
declare class EntityServiceDecoratorsDecorator extends C3Decorator2 {
|
|
161
|
-
config: EntityServiceDecoratorsConfig;
|
|
162
|
-
constructor();
|
|
163
|
-
}
|
|
164
|
-
declare class PolicyDecorator extends EntityServiceDecorator {
|
|
165
|
-
policies: string[][];
|
|
166
|
-
constructor(policies: string[][]);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Provides a mechanism to apply the @Policy decorator to an {@link EntityService}
|
|
170
|
-
* @param policies to be supplied
|
|
171
|
-
*/
|
|
172
|
-
declare function $Policy(policies: string[][]): PolicyDecorator;
|
|
173
|
-
declare class RoleDecorator extends EntityServiceDecorator {
|
|
174
|
-
roles: string[];
|
|
175
|
-
constructor(roles: string[]);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Provides a mechanism to apply the @Role decorator to an {@link EntityService}
|
|
179
|
-
* @param roles to be supplied
|
|
180
|
-
*/
|
|
181
|
-
declare function $Role(roles: string[]): RoleDecorator;
|
|
93
|
+
import { Pageable as Pageable2, IterablePage as IterablePage2 } from "@kinotic-ai/core";
|
|
182
94
|
import { IKinotic } from "@kinotic-ai/core";
|
|
183
95
|
import { IServiceProxy, Page, Pageable, IterablePage } from "@kinotic-ai/core";
|
|
184
96
|
/**
|
|
185
97
|
* The zone for the platform's application facing data services, such as entity persistence
|
|
186
98
|
* and named query execution — where the services backing these repositories are hosted.
|
|
187
99
|
*/
|
|
188
|
-
declare const APP_API_ZONE = "
|
|
100
|
+
declare const APP_API_ZONE = "app-api";
|
|
189
101
|
interface IEntitiesRepository {
|
|
190
102
|
/**
|
|
191
103
|
* Saves all given entities.
|
|
@@ -350,118 +262,6 @@ declare class EntitiesRepository implements IEntitiesRepository {
|
|
|
350
262
|
syncIndex(entityDefinitionId: string): Promise<void>;
|
|
351
263
|
update<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
352
264
|
}
|
|
353
|
-
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
354
|
-
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable2, IterablePage as IterablePage2 } from "@kinotic-ai/core";
|
|
355
|
-
type TenantSelection = string[];
|
|
356
|
-
interface IAdminEntitiesRepository {
|
|
357
|
-
/**
|
|
358
|
-
* Returns the number of entities available.
|
|
359
|
-
* @param structureId the id of the structure to count
|
|
360
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
361
|
-
* @return {@link Promise} emitting the number of entities.
|
|
362
|
-
*/
|
|
363
|
-
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
364
|
-
/**
|
|
365
|
-
* Returns the number of entities available for the given query.
|
|
366
|
-
*
|
|
367
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
368
|
-
* @param query the query used to limit result
|
|
369
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
370
|
-
* @return Promise emitting the number of entities
|
|
371
|
-
*/
|
|
372
|
-
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
373
|
-
/**
|
|
374
|
-
* Deletes the entity with the given id.
|
|
375
|
-
*
|
|
376
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
377
|
-
* @param id must not be {@literal null}
|
|
378
|
-
* @return {@link Promise} emitting when delete is complete
|
|
379
|
-
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
380
|
-
*/
|
|
381
|
-
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
382
|
-
/**
|
|
383
|
-
* Deletes the entity with the given id.
|
|
384
|
-
*
|
|
385
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
386
|
-
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
387
|
-
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
388
|
-
* @return Promise signaling when operation has completed
|
|
389
|
-
* @throws Error in case the given {@literal query} is {@literal null}
|
|
390
|
-
*/
|
|
391
|
-
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
392
|
-
/**
|
|
393
|
-
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
394
|
-
*
|
|
395
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
396
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
397
|
-
* @param pageable the page settings to be used
|
|
398
|
-
* @return a page of entities
|
|
399
|
-
*/
|
|
400
|
-
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
401
|
-
/**
|
|
402
|
-
* Retrieves an entity by its id.
|
|
403
|
-
*
|
|
404
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
405
|
-
* @param id must not be {@literal null}
|
|
406
|
-
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
407
|
-
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
408
|
-
*/
|
|
409
|
-
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T | null>;
|
|
410
|
-
/**
|
|
411
|
-
* Retrieves a list of entities by their id.
|
|
412
|
-
*
|
|
413
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
414
|
-
* @param ids must not be {@literal null}
|
|
415
|
-
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
416
|
-
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
417
|
-
*/
|
|
418
|
-
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
419
|
-
/**
|
|
420
|
-
* Executes a named query.
|
|
421
|
-
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
422
|
-
* @param queryName the name of the function that defines the query
|
|
423
|
-
* @param parameters to pass to the query
|
|
424
|
-
* @returns Promise with the result of the query
|
|
425
|
-
*/
|
|
426
|
-
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
427
|
-
/**
|
|
428
|
-
* Executes a named query and returns a Page of results.
|
|
429
|
-
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
430
|
-
* @param queryName the name of the function that defines the query
|
|
431
|
-
* @param parameters to pass to the query
|
|
432
|
-
* @param pageable the page settings to be used
|
|
433
|
-
* @returns Promise with the result of the query
|
|
434
|
-
*/
|
|
435
|
-
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
436
|
-
/**
|
|
437
|
-
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
438
|
-
*
|
|
439
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
440
|
-
* @param searchText the text to search for entities for
|
|
441
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
442
|
-
* @param pageable the page settings to be used
|
|
443
|
-
* @return a page of entities
|
|
444
|
-
*/
|
|
445
|
-
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
446
|
-
}
|
|
447
|
-
declare class AdminEntitiesRepository implements IAdminEntitiesRepository {
|
|
448
|
-
protected serviceProxy: IServiceProxy2;
|
|
449
|
-
constructor(kinotic: IKinotic2);
|
|
450
|
-
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
451
|
-
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
452
|
-
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
453
|
-
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
454
|
-
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
455
|
-
findAllSinglePage<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<Page2<T>>;
|
|
456
|
-
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T>;
|
|
457
|
-
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
458
|
-
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
459
|
-
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
460
|
-
namedQuerySinglePage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<Page2<T>>;
|
|
461
|
-
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
462
|
-
searchSinglePage<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<Page2<T>>;
|
|
463
|
-
}
|
|
464
|
-
import { Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
465
265
|
/**
|
|
466
266
|
* This is the base interface for all entity repositories.
|
|
467
267
|
* It provides the basic CRUD operations for entities.
|
|
@@ -531,7 +331,7 @@ interface IEntityRepository<T> {
|
|
|
531
331
|
* @param pageable the page settings to be used
|
|
532
332
|
* @return a page of entities
|
|
533
333
|
*/
|
|
534
|
-
findAll(pageable:
|
|
334
|
+
findAll(pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
535
335
|
/**
|
|
536
336
|
* Retrieves an entity by its id.
|
|
537
337
|
*
|
|
@@ -562,7 +362,7 @@ interface IEntityRepository<T> {
|
|
|
562
362
|
* @param pageable the page settings to be used
|
|
563
363
|
* @returns Promise with the result of the query
|
|
564
364
|
*/
|
|
565
|
-
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable:
|
|
365
|
+
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<U>>;
|
|
566
366
|
/**
|
|
567
367
|
* Saves a given entity. This will override all data if there is an existing entity with the same id.
|
|
568
368
|
* Use the returned instance for further operations as the save operation might have changed the entity instance.
|
|
@@ -579,7 +379,7 @@ interface IEntityRepository<T> {
|
|
|
579
379
|
* @param pageable the page settings to be used
|
|
580
380
|
* @return a page of entities
|
|
581
381
|
*/
|
|
582
|
-
search(searchText: string, pageable:
|
|
382
|
+
search(searchText: string, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
583
383
|
/**
|
|
584
384
|
* This operation makes all the recent writes immediately available for search.
|
|
585
385
|
* @return a Promise that resolves when the operation is complete
|
|
@@ -613,18 +413,217 @@ declare class EntityRepository<T> implements IEntityRepository<T> {
|
|
|
613
413
|
countByQuery(query: string): Promise<number>;
|
|
614
414
|
deleteById(id: string): Promise<void>;
|
|
615
415
|
deleteByQuery(query: string): Promise<void>;
|
|
616
|
-
findAll(pageable:
|
|
416
|
+
findAll(pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
617
417
|
findById(id: string): Promise<T | null>;
|
|
618
418
|
findByIds(ids: string[]): Promise<T[]>;
|
|
619
419
|
namedQuery<U>(queryName: string, queryParameters: QueryParameter[]): Promise<U>;
|
|
620
|
-
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable:
|
|
420
|
+
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<U>>;
|
|
621
421
|
save(entity: T): Promise<T>;
|
|
622
|
-
search(searchText: string, pageable:
|
|
422
|
+
search(searchText: string, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
623
423
|
syncIndex(): Promise<void>;
|
|
624
424
|
update(entity: T): Promise<T>;
|
|
625
425
|
protected beforeBulkSaveOrUpdate(entities: T[]): Promise<T[]>;
|
|
626
426
|
protected beforeSaveOrUpdate(entity: T): Promise<T>;
|
|
627
427
|
}
|
|
428
|
+
type IfFunction<
|
|
429
|
+
T,
|
|
430
|
+
U
|
|
431
|
+
> = T extends (...args: any[]) => any ? U : never;
|
|
432
|
+
type MethodsOf<T> = { [K in keyof T] : IfFunction<T[K], K> }[keyof T];
|
|
433
|
+
type ExcludedMethods = "namedQuery" | "namedQueryPage";
|
|
434
|
+
type FilteredMethods<T> = Exclude<MethodsOf<T>, ExcludedMethods>;
|
|
435
|
+
type DecoratedFunction = FilteredMethods<IEntityRepository<any>> | "allCreate" | "allRead" | "allUpdate" | "allDelete";
|
|
436
|
+
/**
|
|
437
|
+
* Configuration for the {@link EntityServiceDecoratorsDecorator}
|
|
438
|
+
* This is a map of method names to an array of decorators that should be applied to that method
|
|
439
|
+
*/
|
|
440
|
+
type EntityServiceDecoratorsConfig = Partial<Record<DecoratedFunction, EntityServiceDecorator[]>>;
|
|
441
|
+
/**
|
|
442
|
+
* Signifies that a property is an auto-generated ID for the entity.
|
|
443
|
+
*/
|
|
444
|
+
declare function AutoGeneratedId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
445
|
+
/**
|
|
446
|
+
* Signifies that a property is a discriminator for the entity.
|
|
447
|
+
* This is used to determine the type of the entity when deserializing from JSON.
|
|
448
|
+
* @param propertyName the name of the property to use as the discriminator
|
|
449
|
+
*/
|
|
450
|
+
declare function Discriminator(_propertyName: string): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
451
|
+
/**
|
|
452
|
+
* Signifies that a class is a Entity.
|
|
453
|
+
* This is required to define the class as an entity in the Kinotic framework.
|
|
454
|
+
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
455
|
+
* @param entityType the type of entity to use for this entity
|
|
456
|
+
*/
|
|
457
|
+
declare function Entity(_multiTenancyType?: MultiTenancyType, _entityType?: EntityType): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
458
|
+
/**
|
|
459
|
+
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
460
|
+
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
461
|
+
*/
|
|
462
|
+
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
463
|
+
/**
|
|
464
|
+
* Provides configuration for the Elasticsearch index.
|
|
465
|
+
* This can be used to override the default index settings and mappings used by Kinotic.
|
|
466
|
+
*/
|
|
467
|
+
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_target: Function, _context: ClassDecoratorContext<any>) => void;
|
|
468
|
+
declare function Flattened(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
469
|
+
/**
|
|
470
|
+
* Signifies that a property is the ID of the entity.
|
|
471
|
+
*/
|
|
472
|
+
declare function Id(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
473
|
+
declare function Nested(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
474
|
+
/**
|
|
475
|
+
* Signifies that a property is not indexed in Elasticsearch.
|
|
476
|
+
*/
|
|
477
|
+
declare function NotIndexed(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
478
|
+
declare function NotNull(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
479
|
+
declare function Policy(_policies: string[][]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
480
|
+
declare function Precision(_precisionType?: PrecisionType): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
481
|
+
declare function Query(_statements: string): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
482
|
+
declare function Role(_roles: string[]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
483
|
+
declare function Text(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
484
|
+
/**
|
|
485
|
+
* This is used for data streams to signify the field that should be used as the time reference.
|
|
486
|
+
*/
|
|
487
|
+
declare function TimeReference(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
488
|
+
declare function Version(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
489
|
+
declare function TenantId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
490
|
+
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
491
|
+
/**
|
|
492
|
+
* Provides a way to add decorators to an entity service
|
|
493
|
+
*/
|
|
494
|
+
declare class EntityServiceDecoratorsDecorator extends C3Decorator2 {
|
|
495
|
+
config: EntityServiceDecoratorsConfig;
|
|
496
|
+
constructor();
|
|
497
|
+
}
|
|
498
|
+
declare class PolicyDecorator extends EntityServiceDecorator {
|
|
499
|
+
policies: string[][];
|
|
500
|
+
constructor(policies: string[][]);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Provides a mechanism to apply the @Policy decorator to an {@link EntityService}
|
|
504
|
+
* @param policies to be supplied
|
|
505
|
+
*/
|
|
506
|
+
declare function $Policy(policies: string[][]): PolicyDecorator;
|
|
507
|
+
declare class RoleDecorator extends EntityServiceDecorator {
|
|
508
|
+
roles: string[];
|
|
509
|
+
constructor(roles: string[]);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Provides a mechanism to apply the @Role decorator to an {@link EntityService}
|
|
513
|
+
* @param roles to be supplied
|
|
514
|
+
*/
|
|
515
|
+
declare function $Role(roles: string[]): RoleDecorator;
|
|
516
|
+
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
517
|
+
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
518
|
+
type TenantSelection = string[];
|
|
519
|
+
interface IAdminEntitiesRepository {
|
|
520
|
+
/**
|
|
521
|
+
* Returns the number of entities available.
|
|
522
|
+
* @param structureId the id of the structure to count
|
|
523
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
524
|
+
* @return {@link Promise} emitting the number of entities.
|
|
525
|
+
*/
|
|
526
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
527
|
+
/**
|
|
528
|
+
* Returns the number of entities available for the given query.
|
|
529
|
+
*
|
|
530
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
531
|
+
* @param query the query used to limit result
|
|
532
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
533
|
+
* @return Promise emitting the number of entities
|
|
534
|
+
*/
|
|
535
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
536
|
+
/**
|
|
537
|
+
* Deletes the entity with the given id.
|
|
538
|
+
*
|
|
539
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
540
|
+
* @param id must not be {@literal null}
|
|
541
|
+
* @return {@link Promise} emitting when delete is complete
|
|
542
|
+
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
543
|
+
*/
|
|
544
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
545
|
+
/**
|
|
546
|
+
* Deletes the entity with the given id.
|
|
547
|
+
*
|
|
548
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
549
|
+
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
550
|
+
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
551
|
+
* @return Promise signaling when operation has completed
|
|
552
|
+
* @throws Error in case the given {@literal query} is {@literal null}
|
|
553
|
+
*/
|
|
554
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
555
|
+
/**
|
|
556
|
+
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
557
|
+
*
|
|
558
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
559
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
560
|
+
* @param pageable the page settings to be used
|
|
561
|
+
* @return a page of entities
|
|
562
|
+
*/
|
|
563
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
564
|
+
/**
|
|
565
|
+
* Retrieves an entity by its id.
|
|
566
|
+
*
|
|
567
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
568
|
+
* @param id must not be {@literal null}
|
|
569
|
+
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
570
|
+
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
571
|
+
*/
|
|
572
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T | null>;
|
|
573
|
+
/**
|
|
574
|
+
* Retrieves a list of entities by their id.
|
|
575
|
+
*
|
|
576
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
577
|
+
* @param ids must not be {@literal null}
|
|
578
|
+
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
579
|
+
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
580
|
+
*/
|
|
581
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
582
|
+
/**
|
|
583
|
+
* Executes a named query.
|
|
584
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
585
|
+
* @param queryName the name of the function that defines the query
|
|
586
|
+
* @param parameters to pass to the query
|
|
587
|
+
* @returns Promise with the result of the query
|
|
588
|
+
*/
|
|
589
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
590
|
+
/**
|
|
591
|
+
* Executes a named query and returns a Page of results.
|
|
592
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
593
|
+
* @param queryName the name of the function that defines the query
|
|
594
|
+
* @param parameters to pass to the query
|
|
595
|
+
* @param pageable the page settings to be used
|
|
596
|
+
* @returns Promise with the result of the query
|
|
597
|
+
*/
|
|
598
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
599
|
+
/**
|
|
600
|
+
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
601
|
+
*
|
|
602
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
603
|
+
* @param searchText the text to search for entities for
|
|
604
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
605
|
+
* @param pageable the page settings to be used
|
|
606
|
+
* @return a page of entities
|
|
607
|
+
*/
|
|
608
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
609
|
+
}
|
|
610
|
+
declare class AdminEntitiesRepository implements IAdminEntitiesRepository {
|
|
611
|
+
protected serviceProxy: IServiceProxy2;
|
|
612
|
+
constructor(kinotic: IKinotic2);
|
|
613
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
614
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
615
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
616
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
617
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
618
|
+
findAllSinglePage<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<Page2<T>>;
|
|
619
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T>;
|
|
620
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
621
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
622
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
623
|
+
namedQuerySinglePage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<Page2<T>>;
|
|
624
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
625
|
+
searchSinglePage<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<Page2<T>>;
|
|
626
|
+
}
|
|
628
627
|
import { Pageable as Pageable4, IterablePage as IterablePage4 } from "@kinotic-ai/core";
|
|
629
628
|
/**
|
|
630
629
|
* This is the base interface for all admin entity repositories.
|
|
@@ -745,7 +744,7 @@ declare class AdminEntityRepository<T> implements IAdminEntityRepository<T> {
|
|
|
745
744
|
deleteById(id: TenantSpecificId): Promise<void>;
|
|
746
745
|
deleteByQuery(query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
747
746
|
findAll(tenantSelection: TenantSelection, pageable: Pageable4): Promise<IterablePage4<T>>;
|
|
748
|
-
findById(id: TenantSpecificId): Promise<T>;
|
|
747
|
+
findById(id: TenantSpecificId): Promise<T | null>;
|
|
749
748
|
findByIds(ids: TenantSpecificId[]): Promise<T[]>;
|
|
750
749
|
namedQuery<U>(queryName: string, queryParameters: QueryParameter[]): Promise<U>;
|
|
751
750
|
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable4): Promise<IterablePage4<U>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -90,102 +90,14 @@ 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 {
|
|
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
|
-
/**
|
|
108
|
-
* Signifies that a property is an auto-generated ID for the entity.
|
|
109
|
-
*/
|
|
110
|
-
declare function AutoGeneratedId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
111
|
-
/**
|
|
112
|
-
* Signifies that a property is a discriminator for the entity.
|
|
113
|
-
* This is used to determine the type of the entity when deserializing from JSON.
|
|
114
|
-
* @param propertyName the name of the property to use as the discriminator
|
|
115
|
-
*/
|
|
116
|
-
declare function Discriminator(_propertyName: string): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
117
|
-
/**
|
|
118
|
-
* Signifies that a class is a Entity.
|
|
119
|
-
* This is required to define the class as an entity in the Kinotic framework.
|
|
120
|
-
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
121
|
-
* @param entityType the type of entity to use for this entity
|
|
122
|
-
*/
|
|
123
|
-
declare function Entity(_multiTenancyType?: MultiTenancyType, _entityType?: EntityType): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
124
|
-
/**
|
|
125
|
-
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
126
|
-
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
127
|
-
*/
|
|
128
|
-
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
129
|
-
/**
|
|
130
|
-
* Provides configuration for the Elasticsearch index.
|
|
131
|
-
* This can be used to override the default index settings and mappings used by Kinotic.
|
|
132
|
-
*/
|
|
133
|
-
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_target: Function, _context: ClassDecoratorContext<any>) => void;
|
|
134
|
-
declare function Flattened(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
135
|
-
/**
|
|
136
|
-
* Signifies that a property is the ID of the entity.
|
|
137
|
-
*/
|
|
138
|
-
declare function Id(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
139
|
-
declare function Nested(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
140
|
-
/**
|
|
141
|
-
* Signifies that a property is not indexed in Elasticsearch.
|
|
142
|
-
*/
|
|
143
|
-
declare function NotIndexed(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
144
|
-
declare function NotNull(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
145
|
-
declare function Policy(_policies: string[][]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
146
|
-
declare function Precision(_precisionType?: PrecisionType): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
147
|
-
declare function Query(_statements: string): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
148
|
-
declare function Role(_roles: string[]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
149
|
-
declare function Text(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
150
|
-
/**
|
|
151
|
-
* This is used for data streams to signify the field that should be used as the time reference.
|
|
152
|
-
*/
|
|
153
|
-
declare function TimeReference(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
154
|
-
declare function Version(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
155
|
-
declare function TenantId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
156
|
-
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
157
|
-
/**
|
|
158
|
-
* Provides a way to add decorators to an entity service
|
|
159
|
-
*/
|
|
160
|
-
declare class EntityServiceDecoratorsDecorator extends C3Decorator2 {
|
|
161
|
-
config: EntityServiceDecoratorsConfig;
|
|
162
|
-
constructor();
|
|
163
|
-
}
|
|
164
|
-
declare class PolicyDecorator extends EntityServiceDecorator {
|
|
165
|
-
policies: string[][];
|
|
166
|
-
constructor(policies: string[][]);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Provides a mechanism to apply the @Policy decorator to an {@link EntityService}
|
|
170
|
-
* @param policies to be supplied
|
|
171
|
-
*/
|
|
172
|
-
declare function $Policy(policies: string[][]): PolicyDecorator;
|
|
173
|
-
declare class RoleDecorator extends EntityServiceDecorator {
|
|
174
|
-
roles: string[];
|
|
175
|
-
constructor(roles: string[]);
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Provides a mechanism to apply the @Role decorator to an {@link EntityService}
|
|
179
|
-
* @param roles to be supplied
|
|
180
|
-
*/
|
|
181
|
-
declare function $Role(roles: string[]): RoleDecorator;
|
|
93
|
+
import { Pageable as Pageable2, IterablePage as IterablePage2 } from "@kinotic-ai/core";
|
|
182
94
|
import { IKinotic } from "@kinotic-ai/core";
|
|
183
95
|
import { IServiceProxy, Page, Pageable, IterablePage } from "@kinotic-ai/core";
|
|
184
96
|
/**
|
|
185
97
|
* The zone for the platform's application facing data services, such as entity persistence
|
|
186
98
|
* and named query execution — where the services backing these repositories are hosted.
|
|
187
99
|
*/
|
|
188
|
-
declare const APP_API_ZONE = "
|
|
100
|
+
declare const APP_API_ZONE = "app-api";
|
|
189
101
|
interface IEntitiesRepository {
|
|
190
102
|
/**
|
|
191
103
|
* Saves all given entities.
|
|
@@ -350,118 +262,6 @@ declare class EntitiesRepository implements IEntitiesRepository {
|
|
|
350
262
|
syncIndex(entityDefinitionId: string): Promise<void>;
|
|
351
263
|
update<T>(entityDefinitionId: string, entity: T): Promise<T>;
|
|
352
264
|
}
|
|
353
|
-
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
354
|
-
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable2, IterablePage as IterablePage2 } from "@kinotic-ai/core";
|
|
355
|
-
type TenantSelection = string[];
|
|
356
|
-
interface IAdminEntitiesRepository {
|
|
357
|
-
/**
|
|
358
|
-
* Returns the number of entities available.
|
|
359
|
-
* @param structureId the id of the structure to count
|
|
360
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
361
|
-
* @return {@link Promise} emitting the number of entities.
|
|
362
|
-
*/
|
|
363
|
-
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
364
|
-
/**
|
|
365
|
-
* Returns the number of entities available for the given query.
|
|
366
|
-
*
|
|
367
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
368
|
-
* @param query the query used to limit result
|
|
369
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
370
|
-
* @return Promise emitting the number of entities
|
|
371
|
-
*/
|
|
372
|
-
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
373
|
-
/**
|
|
374
|
-
* Deletes the entity with the given id.
|
|
375
|
-
*
|
|
376
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
377
|
-
* @param id must not be {@literal null}
|
|
378
|
-
* @return {@link Promise} emitting when delete is complete
|
|
379
|
-
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
380
|
-
*/
|
|
381
|
-
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
382
|
-
/**
|
|
383
|
-
* Deletes the entity with the given id.
|
|
384
|
-
*
|
|
385
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
386
|
-
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
387
|
-
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
388
|
-
* @return Promise signaling when operation has completed
|
|
389
|
-
* @throws Error in case the given {@literal query} is {@literal null}
|
|
390
|
-
*/
|
|
391
|
-
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
392
|
-
/**
|
|
393
|
-
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
394
|
-
*
|
|
395
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
396
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
397
|
-
* @param pageable the page settings to be used
|
|
398
|
-
* @return a page of entities
|
|
399
|
-
*/
|
|
400
|
-
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
401
|
-
/**
|
|
402
|
-
* Retrieves an entity by its id.
|
|
403
|
-
*
|
|
404
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
405
|
-
* @param id must not be {@literal null}
|
|
406
|
-
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
407
|
-
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
408
|
-
*/
|
|
409
|
-
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T | null>;
|
|
410
|
-
/**
|
|
411
|
-
* Retrieves a list of entities by their id.
|
|
412
|
-
*
|
|
413
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
414
|
-
* @param ids must not be {@literal null}
|
|
415
|
-
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
416
|
-
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
417
|
-
*/
|
|
418
|
-
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
419
|
-
/**
|
|
420
|
-
* Executes a named query.
|
|
421
|
-
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
422
|
-
* @param queryName the name of the function that defines the query
|
|
423
|
-
* @param parameters to pass to the query
|
|
424
|
-
* @returns Promise with the result of the query
|
|
425
|
-
*/
|
|
426
|
-
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
427
|
-
/**
|
|
428
|
-
* Executes a named query and returns a Page of results.
|
|
429
|
-
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
430
|
-
* @param queryName the name of the function that defines the query
|
|
431
|
-
* @param parameters to pass to the query
|
|
432
|
-
* @param pageable the page settings to be used
|
|
433
|
-
* @returns Promise with the result of the query
|
|
434
|
-
*/
|
|
435
|
-
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
436
|
-
/**
|
|
437
|
-
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
438
|
-
*
|
|
439
|
-
* @param entityDefinitionId the id of the structure to save the entity for
|
|
440
|
-
* @param searchText the text to search for entities for
|
|
441
|
-
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
442
|
-
* @param pageable the page settings to be used
|
|
443
|
-
* @return a page of entities
|
|
444
|
-
*/
|
|
445
|
-
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
446
|
-
}
|
|
447
|
-
declare class AdminEntitiesRepository implements IAdminEntitiesRepository {
|
|
448
|
-
protected serviceProxy: IServiceProxy2;
|
|
449
|
-
constructor(kinotic: IKinotic2);
|
|
450
|
-
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
451
|
-
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
452
|
-
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
453
|
-
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
454
|
-
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
455
|
-
findAllSinglePage<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<Page2<T>>;
|
|
456
|
-
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T>;
|
|
457
|
-
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
458
|
-
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
459
|
-
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
460
|
-
namedQuerySinglePage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable2): Promise<Page2<T>>;
|
|
461
|
-
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
462
|
-
searchSinglePage<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable2): Promise<Page2<T>>;
|
|
463
|
-
}
|
|
464
|
-
import { Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
465
265
|
/**
|
|
466
266
|
* This is the base interface for all entity repositories.
|
|
467
267
|
* It provides the basic CRUD operations for entities.
|
|
@@ -531,7 +331,7 @@ interface IEntityRepository<T> {
|
|
|
531
331
|
* @param pageable the page settings to be used
|
|
532
332
|
* @return a page of entities
|
|
533
333
|
*/
|
|
534
|
-
findAll(pageable:
|
|
334
|
+
findAll(pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
535
335
|
/**
|
|
536
336
|
* Retrieves an entity by its id.
|
|
537
337
|
*
|
|
@@ -562,7 +362,7 @@ interface IEntityRepository<T> {
|
|
|
562
362
|
* @param pageable the page settings to be used
|
|
563
363
|
* @returns Promise with the result of the query
|
|
564
364
|
*/
|
|
565
|
-
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable:
|
|
365
|
+
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<U>>;
|
|
566
366
|
/**
|
|
567
367
|
* Saves a given entity. This will override all data if there is an existing entity with the same id.
|
|
568
368
|
* Use the returned instance for further operations as the save operation might have changed the entity instance.
|
|
@@ -579,7 +379,7 @@ interface IEntityRepository<T> {
|
|
|
579
379
|
* @param pageable the page settings to be used
|
|
580
380
|
* @return a page of entities
|
|
581
381
|
*/
|
|
582
|
-
search(searchText: string, pageable:
|
|
382
|
+
search(searchText: string, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
583
383
|
/**
|
|
584
384
|
* This operation makes all the recent writes immediately available for search.
|
|
585
385
|
* @return a Promise that resolves when the operation is complete
|
|
@@ -613,18 +413,217 @@ declare class EntityRepository<T> implements IEntityRepository<T> {
|
|
|
613
413
|
countByQuery(query: string): Promise<number>;
|
|
614
414
|
deleteById(id: string): Promise<void>;
|
|
615
415
|
deleteByQuery(query: string): Promise<void>;
|
|
616
|
-
findAll(pageable:
|
|
416
|
+
findAll(pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
617
417
|
findById(id: string): Promise<T | null>;
|
|
618
418
|
findByIds(ids: string[]): Promise<T[]>;
|
|
619
419
|
namedQuery<U>(queryName: string, queryParameters: QueryParameter[]): Promise<U>;
|
|
620
|
-
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable:
|
|
420
|
+
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable2): Promise<IterablePage2<U>>;
|
|
621
421
|
save(entity: T): Promise<T>;
|
|
622
|
-
search(searchText: string, pageable:
|
|
422
|
+
search(searchText: string, pageable: Pageable2): Promise<IterablePage2<T>>;
|
|
623
423
|
syncIndex(): Promise<void>;
|
|
624
424
|
update(entity: T): Promise<T>;
|
|
625
425
|
protected beforeBulkSaveOrUpdate(entities: T[]): Promise<T[]>;
|
|
626
426
|
protected beforeSaveOrUpdate(entity: T): Promise<T>;
|
|
627
427
|
}
|
|
428
|
+
type IfFunction<
|
|
429
|
+
T,
|
|
430
|
+
U
|
|
431
|
+
> = T extends (...args: any[]) => any ? U : never;
|
|
432
|
+
type MethodsOf<T> = { [K in keyof T] : IfFunction<T[K], K> }[keyof T];
|
|
433
|
+
type ExcludedMethods = "namedQuery" | "namedQueryPage";
|
|
434
|
+
type FilteredMethods<T> = Exclude<MethodsOf<T>, ExcludedMethods>;
|
|
435
|
+
type DecoratedFunction = FilteredMethods<IEntityRepository<any>> | "allCreate" | "allRead" | "allUpdate" | "allDelete";
|
|
436
|
+
/**
|
|
437
|
+
* Configuration for the {@link EntityServiceDecoratorsDecorator}
|
|
438
|
+
* This is a map of method names to an array of decorators that should be applied to that method
|
|
439
|
+
*/
|
|
440
|
+
type EntityServiceDecoratorsConfig = Partial<Record<DecoratedFunction, EntityServiceDecorator[]>>;
|
|
441
|
+
/**
|
|
442
|
+
* Signifies that a property is an auto-generated ID for the entity.
|
|
443
|
+
*/
|
|
444
|
+
declare function AutoGeneratedId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
445
|
+
/**
|
|
446
|
+
* Signifies that a property is a discriminator for the entity.
|
|
447
|
+
* This is used to determine the type of the entity when deserializing from JSON.
|
|
448
|
+
* @param propertyName the name of the property to use as the discriminator
|
|
449
|
+
*/
|
|
450
|
+
declare function Discriminator(_propertyName: string): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
451
|
+
/**
|
|
452
|
+
* Signifies that a class is a Entity.
|
|
453
|
+
* This is required to define the class as an entity in the Kinotic framework.
|
|
454
|
+
* @param multiTenancyType the type of multi-tenancy to use for this entity
|
|
455
|
+
* @param entityType the type of entity to use for this entity
|
|
456
|
+
*/
|
|
457
|
+
declare function Entity(_multiTenancyType?: MultiTenancyType, _entityType?: EntityType): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
458
|
+
/**
|
|
459
|
+
* A class Decorator when applied to an Entity will configure Decorators to be applied to the EntityService
|
|
460
|
+
* @param config the {@link EntityServiceDecoratorsConfig} to use
|
|
461
|
+
*/
|
|
462
|
+
declare function EntityServiceDecorators(_config: EntityServiceDecoratorsConfig): (_value: Function, _context: ClassDecoratorContext<any>) => void;
|
|
463
|
+
/**
|
|
464
|
+
* Provides configuration for the Elasticsearch index.
|
|
465
|
+
* This can be used to override the default index settings and mappings used by Kinotic.
|
|
466
|
+
*/
|
|
467
|
+
declare function EsIndexConfiguration(_value: EsIndexConfigurationData): (_target: Function, _context: ClassDecoratorContext<any>) => void;
|
|
468
|
+
declare function Flattened(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
469
|
+
/**
|
|
470
|
+
* Signifies that a property is the ID of the entity.
|
|
471
|
+
*/
|
|
472
|
+
declare function Id(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
473
|
+
declare function Nested(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
474
|
+
/**
|
|
475
|
+
* Signifies that a property is not indexed in Elasticsearch.
|
|
476
|
+
*/
|
|
477
|
+
declare function NotIndexed(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
478
|
+
declare function NotNull(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
479
|
+
declare function Policy(_policies: string[][]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
480
|
+
declare function Precision(_precisionType?: PrecisionType): (_value: undefined, _context: ClassFieldDecoratorContext) => void;
|
|
481
|
+
declare function Query(_statements: string): (_value: Function, _context: ClassMethodDecoratorContext) => void;
|
|
482
|
+
declare function Role(_roles: string[]): (_value: unknown, _context: ClassDecoratorContext<any> | ClassFieldDecoratorContext | ClassMethodDecoratorContext) => void;
|
|
483
|
+
declare function Text(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
484
|
+
/**
|
|
485
|
+
* This is used for data streams to signify the field that should be used as the time reference.
|
|
486
|
+
*/
|
|
487
|
+
declare function TimeReference(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
488
|
+
declare function Version(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
489
|
+
declare function TenantId(_value: undefined, _context: ClassFieldDecoratorContext): void;
|
|
490
|
+
import { C3Decorator as C3Decorator2 } from "@kinotic-ai/idl";
|
|
491
|
+
/**
|
|
492
|
+
* Provides a way to add decorators to an entity service
|
|
493
|
+
*/
|
|
494
|
+
declare class EntityServiceDecoratorsDecorator extends C3Decorator2 {
|
|
495
|
+
config: EntityServiceDecoratorsConfig;
|
|
496
|
+
constructor();
|
|
497
|
+
}
|
|
498
|
+
declare class PolicyDecorator extends EntityServiceDecorator {
|
|
499
|
+
policies: string[][];
|
|
500
|
+
constructor(policies: string[][]);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Provides a mechanism to apply the @Policy decorator to an {@link EntityService}
|
|
504
|
+
* @param policies to be supplied
|
|
505
|
+
*/
|
|
506
|
+
declare function $Policy(policies: string[][]): PolicyDecorator;
|
|
507
|
+
declare class RoleDecorator extends EntityServiceDecorator {
|
|
508
|
+
roles: string[];
|
|
509
|
+
constructor(roles: string[]);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Provides a mechanism to apply the @Role decorator to an {@link EntityService}
|
|
513
|
+
* @param roles to be supplied
|
|
514
|
+
*/
|
|
515
|
+
declare function $Role(roles: string[]): RoleDecorator;
|
|
516
|
+
import { IKinotic as IKinotic2 } from "@kinotic-ai/core";
|
|
517
|
+
import { IServiceProxy as IServiceProxy2, Page as Page2, Pageable as Pageable3, IterablePage as IterablePage3 } from "@kinotic-ai/core";
|
|
518
|
+
type TenantSelection = string[];
|
|
519
|
+
interface IAdminEntitiesRepository {
|
|
520
|
+
/**
|
|
521
|
+
* Returns the number of entities available.
|
|
522
|
+
* @param structureId the id of the structure to count
|
|
523
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
524
|
+
* @return {@link Promise} emitting the number of entities.
|
|
525
|
+
*/
|
|
526
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
527
|
+
/**
|
|
528
|
+
* Returns the number of entities available for the given query.
|
|
529
|
+
*
|
|
530
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
531
|
+
* @param query the query used to limit result
|
|
532
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
533
|
+
* @return Promise emitting the number of entities
|
|
534
|
+
*/
|
|
535
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
536
|
+
/**
|
|
537
|
+
* Deletes the entity with the given id.
|
|
538
|
+
*
|
|
539
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
540
|
+
* @param id must not be {@literal null}
|
|
541
|
+
* @return {@link Promise} emitting when delete is complete
|
|
542
|
+
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
543
|
+
*/
|
|
544
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
545
|
+
/**
|
|
546
|
+
* Deletes the entity with the given id.
|
|
547
|
+
*
|
|
548
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
549
|
+
* @param query the query used to filter records to delete, must not be {@literal null}
|
|
550
|
+
* @param tenantSelection the list of tenants to use when deleting the entity records
|
|
551
|
+
* @return Promise signaling when operation has completed
|
|
552
|
+
* @throws Error in case the given {@literal query} is {@literal null}
|
|
553
|
+
*/
|
|
554
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
555
|
+
/**
|
|
556
|
+
* Returns a {@link IterablePage} of entities meeting the paging restriction provided in the {@link Pageable} object.
|
|
557
|
+
*
|
|
558
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
559
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
560
|
+
* @param pageable the page settings to be used
|
|
561
|
+
* @return a page of entities
|
|
562
|
+
*/
|
|
563
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
564
|
+
/**
|
|
565
|
+
* Retrieves an entity by its id.
|
|
566
|
+
*
|
|
567
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
568
|
+
* @param id must not be {@literal null}
|
|
569
|
+
* @return {@link Promise} with the entity with the given id or {@link Promise} emitting null if none found
|
|
570
|
+
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
|
|
571
|
+
*/
|
|
572
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T | null>;
|
|
573
|
+
/**
|
|
574
|
+
* Retrieves a list of entities by their id.
|
|
575
|
+
*
|
|
576
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
577
|
+
* @param ids must not be {@literal null}
|
|
578
|
+
* @return Promise emitting the entities with the given ids or Promise emitting null if none found
|
|
579
|
+
* @throws Error in case the given {@literal ids} is {@literal null}
|
|
580
|
+
*/
|
|
581
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
582
|
+
/**
|
|
583
|
+
* Executes a named query.
|
|
584
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
585
|
+
* @param queryName the name of the function that defines the query
|
|
586
|
+
* @param parameters to pass to the query
|
|
587
|
+
* @returns Promise with the result of the query
|
|
588
|
+
*/
|
|
589
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
590
|
+
/**
|
|
591
|
+
* Executes a named query and returns a Page of results.
|
|
592
|
+
* @param entityDefinitionId the id of the structure that this named query is defined for
|
|
593
|
+
* @param queryName the name of the function that defines the query
|
|
594
|
+
* @param parameters to pass to the query
|
|
595
|
+
* @param pageable the page settings to be used
|
|
596
|
+
* @returns Promise with the result of the query
|
|
597
|
+
*/
|
|
598
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
599
|
+
/**
|
|
600
|
+
* Returns a {@link IterablePage} of entities matching the search text and paging restriction provided in the {@link Pageable} object.
|
|
601
|
+
*
|
|
602
|
+
* @param entityDefinitionId the id of the structure to save the entity for
|
|
603
|
+
* @param searchText the text to search for entities for
|
|
604
|
+
* @param tenantSelection the list of tenants to use when retrieving the entity records
|
|
605
|
+
* @param pageable the page settings to be used
|
|
606
|
+
* @return a page of entities
|
|
607
|
+
*/
|
|
608
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
609
|
+
}
|
|
610
|
+
declare class AdminEntitiesRepository implements IAdminEntitiesRepository {
|
|
611
|
+
protected serviceProxy: IServiceProxy2;
|
|
612
|
+
constructor(kinotic: IKinotic2);
|
|
613
|
+
count(entityDefinitionId: string, tenantSelection: TenantSelection): Promise<number>;
|
|
614
|
+
countByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<number>;
|
|
615
|
+
deleteById(entityDefinitionId: string, id: TenantSpecificId): Promise<void>;
|
|
616
|
+
deleteByQuery(entityDefinitionId: string, query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
617
|
+
findAll<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
618
|
+
findAllSinglePage<T>(entityDefinitionId: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<Page2<T>>;
|
|
619
|
+
findById<T>(entityDefinitionId: string, id: TenantSpecificId): Promise<T>;
|
|
620
|
+
findByIds<T>(entityDefinitionId: string, ids: TenantSpecificId[]): Promise<T[]>;
|
|
621
|
+
namedQuery<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[]): Promise<T>;
|
|
622
|
+
namedQueryPage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
623
|
+
namedQuerySinglePage<T>(entityDefinitionId: string, queryName: string, parameters: QueryParameter[], pageable: Pageable3): Promise<Page2<T>>;
|
|
624
|
+
search<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<IterablePage3<T>>;
|
|
625
|
+
searchSinglePage<T>(entityDefinitionId: string, searchText: string, tenantSelection: TenantSelection, pageable: Pageable3): Promise<Page2<T>>;
|
|
626
|
+
}
|
|
628
627
|
import { Pageable as Pageable4, IterablePage as IterablePage4 } from "@kinotic-ai/core";
|
|
629
628
|
/**
|
|
630
629
|
* This is the base interface for all admin entity repositories.
|
|
@@ -745,7 +744,7 @@ declare class AdminEntityRepository<T> implements IAdminEntityRepository<T> {
|
|
|
745
744
|
deleteById(id: TenantSpecificId): Promise<void>;
|
|
746
745
|
deleteByQuery(query: string, tenantSelection: TenantSelection): Promise<void>;
|
|
747
746
|
findAll(tenantSelection: TenantSelection, pageable: Pageable4): Promise<IterablePage4<T>>;
|
|
748
|
-
findById(id: TenantSpecificId): Promise<T>;
|
|
747
|
+
findById(id: TenantSpecificId): Promise<T | null>;
|
|
749
748
|
findByIds(ids: TenantSpecificId[]): Promise<T[]>;
|
|
750
749
|
namedQuery<U>(queryName: string, queryParameters: QueryParameter[]): Promise<U>;
|
|
751
750
|
namedQueryPage<U>(queryName: string, queryParameters: QueryParameter[], pageable: Pageable4): Promise<IterablePage4<U>>;
|
package/dist/index.js
CHANGED
|
@@ -119,12 +119,12 @@ function $Role(roles) {
|
|
|
119
119
|
import {
|
|
120
120
|
FunctionalIterablePage
|
|
121
121
|
} from "@kinotic-ai/core";
|
|
122
|
-
var APP_API_ZONE = "
|
|
122
|
+
var APP_API_ZONE = "app-api";
|
|
123
123
|
|
|
124
124
|
class EntitiesRepository {
|
|
125
125
|
serviceProxy;
|
|
126
126
|
constructor(kinotic) {
|
|
127
|
-
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}
|
|
127
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}~org.kinotic.persistence.api.services.JsonEntitiesRepository`);
|
|
128
128
|
}
|
|
129
129
|
bulkSave(entityDefinitionId, entities) {
|
|
130
130
|
return this.serviceProxy.invoke("bulkSave", [entityDefinitionId, entities]);
|
|
@@ -192,7 +192,7 @@ import {
|
|
|
192
192
|
class AdminEntitiesRepository {
|
|
193
193
|
serviceProxy;
|
|
194
194
|
constructor(kinotic) {
|
|
195
|
-
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}
|
|
195
|
+
this.serviceProxy = kinotic.serviceProxy(`${APP_API_ZONE}~org.kinotic.persistence.api.services.AdminJsonEntitiesRepository`);
|
|
196
196
|
}
|
|
197
197
|
count(entityDefinitionId, tenantSelection) {
|
|
198
198
|
return this.serviceProxy.invoke("count", [entityDefinitionId, tenantSelection]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/persistence",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"coverage": "bun test --coverage --pass-with-no-tests"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@kinotic-ai/core": ">=
|
|
35
|
+
"@kinotic-ai/core": ">=4.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@kinotic-ai/idl": "1.0.10",
|
|
39
39
|
"rxjs": "^7.8.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@kinotic-ai/core": "
|
|
42
|
+
"@kinotic-ai/core": "4.0.0",
|
|
43
43
|
"@types/node": "^25.3.2",
|
|
44
44
|
"tslib": "^2.8.1",
|
|
45
45
|
"typescript": "^5.9.3"
|