diff --git a/packages/nc-gui/app.vue b/packages/nc-gui/app.vue
index 78d86f7c3e..bf4941ab0c 100644
--- a/packages/nc-gui/app.vue
+++ b/packages/nc-gui/app.vue
@@ -1,4 +1,6 @@
-
+
+
+
+
+
+ {{ handleError(error, clearError) }}
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ handleError(error, clearError) }}
+
+
diff --git a/packages/nocodb-sdk/src/lib/formulaHelpers.ts b/packages/nocodb-sdk/src/lib/formulaHelpers.ts
index d4158a8508..0ba7e1dc54 100644
--- a/packages/nocodb-sdk/src/lib/formulaHelpers.ts
+++ b/packages/nocodb-sdk/src/lib/formulaHelpers.ts
@@ -323,6 +323,7 @@ export const formulas: Record = {
validation: {
args: {
rqd: 3,
+ type: FormulaDataTypes.DATE,
},
custom: (_argTypes: FormulaDataTypes[], parsedTree: any) => {
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) {
@@ -378,7 +379,6 @@ export const formulas: Record = {
validation: {
args: {
rqd: 1,
- type: FormulaDataTypes.DATE,
},
},
syntax: 'DATESTR(date | datetime)',
@@ -390,7 +390,6 @@ export const formulas: Record = {
validation: {
args: {
rqd: 1,
- type: FormulaDataTypes.DATE,
},
},
syntax: 'DAY(date | datetime)',
@@ -402,7 +401,6 @@ export const formulas: Record = {
validation: {
args: {
rqd: 1,
- type: FormulaDataTypes.DATE,
},
},
syntax: 'MONTH(date | datetime)',
@@ -414,7 +412,6 @@ export const formulas: Record = {
validation: {
args: {
rqd: 1,
- type: FormulaDataTypes.DATE,
},
},
syntax: 'DAY(time | datetime)',
@@ -430,6 +427,7 @@ export const formulas: Record = {
args: {
min: 2,
max: 3,
+ type: FormulaDataTypes.DATE,
},
custom: (_argTypes: FormulaDataTypes[], parsedTree: any) => {
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) {
@@ -820,6 +818,7 @@ export const formulas: Record = {
validation: {
args: {
rqd: 0,
+ type: FormulaDataTypes.DATE,
},
},
description: 'Retrieve the current time and day.',
@@ -887,29 +886,8 @@ export const formulas: Record = {
validation: {
args: {
rqd: 2,
+ type: FormulaDataTypes.STRING,
},
- custom(argTypes: FormulaDataTypes[], parsedTree) {
- if (argTypes[0] !== FormulaDataTypes.STRING) {
- throw new FormulaError(
- FormulaErrorType.INVALID_ARG,
- {
- key: 'msg.formula.stringTypeIsExpected',
- calleeName: parsedTree.callee?.name?.toUpperCase(),
- },
- 'String type is expected'
- );
- }
- if (argTypes[1] !== FormulaDataTypes.NUMERIC) {
- throw new FormulaError(
- FormulaErrorType.INVALID_ARG,
- {
- key: 'msg.formula.numericTypeIsExpected',
- calleeName: parsedTree.callee?.name?.toUpperCase(),
- },
- 'Numeric type is expected'
- );
- }
- }
},
description: 'Retrieve the last n characters from the input string.',
syntax: 'RIGHT(str, n)',
@@ -923,29 +901,8 @@ export const formulas: Record = {
validation: {
args: {
rqd: 2,
+ type: FormulaDataTypes.STRING,
},
- custom(argTypes: FormulaDataTypes[], parsedTree) {
- if (argTypes[0] !== FormulaDataTypes.STRING) {
- throw new FormulaError(
- FormulaErrorType.INVALID_ARG,
- {
- key: 'msg.formula.stringTypeIsExpected',
- calleeName: parsedTree.callee?.name?.toUpperCase(),
- },
- 'String type is expected'
- );
- }
- if (argTypes[1] !== FormulaDataTypes.NUMERIC) {
- throw new FormulaError(
- FormulaErrorType.INVALID_ARG,
- {
- key: 'msg.formula.numericTypeIsExpected',
- calleeName: parsedTree.callee?.name?.toUpperCase(),
- },
- 'Numeric type is expected'
- );
- }
- }
},
description: 'Retrieve the first n characters from the input string.',
syntax: 'LEFT(str, n)',
@@ -990,30 +947,6 @@ export const formulas: Record = {
FormulaDataTypes.NUMERIC,
],
},
- custom(argTypes: FormulaDataTypes[], parsedTree) {
- if (argTypes[0] !== FormulaDataTypes.STRING) {
- throw new FormulaError(
- FormulaErrorType.INVALID_ARG,
- {
- key: 'msg.formula.stringTypeIsExpected',
- calleeName: parsedTree.callee?.name?.toUpperCase(),
- },
- 'String type is expected'
- );
- }
- for(const i of [1,2]) {
- if (argTypes[i] !== FormulaDataTypes.NUMERIC) {
- throw new FormulaError(
- FormulaErrorType.INVALID_ARG,
- {
- key: 'msg.formula.numericTypeIsExpected',
- calleeName: parsedTree.callee?.name?.toUpperCase(),
- },
- 'Numeric type is expected'
- );
- }
- }
- }
},
description: 'Extracts a substring; an alias for SUBSTR.',
syntax: 'MID(str, position, [count])',
@@ -1131,6 +1064,7 @@ export const formulas: Record = {
args: {
min: 1,
max: 2,
+ type: FormulaDataTypes.NUMERIC,
},
custom(_argTypes: FormulaDataTypes[], parsedTree: any) {
if (parsedTree.arguments[0].type === JSEPNode.LITERAL) {
diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts
index bc74df30b3..586882ec0c 100644
--- a/packages/nocodb/src/db/BaseModelSqlv2.ts
+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts
@@ -2105,7 +2105,8 @@ class BaseModelSqlv2 {
obj.conditionGraph = args.conditionGraph || {};
obj.limit = Math.max(
Math.min(
- args.limit || args.l || BaseModelSqlv2.config.limitDefault,
+ Math.max(+(args.limit || args.l), 0) ||
+ BaseModelSqlv2.config.limitDefault,
BaseModelSqlv2.config.limitMax,
),
BaseModelSqlv2.config.limitMin,
@@ -6371,7 +6372,8 @@ export function getListArgs(
obj.conditionGraph = args.conditionGraph || {};
obj.limit = Math.max(
Math.min(
- args?.limit || args?.l || BaseModelSqlv2.config.limitDefault,
+ Math.max(+(args?.limit || args?.l), 0) ||
+ BaseModelSqlv2.config.limitDefault,
BaseModelSqlv2.config.limitMax,
),
BaseModelSqlv2.config.limitMin,
diff --git a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts
index 10bac3ceb0..a32736b44d 100644
--- a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts
+++ b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts
@@ -16,7 +16,7 @@ import type { BaseModelSqlv2 } from '~/db/BaseModelSqlv2';
import type Column from '~/models/Column';
import Model from '~/models/Model';
import NocoCache from '~/cache/NocoCache';
-import { CacheGetType, CacheScope } from '~/utils/globals';
+import { CacheScope } from '~/utils/globals';
import { convertDateFormatForConcat } from '~/helpers/formulaFnHelper';
import FormulaColumn from '~/models/FormulaColumn';
import { Base, BaseUser } from '~/models';
diff --git a/packages/nocodb/src/services/data-table.service.ts b/packages/nocodb/src/services/data-table.service.ts
index a567596018..3077cb9f8f 100644
--- a/packages/nocodb/src/services/data-table.service.ts
+++ b/packages/nocodb/src/services/data-table.service.ts
@@ -21,15 +21,13 @@ export class DataTableService {
viewId?: string;
ignorePagination?: boolean;
}) {
- const { model, view } = await this.getModelAndView(param);
-
- return await this.datasService.getDataList({
- model,
- view,
- query: param.query,
- throwErrorIfInvalidParams: true,
- ignorePagination: param.ignorePagination,
+ const { modelId, viewId, baseId, ...rest } = param;
+ const { model, view } = await this.getModelAndView({
+ modelId,
+ viewId,
+ baseId,
});
+ return await this.datasService.dataList({ ...rest, model, view });
}
async dataRead(param: {
diff --git a/packages/nocodb/src/services/datas.service.ts b/packages/nocodb/src/services/datas.service.ts
index 07250afc22..17f3c41de4 100644
--- a/packages/nocodb/src/services/datas.service.ts
+++ b/packages/nocodb/src/services/datas.service.ts
@@ -20,13 +20,22 @@ export class DatasService {
constructor() {}
async dataList(
- param: PathParams & {
+ param: (PathParams | { view?: View; model: Model }) & {
query: any;
disableOptimization?: boolean;
ignorePagination?: boolean;
+ throwErrorIfInvalidParams?: boolean;
},
) {
- const { model, view } = await getViewAndModelByAliasOrId(param);
+ let { model, view } = param as { view?: View; model?: Model };
+
+ if (!model) {
+ const modelAndView = await getViewAndModelByAliasOrId(
+ param as PathParams,
+ );
+ model = modelAndView.model;
+ view = modelAndView.view;
+ }
return await this.getDataList({
model,