@budibase/shared-core 2.9.19-alpha.0 → 2.9.19
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/constants.d.ts +93 -0
- package/dist/filters.d.ts +94 -0
- package/dist/helpers/helpers.d.ts +29 -0
- package/dist/helpers/index.d.ts +2 -0
- package/dist/helpers/integrations.d.ts +3 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +746 -0
- package/dist/index.js.map +7 -0
- package/dist/index.js.meta.json +1 -0
- package/dist/sdk/documents/applications.d.ts +5 -0
- package/dist/sdk/documents/index.d.ts +2 -0
- package/dist/sdk/documents/users.d.ts +8 -0
- package/dist/sdk/index.d.ts +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/utils.d.ts +2 -0
- package/package.json +3 -3
- package/src/filters.ts +64 -22
- package/tsconfig.build.json +0 -28
- package/tsconfig.json +0 -4
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
ScreenChange = "ScreenChange",
|
|
86
|
+
AppMetadataChange = "AppMetadataChange",
|
|
87
|
+
SelectResource = "SelectResource",
|
|
88
|
+
AppPublishChange = "AppPublishChange",
|
|
89
|
+
AutomationChange = "AutomationChange"
|
|
90
|
+
}
|
|
91
|
+
export declare const SocketSessionTTL = 60;
|
|
92
|
+
export declare const ValidQueryNameRegex: RegExp;
|
|
93
|
+
export declare const ValidColumnNameRegex: RegExp;
|
|
@@ -0,0 +1,94 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { User } from "@budibase/types";
|
|
2
|
+
/**
|
|
3
|
+
* Gets a key within an object. The key supports dot syntax for retrieving deep
|
|
4
|
+
* fields - e.g. "a.b.c".
|
|
5
|
+
* Exact matches of keys with dots in them take precedence over nested keys of
|
|
6
|
+
* the same path - e.g. getting "a.b" from { "a.b": "foo", a: { b: "bar" } }
|
|
7
|
+
* will return "foo" over "bar".
|
|
8
|
+
* @param obj the object
|
|
9
|
+
* @param key the key
|
|
10
|
+
* @return {*|null} the value or null if a value was not found for this key
|
|
11
|
+
*/
|
|
12
|
+
export declare const deepGet: (obj: {
|
|
13
|
+
[x: string]: any;
|
|
14
|
+
}, key: string) => any;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the initials to show in a user avatar.
|
|
17
|
+
* @param user the user
|
|
18
|
+
*/
|
|
19
|
+
export declare const getUserInitials: (user: User) => string;
|
|
20
|
+
/**
|
|
21
|
+
* Gets a deterministic colour for a particular user
|
|
22
|
+
* @param user the user
|
|
23
|
+
*/
|
|
24
|
+
export declare const getUserColor: (user: User) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Gets a friendly label to describe who a user is.
|
|
27
|
+
* @param user the user
|
|
28
|
+
*/
|
|
29
|
+
export declare const getUserLabel: (user: User) => string;
|