@budibase/shared-core 2.8.30 → 2.8.31-alpha.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/package.json +11 -25
- package/src/constants.ts +6 -0
- package/src/index.ts +1 -0
- package/src/sdk/documents/applications.ts +35 -0
- package/src/sdk/documents/index.ts +2 -0
- package/src/sdk/documents/users.ts +62 -0
- package/src/sdk/index.ts +1 -0
- package/tsconfig.build.json +22 -5
- package/tsconfig.json +6 -3
- package/dist/cjs/src/constants.d.ts +0 -87
- package/dist/cjs/src/constants.js +0 -94
- package/dist/cjs/src/constants.js.map +0 -1
- package/dist/cjs/src/filters.d.ts +0 -94
- package/dist/cjs/src/filters.js +0 -367
- package/dist/cjs/src/filters.js.map +0 -1
- package/dist/cjs/src/helpers/helpers.d.ts +0 -29
- package/dist/cjs/src/helpers/helpers.js +0 -90
- package/dist/cjs/src/helpers/helpers.js.map +0 -1
- package/dist/cjs/src/helpers/index.d.ts +0 -2
- package/dist/cjs/src/helpers/index.js +0 -19
- package/dist/cjs/src/helpers/index.js.map +0 -1
- package/dist/cjs/src/helpers/integrations.d.ts +0 -3
- package/dist/cjs/src/helpers/integrations.js +0 -22
- package/dist/cjs/src/helpers/integrations.js.map +0 -1
- package/dist/cjs/src/index.d.ts +0 -4
- package/dist/cjs/src/index.js +0 -34
- package/dist/cjs/src/index.js.map +0 -1
- package/dist/cjs/src/tsconfig-cjs.build.tsbuildinfo +0 -1
- package/dist/cjs/src/utils.d.ts +0 -2
- package/dist/cjs/src/utils.js +0 -50
- package/dist/cjs/src/utils.js.map +0 -1
- package/dist/mjs/src/constants.d.ts +0 -87
- package/dist/mjs/src/constants.js +0 -91
- package/dist/mjs/src/constants.js.map +0 -1
- package/dist/mjs/src/filters.d.ts +0 -94
- package/dist/mjs/src/filters.js +0 -356
- package/dist/mjs/src/filters.js.map +0 -1
- package/dist/mjs/src/helpers/helpers.d.ts +0 -29
- package/dist/mjs/src/helpers/helpers.js +0 -82
- package/dist/mjs/src/helpers/helpers.js.map +0 -1
- package/dist/mjs/src/helpers/index.d.ts +0 -2
- package/dist/mjs/src/helpers/index.js +0 -3
- package/dist/mjs/src/helpers/index.js.map +0 -1
- package/dist/mjs/src/helpers/integrations.d.ts +0 -3
- package/dist/mjs/src/helpers/integrations.js +0 -17
- package/dist/mjs/src/helpers/integrations.js.map +0 -1
- package/dist/mjs/src/index.d.ts +0 -4
- package/dist/mjs/src/index.js +0 -5
- package/dist/mjs/src/index.js.map +0 -1
- package/dist/mjs/src/tsconfig.build.tsbuildinfo +0 -1
- package/dist/mjs/src/utils.d.ts +0 -2
- package/dist/mjs/src/utils.js +0 -34
- package/dist/mjs/src/utils.js.map +0 -1
- package/tsconfig-base.build.json +0 -25
- package/tsconfig-cjs.build.json +0 -8
package/package.json
CHANGED
|
@@ -1,45 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/shared-core",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.31-alpha.0",
|
|
4
4
|
"description": "Shared data utils",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "src/index.ts",
|
|
6
|
+
"types": "src/index.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"import": "./dist/
|
|
10
|
-
"require": "./
|
|
11
|
-
}
|
|
12
|
-
"./package.json": "./dist/mjs/package.json"
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./src/index.ts"
|
|
11
|
+
}
|
|
13
12
|
},
|
|
14
13
|
"author": "Budibase",
|
|
15
14
|
"license": "GPL-3.0",
|
|
16
15
|
"scripts": {
|
|
17
16
|
"prebuild": "rimraf dist/",
|
|
18
|
-
"build": "tsc -p tsconfig.build.json
|
|
17
|
+
"build": "tsc -p tsconfig.build.json",
|
|
19
18
|
"build:dev": "yarn prebuild && tsc --build --watch --preserveWatchOutput",
|
|
20
|
-
"dev:builder": "yarn prebuild &&
|
|
19
|
+
"dev:builder": "yarn prebuild && tsc -p tsconfig.json --watch --preserveWatchOutput",
|
|
20
|
+
"check:types": "tsc -p tsconfig.json --noEmit --paths null"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@budibase/types": "2.8.
|
|
23
|
+
"@budibase/types": "2.8.31-alpha.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"concurrently": "^7.6.0",
|
|
27
27
|
"rimraf": "3.0.2",
|
|
28
28
|
"typescript": "4.7.3"
|
|
29
29
|
},
|
|
30
|
-
"
|
|
31
|
-
"targets": {
|
|
32
|
-
"build": {
|
|
33
|
-
"dependsOn": [
|
|
34
|
-
{
|
|
35
|
-
"projects": [
|
|
36
|
-
"@budibase/types"
|
|
37
|
-
],
|
|
38
|
-
"target": "build"
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"gitHead": "0bb17a32b1120c5b2526983870dbec4ee8cd6086"
|
|
30
|
+
"gitHead": "38e2c52eb34c0fae42da6e7f346996c379cd281f"
|
|
45
31
|
}
|
package/src/constants.ts
CHANGED
|
@@ -86,7 +86,13 @@ export enum BuilderSocketEvent {
|
|
|
86
86
|
TableChange = "TableChange",
|
|
87
87
|
DatasourceChange = "DatasourceChange",
|
|
88
88
|
LockTransfer = "LockTransfer",
|
|
89
|
+
ScreenChange = "ScreenChange",
|
|
90
|
+
AppMetadataChange = "AppMetadataChange",
|
|
91
|
+
SelectResource = "SelectResource",
|
|
92
|
+
AppPublishChange = "AppPublishChange",
|
|
93
|
+
AutomationChange = "AutomationChange",
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
export const SocketSessionTTL = 60
|
|
97
|
+
export const ValidQueryNameRegex = /^[^()]*$/
|
|
92
98
|
export const ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DocumentType, prefixed } from "@budibase/types"
|
|
2
|
+
|
|
3
|
+
const APP_PREFIX = prefixed(DocumentType.APP)
|
|
4
|
+
const APP_DEV_PREFIX = prefixed(DocumentType.APP_DEV)
|
|
5
|
+
|
|
6
|
+
export function getDevAppID(appId: string) {
|
|
7
|
+
if (!appId) {
|
|
8
|
+
throw new Error("No app ID provided")
|
|
9
|
+
}
|
|
10
|
+
if (appId.startsWith(APP_DEV_PREFIX)) {
|
|
11
|
+
return appId
|
|
12
|
+
}
|
|
13
|
+
// split to take off the app_ element, then join it together incase any other app_ exist
|
|
14
|
+
const split = appId.split(APP_PREFIX)
|
|
15
|
+
split.shift()
|
|
16
|
+
const rest = split.join(APP_PREFIX)
|
|
17
|
+
return `${APP_DEV_PREFIX}${rest}`
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Convert a development app ID to a deployed app ID.
|
|
22
|
+
*/
|
|
23
|
+
export function getProdAppID(appId: string) {
|
|
24
|
+
if (!appId) {
|
|
25
|
+
throw new Error("No app ID provided")
|
|
26
|
+
}
|
|
27
|
+
if (!appId.startsWith(APP_DEV_PREFIX)) {
|
|
28
|
+
return appId
|
|
29
|
+
}
|
|
30
|
+
// split to take off the app_dev element, then join it together incase any other app_ exist
|
|
31
|
+
const split = appId.split(APP_DEV_PREFIX)
|
|
32
|
+
split.shift()
|
|
33
|
+
const rest = split.join(APP_DEV_PREFIX)
|
|
34
|
+
return `${APP_PREFIX}${rest}`
|
|
35
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ContextUser, User } from "@budibase/types"
|
|
2
|
+
import { getProdAppID } from "./applications"
|
|
3
|
+
|
|
4
|
+
// checks if a user is specifically a builder, given an app ID
|
|
5
|
+
export function isBuilder(user: User | ContextUser, appId?: string): boolean {
|
|
6
|
+
if (!user) {
|
|
7
|
+
return false
|
|
8
|
+
}
|
|
9
|
+
if (user.builder?.global) {
|
|
10
|
+
return true
|
|
11
|
+
} else if (appId && user.builder?.apps?.includes(getProdAppID(appId))) {
|
|
12
|
+
return true
|
|
13
|
+
}
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isGlobalBuilder(user: User | ContextUser): boolean {
|
|
18
|
+
return (isBuilder(user) && !hasAppBuilderPermissions(user)) || isAdmin(user)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// alias for hasAdminPermission, currently do the same thing
|
|
22
|
+
// in future whether someone has admin permissions and whether they are
|
|
23
|
+
// an admin for a specific resource could be separated
|
|
24
|
+
export function isAdmin(user: User | ContextUser): boolean {
|
|
25
|
+
if (!user) {
|
|
26
|
+
return false
|
|
27
|
+
}
|
|
28
|
+
return hasAdminPermissions(user)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function isAdminOrBuilder(
|
|
32
|
+
user: User | ContextUser,
|
|
33
|
+
appId?: string
|
|
34
|
+
): boolean {
|
|
35
|
+
return isBuilder(user, appId) || isAdmin(user)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// check if they are a builder within an app (not necessarily a global builder)
|
|
39
|
+
export function hasAppBuilderPermissions(user?: User | ContextUser): boolean {
|
|
40
|
+
if (!user) {
|
|
41
|
+
return false
|
|
42
|
+
}
|
|
43
|
+
const appLength = user.builder?.apps?.length
|
|
44
|
+
const isGlobalBuilder = !!user.builder?.global
|
|
45
|
+
return !isGlobalBuilder && appLength != null && appLength > 0
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// checks if a user is capable of building any app
|
|
49
|
+
export function hasBuilderPermissions(user?: User | ContextUser): boolean {
|
|
50
|
+
if (!user) {
|
|
51
|
+
return false
|
|
52
|
+
}
|
|
53
|
+
return user.builder?.global || hasAppBuilderPermissions(user)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// checks if a user is capable of being an admin
|
|
57
|
+
export function hasAdminPermissions(user?: User | ContextUser): boolean {
|
|
58
|
+
if (!user) {
|
|
59
|
+
return false
|
|
60
|
+
}
|
|
61
|
+
return !!user.admin?.global
|
|
62
|
+
}
|
package/src/sdk/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./documents"
|
package/tsconfig.build.json
CHANGED
|
@@ -1,8 +1,25 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "./tsconfig-base.build.json",
|
|
3
2
|
"compilerOptions": {
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
3
|
+
"target": "es6",
|
|
4
|
+
"moduleResolution": "node",
|
|
5
|
+
"lib": ["es2020"],
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noImplicitAny": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"resolveJsonModule": true,
|
|
10
|
+
"incremental": true,
|
|
11
|
+
"sourceMap": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"types": ["node"],
|
|
14
|
+
"outDir": "dist",
|
|
15
|
+
"skipLibCheck": true
|
|
16
|
+
},
|
|
17
|
+
"include": ["**/*.js", "**/*.ts"],
|
|
18
|
+
"exclude": [
|
|
19
|
+
"node_modules",
|
|
20
|
+
"dist",
|
|
21
|
+
"**/*.spec.ts",
|
|
22
|
+
"**/*.spec.js",
|
|
23
|
+
"__mocks__"
|
|
24
|
+
]
|
|
8
25
|
}
|
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "./tsconfig.build.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"composite": true,
|
|
5
4
|
"baseUrl": ".",
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"composite": true,
|
|
7
|
+
"tsBuildInfoFile": "dist/tsconfig.tsbuildinfo",
|
|
6
8
|
"paths": {
|
|
7
|
-
"@budibase/types": ["
|
|
9
|
+
"@budibase/types": ["../../types/src"]
|
|
8
10
|
}
|
|
9
|
-
}
|
|
11
|
+
},
|
|
12
|
+
"exclude": ["node_modules", "dist"]
|
|
10
13
|
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
export declare const OperatorOptions: {
|
|
2
|
-
Equals: {
|
|
3
|
-
value: string;
|
|
4
|
-
label: string;
|
|
5
|
-
};
|
|
6
|
-
NotEquals: {
|
|
7
|
-
value: string;
|
|
8
|
-
label: string;
|
|
9
|
-
};
|
|
10
|
-
Empty: {
|
|
11
|
-
value: string;
|
|
12
|
-
label: string;
|
|
13
|
-
};
|
|
14
|
-
NotEmpty: {
|
|
15
|
-
value: string;
|
|
16
|
-
label: string;
|
|
17
|
-
};
|
|
18
|
-
StartsWith: {
|
|
19
|
-
value: string;
|
|
20
|
-
label: string;
|
|
21
|
-
};
|
|
22
|
-
Like: {
|
|
23
|
-
value: string;
|
|
24
|
-
label: string;
|
|
25
|
-
};
|
|
26
|
-
MoreThan: {
|
|
27
|
-
value: string;
|
|
28
|
-
label: string;
|
|
29
|
-
};
|
|
30
|
-
LessThan: {
|
|
31
|
-
value: string;
|
|
32
|
-
label: string;
|
|
33
|
-
};
|
|
34
|
-
Contains: {
|
|
35
|
-
value: string;
|
|
36
|
-
label: string;
|
|
37
|
-
};
|
|
38
|
-
NotContains: {
|
|
39
|
-
value: string;
|
|
40
|
-
label: string;
|
|
41
|
-
};
|
|
42
|
-
In: {
|
|
43
|
-
value: string;
|
|
44
|
-
label: string;
|
|
45
|
-
};
|
|
46
|
-
ContainsAny: {
|
|
47
|
-
value: string;
|
|
48
|
-
label: string;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
export declare const SqlNumberTypeRangeMap: {
|
|
52
|
-
integer: {
|
|
53
|
-
max: number;
|
|
54
|
-
min: number;
|
|
55
|
-
};
|
|
56
|
-
int: {
|
|
57
|
-
max: number;
|
|
58
|
-
min: number;
|
|
59
|
-
};
|
|
60
|
-
smallint: {
|
|
61
|
-
max: number;
|
|
62
|
-
min: number;
|
|
63
|
-
};
|
|
64
|
-
mediumint: {
|
|
65
|
-
max: number;
|
|
66
|
-
min: number;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
export declare enum SocketEvent {
|
|
70
|
-
UserUpdate = "UserUpdate",
|
|
71
|
-
UserDisconnect = "UserDisconnect",
|
|
72
|
-
Heartbeat = "Heartbeat"
|
|
73
|
-
}
|
|
74
|
-
export declare enum GridSocketEvent {
|
|
75
|
-
RowChange = "RowChange",
|
|
76
|
-
TableChange = "TableChange",
|
|
77
|
-
SelectTable = "SelectTable",
|
|
78
|
-
SelectCell = "SelectCell"
|
|
79
|
-
}
|
|
80
|
-
export declare enum BuilderSocketEvent {
|
|
81
|
-
SelectApp = "SelectApp",
|
|
82
|
-
TableChange = "TableChange",
|
|
83
|
-
DatasourceChange = "DatasourceChange",
|
|
84
|
-
LockTransfer = "LockTransfer"
|
|
85
|
-
}
|
|
86
|
-
export declare const SocketSessionTTL = 60;
|
|
87
|
-
export declare const ValidColumnNameRegex: RegExp;
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ValidColumnNameRegex = exports.SocketSessionTTL = exports.BuilderSocketEvent = exports.GridSocketEvent = exports.SocketEvent = exports.SqlNumberTypeRangeMap = exports.OperatorOptions = void 0;
|
|
4
|
-
exports.OperatorOptions = {
|
|
5
|
-
Equals: {
|
|
6
|
-
value: "equal",
|
|
7
|
-
label: "Equals",
|
|
8
|
-
},
|
|
9
|
-
NotEquals: {
|
|
10
|
-
value: "notEqual",
|
|
11
|
-
label: "Not equals",
|
|
12
|
-
},
|
|
13
|
-
Empty: {
|
|
14
|
-
value: "empty",
|
|
15
|
-
label: "Is empty",
|
|
16
|
-
},
|
|
17
|
-
NotEmpty: {
|
|
18
|
-
value: "notEmpty",
|
|
19
|
-
label: "Is not empty",
|
|
20
|
-
},
|
|
21
|
-
StartsWith: {
|
|
22
|
-
value: "string",
|
|
23
|
-
label: "Starts with",
|
|
24
|
-
},
|
|
25
|
-
Like: {
|
|
26
|
-
value: "fuzzy",
|
|
27
|
-
label: "Like",
|
|
28
|
-
},
|
|
29
|
-
MoreThan: {
|
|
30
|
-
value: "rangeLow",
|
|
31
|
-
label: "More than or equal to",
|
|
32
|
-
},
|
|
33
|
-
LessThan: {
|
|
34
|
-
value: "rangeHigh",
|
|
35
|
-
label: "Less than or equal to",
|
|
36
|
-
},
|
|
37
|
-
Contains: {
|
|
38
|
-
value: "contains",
|
|
39
|
-
label: "Contains",
|
|
40
|
-
},
|
|
41
|
-
NotContains: {
|
|
42
|
-
value: "notContains",
|
|
43
|
-
label: "Does not contain",
|
|
44
|
-
},
|
|
45
|
-
In: {
|
|
46
|
-
value: "oneOf",
|
|
47
|
-
label: "Is in",
|
|
48
|
-
},
|
|
49
|
-
ContainsAny: {
|
|
50
|
-
value: "containsAny",
|
|
51
|
-
label: "Has any",
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
exports.SqlNumberTypeRangeMap = {
|
|
55
|
-
integer: {
|
|
56
|
-
max: 2147483647,
|
|
57
|
-
min: -2147483648,
|
|
58
|
-
},
|
|
59
|
-
int: {
|
|
60
|
-
max: 2147483647,
|
|
61
|
-
min: -2147483648,
|
|
62
|
-
},
|
|
63
|
-
smallint: {
|
|
64
|
-
max: 32767,
|
|
65
|
-
min: -32768,
|
|
66
|
-
},
|
|
67
|
-
mediumint: {
|
|
68
|
-
max: 8388607,
|
|
69
|
-
min: -8388608,
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
var SocketEvent;
|
|
73
|
-
(function (SocketEvent) {
|
|
74
|
-
SocketEvent["UserUpdate"] = "UserUpdate";
|
|
75
|
-
SocketEvent["UserDisconnect"] = "UserDisconnect";
|
|
76
|
-
SocketEvent["Heartbeat"] = "Heartbeat";
|
|
77
|
-
})(SocketEvent = exports.SocketEvent || (exports.SocketEvent = {}));
|
|
78
|
-
var GridSocketEvent;
|
|
79
|
-
(function (GridSocketEvent) {
|
|
80
|
-
GridSocketEvent["RowChange"] = "RowChange";
|
|
81
|
-
GridSocketEvent["TableChange"] = "TableChange";
|
|
82
|
-
GridSocketEvent["SelectTable"] = "SelectTable";
|
|
83
|
-
GridSocketEvent["SelectCell"] = "SelectCell";
|
|
84
|
-
})(GridSocketEvent = exports.GridSocketEvent || (exports.GridSocketEvent = {}));
|
|
85
|
-
var BuilderSocketEvent;
|
|
86
|
-
(function (BuilderSocketEvent) {
|
|
87
|
-
BuilderSocketEvent["SelectApp"] = "SelectApp";
|
|
88
|
-
BuilderSocketEvent["TableChange"] = "TableChange";
|
|
89
|
-
BuilderSocketEvent["DatasourceChange"] = "DatasourceChange";
|
|
90
|
-
BuilderSocketEvent["LockTransfer"] = "LockTransfer";
|
|
91
|
-
})(BuilderSocketEvent = exports.BuilderSocketEvent || (exports.BuilderSocketEvent = {}));
|
|
92
|
-
exports.SocketSessionTTL = 60;
|
|
93
|
-
exports.ValidColumnNameRegex = /^[_a-zA-Z0-9\s]*$/g;
|
|
94
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG;IAC7B,MAAM,EAAE;QACN,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,QAAQ;KAChB;IACD,SAAS,EAAE;QACT,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,YAAY;KACpB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,UAAU;KAClB;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,cAAc;KACtB;IACD,UAAU,EAAE;QACV,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,aAAa;KACrB;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,MAAM;KACd;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,uBAAuB;KAC/B;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,WAAW;QAClB,KAAK,EAAE,uBAAuB;KAC/B;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,KAAK,EAAE,UAAU;KAClB;IACD,WAAW,EAAE;QACX,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,kBAAkB;KAC1B;IACD,EAAE,EAAE;QACF,KAAK,EAAE,OAAO;QACd,KAAK,EAAE,OAAO;KACf;IACD,WAAW,EAAE;QACX,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,SAAS;KACjB;CACF,CAAA;AAEY,QAAA,qBAAqB,GAAG;IACnC,OAAO,EAAE;QACP,GAAG,EAAE,UAAU;QACf,GAAG,EAAE,CAAC,UAAU;KACjB;IACD,GAAG,EAAE;QACH,GAAG,EAAE,UAAU;QACf,GAAG,EAAE,CAAC,UAAU;KACjB;IACD,QAAQ,EAAE;QACR,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,CAAC,KAAK;KACZ;IACD,SAAS,EAAE;QACT,GAAG,EAAE,OAAO;QACZ,GAAG,EAAE,CAAC,OAAO;KACd;CACF,CAAA;AAED,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,wCAAyB,CAAA;IACzB,gDAAiC,CAAA;IACjC,sCAAuB,CAAA;AACzB,CAAC,EAJW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAItB;AAED,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,8CAA2B,CAAA;IAC3B,8CAA2B,CAAA;IAC3B,4CAAyB,CAAA;AAC3B,CAAC,EALW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAK1B;AAED,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,6CAAuB,CAAA;IACvB,iDAA2B,CAAA;IAC3B,2DAAqC,CAAA;IACrC,mDAA6B,CAAA;AAC/B,CAAC,EALW,kBAAkB,GAAlB,0BAAkB,KAAlB,0BAAkB,QAK7B;AAEY,QAAA,gBAAgB,GAAG,EAAE,CAAA;AACrB,QAAA,oBAAoB,GAAG,oBAAoB,CAAA"}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { Datasource, FieldType, SortDirection, SortType } from "@budibase/types";
|
|
2
|
-
import { SqlNumberTypeRangeMap } from "./constants";
|
|
3
|
-
/**
|
|
4
|
-
* Returns the valid operator options for a certain data type
|
|
5
|
-
* @param type the data type
|
|
6
|
-
*/
|
|
7
|
-
export declare const getValidOperatorsForType: (type: FieldType, field: string, datasource: Datasource & {
|
|
8
|
-
tableId: any;
|
|
9
|
-
}) => {
|
|
10
|
-
value: string;
|
|
11
|
-
label: string;
|
|
12
|
-
}[];
|
|
13
|
-
/**
|
|
14
|
-
* Operators which do not support empty strings as values
|
|
15
|
-
*/
|
|
16
|
-
export declare const NoEmptyFilterStrings: (keyof QueryFields)[];
|
|
17
|
-
declare type Filter = {
|
|
18
|
-
operator: keyof Query;
|
|
19
|
-
field: string;
|
|
20
|
-
type: any;
|
|
21
|
-
value: any;
|
|
22
|
-
externalType: keyof typeof SqlNumberTypeRangeMap;
|
|
23
|
-
};
|
|
24
|
-
declare type Query = QueryFields & QueryConfig;
|
|
25
|
-
declare type QueryFields = {
|
|
26
|
-
string?: {
|
|
27
|
-
[key: string]: string;
|
|
28
|
-
};
|
|
29
|
-
fuzzy?: {
|
|
30
|
-
[key: string]: string;
|
|
31
|
-
};
|
|
32
|
-
range?: {
|
|
33
|
-
[key: string]: {
|
|
34
|
-
high: number | string;
|
|
35
|
-
low: number | string;
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
equal?: {
|
|
39
|
-
[key: string]: any;
|
|
40
|
-
};
|
|
41
|
-
notEqual?: {
|
|
42
|
-
[key: string]: any;
|
|
43
|
-
};
|
|
44
|
-
empty?: {
|
|
45
|
-
[key: string]: any;
|
|
46
|
-
};
|
|
47
|
-
notEmpty?: {
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
};
|
|
50
|
-
oneOf?: {
|
|
51
|
-
[key: string]: any[];
|
|
52
|
-
};
|
|
53
|
-
contains?: {
|
|
54
|
-
[key: string]: any[];
|
|
55
|
-
};
|
|
56
|
-
notContains?: {
|
|
57
|
-
[key: string]: any[];
|
|
58
|
-
};
|
|
59
|
-
containsAny?: {
|
|
60
|
-
[key: string]: any[];
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
declare type QueryConfig = {
|
|
64
|
-
allOr?: boolean;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* Builds a lucene JSON query from the filter structure generated in the builder
|
|
68
|
-
* @param filter the builder filter structure
|
|
69
|
-
*/
|
|
70
|
-
export declare const buildLuceneQuery: (filter: Filter[]) => Query;
|
|
71
|
-
/**
|
|
72
|
-
* Performs a client-side lucene search on an array of data
|
|
73
|
-
* @param docs the data
|
|
74
|
-
* @param query the JSON lucene query
|
|
75
|
-
*/
|
|
76
|
-
export declare const runLuceneQuery: (docs: any[], query?: Query) => any[];
|
|
77
|
-
/**
|
|
78
|
-
* Performs a client-side sort from the equivalent server-side lucene sort
|
|
79
|
-
* parameters.
|
|
80
|
-
* @param docs the data
|
|
81
|
-
* @param sort the sort column
|
|
82
|
-
* @param sortOrder the sort order ("ascending" or "descending")
|
|
83
|
-
* @param sortType the type of sort ("string" or "number")
|
|
84
|
-
*/
|
|
85
|
-
export declare const luceneSort: (docs: any[], sort: string, sortOrder: SortDirection, sortType?: SortType) => any[];
|
|
86
|
-
/**
|
|
87
|
-
* Limits the specified docs to the specified number of rows from the equivalent
|
|
88
|
-
* server-side lucene limit parameters.
|
|
89
|
-
* @param docs the data
|
|
90
|
-
* @param limit the number of docs to limit to
|
|
91
|
-
*/
|
|
92
|
-
export declare const luceneLimit: (docs: any[], limit: string) => any[];
|
|
93
|
-
export declare const hasFilters: (query?: Query) => boolean;
|
|
94
|
-
export {};
|