@budibase/types 2.25.0 → 2.26.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,4 +1,4 @@
1
- import { FieldSchema, Row, Table, TableRequest, View, ViewV2Enriched } from "../../../documents";
1
+ import { Row, Table, TableRequest, View, ViewV2Enriched } from "../../../documents";
2
2
  export type TableViewsResponse = {
3
3
  [key: string]: View | ViewV2Enriched;
4
4
  };
@@ -18,8 +18,8 @@ export interface BulkImportResponse {
18
18
  message: string;
19
19
  }
20
20
  export interface MigrateRequest {
21
- oldColumn: FieldSchema;
22
- newColumn: FieldSchema;
21
+ oldColumn: string;
22
+ newColumn: string;
23
23
  }
24
24
  export interface MigrateResponse {
25
25
  message: string;
@@ -99,13 +99,17 @@ export declare enum FieldType {
99
99
  */
100
100
  BIGINT = "bigint",
101
101
  /**
102
- * a JSON type, called User within Budibase. This type is used to represent a link to an internal Budibase
102
+ * a JSON type, called Users within Budibase. It will hold an array of strings. This type is used to represent a link to an internal Budibase
103
103
  * resource, like a user or group, today only users are supported. This type will be represented as an
104
104
  * array of internal resource IDs (e.g. user IDs) within the row - this ID list will be enriched with
105
105
  * the full resources when rows are returned from the API. The full resources can be input to the API, or
106
106
  * an array of resource IDs, the API will squash these down and validate them before saving the row.
107
107
  */
108
- BB_REFERENCE = "bb_reference"
108
+ BB_REFERENCE = "bb_reference",
109
+ /**
110
+ * a string type, called User within Budibase. Same logic as `bb_reference`, storing a single id as string instead of an array
111
+ */
112
+ BB_REFERENCE_SINGLE = "bb_reference_single"
109
113
  }
110
114
  export interface RowAttachment {
111
115
  size: number;
@@ -1,3 +1,4 @@
1
+ import { FieldType } from "../row";
1
2
  export declare enum RelationshipType {
2
3
  ONE_TO_MANY = "one-to-many",
3
4
  MANY_TO_ONE = "many-to-one",
@@ -22,5 +23,7 @@ export declare enum FormulaType {
22
23
  }
23
24
  export declare enum BBReferenceFieldSubType {
24
25
  USER = "user",
26
+ /** @deprecated this should not be used anymore, left here in order to support the existing usages */
25
27
  USERS = "users"
26
28
  }
29
+ export type SupportedSqlTypes = FieldType.STRING | FieldType.BARCODEQR | FieldType.LONGFORM | FieldType.OPTIONS | FieldType.DATETIME | FieldType.NUMBER | FieldType.BOOLEAN | FieldType.FORMULA | FieldType.BIGINT | FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE | FieldType.LINK | FieldType.ARRAY;
@@ -74,9 +74,13 @@ export interface FormulaFieldMetadata extends BaseFieldSchema {
74
74
  }
75
75
  export interface BBReferenceFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
76
76
  type: FieldType.BB_REFERENCE;
77
- subtype: BBReferenceFieldSubType.USER | BBReferenceFieldSubType.USERS;
77
+ subtype: BBReferenceFieldSubType;
78
78
  relationshipType?: RelationshipType;
79
79
  }
80
+ export interface BBReferenceSingleFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
81
+ type: FieldType.BB_REFERENCE_SINGLE;
82
+ subtype: Exclude<BBReferenceFieldSubType, BBReferenceFieldSubType.USERS>;
83
+ }
80
84
  export interface AttachmentFieldMetadata extends BaseFieldSchema {
81
85
  type: FieldType.ATTACHMENTS;
82
86
  }
@@ -112,9 +116,9 @@ interface BaseFieldSchema extends UIFieldMetadata {
112
116
  subtype?: never;
113
117
  }
114
118
  interface OtherFieldMetadata extends BaseFieldSchema {
115
- type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE | FieldType.ATTACHMENTS>;
119
+ type: Exclude<FieldType, FieldType.DATETIME | FieldType.LINK | FieldType.AUTO | FieldType.FORMULA | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE | FieldType.BB_REFERENCE_SINGLE | FieldType.ATTACHMENTS>;
116
120
  }
117
- export type FieldSchema = OtherFieldMetadata | DateFieldMetadata | RelationshipFieldMetadata | AutoColumnFieldMetadata | FormulaFieldMetadata | NumberFieldMetadata | LongFormFieldMetadata | BBReferenceFieldMetadata | JsonFieldMetadata | AttachmentFieldMetadata;
121
+ export type FieldSchema = OtherFieldMetadata | DateFieldMetadata | RelationshipFieldMetadata | AutoColumnFieldMetadata | FormulaFieldMetadata | NumberFieldMetadata | LongFormFieldMetadata | BBReferenceFieldMetadata | JsonFieldMetadata | AttachmentFieldMetadata | BBReferenceSingleFieldMetadata;
118
122
  export interface TableSchema {
119
123
  [key: string]: FieldSchema;
120
124
  }
@@ -122,6 +126,4 @@ export declare function isRelationshipField(field: FieldSchema): field is Relati
122
126
  export declare function isManyToMany(field: RelationshipFieldMetadata): field is ManyToManyRelationshipFieldMetadata;
123
127
  export declare function isOneToMany(field: RelationshipFieldMetadata): field is OneToManyRelationshipFieldMetadata;
124
128
  export declare function isManyToOne(field: RelationshipFieldMetadata): field is ManyToOneRelationshipFieldMetadata;
125
- export declare function isBBReferenceField(field: FieldSchema): field is BBReferenceFieldMetadata;
126
- export declare function isAttachmentField(field: FieldSchema): field is AttachmentFieldMetadata;
127
129
  export {};
package/dist/index.js CHANGED
@@ -118,8 +118,6 @@ __export(src_exports, {
118
118
  VirtualDocumentType: () => VirtualDocumentType,
119
119
  WebhookActionType: () => WebhookActionType,
120
120
  isAppBackupMetadata: () => isAppBackupMetadata,
121
- isAttachmentField: () => isAttachmentField,
122
- isBBReferenceField: () => isBBReferenceField,
123
121
  isCloudAccount: () => isCloudAccount,
124
122
  isConstantQuota: () => isConstantQuota,
125
123
  isCreatePasswordAccount: () => isCreatePasswordAccount,
@@ -954,6 +952,7 @@ var FieldType = /* @__PURE__ */ ((FieldType2) => {
954
952
  FieldType2["BARCODEQR"] = "barcodeqr";
955
953
  FieldType2["BIGINT"] = "bigint";
956
954
  FieldType2["BB_REFERENCE"] = "bb_reference";
955
+ FieldType2["BB_REFERENCE_SINGLE"] = "bb_reference_single";
957
956
  return FieldType2;
958
957
  })(FieldType || {});
959
958
 
@@ -1004,12 +1003,6 @@ function isOneToMany(field) {
1004
1003
  function isManyToOne(field) {
1005
1004
  return field.relationshipType === "many-to-one" /* MANY_TO_ONE */;
1006
1005
  }
1007
- function isBBReferenceField(field) {
1008
- return field.type === "bb_reference" /* BB_REFERENCE */;
1009
- }
1010
- function isAttachmentField(field) {
1011
- return field.type === "attachment" /* ATTACHMENTS */;
1012
- }
1013
1006
 
1014
1007
  // src/documents/app/view.ts
1015
1008
  var ViewCalculation = /* @__PURE__ */ ((ViewCalculation2) => {
@@ -1349,8 +1342,6 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1349
1342
  VirtualDocumentType,
1350
1343
  WebhookActionType,
1351
1344
  isAppBackupMetadata,
1352
- isAttachmentField,
1353
- isBBReferenceField,
1354
1345
  isCloudAccount,
1355
1346
  isConstantQuota,
1356
1347
  isCreatePasswordAccount,