@ruiapp/rapid-core 0.9.11 → 0.9.13

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.js CHANGED
@@ -2879,6 +2879,7 @@ async function findManyRelationLinksViaLinkTable(options) {
2879
2879
  singularCode: relationModel.singularCode,
2880
2880
  });
2881
2881
  const findEntityOptions = {
2882
+ routeContext,
2882
2883
  filters: [
2883
2884
  {
2884
2885
  field: "id",
@@ -2917,11 +2918,12 @@ async function findManyRelationLinksViaLinkTable(options) {
2917
2918
  return { relationLinks, targetEntities };
2918
2919
  }
2919
2920
  async function findManyRelatedEntitiesViaIdPropertyCode(options) {
2920
- const { server, relationProperty, mainEntityIds, selectRelationOptions } = options;
2921
+ const { server, routeContext, relationProperty, mainEntityIds, selectRelationOptions } = options;
2921
2922
  const dataAccessor = server.getDataAccessor({
2922
2923
  singularCode: relationProperty.targetSingularCode,
2923
2924
  });
2924
2925
  const findEntityOptions = {
2926
+ routeContext,
2925
2927
  filters: [
2926
2928
  {
2927
2929
  field: relationProperty.selfIdColumnName,
@@ -2962,11 +2964,12 @@ async function findManyRelatedEntitiesViaIdPropertyCode(options) {
2962
2964
  return await findEntities(server, dataAccessor, findEntityOptions);
2963
2965
  }
2964
2966
  async function findOneRelatedEntitiesViaIdPropertyCode(options) {
2965
- const { server, relationProperty, relationEntityIds, selectRelationOptions } = options;
2967
+ const { server, routeContext, relationProperty, relationEntityIds, selectRelationOptions } = options;
2966
2968
  const dataAccessor = server.getDataAccessor({
2967
2969
  singularCode: relationProperty.targetSingularCode,
2968
2970
  });
2969
2971
  const findEntityOptions = {
2972
+ routeContext,
2970
2973
  filters: [
2971
2974
  {
2972
2975
  field: "id",
@@ -8198,13 +8201,14 @@ class ServerOperationPlugin {
8198
8201
  async configureRoutes(server, applicationConfig) {
8199
8202
  const routes = [];
8200
8203
  for (const operation of this.#operations) {
8204
+ const path = operation.path || `/app/${operation.code}`;
8201
8205
  routes.push({
8202
8206
  namespace: "app",
8203
8207
  name: `app.operations.${operation.code}`,
8204
8208
  code: `app.operations.${operation.code}`,
8205
8209
  type: "RESTful",
8206
8210
  method: operation.method,
8207
- endpoint: `/app/${operation.code}`,
8211
+ endpoint: path,
8208
8212
  actions: [
8209
8213
  {
8210
8214
  code: "runServerOperation",
@@ -5,6 +5,10 @@ export interface ServerOperation {
5
5
  code: string;
6
6
  description?: string;
7
7
  method: RpdHttpMethod;
8
+ /**
9
+ * 接口路径,默认值为 `/app/{code}`
10
+ */
11
+ path?: string;
8
12
  permissionCheck?: PermissionCheckPolicy;
9
13
  handler: (ctx: ActionHandlerContext) => Promise<void>;
10
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ruiapp/rapid-core",
3
- "version": "0.9.11",
3
+ "version": "0.9.13",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -649,6 +649,7 @@ async function findManyRelationLinksViaLinkTable(options: FindManyRelationEntiti
649
649
  });
650
650
 
651
651
  const findEntityOptions: FindEntityOptions = {
652
+ routeContext,
652
653
  filters: [
653
654
  {
654
655
  field: "id",
@@ -692,12 +693,13 @@ async function findManyRelationLinksViaLinkTable(options: FindManyRelationEntiti
692
693
  }
693
694
 
694
695
  async function findManyRelatedEntitiesViaIdPropertyCode(options: FindManyRelationEntitiesOptions) {
695
- const { server, relationProperty, mainEntityIds, selectRelationOptions } = options;
696
+ const { server, routeContext, relationProperty, mainEntityIds, selectRelationOptions } = options;
696
697
  const dataAccessor = server.getDataAccessor({
697
698
  singularCode: relationProperty.targetSingularCode as string,
698
699
  });
699
700
 
700
701
  const findEntityOptions: FindEntityOptions = {
702
+ routeContext,
701
703
  filters: [
702
704
  {
703
705
  field: relationProperty.selfIdColumnName,
@@ -741,13 +743,14 @@ async function findManyRelatedEntitiesViaIdPropertyCode(options: FindManyRelatio
741
743
  }
742
744
 
743
745
  async function findOneRelatedEntitiesViaIdPropertyCode(options: FindOneRelationEntitiesOptions) {
744
- const { server, relationProperty, relationEntityIds, selectRelationOptions } = options;
746
+ const { server, routeContext, relationProperty, relationEntityIds, selectRelationOptions } = options;
745
747
 
746
748
  const dataAccessor = server.getDataAccessor({
747
749
  singularCode: relationProperty.targetSingularCode as string,
748
750
  });
749
751
 
750
752
  const findEntityOptions: FindEntityOptions = {
753
+ routeContext,
751
754
  filters: [
752
755
  {
753
756
  field: "id",
@@ -62,13 +62,14 @@ class ServerOperationPlugin implements RapidPlugin {
62
62
  async configureRoutes(server: IRpdServer, applicationConfig: RpdApplicationConfig): Promise<any> {
63
63
  const routes: RpdRoute[] = [];
64
64
  for (const operation of this.#operations) {
65
+ const path = operation.path || `/app/${operation.code}`;
65
66
  routes.push({
66
67
  namespace: "app",
67
68
  name: `app.operations.${operation.code}`,
68
69
  code: `app.operations.${operation.code}`,
69
70
  type: "RESTful",
70
71
  method: operation.method,
71
- endpoint: `/app/${operation.code}`,
72
+ endpoint: path,
72
73
  actions: [
73
74
  {
74
75
  code: "runServerOperation",
@@ -6,6 +6,11 @@ export interface ServerOperation {
6
6
  code: string;
7
7
  description?: string;
8
8
  method: RpdHttpMethod;
9
+
10
+ /**
11
+ * 接口路径,默认值为 `/app/{code}`
12
+ */
13
+ path?: string;
9
14
  permissionCheck?: PermissionCheckPolicy;
10
15
  handler: (ctx: ActionHandlerContext) => Promise<void>;
11
16
  }