@ruiapp/rapid-core 0.1.55 → 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/dataAccess/entityManager.d.ts +2 -2
- package/dist/index.js +4 -4
- package/package.json +1 -1
- package/src/core/http-types.ts +4 -4
- package/src/dataAccess/entityManager.ts +9 -9
- 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/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/utilities/rapidUtility.ts +5 -5
- package/src/utilities/typeUtility.ts +11 -11
|
@@ -6,11 +6,11 @@ export default class EntityManager<TEntity = any> {
|
|
|
6
6
|
getModel(): RpdDataModel;
|
|
7
7
|
findEntities(options: FindEntityOptions): Promise<TEntity[]>;
|
|
8
8
|
findEntity(options: FindEntityOptions): Promise<TEntity | null>;
|
|
9
|
-
findById(options: FindEntityByIdOptions): Promise<TEntity | null>;
|
|
9
|
+
findById(options: FindEntityByIdOptions | string | number): Promise<TEntity | null>;
|
|
10
10
|
createEntity(options: CreateEntityOptions, plugin?: RapidPlugin): Promise<TEntity>;
|
|
11
11
|
updateEntityById(options: UpdateEntityByIdOptions, plugin?: RapidPlugin): Promise<TEntity>;
|
|
12
12
|
count(options: CountEntityOptions): Promise<CountEntityResult>;
|
|
13
|
-
deleteById(options: DeleteEntityByIdOptions, plugin?: RapidPlugin): Promise<void>;
|
|
13
|
+
deleteById(options: DeleteEntityByIdOptions | string | number, plugin?: RapidPlugin): Promise<void>;
|
|
14
14
|
addRelations(options: AddEntityRelationsOptions, plugin?: RapidPlugin): Promise<void>;
|
|
15
15
|
removeRelations(options: RemoveEntityRelationsOptions, plugin?: RapidPlugin): Promise<void>;
|
|
16
16
|
}
|
package/dist/index.js
CHANGED
|
@@ -1999,10 +1999,10 @@ async function findEntities(server, dataAccessor, options) {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
let propertiesToSlect;
|
|
2001
2001
|
if (!options.properties || !options.properties.length) {
|
|
2002
|
-
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter(property => !isRelationProperty(property));
|
|
2002
|
+
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter((property) => !isRelationProperty(property));
|
|
2003
2003
|
}
|
|
2004
2004
|
else {
|
|
2005
|
-
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter(property => options.properties.includes(property.code));
|
|
2005
|
+
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter((property) => options.properties.includes(property.code));
|
|
2006
2006
|
}
|
|
2007
2007
|
const columnsToSelect = [];
|
|
2008
2008
|
const relationPropertiesToSelect = [];
|
|
@@ -2044,7 +2044,7 @@ async function findEntities(server, dataAccessor, options) {
|
|
|
2044
2044
|
});
|
|
2045
2045
|
// if `keepNonPropertyFields` is true and `properties` are not specified, then select relation columns automatically.
|
|
2046
2046
|
if (options.keepNonPropertyFields && (!options.properties || !options.properties.length)) {
|
|
2047
|
-
const oneRelationPropertiesWithNoLinkTable = getEntityPropertiesIncludingBase(server, model).filter(property => property.relation === "one" && !property.linkTableName);
|
|
2047
|
+
const oneRelationPropertiesWithNoLinkTable = getEntityPropertiesIncludingBase(server, model).filter((property) => property.relation === "one" && !property.linkTableName);
|
|
2048
2048
|
oneRelationPropertiesWithNoLinkTable.forEach((property) => {
|
|
2049
2049
|
if (property.targetIdColumnName) {
|
|
2050
2050
|
columnsToSelect.push({
|
|
@@ -2338,7 +2338,7 @@ async function convertEntityFiltersToRowFilters(server, model, baseModel, filter
|
|
|
2338
2338
|
operator: filter.operator,
|
|
2339
2339
|
field: {
|
|
2340
2340
|
name: columnName,
|
|
2341
|
-
tableName:
|
|
2341
|
+
tableName: property && property.isBaseProperty ? baseModel.tableName : model.tableName,
|
|
2342
2342
|
},
|
|
2343
2343
|
value: filter.value,
|
|
2344
2344
|
itemType: filter.itemType,
|
package/package.json
CHANGED
package/src/core/http-types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type HttpStatus = number;
|
|
2
|
-
export type ResponseData = string | ArrayBuffer | ReadableStream;
|
|
3
|
-
|
|
4
|
-
export type HeadersDefinition = [string, string][] | Record<string, string>;
|
|
1
|
+
export type HttpStatus = number;
|
|
2
|
+
export type ResponseData = string | ArrayBuffer | ReadableStream;
|
|
3
|
+
|
|
4
|
+
export type HeadersDefinition = [string, string][] | Record<string, string>;
|
|
@@ -68,9 +68,9 @@ async function findEntities(server: IRpdServer, dataAccessor: IRpdDataAccessor,
|
|
|
68
68
|
|
|
69
69
|
let propertiesToSlect: RpdDataModelProperty[];
|
|
70
70
|
if (!options.properties || !options.properties.length) {
|
|
71
|
-
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter(property => !isRelationProperty(property));
|
|
71
|
+
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter((property) => !isRelationProperty(property));
|
|
72
72
|
} else {
|
|
73
|
-
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter(property => options.properties.includes(property.code));
|
|
73
|
+
propertiesToSlect = getEntityPropertiesIncludingBase(server, model).filter((property) => options.properties.includes(property.code));
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const columnsToSelect: ColumnQueryOptions[] = [];
|
|
@@ -114,7 +114,7 @@ async function findEntities(server: IRpdServer, dataAccessor: IRpdDataAccessor,
|
|
|
114
114
|
|
|
115
115
|
// if `keepNonPropertyFields` is true and `properties` are not specified, then select relation columns automatically.
|
|
116
116
|
if (options.keepNonPropertyFields && (!options.properties || !options.properties.length)) {
|
|
117
|
-
const oneRelationPropertiesWithNoLinkTable = getEntityPropertiesIncludingBase(server, model).filter(property => property.relation === "one" && !property.linkTableName);
|
|
117
|
+
const oneRelationPropertiesWithNoLinkTable = getEntityPropertiesIncludingBase(server, model).filter((property) => property.relation === "one" && !property.linkTableName);
|
|
118
118
|
oneRelationPropertiesWithNoLinkTable.forEach((property) => {
|
|
119
119
|
if (property.targetIdColumnName) {
|
|
120
120
|
columnsToSelect.push({
|
|
@@ -429,7 +429,7 @@ async function convertEntityFiltersToRowFilters(server: IRpdServer, model: RpdDa
|
|
|
429
429
|
operator: filter.operator,
|
|
430
430
|
field: {
|
|
431
431
|
name: columnName,
|
|
432
|
-
tableName:
|
|
432
|
+
tableName: property && property.isBaseProperty ? baseModel.tableName : model.tableName,
|
|
433
433
|
},
|
|
434
434
|
value: (filter as any).value,
|
|
435
435
|
itemType: (filter as any).itemType,
|
|
@@ -789,7 +789,7 @@ async function updateEntityById(server: IRpdServer, dataAccessor: IRpdDataAccess
|
|
|
789
789
|
updatedEntityOneRelationProps[property.code] = targetEntity;
|
|
790
790
|
targetRow[property.targetIdColumnName!] = targetEntityId;
|
|
791
791
|
}
|
|
792
|
-
}
|
|
792
|
+
}
|
|
793
793
|
|
|
794
794
|
let updatedRow = row;
|
|
795
795
|
if (Object.keys(row).length) {
|
|
@@ -803,7 +803,7 @@ async function updateEntityById(server: IRpdServer, dataAccessor: IRpdDataAccess
|
|
|
803
803
|
updatedBaseRow = await baseDataAccessor.updateById(id, updatedBaseRow);
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
let updatedEntity = mapDbRowToEntity(server, model, {...updatedRow, ...updatedBaseRow, ...updatedEntityOneRelationProps}, true);
|
|
806
|
+
let updatedEntity = mapDbRowToEntity(server, model, { ...updatedRow, ...updatedBaseRow, ...updatedEntityOneRelationProps }, true);
|
|
807
807
|
updatedEntity = Object.assign({}, entity, updatedEntity);
|
|
808
808
|
|
|
809
809
|
// save many-relation properties
|
|
@@ -923,7 +923,7 @@ export default class EntityManager<TEntity = any> {
|
|
|
923
923
|
return await findEntity(this.#server, this.#dataAccessor, options);
|
|
924
924
|
}
|
|
925
925
|
|
|
926
|
-
async findById(options: FindEntityByIdOptions): Promise<TEntity | null> {
|
|
926
|
+
async findById(options: FindEntityByIdOptions | string | number): Promise<TEntity | null> {
|
|
927
927
|
// options is id
|
|
928
928
|
if (!isObject(options)) {
|
|
929
929
|
options = {
|
|
@@ -951,11 +951,11 @@ export default class EntityManager<TEntity = any> {
|
|
|
951
951
|
}
|
|
952
952
|
const countRowOptions: CountRowOptions = {
|
|
953
953
|
filters: await convertEntityFiltersToRowFilters(this.#server, model, baseModel, options.filters),
|
|
954
|
-
}
|
|
954
|
+
};
|
|
955
955
|
return await this.#dataAccessor.count(countRowOptions);
|
|
956
956
|
}
|
|
957
957
|
|
|
958
|
-
async deleteById(options: DeleteEntityByIdOptions, plugin?: RapidPlugin): Promise<void> {
|
|
958
|
+
async deleteById(options: DeleteEntityByIdOptions | string | number, plugin?: RapidPlugin): Promise<void> {
|
|
959
959
|
// options is id
|
|
960
960
|
if (!isObject(options)) {
|
|
961
961
|
options = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
import { AssertionError } from "./assertion_error";
|
|
3
|
-
|
|
4
|
-
/** Make an assertion, error will be thrown if `expr` does not have truthy value. */
|
|
5
|
-
export function assert(expr: unknown, msg = ""): asserts expr {
|
|
6
|
-
if (!expr) {
|
|
7
|
-
throw new AssertionError(msg);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
import { AssertionError } from "./assertion_error";
|
|
3
|
+
|
|
4
|
+
/** Make an assertion, error will be thrown if `expr` does not have truthy value. */
|
|
5
|
+
export function assert(expr: unknown, msg = ""): asserts expr {
|
|
6
|
+
if (!expr) {
|
|
7
|
+
throw new AssertionError(msg);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
-
export class AssertionError extends Error {
|
|
3
|
-
override name = "AssertionError";
|
|
4
|
-
constructor(message: string) {
|
|
5
|
-
super(message);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
1
|
+
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
|
2
|
+
export class AssertionError extends Error {
|
|
3
|
+
override name = "AssertionError";
|
|
4
|
+
constructor(message: string) {
|
|
5
|
+
super(message);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isArray, mergeWith } from "lodash";
|
|
2
|
-
|
|
3
|
-
export function mergeInput(defaultInput: any, input: any, fixedInput: any) {
|
|
4
|
-
return mergeWith({}, defaultInput, input, fixedInput, doNotMergeArray);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function doNotMergeArray(objValue: any, srcValue: any) {
|
|
8
|
-
if (isArray(srcValue)) {
|
|
9
|
-
return srcValue;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
import { isArray, mergeWith } from "lodash";
|
|
2
|
+
|
|
3
|
+
export function mergeInput(defaultInput: any, input: any, fixedInput: any) {
|
|
4
|
+
return mergeWith({}, defaultInput, input, fixedInput, doNotMergeArray);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function doNotMergeArray(objValue: any, srcValue: any) {
|
|
8
|
+
if (isArray(srcValue)) {
|
|
9
|
+
return srcValue;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ActionHandlerContext } from "~/core/actionHandler";
|
|
2
|
-
import { RapidPlugin } from "~/core/server";
|
|
3
|
-
|
|
4
|
-
export const code = "runServerOperation";
|
|
5
|
-
|
|
6
|
-
export async function handler(
|
|
7
|
-
plugin: RapidPlugin,
|
|
8
|
-
ctx: ActionHandlerContext,
|
|
9
|
-
options: {
|
|
10
|
-
operation: (ctx: ActionHandlerContext) => Promise<void>;
|
|
11
|
-
},
|
|
12
|
-
) {
|
|
13
|
-
const { operation } = options;
|
|
14
|
-
await operation(ctx);
|
|
15
|
-
}
|
|
1
|
+
import { ActionHandlerContext } from "~/core/actionHandler";
|
|
2
|
+
import { RapidPlugin } from "~/core/server";
|
|
3
|
+
|
|
4
|
+
export const code = "runServerOperation";
|
|
5
|
+
|
|
6
|
+
export async function handler(
|
|
7
|
+
plugin: RapidPlugin,
|
|
8
|
+
ctx: ActionHandlerContext,
|
|
9
|
+
options: {
|
|
10
|
+
operation: (ctx: ActionHandlerContext) => Promise<void>;
|
|
11
|
+
},
|
|
12
|
+
) {
|
|
13
|
+
const { operation } = options;
|
|
14
|
+
await operation(ctx);
|
|
15
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { DefaultStateMachineSnapshot, GetStateMachineNextSnapshotOptions, TryGetStateMachineNextSnapshotResult } from "./StateMachinePluginTypes";
|
|
2
|
-
import { createMachine, getInitialSnapshot, getNextSnapshot } from "xstate";
|
|
3
|
-
|
|
4
|
-
export async function getStateMachineNextSnapshot(options: GetStateMachineNextSnapshotOptions) {
|
|
5
|
-
const { machineConfig, currentState, event } = options;
|
|
6
|
-
machineConfig.initial = currentState;
|
|
7
|
-
|
|
8
|
-
const machine = createMachine(machineConfig);
|
|
9
|
-
const snapshot = getInitialSnapshot(machine);
|
|
10
|
-
|
|
11
|
-
if (!snapshot.can(event)) {
|
|
12
|
-
throw new Error(`'${event.type}' action is not allowed at '${currentState}' state.`);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const nextSnapshot = getNextSnapshot(machine, snapshot, event);
|
|
16
|
-
return nextSnapshot;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function tryGetStateMachineNextSnapshot(options: GetStateMachineNextSnapshotOptions): Promise<TryGetStateMachineNextSnapshotResult> {
|
|
20
|
-
const { machineConfig, currentState, event } = options;
|
|
21
|
-
machineConfig.initial = currentState;
|
|
22
|
-
|
|
23
|
-
const machine = createMachine(machineConfig);
|
|
24
|
-
const snapshot = getInitialSnapshot(machine);
|
|
25
|
-
|
|
26
|
-
const canTransfer = snapshot.can(event);
|
|
27
|
-
let nextSnapshot: DefaultStateMachineSnapshot;
|
|
28
|
-
if (canTransfer) {
|
|
29
|
-
nextSnapshot = getNextSnapshot(machine, snapshot, event);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
canTransfer,
|
|
34
|
-
nextSnapshot,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
1
|
+
import { DefaultStateMachineSnapshot, GetStateMachineNextSnapshotOptions, TryGetStateMachineNextSnapshotResult } from "./StateMachinePluginTypes";
|
|
2
|
+
import { createMachine, getInitialSnapshot, getNextSnapshot } from "xstate";
|
|
3
|
+
|
|
4
|
+
export async function getStateMachineNextSnapshot(options: GetStateMachineNextSnapshotOptions) {
|
|
5
|
+
const { machineConfig, currentState, event } = options;
|
|
6
|
+
machineConfig.initial = currentState;
|
|
7
|
+
|
|
8
|
+
const machine = createMachine(machineConfig);
|
|
9
|
+
const snapshot = getInitialSnapshot(machine);
|
|
10
|
+
|
|
11
|
+
if (!snapshot.can(event)) {
|
|
12
|
+
throw new Error(`'${event.type}' action is not allowed at '${currentState}' state.`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const nextSnapshot = getNextSnapshot(machine, snapshot, event);
|
|
16
|
+
return nextSnapshot;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function tryGetStateMachineNextSnapshot(options: GetStateMachineNextSnapshotOptions): Promise<TryGetStateMachineNextSnapshotResult> {
|
|
20
|
+
const { machineConfig, currentState, event } = options;
|
|
21
|
+
machineConfig.initial = currentState;
|
|
22
|
+
|
|
23
|
+
const machine = createMachine(machineConfig);
|
|
24
|
+
const snapshot = getInitialSnapshot(machine);
|
|
25
|
+
|
|
26
|
+
const canTransfer = snapshot.can(event);
|
|
27
|
+
let nextSnapshot: DefaultStateMachineSnapshot;
|
|
28
|
+
if (canTransfer) {
|
|
29
|
+
nextSnapshot = getNextSnapshot(machine, snapshot, event);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
canTransfer,
|
|
34
|
+
nextSnapshot,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { RpdApplicationConfig } from "~/types";
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
models: [
|
|
5
|
-
{
|
|
6
|
-
name: "webhook",
|
|
7
|
-
namespace: "sys",
|
|
8
|
-
singularCode: "webhook",
|
|
9
|
-
pluralCode: "webhooks",
|
|
10
|
-
schema: "public",
|
|
11
|
-
tableName: "sys_webhooks",
|
|
12
|
-
properties: [
|
|
13
|
-
{
|
|
14
|
-
name: "id",
|
|
15
|
-
code: "id",
|
|
16
|
-
columnName: "id",
|
|
17
|
-
type: "integer",
|
|
18
|
-
required: true,
|
|
19
|
-
autoIncrement: true,
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
name: "name",
|
|
23
|
-
code: "name",
|
|
24
|
-
columnName: "name",
|
|
25
|
-
type: "text",
|
|
26
|
-
required: true,
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
name: "url",
|
|
30
|
-
code: "url",
|
|
31
|
-
columnName: "url",
|
|
32
|
-
type: "text",
|
|
33
|
-
required: true,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: "secret",
|
|
37
|
-
code: "secret",
|
|
38
|
-
columnName: "secret",
|
|
39
|
-
type: "text",
|
|
40
|
-
required: false,
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
name: "namespace",
|
|
44
|
-
code: "namespace",
|
|
45
|
-
columnName: "namespace",
|
|
46
|
-
type: "text",
|
|
47
|
-
required: true,
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: "model singular code",
|
|
51
|
-
code: "modelSingularCode",
|
|
52
|
-
columnName: "model_singular_code",
|
|
53
|
-
type: "text",
|
|
54
|
-
required: true,
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
name: "events",
|
|
58
|
-
code: "events",
|
|
59
|
-
columnName: "events",
|
|
60
|
-
type: "json",
|
|
61
|
-
required: false,
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "enabled",
|
|
65
|
-
code: "enabled",
|
|
66
|
-
columnName: "enabled",
|
|
67
|
-
type: "boolean",
|
|
68
|
-
required: true,
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
routes: [],
|
|
74
|
-
} satisfies RpdApplicationConfig;
|
|
1
|
+
import { RpdApplicationConfig } from "~/types";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
models: [
|
|
5
|
+
{
|
|
6
|
+
name: "webhook",
|
|
7
|
+
namespace: "sys",
|
|
8
|
+
singularCode: "webhook",
|
|
9
|
+
pluralCode: "webhooks",
|
|
10
|
+
schema: "public",
|
|
11
|
+
tableName: "sys_webhooks",
|
|
12
|
+
properties: [
|
|
13
|
+
{
|
|
14
|
+
name: "id",
|
|
15
|
+
code: "id",
|
|
16
|
+
columnName: "id",
|
|
17
|
+
type: "integer",
|
|
18
|
+
required: true,
|
|
19
|
+
autoIncrement: true,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "name",
|
|
23
|
+
code: "name",
|
|
24
|
+
columnName: "name",
|
|
25
|
+
type: "text",
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "url",
|
|
30
|
+
code: "url",
|
|
31
|
+
columnName: "url",
|
|
32
|
+
type: "text",
|
|
33
|
+
required: true,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "secret",
|
|
37
|
+
code: "secret",
|
|
38
|
+
columnName: "secret",
|
|
39
|
+
type: "text",
|
|
40
|
+
required: false,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "namespace",
|
|
44
|
+
code: "namespace",
|
|
45
|
+
columnName: "namespace",
|
|
46
|
+
type: "text",
|
|
47
|
+
required: true,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "model singular code",
|
|
51
|
+
code: "modelSingularCode",
|
|
52
|
+
columnName: "model_singular_code",
|
|
53
|
+
type: "text",
|
|
54
|
+
required: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "events",
|
|
58
|
+
code: "events",
|
|
59
|
+
columnName: "events",
|
|
60
|
+
type: "json",
|
|
61
|
+
required: false,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "enabled",
|
|
65
|
+
code: "enabled",
|
|
66
|
+
columnName: "enabled",
|
|
67
|
+
type: "boolean",
|
|
68
|
+
required: true,
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
routes: [],
|
|
74
|
+
} satisfies RpdApplicationConfig;
|
package/src/proxy/types.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { RapidRequest } from "~/core/request";
|
|
2
|
-
import { RunProxyHandlerOptions } from "../types";
|
|
3
|
-
import { RapidResponse } from "~/core/response";
|
|
4
|
-
|
|
5
|
-
export interface ProxyContext {
|
|
6
|
-
sourceContext: ProxySourceContext;
|
|
7
|
-
targetContext: ProxyTargetContext;
|
|
8
|
-
options: ProxyOptions;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ProxySourceContext {
|
|
12
|
-
request: RapidRequest;
|
|
13
|
-
response: RapidResponse;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ProxyTargetContext {
|
|
17
|
-
request?: RapidRequest;
|
|
18
|
-
response?: RapidResponse;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export type ProxyOptions = RunProxyHandlerOptions;
|
|
1
|
+
import { RapidRequest } from "~/core/request";
|
|
2
|
+
import { RunProxyHandlerOptions } from "../types";
|
|
3
|
+
import { RapidResponse } from "~/core/response";
|
|
4
|
+
|
|
5
|
+
export interface ProxyContext {
|
|
6
|
+
sourceContext: ProxySourceContext;
|
|
7
|
+
targetContext: ProxyTargetContext;
|
|
8
|
+
options: ProxyOptions;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface ProxySourceContext {
|
|
12
|
+
request: RapidRequest;
|
|
13
|
+
response: RapidResponse;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface ProxyTargetContext {
|
|
17
|
+
request?: RapidRequest;
|
|
18
|
+
response?: RapidResponse;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ProxyOptions = RunProxyHandlerOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from "./queryBuilder";
|
|
1
|
+
export * from "./queryBuilder";
|
|
@@ -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
|
+
}
|