Merge pull request #15705 from Budibase/types/check-types-in-client

Check types in client
This commit is contained in:
Adria Navarro 2025-03-11 12:12:32 +01:00 committed by GitHub
commit 480db7a884
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 30 additions and 19 deletions

View File

@ -18,7 +18,6 @@
"eslint-plugin-jest": "28.9.0",
"eslint-plugin-local-rules": "3.0.2",
"eslint-plugin-svelte": "2.46.1",
"svelte-preprocess": "^6.0.3",
"husky": "^8.0.3",
"kill-port": "^1.6.1",
"lerna": "7.4.2",
@ -29,7 +28,9 @@
"prettier-plugin-svelte": "^2.3.0",
"proper-lockfile": "^4.1.2",
"svelte": "4.2.19",
"svelte-check": "^4.1.5",
"svelte-eslint-parser": "0.43.0",
"svelte-preprocess": "^6.0.3",
"typescript": "5.7.2",
"typescript-eslint": "8.17.0",
"yargs": "^17.7.2"

View File

@ -100,7 +100,6 @@
"jest": "29.7.0",
"jsdom": "^21.1.1",
"resize-observer-polyfill": "^1.5.1",
"svelte-check": "^4.1.0",
"svelte-jester": "^1.3.2",
"vite": "^4.5.0",
"vite-plugin-static-copy": "^0.17.0",

View File

@ -16,7 +16,8 @@
},
"scripts": {
"build": "vite build",
"dev": "vite build --watch --mode=dev"
"dev": "vite build --watch --mode=dev",
"check:types": "yarn svelte-check"
},
"dependencies": {
"@budibase/bbui": "*",

View File

@ -10,7 +10,9 @@ export const API = createAPIClient({
// Attach client specific headers
attachHeaders: headers => {
// Attach app ID header
headers["x-budibase-app-id"] = window["##BUDIBASE_APP_ID##"]
if (window["##BUDIBASE_APP_ID##"]) {
headers["x-budibase-app-id"] = window["##BUDIBASE_APP_ID##"]
}
// Attach client header if not inside the builder preview
if (!window["##BUDIBASE_IN_BUILDER##"]) {

View File

@ -141,6 +141,7 @@
var(--spectrum-global-dimension-size-300)
);
display: -webkit-box;
line-clamp: 2;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;

View File

@ -7,6 +7,7 @@
import { isGridEvent } from "@/utils/grid"
import { DNDPlaceholderID } from "@/constants"
import type { Component } from "@budibase/types"
import { DropPosition } from "@budibase/types"
type ChildCoords = {
placeholder: boolean
@ -287,7 +288,7 @@
}
// Convert parent + index into target + mode
let legacyDropTarget, legacyDropMode
let legacyDropTarget, legacyDropMode: DropPosition
const parent: Component | null = findComponentById(
get(screenStore).activeScreen?.props,
drop.parent
@ -309,16 +310,16 @@
// Use inside if no existing children
if (!children?.length) {
legacyDropTarget = parent._id
legacyDropMode = "inside"
legacyDropMode = DropPosition.INSIDE
} else if (drop.index === 0) {
legacyDropTarget = children[0]?._id
legacyDropMode = "above"
legacyDropMode = DropPosition.ABOVE
} else {
legacyDropTarget = children[drop.index - 1]?._id
legacyDropMode = "below"
legacyDropMode = DropPosition.BELOW
}
if (legacyDropTarget && legacyDropMode) {
if (legacyDropTarget && legacyDropMode && source.id) {
dropping = true
await builderStore.actions.moveComponent(
source.id,

View File

@ -17,6 +17,7 @@
Devices,
GridDragMode,
} from "@/utils/grid"
import { DropPosition } from "@budibase/types"
type GridDragSide =
| "top"
@ -222,7 +223,7 @@
// If holding ctrl/cmd then leave behind a duplicate of this component
if (mode === GridDragMode.Move && (e.ctrlKey || e.metaKey)) {
builderStore.actions.duplicateComponent(id, "above", false)
builderStore.actions.duplicateComponent(id, DropPosition.ABOVE, false)
}
// Find grid parent and read from DOM

View File

@ -115,7 +115,7 @@ const createBuilderStore = () => {
component: string,
parent: string,
index: number,
props: Record<string, any>
props?: Record<string, any>
) => {
eventStore.actions.dispatchEvent("drop-new-component", {
component,

View File

@ -7,6 +7,7 @@
"target": "ESNext",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"skipLibCheck": true,
"paths": {
"@budibase/*": [
"../*/src/index.ts",

View File

@ -16,8 +16,5 @@
"lodash": "4.17.21",
"shortid": "2.2.15",
"socket.io-client": "^4.7.5"
},
"devDependencies": {
"svelte-check": "^4.1.0"
}
}

View File

@ -1,6 +1,6 @@
export { createAPIClient } from "./api"
export type { APIClient } from "./api"
export { fetchData, DataFetchMap } from "./fetch"
export { fetchData, DataFetchMap, type DataFetchType } from "./fetch"
export * as Constants from "./constants"
export * from "./stores"
export * from "./utils"

View File

@ -0,0 +1,7 @@
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"
const config = {
preprocess: vitePreprocess(),
}
export default config

View File

@ -20499,10 +20499,10 @@ supports-preserve-symlinks-flag@^1.0.0:
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
svelte-check@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/svelte-check/-/svelte-check-4.1.0.tgz#4389c1c88aa24f3d06fe0df94f9075a55017256d"
integrity sha512-AflEZYqI578KuDZcpcorPSf597LStxlkN7XqXi38u09zlHODVKd7c+7OuubGzbhgGRUqNTdQCZ+Ga96iRXEf2g==
svelte-check@^4.1.5:
version "4.1.5"
resolved "https://registry.yarnpkg.com/svelte-check/-/svelte-check-4.1.5.tgz#afdb3f8050c123064124d5aa7821365c7befa7a4"
integrity sha512-Gb0T2IqBNe1tLB9EB1Qh+LOe+JB8wt2/rNBDGvkxQVvk8vNeAoG+vZgFB/3P5+zC7RWlyBlzm9dVjZFph/maIg==
dependencies:
"@jridgewell/trace-mapping" "^0.3.25"
chokidar "^4.0.1"