@budibase/types 2.22.17 → 2.23.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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { SearchFilters, SearchParams } from "../../../sdk";
2
+ import { SearchFilters, RowSearchParams } from "../../../sdk";
3
3
  import { Row } from "../../../documents";
4
4
  import { PaginationResponse, SortOrder } from "../../../api";
5
5
  import { ReadStream } from "fs";
@@ -12,7 +12,7 @@ export interface PatchRowRequest extends Row {
12
12
  }
13
13
  export interface PatchRowResponse extends Row {
14
14
  }
15
- export interface SearchRowRequest extends Omit<SearchParams, "tableId"> {
15
+ export interface SearchRowRequest extends Omit<RowSearchParams, "tableId"> {
16
16
  }
17
17
  export interface SearchViewRowRequest extends Pick<SearchRowRequest, "sort" | "sortOrder" | "sortType" | "limit" | "bookmark" | "paginate" | "query"> {
18
18
  }
@@ -1,9 +1,6 @@
1
- import { FieldSchema, Row, Table, TableRequest, TableSchema, View, ViewV2 } from "../../../documents";
2
- interface ViewV2Response extends ViewV2 {
3
- schema: TableSchema;
4
- }
1
+ import { FieldSchema, Row, Table, TableRequest, View, ViewV2Enriched } from "../../../documents";
5
2
  export type TableViewsResponse = {
6
- [key: string]: View | ViewV2Response;
3
+ [key: string]: View | ViewV2Enriched;
7
4
  };
8
5
  export interface TableResponse extends Table {
9
6
  views?: TableViewsResponse;
@@ -27,4 +24,3 @@ export interface MigrateRequest {
27
24
  export interface MigrateResponse {
28
25
  message: string;
29
26
  }
30
- export {};
@@ -1,10 +1,11 @@
1
- import { ViewV2, UIFieldMetadata } from "../../../documents";
1
+ import { ViewV2, ViewV2Enriched } from "../../../documents";
2
2
  export interface ViewResponse {
3
3
  data: ViewV2;
4
4
  }
5
- export interface CreateViewRequest extends Omit<ViewV2, "version" | "id" | "schema"> {
6
- schema?: Record<string, UIFieldMetadata>;
5
+ export interface ViewResponseEnriched {
6
+ data: ViewV2Enriched;
7
7
  }
8
- export interface UpdateViewRequest extends Omit<ViewV2, "schema"> {
9
- schema?: Record<string, UIFieldMetadata>;
8
+ export interface CreateViewRequest extends Omit<ViewV2, "version" | "id"> {
9
+ }
10
+ export interface UpdateViewRequest extends ViewV2 {
10
11
  }
@@ -4,7 +4,7 @@ export declare enum SortOrder {
4
4
  }
5
5
  export declare enum SortType {
6
6
  STRING = "string",
7
- number = "number"
7
+ NUMBER = "number"
8
8
  }
9
9
  export interface BasicPaginationRequest {
10
10
  bookmark?: string;
@@ -18,6 +18,6 @@ export interface PaginationRequest extends BasicPaginationRequest {
18
18
  };
19
19
  }
20
20
  export interface PaginationResponse {
21
- bookmark: string | undefined;
22
- hasNextPage: boolean;
21
+ bookmark: string | number | undefined;
22
+ hasNextPage?: boolean;
23
23
  }
@@ -14,4 +14,5 @@ export * from "./backup";
14
14
  export * from "./webhook";
15
15
  export * from "./links";
16
16
  export * from "./component";
17
+ export * from "./sqlite";
17
18
  export * from "./snippet";
@@ -6,6 +6,7 @@ export interface LinkInfo {
6
6
  }
7
7
  export interface LinkDocument extends Document {
8
8
  type: string;
9
+ tableId: string;
9
10
  doc1: LinkInfo;
10
11
  doc2: LinkInfo;
11
12
  }
@@ -7,7 +7,8 @@ export declare enum FieldType {
7
7
  BOOLEAN = "boolean",
8
8
  ARRAY = "array",
9
9
  DATETIME = "datetime",
10
- ATTACHMENT = "attachment",
10
+ ATTACHMENTS = "attachment",
11
+ ATTACHMENT_SINGLE = "attachment_single",
11
12
  LINK = "link",
12
13
  FORMULA = "formula",
13
14
  AUTO = "auto",
@@ -32,15 +33,11 @@ export interface Row extends Document {
32
33
  }
33
34
  export declare enum FieldSubtype {
34
35
  USER = "user",
35
- USERS = "users",
36
- SINGLE = "single"
36
+ USERS = "users"
37
37
  }
38
38
  export declare const FieldTypeSubtypes: {
39
39
  BB_REFERENCE: {
40
40
  USER: FieldSubtype.USER;
41
41
  USERS: FieldSubtype.USERS;
42
42
  };
43
- ATTACHMENT: {
44
- SINGLE: FieldSubtype.SINGLE;
45
- };
46
43
  };
@@ -0,0 +1,26 @@
1
+ export declare enum SQLiteType {
2
+ REAL = "REAL",
3
+ TEXT = "VARCHAR",
4
+ INT = "INTEGER",
5
+ BLOB = "BLOB",
6
+ NUMERIC = "NUMERIC"
7
+ }
8
+ export interface SQLiteDefinition {
9
+ _id: string;
10
+ language: string;
11
+ sql: {
12
+ tables: {
13
+ [tableName: string]: {
14
+ fields: {
15
+ [key: string]: SQLiteType | {
16
+ field: string;
17
+ type: SQLiteType;
18
+ };
19
+ };
20
+ };
21
+ };
22
+ options: {
23
+ table_name: string;
24
+ };
25
+ };
26
+ }
@@ -76,9 +76,8 @@ export interface BBReferenceFieldMetadata extends Omit<BaseFieldSchema, "subtype
76
76
  subtype: FieldSubtype.USER | FieldSubtype.USERS;
77
77
  relationshipType?: RelationshipType;
78
78
  }
79
- export interface AttachmentFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
80
- type: FieldType.ATTACHMENT;
81
- subtype?: FieldSubtype.SINGLE;
79
+ export interface AttachmentFieldMetadata extends BaseFieldSchema {
80
+ type: FieldType.ATTACHMENTS;
82
81
  }
83
82
  export interface FieldConstraints {
84
83
  type?: string;
@@ -112,7 +111,7 @@ interface BaseFieldSchema extends UIFieldMetadata {
112
111
  subtype?: never;
113
112
  }
114
113
  interface OtherFieldMetadata extends BaseFieldSchema {
115
- type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE | FieldType.ATTACHMENT>;
114
+ type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE | FieldType.ATTACHMENTS>;
116
115
  }
117
116
  export type FieldSchema = OtherFieldMetadata | DateFieldMetadata | RelationshipFieldMetadata | AutoColumnFieldMetadata | FormulaFieldMetadata | NumberFieldMetadata | LongFormFieldMetadata | BBReferenceFieldMetadata | JsonFieldMetadata | AttachmentFieldMetadata;
118
117
  export interface TableSchema {
@@ -14,6 +14,7 @@ export interface Table extends Document {
14
14
  [key: string]: View | ViewV2;
15
15
  };
16
16
  name: string;
17
+ originalName?: string;
17
18
  sourceId: string;
18
19
  primary?: string[];
19
20
  schema: TableSchema;
@@ -1,5 +1,5 @@
1
1
  import { SearchFilter, SortOrder, SortType } from "../../api";
2
- import { UIFieldMetadata } from "./table";
2
+ import { TableSchema, UIFieldMetadata } from "./table";
3
3
  import { Document } from "../document";
4
4
  import { DBView } from "../../sdk";
5
5
  export type ViewTemplateOpts = {
@@ -43,6 +43,9 @@ export interface ViewV2 {
43
43
  };
44
44
  schema?: Record<string, UIFieldMetadata>;
45
45
  }
46
+ export interface ViewV2Enriched extends ViewV2 {
47
+ schema?: TableSchema;
48
+ }
46
49
  export type ViewSchema = ViewCountOrSumSchema | ViewStatisticsSchema;
47
50
  export interface ViewCountOrSumSchema {
48
51
  field: string;
package/dist/index.js CHANGED
@@ -96,6 +96,7 @@ __export(src_exports, {
96
96
  RelationshipType: () => RelationshipType,
97
97
  RestAuthType: () => RestAuthType,
98
98
  SEPARATOR: () => SEPARATOR,
99
+ SQLiteType: () => SQLiteType,
99
100
  SSOProviderType: () => SSOProviderType,
100
101
  ScheduleRepeatPeriod: () => ScheduleRepeatPeriod,
101
102
  ScheduleType: () => ScheduleType,
@@ -919,7 +920,8 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
919
920
  FieldType2["BOOLEAN"] = "boolean";
920
921
  FieldType2["ARRAY"] = "array";
921
922
  FieldType2["DATETIME"] = "datetime";
922
- FieldType2["ATTACHMENT"] = "attachment";
923
+ FieldType2["ATTACHMENTS"] = "attachment";
924
+ FieldType2["ATTACHMENT_SINGLE"] = "attachment_single";
923
925
  FieldType2["LINK"] = "link";
924
926
  FieldType2["FORMULA"] = "formula";
925
927
  FieldType2["AUTO"] = "auto";
@@ -933,16 +935,12 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
933
935
  var FieldSubtype = /* @__PURE__ */ ((FieldSubtype3) => {
934
936
  FieldSubtype3["USER"] = "user";
935
937
  FieldSubtype3["USERS"] = "users";
936
- FieldSubtype3["SINGLE"] = "single";
937
938
  return FieldSubtype3;
938
939
  })(FieldSubtype || {});
939
940
  var FieldTypeSubtypes = {
940
941
  BB_REFERENCE: {
941
942
  USER: "user" /* USER */,
942
943
  USERS: "users" /* USERS */
943
- },
944
- ATTACHMENT: {
945
- SINGLE: "single" /* SINGLE */
946
944
  }
947
945
  };
948
946
 
@@ -992,7 +990,7 @@ function isBBReferenceField(field) {
992
990
  return field.type === "bb_reference" /* BB_REFERENCE */;
993
991
  }
994
992
  function isAttachmentField(field) {
995
- return field.type === "attachment" /* ATTACHMENT */;
993
+ return field.type === "attachment" /* ATTACHMENTS */;
996
994
  }
997
995
 
998
996
  // src/documents/app/view.ts
@@ -1096,6 +1094,16 @@ var WebhookActionType = /* @__PURE__ */ ((WebhookActionType2) => {
1096
1094
  return WebhookActionType2;
1097
1095
  })(WebhookActionType || {});
1098
1096
 
1097
+ // src/documents/app/sqlite.ts
1098
+ var SQLiteType = /* @__PURE__ */ ((SQLiteType2) => {
1099
+ SQLiteType2["REAL"] = "REAL";
1100
+ SQLiteType2["TEXT"] = "VARCHAR";
1101
+ SQLiteType2["INT"] = "INTEGER";
1102
+ SQLiteType2["BLOB"] = "BLOB";
1103
+ SQLiteType2["NUMERIC"] = "NUMERIC";
1104
+ return SQLiteType2;
1105
+ })(SQLiteType || {});
1106
+
1099
1107
  // src/documents/global/config.ts
1100
1108
  var isSettingsConfig = (config) => config.type === "settings" /* SETTINGS */;
1101
1109
  var isSMTPConfig = (config) => config.type === "smtp" /* SMTP */;
@@ -1209,7 +1217,7 @@ var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
1209
1217
  })(SortOrder || {});
1210
1218
  var SortType = /* @__PURE__ */ ((SortType2) => {
1211
1219
  SortType2["STRING"] = "string";
1212
- SortType2["number"] = "number";
1220
+ SortType2["NUMBER"] = "number";
1213
1221
  return SortType2;
1214
1222
  })(SortType || {});
1215
1223
 
@@ -1317,6 +1325,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1317
1325
  RelationshipType,
1318
1326
  RestAuthType,
1319
1327
  SEPARATOR,
1328
+ SQLiteType,
1320
1329
  SSOProviderType,
1321
1330
  ScheduleRepeatPeriod,
1322
1331
  ScheduleType,