@budibase/types 2.23.5 → 2.23.7

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.
@@ -1,64 +1,10 @@
1
1
  import { FieldType } from "../../documents";
2
- import { EmptyFilterOption } from "../../sdk";
2
+ import { EmptyFilterOption, SearchFilters } from "../../sdk";
3
3
  export type SearchFilter = {
4
- operator: keyof SearchQuery;
4
+ operator: keyof SearchFilters | "rangeLow" | "rangeHigh";
5
5
  onEmptyFilter?: EmptyFilterOption;
6
6
  field: string;
7
7
  type?: FieldType;
8
8
  value: any;
9
9
  externalType?: string;
10
10
  };
11
- export declare enum SearchQueryOperators {
12
- STRING = "string",
13
- FUZZY = "fuzzy",
14
- RANGE = "range",
15
- EQUAL = "equal",
16
- NOT_EQUAL = "notEqual",
17
- EMPTY = "empty",
18
- NOT_EMPTY = "notEmpty",
19
- ONE_OF = "oneOf",
20
- CONTAINS = "contains",
21
- NOT_CONTAINS = "notContains",
22
- CONTAINS_ANY = "containsAny"
23
- }
24
- export type SearchQuery = {
25
- allOr?: boolean;
26
- onEmptyFilter?: EmptyFilterOption;
27
- [SearchQueryOperators.STRING]?: {
28
- [key: string]: string;
29
- };
30
- [SearchQueryOperators.FUZZY]?: {
31
- [key: string]: string;
32
- };
33
- [SearchQueryOperators.RANGE]?: {
34
- [key: string]: {
35
- high: number | string;
36
- low: number | string;
37
- };
38
- };
39
- [SearchQueryOperators.EQUAL]?: {
40
- [key: string]: any;
41
- };
42
- [SearchQueryOperators.NOT_EQUAL]?: {
43
- [key: string]: any;
44
- };
45
- [SearchQueryOperators.EMPTY]?: {
46
- [key: string]: any;
47
- };
48
- [SearchQueryOperators.NOT_EMPTY]?: {
49
- [key: string]: any;
50
- };
51
- [SearchQueryOperators.ONE_OF]?: {
52
- [key: string]: any[];
53
- };
54
- [SearchQueryOperators.CONTAINS]?: {
55
- [key: string]: any[];
56
- };
57
- [SearchQueryOperators.NOT_CONTAINS]?: {
58
- [key: string]: any[];
59
- };
60
- [SearchQueryOperators.CONTAINS_ANY]?: {
61
- [key: string]: any[];
62
- };
63
- };
64
- export type SearchQueryFields = Omit<SearchQuery, "allOr" | "onEmptyFilter">;
@@ -1,5 +1,5 @@
1
1
  import { User } from "../../documents";
