From a18264332c2d3d34e437f84195a8fc583dc9a71c Mon Sep 17 00:00:00 2001 From: jvcalderon Date: Thu, 25 Apr 2024 10:50:55 +0200 Subject: [PATCH 01/17] Lint --- yarn.lock | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/yarn.lock b/yarn.lock index 30b275c434..8580ef9657 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5930,6 +5930,14 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== +"@types/readable-stream@^4.0.0": + version "4.0.11" + resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.11.tgz#684f1e947c90cb6a8ad3904523d650bb66cdbb84" + integrity sha512-R3eUMUTTKoIoaz7UpYLxvZCrOmCRPRbAmoDDHKcimTEySltaJhF8hLzj4+EzyDifiX5eK6oDQGSfmNnXjxZzYQ== + dependencies: + "@types/node" "*" + safe-buffer "~5.1.1" + "@types/readdir-glob@*": version "1.1.5" resolved "https://registry.yarnpkg.com/@types/readdir-glob/-/readdir-glob-1.1.5.tgz#21a4a98898fc606cb568ad815f2a0eedc24d412a" From c79ea9b0678f8fdb0a03f4dc6a88d674b356d7c0 Mon Sep 17 00:00:00 2001 From: jvcalderon Date: Thu, 25 Apr 2024 12:01:45 +0200 Subject: [PATCH 02/17] Adds ENTERPRISE_BASIC_TRIAL --- packages/types/src/sdk/licensing/plan.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/types/src/sdk/licensing/plan.ts b/packages/types/src/sdk/licensing/plan.ts index 016caf8c38..af682cbad1 100644 --- a/packages/types/src/sdk/licensing/plan.ts +++ b/packages/types/src/sdk/licensing/plan.ts @@ -11,6 +11,7 @@ export enum PlanType { /** @deprecated */ BUSINESS = "business", ENTERPRISE_BASIC = "enterprise_basic", + ENTERPRISE_BASIC_TRIAL = "enterprise_basic_trial", ENTERPRISE = "enterprise", } From d4c0f489c82a2a50ea7bbad33321ec58020423d0 Mon Sep 17 00:00:00 2001 From: jvcalderon Date: Thu, 25 Apr 2024 12:02:23 +0200 Subject: [PATCH 03/17] Update Submodules --- packages/account-portal | 2 +- packages/pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account-portal b/packages/account-portal index c167c331ff..a9508c96ef 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit c167c331ff9b8161fc18e2ecbaaf1ea5815ba964 +Subproject commit a9508c96efb7bf056c3988d9a71e763c6e4a7b83 diff --git a/packages/pro b/packages/pro index dff7b5a9dd..e3e8578a48 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit dff7b5a9dd1fd770f8a48fb8e6df1740be605f18 +Subproject commit e3e8578a480a31365f11fdfbf7b0c383c056f9b4 From 4615d9c61ce8e267fa4dd874150d716e10ba9dad Mon Sep 17 00:00:00 2001 From: jvcalderon Date: Thu, 25 Apr 2024 13:51:52 +0200 Subject: [PATCH 04/17] Restore yarn.lock --- yarn.lock | 8 -------- 1 file changed, 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8580ef9657..30b275c434 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5930,14 +5930,6 @@ resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.4.tgz#cd667bcfdd025213aafb7ca5915a932590acdcdc" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== -"@types/readable-stream@^4.0.0": - version "4.0.11" - resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.11.tgz#684f1e947c90cb6a8ad3904523d650bb66cdbb84" - integrity sha512-R3eUMUTTKoIoaz7UpYLxvZCrOmCRPRbAmoDDHKcimTEySltaJhF8hLzj4+EzyDifiX5eK6oDQGSfmNnXjxZzYQ== - dependencies: - "@types/node" "*" - safe-buffer "~5.1.1" - "@types/readdir-glob@*": version "1.1.5" resolved "https://registry.yarnpkg.com/@types/readdir-glob/-/readdir-glob-1.1.5.tgz#21a4a98898fc606cb568ad815f2a0eedc24d412a" From 22a67eb7690c4a2344f5d6c92e3b901a7b7f7392 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 25 Apr 2024 18:43:54 +0100 Subject: [PATCH 05/17] Matching rollup version across all packages, there was a lot of mis-match and I was running into some build issues due to this, getting everything on the same version so that they can all use the same package - this also requires updating all .js extensions to .mjs to correctly support the imports. --- packages/bbui/package.json | 2 +- .../bbui/{rollup.config.js => rollup.config.mjs} | 0 .../{rollup.config.js => rollup.config.mjs} | 0 packages/pro | 2 +- .../sdk/{rollup.config.js => rollup.config.mjs} | 0 packages/string-templates/package.json | 2 +- .../{rollup.config.js => rollup.config.mjs} | 0 yarn.lock | 16 +--------------- 8 files changed, 4 insertions(+), 18 deletions(-) rename packages/bbui/{rollup.config.js => rollup.config.mjs} (100%) rename packages/client/{rollup.config.js => rollup.config.mjs} (100%) rename packages/sdk/{rollup.config.js => rollup.config.mjs} (100%) rename packages/string-templates/{rollup.config.js => rollup.config.mjs} (100%) diff --git a/packages/bbui/package.json b/packages/bbui/package.json index a1baa2a38b..2dbce9668d 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -21,7 +21,7 @@ "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^11.2.1", "postcss": "^8.2.9", - "rollup": "^2.45.2", + "rollup": "^4.9.6", "rollup-plugin-postcss": "^4.0.0", "rollup-plugin-svelte": "^7.1.0", "rollup-plugin-terser": "^7.0.2" diff --git a/packages/bbui/rollup.config.js b/packages/bbui/rollup.config.mjs similarity index 100% rename from packages/bbui/rollup.config.js rename to packages/bbui/rollup.config.mjs diff --git a/packages/client/rollup.config.js b/packages/client/rollup.config.mjs similarity index 100% rename from packages/client/rollup.config.js rename to packages/client/rollup.config.mjs diff --git a/packages/pro b/packages/pro index dff7b5a9dd..1dccc9edf1 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit dff7b5a9dd1fd770f8a48fb8e6df1740be605f18 +Subproject commit 1dccc9edf111d5880548aed2294219eccce37aea diff --git a/packages/sdk/rollup.config.js b/packages/sdk/rollup.config.mjs similarity index 100% rename from packages/sdk/rollup.config.js rename to packages/sdk/rollup.config.mjs diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 8cf8d92692..5d99313b39 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -38,7 +38,7 @@ "doctrine": "^3.0.0", "jest": "29.7.0", "marked": "^4.0.10", - "rollup": "^2.36.2", + "rollup": "^4.9.6", "rollup-plugin-inject-process-env": "^1.3.1", "rollup-plugin-node-builtins": "^2.1.2", "rollup-plugin-node-globals": "^1.4.0", diff --git a/packages/string-templates/rollup.config.js b/packages/string-templates/rollup.config.mjs similarity index 100% rename from packages/string-templates/rollup.config.js rename to packages/string-templates/rollup.config.mjs diff --git a/yarn.lock b/yarn.lock index 727a927df4..8fb958b76b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11590,7 +11590,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.1, fsevents@~2.3.2: +fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -19714,20 +19714,6 @@ rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.8.1, dependencies: estree-walker "^0.6.1" -rollup@2.45.2: - version "2.45.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.45.2.tgz#8fb85917c9f35605720e92328f3ccbfba6f78b48" - integrity sha512-kRRU7wXzFHUzBIv0GfoFFIN3m9oteY4uAsKllIpQDId5cfnkWF2J130l+27dzDju0E6MScKiV0ZM5Bw8m4blYQ== - optionalDependencies: - fsevents "~2.3.1" - -rollup@^2.36.2, rollup@^2.45.2: - version "2.79.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7" - integrity sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw== - optionalDependencies: - fsevents "~2.3.2" - rollup@^3.27.1: version "3.29.4" resolved "https://registry.yarnpkg.com/rollup/-/rollup-3.29.4.tgz#4d70c0f9834146df8705bfb69a9a19c9e1109981" From fe68abe6de6c2d5eeb650eae5ce58953672b6d47 Mon Sep 17 00:00:00 2001 From: jvcalderon Date: Fri, 26 Apr 2024 08:55:49 +0200 Subject: [PATCH 06/17] Upgrade pro and account-portal submodules --- packages/account-portal | 2 +- packages/pro | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account-portal b/packages/account-portal index a9508c96ef..44437254b3 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit a9508c96efb7bf056c3988d9a71e763c6e4a7b83 +Subproject commit 44437254b3340781d8c2af95d9f0bbac0a83b2b7 diff --git a/packages/pro b/packages/pro index e3e8578a48..01bec5657e 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit e3e8578a480a31365f11fdfbf7b0c383c056f9b4 +Subproject commit 01bec5657e0c3c3bb29e883e6ac71258fee8710b From d32623c340dff9014cf9b116aa2cacdc33d5ddff Mon Sep 17 00:00:00 2001 From: jvcalderon Date: Fri, 26 Apr 2024 09:15:36 +0200 Subject: [PATCH 07/17] Restore account portal submodule --- packages/account-portal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-portal b/packages/account-portal index 44437254b3..c167c331ff 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit 44437254b3340781d8c2af95d9f0bbac0a83b2b7 +Subproject commit c167c331ff9b8161fc18e2ecbaaf1ea5815ba964 From 6cf2da794437503c79dbafe9f566db9387ca80bd Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 26 Apr 2024 11:10:13 +0100 Subject: [PATCH 08/17] Pro version to master. --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 7acb40a7b1..5d4ab38fb1 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 7acb40a7b146016571725bd3f272d9587d9a73c5 +Subproject commit 5d4ab38fb197615a5c7bdc14f05f0fccd72766fe From 637f7f514ae69f1ac9a9c39710ce31c27dc4f573 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 26 Apr 2024 12:18:50 +0200 Subject: [PATCH 09/17] Remove FieldTypeSubtypes --- packages/frontend-core/src/constants.js | 6 +++--- packages/server/src/api/routes/tests/row.spec.ts | 6 +++--- .../server/src/sdk/app/rows/search/tests/utils.spec.ts | 6 +++--- .../utilities/rowProcessor/tests/inputProcessing.spec.ts | 8 ++++---- .../utilities/rowProcessor/tests/outputProcessing.spec.ts | 7 +++---- packages/types/src/documents/app/row.ts | 8 -------- 6 files changed, 16 insertions(+), 25 deletions(-) diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 95228c3bdc..2a9b0379f8 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -4,7 +4,7 @@ export { OperatorOptions, SqlNumberTypeRangeMap } from "@budibase/shared-core" export { Feature as Features } from "@budibase/types" import { BpmCorrelationKey } from "@budibase/shared-core" -import { FieldType, FieldTypeSubtypes } from "@budibase/types" +import { FieldType, FieldSubtype } from "@budibase/types" // Cookie names export const Cookies = { @@ -134,7 +134,7 @@ export const TypeIconMap = { [FieldType.USER]: "User", [FieldType.USERS]: "UserGroup", [FieldType.BB_REFERENCE]: { - [FieldTypeSubtypes.BB_REFERENCE.USER]: "User", - [FieldTypeSubtypes.BB_REFERENCE.USERS]: "UserGroup", + [FieldSubtype.USER]: "User", + [FieldSubtype.USERS]: "UserGroup", }, } diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 8e1014f825..f2ace8f795 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -13,7 +13,7 @@ import { DeleteRow, FieldSchema, FieldType, - FieldTypeSubtypes, + FieldSubtype, FormulaType, INTERNAL_TABLE_SOURCE_ID, NumberFieldMetadata, @@ -1015,12 +1015,12 @@ describe.each([ user: { name: "user", type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, }, users: { name: "users", type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USERS, + subtype: FieldSubtype.USERS, }, }), () => config.createUser(), diff --git a/packages/server/src/sdk/app/rows/search/tests/utils.spec.ts b/packages/server/src/sdk/app/rows/search/tests/utils.spec.ts index bf7799402d..413b5e28cf 100644 --- a/packages/server/src/sdk/app/rows/search/tests/utils.spec.ts +++ b/packages/server/src/sdk/app/rows/search/tests/utils.spec.ts @@ -2,7 +2,7 @@ import { searchInputMapping } from "../utils" import { db as dbCore } from "@budibase/backend-core" import { FieldType, - FieldTypeSubtypes, + FieldSubtype, INTERNAL_TABLE_SOURCE_ID, RowSearchParams, Table, @@ -20,7 +20,7 @@ const tableWithUserCol: Table = { user: { name: "user", type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, }, }, } @@ -35,7 +35,7 @@ const tableWithUsersCol: Table = { user: { name: "user", type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USERS, + subtype: FieldSubtype.USERS, }, }, } diff --git a/packages/server/src/utilities/rowProcessor/tests/inputProcessing.spec.ts b/packages/server/src/utilities/rowProcessor/tests/inputProcessing.spec.ts index 859a203133..47f930803b 100644 --- a/packages/server/src/utilities/rowProcessor/tests/inputProcessing.spec.ts +++ b/packages/server/src/utilities/rowProcessor/tests/inputProcessing.spec.ts @@ -2,7 +2,7 @@ import { inputProcessing } from ".." import { generator, structures } from "@budibase/backend-core/tests" import { FieldType, - FieldTypeSubtypes, + FieldSubtype, INTERNAL_TABLE_SOURCE_ID, Table, TableSourceType, @@ -39,7 +39,7 @@ describe("rowProcessor - inputProcessing", () => { }, user: { type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, name: "user", constraints: { presence: true, @@ -93,7 +93,7 @@ describe("rowProcessor - inputProcessing", () => { }, user: { type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, name: "user", constraints: { presence: false, @@ -135,7 +135,7 @@ describe("rowProcessor - inputProcessing", () => { }, user: { type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, name: "user", constraints: { presence: false, diff --git a/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts b/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts index 74d55aff36..7a7c319bb8 100644 --- a/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts +++ b/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts @@ -1,7 +1,6 @@ import { - FieldSubtype, FieldType, - FieldTypeSubtypes, + FieldSubtype, INTERNAL_TABLE_SOURCE_ID, RowAttachment, Table, @@ -42,7 +41,7 @@ describe("rowProcessor - outputProcessing", () => { }, user: { type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, name: "user", constraints: { presence: false, @@ -175,7 +174,7 @@ describe("rowProcessor - outputProcessing", () => { }, user: { type: FieldType.BB_REFERENCE, - subtype: FieldTypeSubtypes.BB_REFERENCE.USER, + subtype: FieldSubtype.USER, name: "user", constraints: { presence: false, diff --git a/packages/types/src/documents/app/row.ts b/packages/types/src/documents/app/row.ts index 865ab4ba64..b98bd8dc32 100644 --- a/packages/types/src/documents/app/row.ts +++ b/packages/types/src/documents/app/row.ts @@ -129,11 +129,3 @@ export enum FieldSubtype { USER = "user", USERS = "users", } - -// The 'as' are required for typescript not to type the outputs as generic FieldSubtype -export const FieldTypeSubtypes = { - BB_REFERENCE: { - USER: FieldSubtype.USER as FieldSubtype.USER, - USERS: FieldSubtype.USERS as FieldSubtype.USERS, - }, -} From b1b5b49687b2773f404c0ac61ef0a84622424a4f Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 26 Apr 2024 12:21:53 +0200 Subject: [PATCH 10/17] Move and rename BBReferenceFieldSubType --- packages/types/src/documents/app/row.ts | 5 ----- packages/types/src/documents/app/table/constants.ts | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/types/src/documents/app/row.ts b/packages/types/src/documents/app/row.ts index b98bd8dc32..d6a9bb7842 100644 --- a/packages/types/src/documents/app/row.ts +++ b/packages/types/src/documents/app/row.ts @@ -124,8 +124,3 @@ export interface Row extends Document { _viewId?: string [key: string]: any } - -export enum FieldSubtype { - USER = "user", - USERS = "users", -} diff --git a/packages/types/src/documents/app/table/constants.ts b/packages/types/src/documents/app/table/constants.ts index 1d9d14695a..ddf8b5e6ea 100644 --- a/packages/types/src/documents/app/table/constants.ts +++ b/packages/types/src/documents/app/table/constants.ts @@ -24,3 +24,8 @@ export enum FormulaType { STATIC = "static", DYNAMIC = "dynamic", } + +export enum BBReferenceFieldSubType { + USER = "user", + USERS = "users", +} From 1aad2ee6d29b5ab7910662621af0f5f28cfa542a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 26 Apr 2024 12:23:11 +0200 Subject: [PATCH 11/17] Fix after renames --- .../DataTable/modals/CreateEditColumn.svelte | 24 ++++++++----- .../ExistingTableDataImport.svelte | 6 ++-- .../builder/src/constants/backend/index.js | 6 ++-- .../grid/cells/BBReferenceCell.svelte | 9 +++-- .../grid/controls/MigrationModal.svelte | 10 ++++-- packages/frontend-core/src/constants.js | 6 ++-- .../src/api/routes/tests/datasource.spec.ts | 4 +-- .../server/src/api/routes/tests/row.spec.ts | 6 ++-- .../server/src/api/routes/tests/table.spec.ts | 20 +++++------ packages/server/src/integrations/base/sql.ts | 4 +-- .../server/src/integrations/base/sqlTable.ts | 6 ++-- .../sdk/app/rows/search/tests/utils.spec.ts | 6 ++-- .../server/src/sdk/app/rows/search/utils.ts | 6 ++-- .../server/src/sdk/app/tables/migration.ts | 6 ++-- .../rowProcessor/bbReferenceProcessor.ts | 25 ++++++++----- .../src/utilities/rowProcessor/errors.ts | 4 +-- .../tests/bbReferenceProcessor.spec.ts | 35 +++++++++++-------- .../tests/inputProcessing.spec.ts | 8 ++--- .../tests/outputProcessing.spec.ts | 8 ++--- packages/server/src/utilities/schema.ts | 17 +++++---- packages/shared-core/src/filters.ts | 14 +++++--- .../types/src/documents/app/table/schema.ts | 5 +-- 22 files changed, 136 insertions(+), 99 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index d271462f3e..f3ae207cb4 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -29,7 +29,11 @@ import ModalBindableInput from "components/common/bindings/ModalBindableInput.svelte" import { getBindings } from "components/backend/DataTable/formula" import JSONSchemaModal from "./JSONSchemaModal.svelte" - import { FieldType, FieldSubtype, SourceName } from "@budibase/types" + import { + FieldType, + BBReferenceFieldSubType, + SourceName, + } from "@budibase/types" import RelationshipSelector from "components/common/RelationshipSelector.svelte" import { RowUtils } from "@budibase/frontend-core" import ServerBindingPanel from "components/common/bindings/ServerBindingPanel.svelte" @@ -41,8 +45,6 @@ const NUMBER_TYPE = FieldType.NUMBER const JSON_TYPE = FieldType.JSON const DATE_TYPE = FieldType.DATETIME - const USER_TYPE = FieldSubtype.USER - const USERS_TYPE = FieldSubtype.USERS const dispatch = createEventDispatcher() const PROHIBITED_COLUMN_NAMES = ["type", "_id", "_rev", "tableId"] @@ -263,9 +265,9 @@ delete saveColumn.fieldName } if (isUsersColumn(saveColumn)) { - if (saveColumn.subtype === USER_TYPE) { + if (saveColumn.subtype === BBReferenceFieldSubType.USER) { saveColumn.relationshipType = RelationshipType.ONE_TO_MANY - } else if (saveColumn.subtype === USERS_TYPE) { + } else if (saveColumn.subtype === BBReferenceFieldSubType.USERS) { saveColumn.relationshipType = RelationshipType.MANY_TO_MANY } } @@ -375,7 +377,7 @@ const isUsers = editableColumn.type === FieldType.BB_REFERENCE && - editableColumn.subtype === FieldSubtype.USERS + editableColumn.subtype === BBReferenceFieldSubType.USERS if (!externalTable) { return [ @@ -485,7 +487,9 @@ function isUsersColumn(column) { return ( column.type === FieldType.BB_REFERENCE && - [FieldSubtype.USER, FieldSubtype.USERS].includes(column.subtype) + [BBReferenceFieldSubType.USER, BBReferenceFieldSubType.USERS].includes( + column.subtype + ) ) } @@ -688,12 +692,14 @@ > {:else if isUsersColumn(editableColumn) && datasource?.source !== SourceName.GOOGLE_SHEETS} handleTypeChange( makeFieldId( FieldType.BB_REFERENCE, - e.detail ? FieldSubtype.USERS : FieldSubtype.USER + e.detail + ? BBReferenceFieldSubType.USERS + : BBReferenceFieldSubType.USER ) )} disabled={!isCreating} diff --git a/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte index 6901503071..b7fa243c07 100644 --- a/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte @@ -1,5 +1,5 @@