@budibase/types 2.33.2 → 2.33.4

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,11 +1,13 @@
1
1
  import { Role, RoleUIMetadata } from "../../documents";
2
+ import { PermissionLevel } from "../../sdk";
2
3
  export interface SaveRoleRequest {
3
4
  _id?: string;
4
5
  _rev?: string;
5
6
  name: string;
6
- inherits: string;
7
+ inherits?: string | string[];
7
8
  permissionId: string;
8
- version: string;
9
+ permissions?: Record<string, PermissionLevel[]>;
10
+ version?: string;
9
11
  uiMetadata?: RoleUIMetadata;
10
12
  }
11
13
  export interface SaveRoleResponse extends Role {
@@ -12,7 +12,10 @@ export interface UserDetails {
12
12
  }
13
13
  export interface BulkUserRequest {
14
14
  delete?: {
15
- userIds: string[];
15
+ users: Array<{
16
+ userId: string;
17
+ email: string;
18
+ }>;
16
19
  };
17
20
  create?: {
18
21
  roles?: any[];
@@ -27,6 +27,7 @@ export interface App extends Document {
27
27
  usedPlugins?: Plugin[];
28
28
  upgradableVersion?: string;
29
29
  snippets?: Snippet[];
30
+ creationVersion?: string;
30
31
  }
31
32
  export interface AppInstance {
32
33
  _id: string;
@@ -222,6 +222,7 @@ export type UpdatedRowEventEmitter = {
222
222
  oldRow: Row;
223
223
  table: Table;
224
224
  appId: string;
225
+ user: User;
225
226
  };
226
227
  export declare enum LoopStepType {
227
228
  ARRAY = "Array",
@@ -7,7 +7,7 @@ export interface RoleUIMetadata {
7
7
  }
8
8
  export interface Role extends Document {
9
9
  permissionId: string;
10
- inherits?: string;
10
+ inherits?: string | string[];
11
11
  permissions: Record<string, PermissionLevel[]>;
12
12
  version?: string;
13
13
  name: string;
@@ -75,6 +75,13 @@ export declare enum FieldType {
75
75
  * that is part of the initial formula definition, the formula will be live evaluated in the browser.
76
76
  */
77
77
  AUTO = "auto",
78
+ /**
79
+ * A complex type, called an AI column within Budibase. This type is only supported against internal tables
80
+ * and calculates the output based on a chosen operation (summarise text, translation etc) which passes to
81
+ * the configured Budibase Large Language Model to retrieve the output and write it back into the row.
82
+ * AI fields function in a similar fashion to static formulas, and possess many of the same characteristics.
83
+ */
84
+ AI = "ai",
78
85
  /**
79
86
  * a JSON type, called JSON within Budibase. This type allows any arbitrary JSON to be input to this column
80
87
  * type, which will be represented as a JSON object in the row. This type depends on a schema being
@@ -20,7 +20,8 @@ export declare enum JsonFieldSubType {
20
20
  }
21
21
  export declare enum FormulaType {
22
22
  STATIC = "static",
23
- DYNAMIC = "dynamic"
23
+ DYNAMIC = "dynamic",
24
+ AI = "ai"
24
25
  }
25
26
  export declare enum BBReferenceFieldSubType {
26
27
  USER = "user",
@@ -1,5 +1,6 @@
1
1
  import { FieldType } from "../row";
2
2
  import { AutoFieldSubType, AutoReason, BBReferenceFieldSubType, FormulaType, JsonFieldSubType, RelationshipType } from "./constants";
3
+ import { AIOperationEnum } from "../../../sdk/ai";
3
4
  export interface UIFieldMetadata {
4
5
  order?: number;
5
6
  width?: number;
@@ -80,6 +81,15 @@ export interface FormulaFieldMetadata extends BaseFieldSchema {
80
81
  formula: string;
81
82
  formulaType?: FormulaType;
82
83
  }
84
+ export interface AIFieldMetadata extends BaseFieldSchema {
85
+ type: FieldType.AI;
86
+ operation: AIOperationEnum;
87
+ columns?: string[];
88
+ column?: string;
89
+ categories?: string[];
90
+ prompt?: string;
91
+ language?: string;
92
+ }
83
93
  export interface BBReferenceFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
84
94
  type: FieldType.BB_REFERENCE;
85
95
  subtype: BBReferenceFieldSubType;
@@ -141,9 +151,9 @@ interface BaseFieldSchema extends UIFieldMetadata {
141
151
  subtype?: never;
142
152
  }
143
153
  interface OtherFieldMetadata extends BaseFieldSchema {
144
- type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE | FieldType.ATTACHMENTS | FieldType.STRING | FieldType.ARRAY | FieldType.OPTIONS>;
154
+ type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.AI | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE | FieldType.ATTACHMENTS | FieldType.STRING | FieldType.ARRAY | FieldType.OPTIONS>;
145
155
  }
146
- export type FieldSchema = OtherFieldMetadata | DateFieldMetadata | RelationshipFieldMetadata | AutoColumnFieldMetadata | FormulaFieldMetadata | NumberFieldMetadata | LongFormFieldMetadata | StringFieldMetadata | BBReferenceFieldMetadata | JsonFieldMetadata | AttachmentFieldMetadata | BBReferenceSingleFieldMetadata | ArrayFieldMetadata | OptionsFieldMetadata;
156
+ export type FieldSchema = OtherFieldMetadata | DateFieldMetadata | RelationshipFieldMetadata | AutoColumnFieldMetadata | FormulaFieldMetadata | AIFieldMetadata | NumberFieldMetadata | LongFormFieldMetadata | StringFieldMetadata | BBReferenceFieldMetadata | JsonFieldMetadata | AttachmentFieldMetadata | BBReferenceSingleFieldMetadata | ArrayFieldMetadata | OptionsFieldMetadata;
147
157
  export interface TableSchema {
148
158
  [key: string]: FieldSchema;
149
159
  }
@@ -7,4 +7,3 @@ export * from "./schedule";
7
7
  export * from "./templates";
8
8
  export * from "./environmentVariables";
9
9
  export * from "./auditLogs";
10
- export * from "./tenantInfo";
@@ -25,6 +25,10 @@ export interface UserSSO {
25
25
  }
26
26
  export type SSOUser = User & UserSSO;
27
27
  export declare function isSSOUser(user: User): user is SSOUser;
28
+ export interface UserIdentifier {
29
+ userId: string;
30
+ email: string;
31
+ }
28
32
  export interface User extends Document {
29
33
  tenantId: string;
30
34
  email: string;
@@ -56,6 +60,15 @@ export interface User extends Document {
56
60
  ssoId?: string;
57
61
  appSort?: string;
58
62
  }
63
+ export interface UserBindings extends Document {
64
+ firstName?: string;
65
+ lastName?: string;
66
+ email?: string;
67
+ status?: string;
68
+ roleId?: string | null;
69
+ globalId?: string;
70
+ userId?: string;
71
+ }
59
72
  export declare enum UserStatus {
60
73
  ACTIVE = "active",
61
74
  INACTIVE = "inactive"
package/dist/index.js CHANGED
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ AIOperationEnum: () => AIOperationEnum,
23
24
  APP_QUOTA_NAMES: () => APP_QUOTA_NAMES,
24
25
  AUDIT_LOG_TYPE: () => AUDIT_LOG_TYPE,
25
26
  AccountSSOProvider: () => AccountSSOProvider,
@@ -86,6 +87,7 @@ __export(src_exports, {
86
87
  LockName: () => LockName,
87
88
  LockType: () => LockType,
88
89
  LogicalOperator: () => LogicalOperator,
90
+ LoginMethod: () => LoginMethod,
89
91
  LoopStepType: () => LoopStepType,
90
92
  MaintenanceType: () => MaintenanceType,
91
93
  MigrationName: () => MigrationName,
@@ -93,6 +95,7 @@ __export(src_exports, {
93
95
  MonthlyQuotaName: () => MonthlyQuotaName,
94
96
  NumericTypes: () => NumericTypes,
95
97
  Operation: () => Operation,
98
+ OperationFieldTypeEnum: () => OperationFieldTypeEnum,
96
99
  PASSWORD_REPLACEMENT: () => PASSWORD_REPLACEMENT,
97
100
  PLUGIN_TYPE_ARR: () => PLUGIN_TYPE_ARR,
98
101
  PermissionLevel: () => PermissionLevel,
@@ -166,6 +169,24 @@ __export(src_exports, {
166
169
  });
167
170
  module.exports = __toCommonJS(src_exports);
168
171
 
172
+ // src/sdk/ai.ts
173
+ var AIOperationEnum = /* @__PURE__ */ ((AIOperationEnum2) => {
174
+ AIOperationEnum2["SUMMARISE_TEXT"] = "SUMMARISE_TEXT";
175
+ AIOperationEnum2["CLEAN_DATA"] = "CLEAN_DATA";
176
+ AIOperationEnum2["TRANSLATE"] = "TRANSLATE";
177
+ AIOperationEnum2["CATEGORISE_TEXT"] = "CATEGORISE_TEXT";
178
+ AIOperationEnum2["SENTIMENT_ANALYSIS"] = "SENTIMENT_ANALYSIS";
179
+ AIOperationEnum2["PROMPT"] = "PROMPT";
180
+ AIOperationEnum2["SEARCH_WEB"] = "SEARCH_WEB";
181
+ return AIOperationEnum2;
182
+ })(AIOperationEnum || {});
183
+ var OperationFieldTypeEnum = /* @__PURE__ */ ((OperationFieldTypeEnum2) => {
184
+ OperationFieldTypeEnum2["MULTI_COLUMN"] = "columns";
185
+ OperationFieldTypeEnum2["COLUMN"] = "column";
186
+ OperationFieldTypeEnum2["BINDABLE_TEXT"] = "prompt";
187
+ return OperationFieldTypeEnum2;
188
+ })(OperationFieldTypeEnum || {});
189
+
169
190
  // src/sdk/hosting.ts
170
191
  var Hosting = /* @__PURE__ */ ((Hosting2) => {
171
192
  Hosting2["CLOUD"] = "cloud";
@@ -744,6 +765,13 @@ var SqlClient = /* @__PURE__ */ ((SqlClient2) => {
744
765
  return SqlClient2;
745
766
  })(SqlClient || {});
746
767
 
768
+ // src/sdk/koa.ts
769
+ var LoginMethod = /* @__PURE__ */ ((LoginMethod2) => {
770
+ LoginMethod2["API_KEY"] = "api_key";
771
+ LoginMethod2["COOKIE"] = "cookie";
772
+ return LoginMethod2;
773
+ })(LoginMethod || {});
774
+
747
775
  // src/sdk/locks.ts
748
776
  var LockType = /* @__PURE__ */ ((LockType2) => {
749
777
  LockType2["TRY_ONCE"] = "try_once";
@@ -796,9 +824,13 @@ var TenantResolutionStrategy = /* @__PURE__ */ ((TenantResolutionStrategy2) => {
796
824
  var FeatureFlag = /* @__PURE__ */ ((FeatureFlag2) => {
797
825
  FeatureFlag2["PER_CREATOR_PER_USER_PRICE"] = "PER_CREATOR_PER_USER_PRICE";
798
826
  FeatureFlag2["PER_CREATOR_PER_USER_PRICE_ALERT"] = "PER_CREATOR_PER_USER_PRICE_ALERT";
827
+ FeatureFlag2["AUTOMATION_BRANCHING"] = "AUTOMATION_BRANCHING";
828
+ FeatureFlag2["SQS"] = "SQS";
799
829
  FeatureFlag2["AI_CUSTOM_CONFIGS"] = "AI_CUSTOM_CONFIGS";
830
+ FeatureFlag2["DEFAULT_VALUES"] = "DEFAULT_VALUES";
800
831
  FeatureFlag2["ENRICHED_RELATIONSHIPS"] = "ENRICHED_RELATIONSHIPS";
801
832
  FeatureFlag2["TABLES_DEFAULT_ADMIN"] = "TABLES_DEFAULT_ADMIN";
833
+ FeatureFlag2["BUDIBASE_AI"] = "BUDIBASE_AI";
802
834
  return FeatureFlag2;
803
835
  })(FeatureFlag || {});
804
836
 
@@ -1059,6 +1091,7 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
1059
1091
  FieldType2["LINK"] = "link";
1060
1092
  FieldType2["FORMULA"] = "formula";
1061
1093
  FieldType2["AUTO"] = "auto";
1094
+ FieldType2["AI"] = "ai";
1062
1095
  FieldType2["JSON"] = "json";
1063
1096
  FieldType2["INTERNAL"] = "internal";
1064
1097
  FieldType2["BARCODEQR"] = "barcodeqr";
@@ -1119,6 +1152,7 @@ var JsonFieldSubType = /* @__PURE__ */ ((JsonFieldSubType3) => {
1119
1152
  var FormulaType = /* @__PURE__ */ ((FormulaType3) => {
1120
1153
  FormulaType3["STATIC"] = "static";
1121
1154
  FormulaType3["DYNAMIC"] = "dynamic";
1155
+ FormulaType3["AI"] = "ai";
1122
1156
  return FormulaType3;
1123
1157
  })(FormulaType || {});
1124
1158
  var BBReferenceFieldSubType = /* @__PURE__ */ ((BBReferenceFieldSubType3) => {
@@ -1416,6 +1450,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1416
1450
  })(MaintenanceType || {});
1417
1451
  // Annotate the CommonJS export names for ESM import in node:
1418
1452
  0 && (module.exports = {
1453
+ AIOperationEnum,
1419
1454
  APP_QUOTA_NAMES,
1420
1455
  AUDIT_LOG_TYPE,
1421
1456
  AccountSSOProvider,
@@ -1482,6 +1517,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1482
1517
  LockName,
1483
1518
  LockType,
1484
1519
  LogicalOperator,
1520
+ LoginMethod,
1485
1521
  LoopStepType,
1486
1522
  MaintenanceType,
1487
1523
  MigrationName,
@@ -1489,6 +1525,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1489
1525
  MonthlyQuotaName,
1490
1526
  NumericTypes,
1491
1527
  Operation,
1528
+ OperationFieldTypeEnum,
1492
1529
  PASSWORD_REPLACEMENT,
1493
1530
  PLUGIN_TYPE_ARR,
1494
1531
  PermissionLevel,