2
- import { SearchQuery } from "./searchFilter";
2
+ import { SearchFilters } from "../../sdk";
3
3
  export interface SaveUserResponse {
4
4
  _id: string;
5
5
  _rev: string;
@@ -57,7 +57,7 @@ export interface InviteUsersResponse {
57
57
  }
58
58
  export interface SearchUsersRequest {
59
59
  bookmark?: string;
60
- query?: SearchQuery;
60
+ query?: SearchFilters;
61
61
  appId?: string;
62
62
  limit?: number;
63
63
  paginate?: boolean;
@@ -1,21 +1,110 @@
1
1
  import { Document } from "../document";
2
2
  export declare enum FieldType {
3
+ /**
4
+ * a primitive type, stores a string, called Text within Budibase. This is one of the default
5
+ * types of Budibase, if an external type is not fully understood, we will treat it as text.
6
+ */
3
7
  STRING = "string",
8
+ /**
9
+ * similar to string type, called Long Form Text within Budibase. This is mainly a frontend
10
+ * orientated type which enables a larger text input area. This can also be used
11
+ * in conjunction with the 'useRichText' option to support a markdown editor/viewer.
12
+ */
4
13
  LONGFORM = "longform",
14
+ /**
15
+ * similar to string type, called Options within Budibase. This works very similarly to
16
+ * the string type within the backend, but is validated to a list of options. This will
17
+ * display a <select> input within the builder/client.
18
+ */
5
19
  OPTIONS = "options",
20
+ /**
21
+ * a primitive type, stores a number, as a floating point, called Number within Budibase.
22
+ * this type will always represent numbers as reals/floating point - there is no integer only
23
+ * type within Budibase.
24
+ */
6
25
  NUMBER = "number",
26
+ /**
27
+ * a primitive type, stores a boolean, called Boolean within Budibase. This is often represented
28
+ * as a toggle or checkbox within forms/grids.
29
+ */
7
30
  BOOLEAN = "boolean",
31
+ /**
32
+ * a JSON type, this type is always an array of strings, called Multi-select within Budibase.
33
+ * This type can be compared to the options type, as it functions similarly, but allows picking
34
+ * multiple options rather than a single option.
35
+ */
8
36
  ARRAY = "array",
37
+ /**
38
+ * a string type, this is always a string when input/returned from the API, called Date/Time within
39
+ * Budibase. We utilise ISO date strings for representing dates, this type has a range of subtypes
40
+ * to restrict it to date only, time only and ignore timezone capabilities.
41
+ */
9
42
  DATETIME = "datetime",
43
+ /**
44
+ * a JSON type, an array of metadata about files held in object storage, called Attachment List within
45
+ * Budibase. To utilise this type there is an API for uploading files to Budibase, which returns metadata
46
+ * that can be stored against columns of this type. Currently this is not supported on external databases.
47
+ */
10
48
  ATTACHMENTS = "attachment",
49
+ /**
50
+ * a JSON type, similar to the attachments type, called Attachment within Budibase. This type functions
51
+ * much the same as the attachment list, but only holds a single attachment metadata as an object.
52
+ * This simplifies the binding experience of using this column type.
53
+ */
11
54
  ATTACHMENT_SINGLE = "attachment_single",
55
+ /**
56
+ * a complex type, called Relationships within Budibase. This is the most complex type of Budibase,
57
+ * nothing should be stored against rows under link columns; this type simply represents the
58
+ * relationship between tables as part of the table schema. When rows are input to the Budibase API
59
+ * relationships to be made are represented as a list of row IDs to link. When rows are returned
60
+ * from the Budibase API it will contain a list of row IDs and display column values of the related rows.
61
+ */
12
62
  LINK = "link",
63
+ /**
64
+ * a complex type, called Formulas within Budibase. This type has two variants, static and dynamic, with
65
+ * static only being supported against internal tables. Dynamic formulas calculate a provided HBS/JS binding
66
+ * based on the row context and enrich it when rows are being returned from the API. Static bindings calculate
67
+ * this when rows are being stored, so that the formula output can be searched upon within the DB.
68
+ */
13
69
  FORMULA = "formula",
70
+ /**
71
+ * a complex type, called Auto Column within Budibase. This type has a few variants, with options such as a
72
+ * date for created at/updated at, an auto ID column with auto-increments as rows are saved and a user
73
+ * relationship type which stores the created by/updated by user details. These subtypes all depend on the
74
+ * date, number of link types respectively. There is one case where these will be executed in the browser,
75
+ * that is part of the initial formula definition, the formula will be live evaluated in the browser.
76
+ */
14
77
  AUTO = "auto",
78
+ /**
79
+ * a JSON type, called JSON within Budibase. This type allows any arbitrary JSON to be input to this column
80
+ * type, which will be represented as a JSON object in the row. This type depends on a schema being
81
+ * provided to make the JSON searchable/bindable, the JSON cannot be fully dynamic.
82
+ */
15
83
  JSON = "json",
84
+ /**
85
+ * @deprecated an internal type, this is an old deprecated type which is no longer used - still represented to note it
86
+ * could appear in very old tables.
87
+ */
16
88
  INTERNAL = "internal",
89
+ /**
90
+ * a string type, called Barcode/QR within Budibase. This type is used to denote to forms to that this column
91
+ * should be filled in using a camera to read a barcode, there is a form component which will be used when this
92
+ * type is found. The column will contain the contents of any barcode scanned.
93
+ */
17
94
  BARCODEQR = "barcodeqr",
95
+ /**
96
+ * a string type, this allows representing very large integers, but they are held/managed within Budibase as
97
+ * strings. When stored in external databases Budibase will attempt to use a real big integer type and depend
98
+ * on the database parsing the string to this type as part of saving.
99
+ */
18
100
  BIGINT = "bigint",
101
+ /**
102
+ * a JSON type, called User within Budibase. This type is used to represent a link to an internal Budibase
103
+ * resource, like a user or group, today only users are supported. This type will be represented as an
104
+ * array of internal resource IDs (e.g. user IDs) within the row - this ID list will be enriched with
105
+ * the full resources when rows are returned from the API. The full resources can be input to the API, or
106
+ * an array of resource IDs, the API will squash these down and validate them before saving the row.
107
+ */
19
108
  BB_REFERENCE = "bb_reference"
20
109
  }
21
110
  export interface RowAttachment {
@@ -5,20 +5,18 @@ export declare enum SQLiteType {
5
5
  BLOB = "BLOB",
6
6
  NUMERIC = "NUMERIC"
7
7
  }
8
+ export type SQLiteTable = Record<string, SQLiteType | {
9
+ field: string;
10
+ type: SQLiteType;
11
+ }>;
12
+ export type SQLiteTables = Record<string, {
13
+ fields: SQLiteTable;
14
+ }>;
8
15
  export interface SQLiteDefinition {
9
16
  _id: string;
10
17
  language: string;
11
18
  sql: {
12
- tables: {
13
- [tableName: string]: {
14
- fields: {
15
- [key: string]: SQLiteType | {
16
- field: string;
17
- type: SQLiteType;
18
- };
19
- };
20
- };
21
- };
19
+ tables: SQLiteTables;
22
20
  options: {
23
21
  table_name: string;
24
22
  };
@@ -1,6 +1,6 @@
1
1
  import { Document } from "../../document";
2
2
  import { View, ViewV2 } from "../view";
3
- import { AddColumn, RenameColumn } from "../../../sdk";
3
+ import { RenameColumn } from "../../../sdk";
4
4
  import { TableSchema } from "./schema";
5
5
  export declare const INTERNAL_TABLE_SOURCE_ID = "bb_internal";
6
6
  export declare enum TableSourceType {
@@ -30,6 +30,5 @@ export interface Table extends Document {
30
30
  }
31
31
  export interface TableRequest extends Table {
32
32
  _rename?: RenameColumn;
33
- _add?: AddColumn;
34
33
  created?: boolean;
35
34
  }
package/dist/index.js CHANGED
@@ -100,8 +100,8 @@ __export(src_exports, {
100
100
  SSOProviderType: () => SSOProviderType,
101
101
  ScheduleRepeatPeriod: () => ScheduleRepeatPeriod,
102
102
  ScheduleType: () => ScheduleType,
103
+ SearchFilterOperator: () => SearchFilterOperator,
103
104
  SearchIndex: () => SearchIndex,
104
- SearchQueryOperators: () => SearchQueryOperators,
105
105
  ServiceType: () => ServiceType,
106
106
  SortDirection: () => SortDirection,
107
107
  SortOption: () => SortOption,
@@ -647,6 +647,20 @@ var DatasourceFeature = /* @__PURE__ */ ((DatasourceFeature2) => {
647
647
  })(DatasourceFeature || {});
648
648
 
649
649
  // src/sdk/search.ts
650
+ var SearchFilterOperator = /* @__PURE__ */ ((SearchFilterOperator2) => {
651
+ SearchFilterOperator2["STRING"] = "string";
652
+ SearchFilterOperator2["FUZZY"] = "fuzzy";
653
+ SearchFilterOperator2["RANGE"] = "range";
654
+ SearchFilterOperator2["EQUAL"] = "equal";
655
+ SearchFilterOperator2["NOT_EQUAL"] = "notEqual";
656
+ SearchFilterOperator2["EMPTY"] = "empty";
657
+ SearchFilterOperator2["NOT_EMPTY"] = "notEmpty";
658
+ SearchFilterOperator2["ONE_OF"] = "oneOf";
659
+ SearchFilterOperator2["CONTAINS"] = "contains";
660
+ SearchFilterOperator2["NOT_CONTAINS"] = "notContains";
661
+ SearchFilterOperator2["CONTAINS_ANY"] = "containsAny";
662
+ return SearchFilterOperator2;
663
+ })(SearchFilterOperator || {});
650
664
  var EmptyFilterOption = /* @__PURE__ */ ((EmptyFilterOption2) => {
651
665
  EmptyFilterOption2["RETURN_ALL"] = "all";
652
666
  EmptyFilterOption2["RETURN_NONE"] = "none";
@@ -1221,22 +1235,6 @@ var SortType = /* @__PURE__ */ ((SortType2) => {
1221
1235
  return SortType2;
1222
1236
  })(SortType || {});
1223
1237
 
1224
- // src/api/web/searchFilter.ts
1225
- var SearchQueryOperators = /* @__PURE__ */ ((SearchQueryOperators2) => {
1226
- SearchQueryOperators2["STRING"] = "string";
1227
- SearchQueryOperators2["FUZZY"] = "fuzzy";
1228
- SearchQueryOperators2["RANGE"] = "range";
1229
- SearchQueryOperators2["EQUAL"] = "equal";
1230
- SearchQueryOperators2["NOT_EQUAL"] = "notEqual";
1231
- SearchQueryOperators2["EMPTY"] = "empty";
1232
- SearchQueryOperators2["NOT_EMPTY"] = "notEmpty";
1233
- SearchQueryOperators2["ONE_OF"] = "oneOf";
1234
- SearchQueryOperators2["CONTAINS"] = "contains";
1235
- SearchQueryOperators2["NOT_CONTAINS"] = "notContains";
1236
- SearchQueryOperators2["CONTAINS_ANY"] = "containsAny";
1237
- return SearchQueryOperators2;
1238
- })(SearchQueryOperators || {});
1239
-
1240
1238
  // src/core/installation.ts
1241
1239
  var ServiceType = /* @__PURE__ */ ((ServiceType2) => {
1242
1240
  ServiceType2["WORKER"] = "worker";
@@ -1329,8 +1327,8 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1329
1327
  SSOProviderType,
1330
1328
  ScheduleRepeatPeriod,
1331
1329
  ScheduleType,
1330
+ SearchFilterOperator,
1332
1331
  SearchIndex,
1333
- SearchQueryOperators,
1334
1332
  ServiceType,
1335
1333
  SortDirection,
1336
1334
  SortOption,