@kinotic-ai/core 1.1.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -641,6 +641,27 @@ declare function Version(version: string): (target: Function) => void;
641
641
  declare function Context(): (target: any, propertyKey: string, parameterIndex: number) => void;
642
642
  declare function Publish(namespace: string, name?: string): (target: Function) => any;
643
643
  /**
644
+ * Configuration for a single entities path and its corresponding repository output.
645
+ */
646
+ type EntitiesPathConfig = {
647
+ /**
648
+ * The path to search for classes decorated with @Entity.
649
+ */
650
+ path: string;
651
+ /**
652
+ * The path where generated Repository classes will be placed.
653
+ */
654
+ repositoryPath: string;
655
+ /**
656
+ * If true, the subfolder structure under the entities path will be mirrored under the repository path.
657
+ * For example, if entitiesPath is "src/model" and contains "payments/Payment.ts",
658
+ * the generated repository will be placed in "repositoryPath/payments/".
659
+ * If false, all generated repositories are placed directly in the repositoryPath.
660
+ * Defaults to true.
661
+ */
662
+ mirrorFolderStructure?: boolean;
663
+ };
664
+ /**
644
665
  * The project configuration for a Kinotic project.
645
666
  */
646
667
  declare class KinoticProjectConfig {
@@ -659,18 +680,23 @@ declare class KinoticProjectConfig {
659
680
  application: string;
660
681
  /**
661
682
  * The paths to search for classes decorated with @Entity that Kinotic will be created for.
683
+ * Each entry can be a string (simple path) or an {@link EntitiesPathConfig} object for full control
684
+ * over where repository classes are generated.
685
+ *
686
+ * When a plain string is provided, the {@link generatedPath} will be used as the repository output path.
662
687
  */
663
- entitiesPaths: string[];
688
+ entitiesPaths: (string | EntitiesPathConfig)[];
664
689
  /**
665
- * The path to where generated files will be placed.
690
+ * The default path to where generated files will be placed when entitiesPaths contains plain strings.
691
+ * Ignored for entitiesPaths entries that use {@link EntitiesPathConfig}.
666
692
  */
667
- generatedPath: string;
693
+ generatedPath?: string;
668
694
  /**
669
695
  * The file extension to use for imports in generated files.
670
696
  */
671
697
  fileExtensionForImports: string;
672
698
  /**
673
- * If true the generated EntityService classes will validate all data before sending to the server.
699
+ * If true the generated Repository classes will validate all data before sending to the server.
674
700
  */
675
701
  validate?: boolean;
676
702
  }
@@ -932,6 +958,15 @@ interface ICrudServiceProxy<T extends Identifiable<string>> extends IEditableDat
932
958
  */
933
959
  save(entity: T): Promise<T>;
934
960
  /**
961
+ * Saves a given entity and waits for the changes to be visible in search results before returning.
962
+ * Use the returned instance for further operations as the save operation might have changed the entity instance completely.
963
+ *
964
+ * @param entity must not be {@literal null}.
965
+ * @return a {@link Promise} emitting the saved entity.
966
+ * @throws Error in case the given {@literal entity} is {@literal null}.
967
+ */
968
+ saveSync(entity: T): Promise<T>;
969
+ /**
935
970
  * Retrieves an entity by its id.
936
971
  *
937
972
  * @param id must not be {@literal null}.
@@ -987,6 +1022,7 @@ declare class CrudServiceProxy<T extends Identifiable<string>> implements ICrudS
987
1022
  findAllSinglePage(pageable: Pageable): Promise<Page<T>>;
988
1023
  findById(id: string): Promise<T>;
989
1024
  save(entity: T): Promise<T>;
1025
+ saveSync(entity: T): Promise<T>;
990
1026
  findByIdNotIn(ids: string[], page: Pageable): Promise<Page<Identifiable<string>>>;
991
1027
  search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
992
1028
  searchSinglePage(searchText: string, pageable: Pageable): Promise<Page<T>>;
@@ -1116,4 +1152,4 @@ declare class ParticipantConstants {
1116
1152
  static readonly PARTICIPANT_TYPE_NODE: string;
1117
1153
  static readonly CLI_PARTICIPANT_ID: string;
1118
1154
  }
1119
- export { createCRI, Version, TextEventFactory, Sort, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticProjectConfig, KinoticPlugin, KinoticError, Kinotic, JsonEventFactory, IterablePage, Identifiable, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, ConnectHeaders, CRI, CONTEXT_METADATA_KEY, AuthorizationError, AuthenticationError, AbstractIterablePage };
1155
+ export { createCRI, Version, TextEventFactory, Sort, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticProjectConfig, KinoticPlugin, KinoticError, Kinotic, JsonEventFactory, IterablePage, Identifiable, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, EntitiesPathConfig, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, ConnectHeaders, CRI, CONTEXT_METADATA_KEY, AuthorizationError, AuthenticationError, AbstractIterablePage };
package/dist/index.d.ts CHANGED
@@ -641,6 +641,27 @@ declare function Version(version: string): (target: Function) => void;
641
641
  declare function Context(): (target: any, propertyKey: string, parameterIndex: number) => void;
642
642
  declare function Publish(namespace: string, name?: string): (target: Function) => any;
643
643
  /**
644
+ * Configuration for a single entities path and its corresponding repository output.
645
+ */
646
+ type EntitiesPathConfig = {
647
+ /**
648
+ * The path to search for classes decorated with @Entity.
649
+ */
650
+ path: string;
651
+ /**
652
+ * The path where generated Repository classes will be placed.
653
+ */
654
+ repositoryPath: string;
655
+ /**
656
+ * If true, the subfolder structure under the entities path will be mirrored under the repository path.
657
+ * For example, if entitiesPath is "src/model" and contains "payments/Payment.ts",
658
+ * the generated repository will be placed in "repositoryPath/payments/".
659
+ * If false, all generated repositories are placed directly in the repositoryPath.
660
+ * Defaults to true.
661
+ */
662
+ mirrorFolderStructure?: boolean;
663
+ };
664
+ /**
644
665
  * The project configuration for a Kinotic project.
645
666
  */
646
667
  declare class KinoticProjectConfig {
@@ -659,18 +680,23 @@ declare class KinoticProjectConfig {
659
680
  application: string;
660
681
  /**
661
682
  * The paths to search for classes decorated with @Entity that Kinotic will be created for.
683
+ * Each entry can be a string (simple path) or an {@link EntitiesPathConfig} object for full control
684
+ * over where repository classes are generated.
685
+ *
686
+ * When a plain string is provided, the {@link generatedPath} will be used as the repository output path.
662
687
  */
663
- entitiesPaths: string[];
688
+ entitiesPaths: (string | EntitiesPathConfig)[];
664
689
  /**
665
- * The path to where generated files will be placed.
690
+ * The default path to where generated files will be placed when entitiesPaths contains plain strings.
691
+ * Ignored for entitiesPaths entries that use {@link EntitiesPathConfig}.
666
692
  */
667
- generatedPath: string;
693
+ generatedPath?: string;
668
694
  /**
669
695
  * The file extension to use for imports in generated files.
670
696
  */
671
697
  fileExtensionForImports: string;
672
698
  /**
673
- * If true the generated EntityService classes will validate all data before sending to the server.
699
+ * If true the generated Repository classes will validate all data before sending to the server.
674
700
  */
675
701
  validate?: boolean;
676
702
  }
@@ -932,6 +958,15 @@ interface ICrudServiceProxy<T extends Identifiable<string>> extends IEditableDat
932
958
  */
933
959
  save(entity: T): Promise<T>;
934
960
  /**
961
+ * Saves a given entity and waits for the changes to be visible in search results before returning.
962
+ * Use the returned instance for further operations as the save operation might have changed the entity instance completely.
963
+ *
964
+ * @param entity must not be {@literal null}.
965
+ * @return a {@link Promise} emitting the saved entity.
966
+ * @throws Error in case the given {@literal entity} is {@literal null}.
967
+ */
968
+ saveSync(entity: T): Promise<T>;
969
+ /**
935
970
  * Retrieves an entity by its id.
936
971
  *
937
972
  * @param id must not be {@literal null}.
@@ -987,6 +1022,7 @@ declare class CrudServiceProxy<T extends Identifiable<string>> implements ICrudS
987
1022
  findAllSinglePage(pageable: Pageable): Promise<Page<T>>;
988
1023
  findById(id: string): Promise<T>;
989
1024
  save(entity: T): Promise<T>;
1025
+ saveSync(entity: T): Promise<T>;
990
1026
  findByIdNotIn(ids: string[], page: Pageable): Promise<Page<Identifiable<string>>>;
991
1027
  search(searchText: string, pageable: Pageable): Promise<IterablePage<T>>;
992
1028
  searchSinglePage(searchText: string, pageable: Pageable): Promise<Page<T>>;
@@ -1116,4 +1152,4 @@ declare class ParticipantConstants {
1116
1152
  static readonly PARTICIPANT_TYPE_NODE: string;
1117
1153
  static readonly CLI_PARTICIPANT_ID: string;
1118
1154
  }
1119
- export { createCRI, Version, TextEventFactory, Sort, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticProjectConfig, KinoticPlugin, KinoticError, Kinotic, JsonEventFactory, IterablePage, Identifiable, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, ConnectHeaders, CRI, CONTEXT_METADATA_KEY, AuthorizationError, AuthenticationError, AbstractIterablePage };
1155
+ export { createCRI, Version, TextEventFactory, Sort, ServiceRegistry, ServiceContext, ServerInfo, Scope, Publish, ParticipantConstants, Participant, Pageable, Page, Order, OffsetPageable, NullHandling, KinoticSingleton, KinoticProjectConfig, KinoticPlugin, KinoticError, Kinotic, JsonEventFactory, IterablePage, Identifiable, IServiceRegistry, IServiceProxy, IParticipant, IKinotic, IEventFactory, IEventBus, IEvent, IEditableDataSource, IDataSource, ICrudServiceProxyFactory, ICrudServiceProxy, FunctionalIterablePage, EventConstants, EventBus, Event, EntitiesPathConfig, Direction, DefaultCRI, DataSourceUtils, CursorPageable, CrudServiceProxyFactory, CrudServiceProxy, ContextInterceptor, Context, ConnectionInfo, ConnectedInfo, ConnectHeaders, CRI, CONTEXT_METADATA_KEY, AuthorizationError, AuthenticationError, AbstractIterablePage };