@budibase/types 2.11.20-alpha.0 → 2.11.22
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/api/web/app/table.d.ts +6 -1
- package/dist/documents/app/datasource.d.ts +0 -1
- package/dist/documents/app/row.d.ts +3 -1
- package/dist/documents/app/table/constants.d.ts +11 -0
- package/dist/documents/app/table/schema.d.ts +58 -19
- package/dist/documents/app/table/table.d.ts +0 -3
- package/dist/documents/document.d.ts +3 -0
- package/dist/index.js +26 -1
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/sdk/datasources.d.ts +0 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Table, TableRequest, TableSchema, View, ViewV2 } from "../../../documents";
|
|
1
|
+
import { Row, Table, TableRequest, TableSchema, View, ViewV2 } from "../../../documents";
|
|
2
2
|
interface ViewV2Response extends ViewV2 {
|
|
3
3
|
schema: TableSchema;
|
|
4
4
|
}
|
|
@@ -10,6 +10,11 @@ export interface TableResponse extends Table {
|
|
|
10
10
|
}
|
|
11
11
|
export type FetchTablesResponse = TableResponse[];
|
|
12
12
|
export interface SaveTableRequest extends TableRequest {
|
|
13
|
+
rows?: Row[];
|
|
13
14
|
}
|
|
14
15
|
export type SaveTableResponse = Table;
|
|
16
|
+
export interface BulkImportRequest {
|
|
17
|
+
rows: Row[];
|
|
18
|
+
identifierFields?: Array<string>;
|
|
19
|
+
}
|
|
15
20
|
export {};
|
|
@@ -31,10 +31,12 @@ export interface Row extends Document {
|
|
|
31
31
|
[key: string]: any;
|
|
32
32
|
}
|
|
33
33
|
export declare enum FieldSubtype {
|
|
34
|
-
USER = "user"
|
|
34
|
+
USER = "user",
|
|
35
|
+
USERS = "users"
|
|
35
36
|
}
|
|
36
37
|
export declare const FieldTypeSubtypes: {
|
|
37
38
|
BB_REFERENCE: {
|
|
38
39
|
USER: FieldSubtype;
|
|
40
|
+
USERS: FieldSubtype;
|
|
39
41
|
};
|
|
40
42
|
};
|
|
@@ -6,3 +6,14 @@ export declare enum RelationshipType {
|
|
|
6
6
|
export declare enum AutoReason {
|
|
7
7
|
FOREIGN_KEY = "foreign_key"
|
|
8
8
|
}
|
|
9
|
+
export declare enum AutoFieldSubTypes {
|
|
10
|
+
CREATED_BY = "createdBy",
|
|
11
|
+
CREATED_AT = "createdAt",
|
|
12
|
+
UPDATED_BY = "updatedBy",
|
|
13
|
+
UPDATED_AT = "updatedAt",
|
|
14
|
+
AUTO_ID = "autoID"
|
|
15
|
+
}
|
|
16
|
+
export declare enum FormulaTypes {
|
|
17
|
+
STATIC = "static",
|
|
18
|
+
DYNAMIC = "dynamic"
|
|
19
|
+
}
|
|
@@ -1,43 +1,74 @@
|
|
|
1
|
-
import { FieldType } from "../row";
|
|
2
|
-
import { AutoReason, RelationshipType } from "./constants";
|
|
1
|
+
import { FieldSubtype, FieldType } from "../row";
|
|
2
|
+
import { AutoFieldSubTypes, AutoReason, FormulaTypes, RelationshipType } from "./constants";
|
|
3
3
|
export interface UIFieldMetadata {
|
|
4
4
|
order?: number;
|
|
5
5
|
width?: number;
|
|
6
6
|
visible?: boolean;
|
|
7
7
|
icon?: string;
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
interface BaseRelationshipFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
|
|
10
|
+
type: FieldType.LINK;
|
|
10
11
|
main?: boolean;
|
|
11
|
-
fieldName
|
|
12
|
-
tableId
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
fieldName: string;
|
|
13
|
+
tableId: string;
|
|
14
|
+
subtype?: AutoFieldSubTypes.CREATED_BY | AutoFieldSubTypes.UPDATED_BY;
|
|
15
|
+
}
|
|
16
|
+
type ManyToManyJunctionTableMetadata = {
|
|
17
|
+
through: string;
|
|
18
|
+
throughFrom: string;
|
|
19
|
+
throughTo: string;
|
|
20
|
+
} | {
|
|
21
|
+
through?: never;
|
|
22
|
+
throughFrom?: never;
|
|
23
|
+
throughTo?: never;
|
|
24
|
+
};
|
|
25
|
+
export type ManyToManyRelationshipFieldMetadata = BaseRelationshipFieldMetadata & {
|
|
26
|
+
relationshipType: RelationshipType.MANY_TO_MANY;
|
|
27
|
+
} & ManyToManyJunctionTableMetadata;
|
|
28
|
+
export interface OneToManyRelationshipFieldMetadata extends BaseRelationshipFieldMetadata {
|
|
29
|
+
relationshipType: RelationshipType.ONE_TO_MANY;
|
|
15
30
|
foreignKey?: string;
|
|
16
|
-
throughFrom?: string;
|
|
17
|
-
throughTo?: string;
|
|
18
31
|
}
|
|
19
|
-
export interface
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
export interface ManyToOneRelationshipFieldMetadata extends BaseRelationshipFieldMetadata {
|
|
33
|
+
relationshipType: RelationshipType.MANY_TO_ONE;
|
|
34
|
+
foreignKey?: string;
|
|
35
|
+
}
|
|
36
|
+
export type RelationshipFieldMetadata = ManyToManyRelationshipFieldMetadata | OneToManyRelationshipFieldMetadata | ManyToOneRelationshipFieldMetadata;
|
|
37
|
+
export interface AutoColumnFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
|
|
38
|
+
type: FieldType.AUTO;
|
|
39
|
+
autocolumn: true;
|
|
40
|
+
subtype?: AutoFieldSubTypes;
|
|
22
41
|
lastID?: number;
|
|
23
42
|
autoReason?: AutoReason;
|
|
24
43
|
}
|
|
25
|
-
export interface NumberFieldMetadata {
|
|
44
|
+
export interface NumberFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
|
|
45
|
+
type: FieldType.NUMBER;
|
|
46
|
+
subtype?: AutoFieldSubTypes.AUTO_ID;
|
|
47
|
+
lastID?: number;
|
|
48
|
+
autoReason?: AutoReason.FOREIGN_KEY;
|
|
26
49
|
meta?: {
|
|
27
50
|
toTable: string;
|
|
28
51
|
toKey: string;
|
|
29
52
|
};
|
|
30
53
|
}
|
|
31
|
-
export interface DateFieldMetadata {
|
|
54
|
+
export interface DateFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
|
|
55
|
+
type: FieldType.DATETIME;
|
|
32
56
|
ignoreTimezones?: boolean;
|
|
33
57
|
timeOnly?: boolean;
|
|
58
|
+
subtype?: AutoFieldSubTypes.CREATED_AT | AutoFieldSubTypes.UPDATED_AT;
|
|
34
59
|
}
|
|
35
|
-
export interface
|
|
60
|
+
export interface LongFormFieldMetadata extends BaseFieldSchema {
|
|
61
|
+
type: FieldType.LONGFORM;
|
|
36
62
|
useRichText?: boolean | null;
|
|
37
63
|
}
|
|
38
|
-
export interface FormulaFieldMetadata {
|
|
39
|
-
|
|
40
|
-
|
|
64
|
+
export interface FormulaFieldMetadata extends BaseFieldSchema {
|
|
65
|
+
type: FieldType.FORMULA;
|
|
66
|
+
formula: string;
|
|
67
|
+
formulaType?: FormulaTypes;
|
|
68
|
+
}
|
|
69
|
+
export interface BBReferenceFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
|
|
70
|
+
type: FieldType.BB_REFERENCE;
|
|
71
|
+
subtype: FieldSubtype.USER | FieldSubtype.USERS;
|
|
41
72
|
}
|
|
42
73
|
export interface FieldConstraints {
|
|
43
74
|
type?: string;
|
|
@@ -59,13 +90,21 @@ export interface FieldConstraints {
|
|
|
59
90
|
earliest: string;
|
|
60
91
|
};
|
|
61
92
|
}
|
|
62
|
-
|
|
93
|
+
interface BaseFieldSchema extends UIFieldMetadata {
|
|
63
94
|
type: FieldType;
|
|
64
95
|
name: string;
|
|
65
96
|
sortable?: boolean;
|
|
66
97
|
externalType?: string;
|
|
67
98
|
constraints?: FieldConstraints;
|
|
99
|
+
autocolumn?: boolean;
|
|
100
|
+
autoReason?: AutoReason.FOREIGN_KEY;
|
|
101
|
+
subtype?: never;
|
|
102
|
+
}
|
|
103
|
+
interface OtherFieldMetadata extends BaseFieldSchema {
|
|
104
|
+
type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.NUMBER | FieldType.LONGFORM>;
|
|
68
105
|
}
|
|
106
|
+
export type FieldSchema = OtherFieldMetadata | DateFieldMetadata | RelationshipFieldMetadata | AutoColumnFieldMetadata | FormulaFieldMetadata | NumberFieldMetadata | LongFormFieldMetadata | BBReferenceFieldMetadata;
|
|
69
107
|
export interface TableSchema {
|
|
70
108
|
[key: string]: FieldSchema;
|
|
71
109
|
}
|
|
110
|
+
export {};
|
|
@@ -37,6 +37,9 @@ export declare enum DocumentType {
|
|
|
37
37
|
AUDIT_LOG = "al"
|
|
38
38
|
}
|
|
39
39
|
export declare const DocumentTypesToImport: DocumentType[];
|
|
40
|
+
export declare enum InternalTable {
|
|
41
|
+
USER_METADATA = "ta_users"
|
|
42
|
+
}
|
|
40
43
|
export declare enum VirtualDocumentType {
|
|
41
44
|
VIEW = "view"
|
|
42
45
|
}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
AuditLogSystemUser: () => AuditLogSystemUser,
|
|
34
34
|
AuditedEventFriendlyName: () => AuditedEventFriendlyName,
|
|
35
35
|
AuthType: () => AuthType,
|
|
36
|
+
AutoFieldSubTypes: () => AutoFieldSubTypes,
|
|
36
37
|
AutoReason: () => AutoReason,
|
|
37
38
|
AutomationActionStepId: () => AutomationActionStepId,
|
|
38
39
|
AutomationCustomIOType: () => AutomationCustomIOType,
|
|
@@ -61,11 +62,13 @@ __export(src_exports, {
|
|
|
61
62
|
FieldType: () => FieldType,
|
|
62
63
|
FieldTypeSubtypes: () => FieldTypeSubtypes,
|
|
63
64
|
FilterType: () => FilterType,
|
|
65
|
+
FormulaTypes: () => FormulaTypes,
|
|
64
66
|
GroupType: () => GroupType,
|
|
65
67
|
Hosting: () => Hosting,
|
|
66
68
|
IdentityType: () => IdentityType,
|
|
67
69
|
IncludeRelationship: () => IncludeRelationship,
|
|
68
70
|
InitType: () => InitType,
|
|
71
|
+
InternalTable: () => InternalTable,
|
|
69
72
|
LockName: () => LockName,
|
|
70
73
|
LockType: () => LockType,
|
|
71
74
|
MigrationName: () => MigrationName,
|
|
@@ -868,6 +871,19 @@ var AutoReason = /* @__PURE__ */ ((AutoReason2) => {
|
|
|
868
871
|
AutoReason2["FOREIGN_KEY"] = "foreign_key";
|
|
869
872
|
return AutoReason2;
|
|
870
873
|
})(AutoReason || {});
|
|
874
|
+
var AutoFieldSubTypes = /* @__PURE__ */ ((AutoFieldSubTypes2) => {
|
|
875
|
+
AutoFieldSubTypes2["CREATED_BY"] = "createdBy";
|
|
876
|
+
AutoFieldSubTypes2["CREATED_AT"] = "createdAt";
|
|
877
|
+
AutoFieldSubTypes2["UPDATED_BY"] = "updatedBy";
|
|
878
|
+
AutoFieldSubTypes2["UPDATED_AT"] = "updatedAt";
|
|
879
|
+
AutoFieldSubTypes2["AUTO_ID"] = "autoID";
|
|
880
|
+
return AutoFieldSubTypes2;
|
|
881
|
+
})(AutoFieldSubTypes || {});
|
|
882
|
+
var FormulaTypes = /* @__PURE__ */ ((FormulaTypes2) => {
|
|
883
|
+
FormulaTypes2["STATIC"] = "static";
|
|
884
|
+
FormulaTypes2["DYNAMIC"] = "dynamic";
|
|
885
|
+
return FormulaTypes2;
|
|
886
|
+
})(FormulaTypes || {});
|
|
871
887
|
|
|
872
888
|
// src/documents/app/view.ts
|
|
873
889
|
var ViewCalculation = /* @__PURE__ */ ((ViewCalculation2) => {
|
|
@@ -932,6 +948,10 @@ var DocumentTypesToImport = [
|
|
|
932
948
|
"inst" /* INSTANCE */,
|
|
933
949
|
"layout" /* LAYOUT */
|
|
934
950
|
];
|
|
951
|
+
var InternalTable = /* @__PURE__ */ ((InternalTable2) => {
|
|
952
|
+
InternalTable2["USER_METADATA"] = "ta_users";
|
|
953
|
+
return InternalTable2;
|
|
954
|
+
})(InternalTable || {});
|
|
935
955
|
var VirtualDocumentType = /* @__PURE__ */ ((VirtualDocumentType2) => {
|
|
936
956
|
VirtualDocumentType2["VIEW"] = "view";
|
|
937
957
|
return VirtualDocumentType2;
|
|
@@ -959,11 +979,13 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
|
|
|
959
979
|
})(FieldType || {});
|
|
960
980
|
var FieldSubtype = /* @__PURE__ */ ((FieldSubtype2) => {
|
|
961
981
|
FieldSubtype2["USER"] = "user";
|
|
982
|
+
FieldSubtype2["USERS"] = "users";
|
|
962
983
|
return FieldSubtype2;
|
|
963
984
|
})(FieldSubtype || {});
|
|
964
985
|
var FieldTypeSubtypes = {
|
|
965
986
|
BB_REFERENCE: {
|
|
966
|
-
USER: "user" /* USER
|
|
987
|
+
USER: "user" /* USER */,
|
|
988
|
+
USERS: "users" /* USERS */
|
|
967
989
|
}
|
|
968
990
|
};
|
|
969
991
|
|
|
@@ -1132,6 +1154,7 @@ var ServiceType = /* @__PURE__ */ ((ServiceType2) => {
|
|
|
1132
1154
|
AuditLogSystemUser,
|
|
1133
1155
|
AuditedEventFriendlyName,
|
|
1134
1156
|
AuthType,
|
|
1157
|
+
AutoFieldSubTypes,
|
|
1135
1158
|
AutoReason,
|
|
1136
1159
|
AutomationActionStepId,
|
|
1137
1160
|
AutomationCustomIOType,
|
|
@@ -1160,11 +1183,13 @@ var ServiceType = /* @__PURE__ */ ((ServiceType2) => {
|
|
|
1160
1183
|
FieldType,
|
|
1161
1184
|
FieldTypeSubtypes,
|
|
1162
1185
|
FilterType,
|
|
1186
|
+
FormulaTypes,
|
|
1163
1187
|
GroupType,
|
|
1164
1188
|
Hosting,
|
|
1165
1189
|
IdentityType,
|
|
1166
1190
|
IncludeRelationship,
|
|
1167
1191
|
InitType,
|
|
1192
|
+
InternalTable,
|
|
1168
1193
|
LockName,
|
|
1169
1194
|
LockType,
|
|
1170
1195
|
MigrationName,
|