@ruiapp/rapid-core 0.3.1 → 0.5.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/core/routeContext.d.ts +9 -0
- package/dist/core/server.d.ts +2 -1
- package/dist/dataAccess/dataAccessor.d.ts +8 -8
- package/dist/helpers/runCollectionEntityActionHandler.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +615 -307
- package/dist/plugins/dataManage/actionHandlers/deleteCollectionEntities.d.ts +1 -0
- package/dist/plugins/license/LicensePlugin.d.ts +23 -0
- package/dist/plugins/license/LicensePluginTypes.d.ts +78 -0
- package/dist/plugins/license/LicenseService.d.ts +22 -0
- package/dist/plugins/license/actionHandlers/getLicense.d.ts +6 -0
- package/dist/plugins/license/actionHandlers/index.d.ts +3 -0
- package/dist/plugins/license/helpers/certHelper.d.ts +2 -0
- package/dist/plugins/license/helpers/cryptoHelper.d.ts +8 -0
- package/dist/plugins/license/models/index.d.ts +2 -0
- package/dist/plugins/license/routes/getLicense.d.ts +12 -0
- package/dist/plugins/license/routes/index.d.ts +12 -0
- package/dist/plugins/sequence/SequenceService.d.ts +3 -2
- package/dist/plugins/sequence/segments/autoIncrement.d.ts +2 -1
- package/dist/plugins/sequence/segments/dayOfMonth.d.ts +2 -1
- package/dist/plugins/sequence/segments/literal.d.ts +2 -1
- package/dist/plugins/sequence/segments/month.d.ts +2 -1
- package/dist/plugins/sequence/segments/parameter.d.ts +2 -1
- package/dist/plugins/sequence/segments/year.d.ts +2 -1
- package/dist/server.d.ts +1 -0
- package/dist/types.d.ts +13 -8
- package/dist/utilities/typeUtility.d.ts +1 -0
- package/package.json +1 -1
- package/src/core/routeContext.ts +53 -0
- package/src/core/server.ts +2 -0
- package/src/dataAccess/dataAccessor.ts +15 -15
- package/src/dataAccess/entityManager.ts +66 -50
- package/src/helpers/runCollectionEntityActionHandler.ts +37 -7
- package/src/index.ts +3 -0
- package/src/plugins/auth/actionHandlers/changePassword.ts +22 -15
- package/src/plugins/auth/actionHandlers/createSession.ts +26 -11
- package/src/plugins/auth/actionHandlers/resetPassword.ts +21 -14
- package/src/plugins/dataManage/actionHandlers/addEntityRelations.ts +7 -12
- package/src/plugins/dataManage/actionHandlers/countCollectionEntities.ts +3 -2
- package/src/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.ts +52 -13
- package/src/plugins/dataManage/actionHandlers/createCollectionEntity.ts +12 -16
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntities.ts +32 -25
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntityById.ts +12 -14
- package/src/plugins/dataManage/actionHandlers/findCollectionEntities.ts +3 -2
- package/src/plugins/dataManage/actionHandlers/findCollectionEntityById.ts +12 -12
- package/src/plugins/dataManage/actionHandlers/removeEntityRelations.ts +8 -13
- package/src/plugins/dataManage/actionHandlers/updateCollectionEntityById.ts +26 -29
- package/src/plugins/fileManage/actionHandlers/downloadDocument.ts +6 -6
- package/src/plugins/fileManage/actionHandlers/downloadFile.ts +3 -3
- package/src/plugins/license/LicensePlugin.ts +79 -0
- package/src/plugins/license/LicensePluginTypes.ts +95 -0
- package/src/plugins/license/LicenseService.ts +112 -0
- package/src/plugins/license/actionHandlers/getLicense.ts +18 -0
- package/src/plugins/license/actionHandlers/index.ts +4 -0
- package/src/plugins/license/helpers/certHelper.ts +21 -0
- package/src/plugins/license/helpers/cryptoHelper.ts +47 -0
- package/src/plugins/license/models/index.ts +1 -0
- package/src/plugins/license/routes/getLicense.ts +15 -0
- package/src/plugins/license/routes/index.ts +3 -0
- package/src/plugins/metaManage/MetaManagePlugin.ts +3 -2
- package/src/plugins/sequence/SequencePlugin.ts +29 -19
- package/src/plugins/sequence/SequenceService.ts +25 -14
- package/src/plugins/sequence/actionHandlers/generateSn.ts +3 -3
- package/src/plugins/sequence/segments/autoIncrement.ts +36 -24
- package/src/plugins/sequence/segments/dayOfMonth.ts +2 -0
- package/src/plugins/sequence/segments/literal.ts +2 -0
- package/src/plugins/sequence/segments/month.ts +2 -0
- package/src/plugins/sequence/segments/parameter.ts +2 -0
- package/src/plugins/sequence/segments/year.ts +2 -0
- package/src/plugins/setting/models/SystemSettingItem.ts +6 -0
- package/src/plugins/setting/models/UserSettingItem.ts +6 -0
- package/src/plugins/stateMachine/StateMachinePlugin.ts +26 -16
- package/src/plugins/stateMachine/actionHandlers/sendStateMachineEvent.ts +14 -11
- package/src/server.ts +4 -0
- package/src/types.ts +14 -8
- package/src/utilities/typeUtility.ts +4 -0
|
@@ -2,18 +2,27 @@ import { RapidRequest } from "./request";
|
|
|
2
2
|
import { RapidResponse } from "./response";
|
|
3
3
|
import { HttpStatus } from "./http-types";
|
|
4
4
|
import { IRpdServer } from "./server";
|
|
5
|
+
import { IDatabaseAccessor, IDatabaseClient } from "../types";
|
|
5
6
|
export type Next = () => Promise<void>;
|
|
6
7
|
export declare class RouteContext {
|
|
8
|
+
#private;
|
|
7
9
|
readonly request: RapidRequest;
|
|
8
10
|
readonly response: RapidResponse;
|
|
9
11
|
readonly state: Record<string, any>;
|
|
12
|
+
readonly databaseAccessor: IDatabaseAccessor;
|
|
10
13
|
method: string;
|
|
11
14
|
path: string;
|
|
12
15
|
params: Record<string, string>;
|
|
13
16
|
routeConfig: any;
|
|
14
17
|
static newSystemOperationContext(server: IRpdServer): RouteContext;
|
|
15
18
|
constructor(server: IRpdServer, request?: RapidRequest);
|
|
19
|
+
clone(): RouteContext;
|
|
20
|
+
setState(state: Record<string, any>): void;
|
|
16
21
|
set(headerName: string, headerValue: string): void;
|
|
17
22
|
json(obj: any, status?: HttpStatus, headers?: HeadersInit): void;
|
|
18
23
|
redirect(url: string, status?: HttpStatus): void;
|
|
24
|
+
getDbTransactionClient(): IDatabaseClient | null;
|
|
25
|
+
beginDbTransaction(): Promise<IDatabaseClient>;
|
|
26
|
+
commitDbTransaction(): Promise<void>;
|
|
27
|
+
rollbackDbTransaction(): Promise<void>;
|
|
19
28
|
}
|
package/dist/core/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateEntityOptions, EmitServerEventOptions, EntityWatcherType, GetDataAccessorOptions, GetModelOptions, IDatabaseConfig, IQueryBuilder, IRpdDataAccessor, RapidServerConfig, RpdApplicationConfig, RpdDataModel, RpdDataModelProperty, RpdServerEventTypes, UpdateEntityByIdOptions } from "../types";
|
|
1
|
+
import { CreateEntityOptions, EmitServerEventOptions, EntityWatcherType, GetDataAccessorOptions, GetModelOptions, IDatabaseAccessor, IDatabaseConfig, IQueryBuilder, IRpdDataAccessor, RapidServerConfig, RpdApplicationConfig, RpdDataModel, RpdDataModelProperty, RpdServerEventTypes, UpdateEntityByIdOptions } from "../types";
|
|
2
2
|
import { IPluginActionHandler, ActionHandler, ActionHandlerContext } from "./actionHandler";
|
|
3
3
|
import { Next, RouteContext } from "./routeContext";
|
|
4
4
|
import EntityManager from "../dataAccess/entityManager";
|
|
@@ -11,6 +11,7 @@ export interface IRpdServer {
|
|
|
11
11
|
getLogger(): Logger;
|
|
12
12
|
registerFacilityFactory(factory: FacilityFactory): any;
|
|
13
13
|
getFacility<TFacility = any>(name: string, options?: any): Promise<TFacility>;
|
|
14
|
+
getDatabaseAccessor(): IDatabaseAccessor;
|
|
14
15
|
queryDatabaseObject: (sql: string, params?: unknown[] | Record<string, unknown>) => Promise<any[]>;
|
|
15
16
|
tryQueryDatabaseObject: (sql: string, params?: unknown[] | Record<string, unknown>) => Promise<any[]>;
|
|
16
17
|
registerMiddleware(middleware: any): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IRpdDataAccessor, RpdDataModel, IDatabaseAccessor } from "../types";
|
|
1
|
+
import { IRpdDataAccessor, RpdDataModel, IDatabaseAccessor, IDatabaseClient } from "../types";
|
|
2
2
|
import QueryBuilder from "../queryBuilder/queryBuilder";
|
|
3
3
|
import { IRpdServer } from "../core/server";
|
|
4
4
|
import { CountRowOptions, FindRowOptions } from "./dataAccessTypes";
|
|
@@ -10,13 +10,13 @@ export default class DataAccessor<T = any> implements IRpdDataAccessor<T> {
|
|
|
10
10
|
#private;
|
|
11
11
|
constructor(server: IRpdServer, databaseAccessor: IDatabaseAccessor, options: IDataAccessorOptions);
|
|
12
12
|
getModel(): RpdDataModel;
|
|
13
|
-
create(entity: Partial<T
|
|
14
|
-
updateById(id: any, entity: Partial<T
|
|
13
|
+
create(entity: Partial<T>, databaseClient: IDatabaseClient | null): Promise<T>;
|
|
14
|
+
updateById(id: any, entity: Partial<T>, databaseClient: IDatabaseClient | null): Promise<{
|
|
15
15
|
count: number;
|
|
16
16
|
}>;
|
|
17
|
-
find(options: FindRowOptions): Promise<T[]>;
|
|
18
|
-
findOne(options: FindRowOptions): Promise<T>;
|
|
19
|
-
findById(id: any): Promise<T | null>;
|
|
20
|
-
count(options: CountRowOptions): Promise<number>;
|
|
21
|
-
deleteById(id: any): Promise<void>;
|
|
17
|
+
find(options: FindRowOptions, databaseClient: IDatabaseClient | null): Promise<T[]>;
|
|
18
|
+
findOne(options: FindRowOptions, databaseClient: IDatabaseClient | null): Promise<T>;
|
|
19
|
+
findById(id: any, databaseClient: IDatabaseClient | null): Promise<T | null>;
|
|
20
|
+
count(options: CountRowOptions, databaseClient: IDatabaseClient | null): Promise<number>;
|
|
21
|
+
deleteById(id: any, databaseClient: IDatabaseClient | null): Promise<void>;
|
|
22
22
|
}
|
|
@@ -2,5 +2,5 @@ import { RunEntityActionHandlerOptions } from "../types";
|
|
|
2
2
|
import { ActionHandlerContext } from "../core/actionHandler";
|
|
3
3
|
import EntityManager from "../dataAccess/entityManager";
|
|
4
4
|
type EntityActionHandler = (entityManager: EntityManager, input: any) => Promise<any>;
|
|
5
|
-
export default function runCollectionEntityActionHandler(ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions, code: string, handleEntityAction: EntityActionHandler): Promise<void>;
|
|
5
|
+
export default function runCollectionEntityActionHandler(ctx: ActionHandlerContext, options: RunEntityActionHandlerOptions, code: string, autoMergeInput: boolean, runInTransaction: boolean, handleEntityAction: EntityActionHandler): Promise<void>;
|
|
6
6
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ export * from "./plugins/sequence/SequencePluginTypes";
|
|
|
16
16
|
export { default as WebhooksPlugin } from "./plugins/webhooks/WebhooksPlugin";
|
|
17
17
|
export { default as AuthPlugin } from "./plugins/auth/AuthPlugin";
|
|
18
18
|
export { default as FileManagePlugin } from "./plugins/fileManage/FileManagePlugin";
|
|
19
|
+
export { default as LicensePlugin } from "./plugins/license/LicensePlugin";
|
|
20
|
+
export * from "./plugins/license/LicensePluginTypes";
|
|
19
21
|
export { default as MailPlugin } from "./plugins/mail/MailPlugin";
|
|
20
22
|
export * from "./plugins/mail/MailPluginTypes";
|
|
21
23
|
export { default as NotificationPlugin } from "./plugins/notification/NotificationPlugin";
|