@ruiapp/rapid-core 0.1.54 → 0.1.56
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/server.d.ts +2 -2
- package/dist/dataAccess/entityManager.d.ts +3 -3
- package/dist/index.js +217 -96
- package/dist/server.d.ts +2 -2
- package/dist/types.d.ts +34 -25
- package/package.json +1 -1
- package/src/core/http-types.ts +4 -4
- package/src/core/server.ts +2 -2
- package/src/dataAccess/entityManager.ts +128 -75
- package/src/deno-std/assert/assert.ts +9 -9
- package/src/deno-std/assert/assertion_error.ts +7 -7
- package/src/helpers/inputHelper.ts +11 -11
- package/src/plugins/dataManage/actionHandlers/addEntityRelations.ts +1 -1
- package/src/plugins/dataManage/actionHandlers/countCollectionEntities.ts +3 -2
- package/src/plugins/dataManage/actionHandlers/createCollectionEntitiesBatch.ts +1 -1
- package/src/plugins/dataManage/actionHandlers/createCollectionEntity.ts +1 -1
- package/src/plugins/dataManage/actionHandlers/deleteCollectionEntityById.ts +4 -1
- package/src/plugins/dataManage/actionHandlers/findCollectionEntities.ts +1 -1
- package/src/plugins/dataManage/actionHandlers/findCollectionEntityById.ts +4 -1
- package/src/plugins/dataManage/actionHandlers/removeEntityRelations.ts +3 -2
- package/src/plugins/dataManage/actionHandlers/updateCollectionEntityById.ts +9 -2
- package/src/plugins/metaManage/MetaManagePlugin.ts +33 -2
- package/src/plugins/serverOperation/actionHandlers/runServerOperation.ts +15 -15
- package/src/plugins/stateMachine/stateMachineHelper.ts +36 -36
- package/src/plugins/webhooks/pluginConfig.ts +74 -74
- package/src/proxy/types.ts +21 -21
- package/src/queryBuilder/index.ts +1 -1
- package/src/server.ts +6 -4
- package/src/types.ts +37 -25
- package/src/utilities/rapidUtility.ts +5 -5
- package/src/utilities/typeUtility.ts +11 -11
package/src/types.ts
CHANGED
|
@@ -68,19 +68,18 @@ export interface GetModelOptions {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
export type RpdServerEventTypes = {
|
|
71
|
-
"entity.beforeCreate": [RapidPlugin, RpdEntityBeforeCreateEventPayload];
|
|
72
|
-
"entity.create": [RapidPlugin, RpdEntityCreateEventPayload];
|
|
73
|
-
"entity.beforeUpdate": [RapidPlugin, RpdEntityBeforeUpdateEventPayload];
|
|
74
|
-
"entity.update": [RapidPlugin, RpdEntityUpdateEventPayload];
|
|
75
|
-
"entity.beforeDelete": [RapidPlugin, RpdEntityBeforeDeleteEventPayload];
|
|
76
|
-
"entity.delete": [RapidPlugin, RpdEntityDeleteEventPayload];
|
|
77
|
-
"entity.addRelations": [RapidPlugin, RpdEntityAddRelationsEventPayload];
|
|
78
|
-
"entity.removeRelations": [RapidPlugin, RpdEntityRemoveRelationsEventPayload];
|
|
79
|
-
"entity.beforeResponse": [RapidPlugin, RpdEntityBeforeResponseEventPayload];
|
|
71
|
+
"entity.beforeCreate": [RapidPlugin, RpdEntityBeforeCreateEventPayload, RouteContext?];
|
|
72
|
+
"entity.create": [RapidPlugin, RpdEntityCreateEventPayload, RouteContext?];
|
|
73
|
+
"entity.beforeUpdate": [RapidPlugin, RpdEntityBeforeUpdateEventPayload, RouteContext?];
|
|
74
|
+
"entity.update": [RapidPlugin, RpdEntityUpdateEventPayload, RouteContext?];
|
|
75
|
+
"entity.beforeDelete": [RapidPlugin, RpdEntityBeforeDeleteEventPayload, RouteContext?];
|
|
76
|
+
"entity.delete": [RapidPlugin, RpdEntityDeleteEventPayload, RouteContext?];
|
|
77
|
+
"entity.addRelations": [RapidPlugin, RpdEntityAddRelationsEventPayload, RouteContext?];
|
|
78
|
+
"entity.removeRelations": [RapidPlugin, RpdEntityRemoveRelationsEventPayload, RouteContext?];
|
|
79
|
+
"entity.beforeResponse": [RapidPlugin, RpdEntityBeforeResponseEventPayload, RouteContext?];
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
export interface RpdEntityBeforeCreateEventPayload {
|
|
83
|
-
routerContext?: RouteContext;
|
|
84
83
|
namespace: string;
|
|
85
84
|
modelSingularCode: string;
|
|
86
85
|
baseModelSingularCode?: string;
|
|
@@ -88,7 +87,6 @@ export interface RpdEntityBeforeCreateEventPayload {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
export interface RpdEntityCreateEventPayload {
|
|
91
|
-
routerContext?: RouteContext;
|
|
92
90
|
namespace: string;
|
|
93
91
|
modelSingularCode: string;
|
|
94
92
|
baseModelSingularCode?: string;
|
|
@@ -96,7 +94,6 @@ export interface RpdEntityCreateEventPayload {
|
|
|
96
94
|
}
|
|
97
95
|
|
|
98
96
|
export interface RpdEntityBeforeUpdateEventPayload {
|
|
99
|
-
routerContext?: RouteContext;
|
|
100
97
|
namespace: string;
|
|
101
98
|
modelSingularCode: string;
|
|
102
99
|
baseModelSingularCode?: string;
|
|
@@ -105,7 +102,6 @@ export interface RpdEntityBeforeUpdateEventPayload {
|
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
export interface RpdEntityUpdateEventPayload {
|
|
108
|
-
routerContext?: RouteContext;
|
|
109
105
|
namespace: string;
|
|
110
106
|
modelSingularCode: string;
|
|
111
107
|
baseModelSingularCode?: string;
|
|
@@ -115,7 +111,6 @@ export interface RpdEntityUpdateEventPayload {
|
|
|
115
111
|
}
|
|
116
112
|
|
|
117
113
|
export interface RpdEntityBeforeDeleteEventPayload {
|
|
118
|
-
routerContext?: RouteContext;
|
|
119
114
|
namespace: string;
|
|
120
115
|
modelSingularCode: string;
|
|
121
116
|
baseModelSingularCode?: string;
|
|
@@ -123,7 +118,6 @@ export interface RpdEntityBeforeDeleteEventPayload {
|
|
|
123
118
|
}
|
|
124
119
|
|
|
125
120
|
export interface RpdEntityDeleteEventPayload {
|
|
126
|
-
routerContext?: RouteContext;
|
|
127
121
|
namespace: string;
|
|
128
122
|
modelSingularCode: string;
|
|
129
123
|
baseModelSingularCode?: string;
|
|
@@ -131,7 +125,6 @@ export interface RpdEntityDeleteEventPayload {
|
|
|
131
125
|
}
|
|
132
126
|
|
|
133
127
|
export interface RpdEntityAddRelationsEventPayload {
|
|
134
|
-
routerContext?: RouteContext;
|
|
135
128
|
namespace: string;
|
|
136
129
|
modelSingularCode: string;
|
|
137
130
|
baseModelSingularCode?: string;
|
|
@@ -141,7 +134,6 @@ export interface RpdEntityAddRelationsEventPayload {
|
|
|
141
134
|
}
|
|
142
135
|
|
|
143
136
|
export interface RpdEntityRemoveRelationsEventPayload {
|
|
144
|
-
routerContext?: RouteContext;
|
|
145
137
|
namespace: string;
|
|
146
138
|
modelSingularCode: string;
|
|
147
139
|
baseModelSingularCode?: string;
|
|
@@ -151,13 +143,19 @@ export interface RpdEntityRemoveRelationsEventPayload {
|
|
|
151
143
|
}
|
|
152
144
|
|
|
153
145
|
export interface RpdEntityBeforeResponseEventPayload {
|
|
154
|
-
routerContext?: RouteContext;
|
|
155
146
|
namespace: string;
|
|
156
147
|
modelSingularCode: string;
|
|
157
148
|
baseModelSingularCode?: string;
|
|
158
149
|
entities: any[];
|
|
159
150
|
}
|
|
160
151
|
|
|
152
|
+
export type EmitServerEventOptions<TEventName extends keyof RpdServerEventTypes> = {
|
|
153
|
+
eventName: TEventName;
|
|
154
|
+
payload: RpdServerEventTypes[TEventName][1];
|
|
155
|
+
sender?: RapidPlugin;
|
|
156
|
+
routeContext?: RouteContext;
|
|
157
|
+
}
|
|
158
|
+
|
|
161
159
|
export interface QuoteTableOptions {
|
|
162
160
|
schema?: string;
|
|
163
161
|
tableName: string;
|
|
@@ -399,7 +397,7 @@ export type EntityFilterOptions = FindEntityRelationalFilterOptions | FindEntity
|
|
|
399
397
|
export type EntityNonRelationPropertyFilterOptions = FindEntityRelationalFilterOptions | FindEntitySetFilterOptions | FindEntityUnaryFilterOptions;
|
|
400
398
|
|
|
401
399
|
export interface FindEntityOptions {
|
|
402
|
-
|
|
400
|
+
routeContext?: RouteContext;
|
|
403
401
|
filters?: EntityFilterOptions[];
|
|
404
402
|
orderBy?: FindEntityOrderByOptions[];
|
|
405
403
|
pagination?: FindEntityPaginationOptions;
|
|
@@ -407,6 +405,13 @@ export interface FindEntityOptions {
|
|
|
407
405
|
keepNonPropertyFields?: boolean;
|
|
408
406
|
}
|
|
409
407
|
|
|
408
|
+
export interface FindEntityByIdOptions {
|
|
409
|
+
routeContext?: RouteContext;
|
|
410
|
+
id: any;
|
|
411
|
+
properties?: string[];
|
|
412
|
+
keepNonPropertyFields?: boolean;
|
|
413
|
+
}
|
|
414
|
+
|
|
410
415
|
export interface FindEntityRelationalFilterOptions {
|
|
411
416
|
field: string;
|
|
412
417
|
operator: EntityFilterRelationalOperators;
|
|
@@ -448,6 +453,7 @@ export interface FindEntityOrderByOptions {
|
|
|
448
453
|
}
|
|
449
454
|
|
|
450
455
|
export interface CountEntityOptions {
|
|
456
|
+
routeContext?: RouteContext;
|
|
451
457
|
filters?: EntityFilterOptions[];
|
|
452
458
|
}
|
|
453
459
|
|
|
@@ -455,19 +461,24 @@ export interface CountEntityResult {
|
|
|
455
461
|
count: number;
|
|
456
462
|
}
|
|
457
463
|
|
|
464
|
+
export interface DeleteEntityByIdOptions {
|
|
465
|
+
routeContext?: RouteContext;
|
|
466
|
+
id: any;
|
|
467
|
+
}
|
|
468
|
+
|
|
458
469
|
export interface CreateEntityOptions {
|
|
459
|
-
|
|
470
|
+
routeContext?: RouteContext;
|
|
460
471
|
entity: any;
|
|
461
472
|
}
|
|
462
473
|
|
|
463
474
|
export interface UpdateEntityOptions {
|
|
464
|
-
|
|
475
|
+
routeContext?: RouteContext;
|
|
465
476
|
filters?: EntityFilterOptions[];
|
|
466
477
|
entity: any;
|
|
467
478
|
}
|
|
468
479
|
|
|
469
480
|
export interface UpdateEntityByIdOptions {
|
|
470
|
-
|
|
481
|
+
routeContext?: RouteContext;
|
|
471
482
|
id: any;
|
|
472
483
|
entityToSave: any;
|
|
473
484
|
operation?: any;
|
|
@@ -475,19 +486,19 @@ export interface UpdateEntityByIdOptions {
|
|
|
475
486
|
}
|
|
476
487
|
|
|
477
488
|
export interface DeleteEntityOptions {
|
|
478
|
-
|
|
489
|
+
routeContext?: RouteContext;
|
|
479
490
|
filters?: EntityFilterOptions[];
|
|
480
491
|
}
|
|
481
492
|
|
|
482
493
|
export interface AddEntityRelationsOptions {
|
|
483
|
-
|
|
494
|
+
routeContext?: RouteContext;
|
|
484
495
|
id: number;
|
|
485
496
|
property: string;
|
|
486
497
|
relations: { id?: number; [k: string]: any }[];
|
|
487
498
|
}
|
|
488
499
|
|
|
489
500
|
export interface RemoveEntityRelationsOptions {
|
|
490
|
-
|
|
501
|
+
routeContext?: RouteContext;
|
|
491
502
|
id: number;
|
|
492
503
|
property: string;
|
|
493
504
|
relations: { id?: number; [k: string]: any }[];
|
|
@@ -507,6 +518,7 @@ export type EntityWatchHandler<TEventName extends keyof RpdServerEventTypes> = (
|
|
|
507
518
|
export type EntityWatchHandlerContext<TEventName extends keyof RpdServerEventTypes> = {
|
|
508
519
|
server: IRpdServer;
|
|
509
520
|
payload: RpdServerEventTypes[TEventName][1];
|
|
521
|
+
routerContext?: RouteContext;
|
|
510
522
|
};
|
|
511
523
|
|
|
512
524
|
export interface EntityWatchPluginInitOptions {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { RpdDataModelProperty } from "../types";
|
|
2
|
-
|
|
3
|
-
export function isRelationProperty(property: RpdDataModelProperty) {
|
|
4
|
-
return property.type === "relation" || property.type === "relation[]";
|
|
5
|
-
}
|
|
1
|
+
import { RpdDataModelProperty } from "../types";
|
|
2
|
+
|
|
3
|
+
export function isRelationProperty(property: RpdDataModelProperty) {
|
|
4
|
+
return property.type === "relation" || property.type === "relation[]";
|
|
5
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export function isUndefined(val: any) {
|
|
2
|
-
return typeof val === "undefined";
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export function isNull(val: any) {
|
|
6
|
-
return val === null;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function isNullOrUndefined(val: any) {
|
|
10
|
-
return isNull(val) || isUndefined(val);
|
|
11
|
-
}
|
|
1
|
+
export function isUndefined(val: any) {
|
|
2
|
+
return typeof val === "undefined";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function isNull(val: any) {
|
|
6
|
+
return val === null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function isNullOrUndefined(val: any) {
|
|
10
|
+
return isNull(val) || isUndefined(val);
|
|
11
|
+
}
|