Skip to content

Commit b669941

Browse files
authored
Merge branch 'master' into feature/automation-state-block
2 parents be620a3 + 995bdde commit b669941

File tree

39 files changed

+338
-213
lines changed

39 files changed

+338
-213
lines changed

.prettierignore

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,12 @@ packages/builder/.routify
1010
packages/sdk/sdk
1111
packages/pro/coverage
1212
**/*.ivm.bundle.js
13-
!**/bson-polyfills.ivm.bundle.js
13+
!**/bson-polyfills.ivm.bundle.js
14+
charts/
15+
**/*.hbs
16+
packages/worker/src/constants/templates/tests/
17+
.github
18+
.vscode
19+
examples
20+
hosting
21+
i18n

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "3.14.1",
3+
"version": "3.15.0",
44
"npmClient": "yarn",
55
"concurrency": 20,
66
"command": {

packages/backend-core/src/sql/sql.ts

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ function wrap(value: string, quoteChar = '"'): string {
109109
return `${quoteChar}${escapeQuotes(value, quoteChar)}${quoteChar}`
110110
}
111111

112-
function stringifyArray(value: any[], quoteStyle = '"'): string {
113-
for (let i in value) {
112+
function stringifyArray(value: unknown[], quoteStyle = '"'): string {
113+
for (const i in value) {
114114
if (typeof value[i] === "string") {
115115
value[i] = wrap(value[i], quoteStyle)
116116
}
@@ -162,6 +162,12 @@ class InternalBuilder {
162162

163163
// states the various situations in which we need a full mapped select statement
164164
private readonly SPECIAL_SELECT_CASES = {
165+
POSTGRES_ARRAY: (field: FieldSchema | undefined) => {
166+
return (
167+
this.client === SqlClient.POSTGRES &&
168+
field?.externalType?.toLowerCase() === "array"
169+
)
170+
},
165171
POSTGRES_MONEY: (field: FieldSchema | undefined) => {
166172
return (
167173
this.client === SqlClient.POSTGRES &&
@@ -233,11 +239,6 @@ class InternalBuilder {
233239
return key.map(part => this.quote(part)).join(".")
234240
}
235241

236-
private quotedValue(value: string): string {
237-
const formatter = this.knexClient.formatter(this.knexClient.queryBuilder())
238-
return formatter.wrap(value, false)
239-
}
240-
241242
private castIntToString(identifier: string | Knex.Raw): Knex.Raw {
242243
switch (this.client) {
243244
case SqlClient.ORACLE: {
@@ -409,6 +410,10 @@ class InternalBuilder {
409410
return JSON.stringify(input)
410411
}
411412

413+
if (this.SPECIAL_SELECT_CASES.POSTGRES_ARRAY(schema)) {
414+
return `{${input}}`
415+
}
416+
412417
if (
413418
this.client === SqlClient.ORACLE &&
414419
schema.type === FieldType.DATETIME &&
@@ -766,15 +771,33 @@ class InternalBuilder {
766771
if (this.client === SqlClient.POSTGRES) {
767772
iterate(mode, ArrayOperator.CONTAINS, (q, key, value) => {
768773
q = addModifiers(q)
774+
const schema = this.getFieldSchema(key)
775+
let cast = "::jsonb"
776+
if (this.SPECIAL_SELECT_CASES.POSTGRES_ARRAY(schema)) {
777+
cast = ""
778+
const values = (value as string[]).map(value =>
779+
value.substring(1, value.length - 1)
780+
)
781+
value = `{${values}}`
782+
}
769783
if (any) {
770-
return q.whereRaw(`COALESCE(??::jsonb \\?| array??, FALSE)`, [
771-
this.rawQuotedIdentifier(key),
772-
this.knex.raw(stringifyArray(value, "'")),
773-
])
784+
return q.whereRaw(
785+
cast
786+
? `COALESCE(??::jsonb \\?| array??, FALSE)`
787+
: `COALESCE(?? && '??', FALSE)`,
788+
[
789+
this.rawQuotedIdentifier(key),
790+
cast
791+
? this.knex.raw(stringifyArray(value, "'"))
792+
: this.knex.raw(value),
793+
]
794+
)
774795
} else {
775-
return q.whereRaw(`COALESCE(??::jsonb @> '??', FALSE)`, [
796+
return q.whereRaw(`COALESCE(??${cast} @> '??', FALSE)`, [
776797
this.rawQuotedIdentifier(key),
777-
this.knex.raw(stringifyArray(value)),
798+
cast
799+
? this.knex.raw(stringifyArray(value))
800+
: this.knex.raw(value),
778801
])
779802
}
780803
})

packages/bbui/src/Icon/Icon.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { TooltipPosition, TooltipType } from "../constants"
44
import InnerIcon from "./InnerIcon.svelte"
55
6-
export let size: "XS" | "S" | "M" | "L" | "XL" | "XXL" | "XXXL" = "M"
6+
export let size: "XXS" | "XS" | "S" | "M" | "L" | "XL" | "XXL" | "XXXL" = "M"
77
export let name: string = "plus"
88
export let hidden: boolean = false
99
export let hoverable: boolean = false

packages/bbui/src/Icon/InnerIcon.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { getPhosphorIcon } from "../helpers"
33
4-
export let size: "XS" | "S" | "M" | "L" | "XL" | "XXL" | "XXXL" = "M"
4+
export let size: "XXS" | "XS" | "S" | "M" | "L" | "XL" | "XXL" | "XXXL" = "M"
55
export let name: string = "plus"
66
export let hidden: boolean = false
77
export let hoverable: boolean = false
@@ -12,6 +12,7 @@
1212
export let weight: "regular" | "bold" | "fill" = "regular"
1313
1414
const sizeMap = {
15+
XXS: "12px",
1516
XS: "14px",
1617
S: "16px",
1718
M: "18px",

packages/bbui/src/Table/Table.svelte

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,12 @@
562562
border-left: 1px solid transparent;
563563
padding-left: var(--cell-padding);
564564
}
565+
566+
.spectrum-Table-head > .spectrum-Table-headCell--edit:first-child {
567+
padding-left: calc(var(--cell-padding) / 1.33);
568+
/* adding 1px to compensate for lack of right border in header */
569+
padding-right: calc(var(--cell-padding) / 1.33 + 1px);
570+
}
565571
.spectrum-Table-head > :last-child {
566572
border-right: 1px solid transparent;
567573
padding-right: var(--cell-padding);
@@ -611,6 +617,9 @@
611617
position: sticky;
612618
left: 0;
613619
z-index: 3;
620+
justify-content: center;
621+
padding-left: calc(var(--cell-padding) / 1.33);
622+
padding-right: calc(var(--cell-padding) / 1.33);
614623
}
615624
.spectrum-Table-headCell .title {
616625
overflow: visible;
@@ -644,6 +653,9 @@
644653
border-left: var(--table-border);
645654
padding-left: var(--cell-padding);
646655
}
656+
.spectrum-Table-row > .spectrum-Table-cell--edit:first-child {
657+
padding-left: calc(var(--cell-padding) / 1.33);
658+
}
647659
.spectrum-Table-row > :last-child {
648660
border-right: var(--table-border);
649661
padding-right: var(--cell-padding);
@@ -673,6 +685,9 @@
673685
position: sticky;
674686
left: 0;
675687
z-index: 2;
688+
justify-content: center;
689+
padding-left: calc(var(--cell-padding) / 1.33);
690+
padding-right: calc(var(--cell-padding) / 1.33);
676691
}
677692
678693
/* Placeholder */

packages/builder/src/components/automation/AutomationBuilder/StepPanel.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@
283283
display: flex;
284284
flex-direction: column;
285285
flex: 1;
286+
min-height: 0;
286287
overflow: auto;
287288
overflow-x: hidden;
288289
}

packages/builder/src/components/automation/SetupPanel/BlockData.svelte

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,9 @@
337337
padding: var(--spacing-l);
338338
}
339339
.viewer {
340-
overflow-y: scroll;
341-
flex: 1;
340+
overflow: auto;
341+
flex: 1 1 0px;
342+
min-height: 0;
342343
padding-right: 0px;
343344
}
344345
.viewer .content {

packages/builder/src/components/common/JSONViewer.svelte

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
color="var(--spectrum-global-color-gray-600)"
127127
hoverColor="var(--spectrum-global-color-gray-900)"
128128
on:click={() => (expanded = !expanded)}
129-
size="XS"
129+
size="XXS"
130130
weight="fill"
131131
/>
132132
{/if}
@@ -154,7 +154,7 @@
154154
<div class="copy-value-icon">
155155
<Icon
156156
name="copy"
157-
size="S"
157+
size="XS"
158158
hoverable
159159
color="var(--spectrum-global-color-gray-600)"
160160
hoverColor="var(--spectrum-global-color-gray-900)"
@@ -189,18 +189,24 @@
189189
flex-direction: column;
190190
gap: 8px;
191191
overflow: hidden;
192+
min-height: 0;
192193
}
193194
194195
/* Expand arrow */
195196
.binding-arrow {
196-
margin: 3px 6px 0 4px;
197+
margin: 0 6px 0 4px;
197198
flex: 0 0 10px;
198-
transition: transform 130ms ease-out;
199+
display: flex;
200+
align-items: center;
201+
line-height: 0;
199202
}
200203
.binding-arrow :global(i) {
201-
width: 10px;
204+
display: inline-block;
205+
transform-origin: 50% 50%;
206+
transition: transform 130ms ease-out;
202207
}
203-
.binding-arrow.expanded {
208+
209+
.binding-arrow.expanded :global(i) {
204210
transform: rotate(90deg);
205211
}
206212
@@ -210,7 +216,7 @@
210216
flex-direction: row;
211217
font-family: monospace;
212218
font-size: 12px;
213-
align-items: flex-start;
219+
align-items: center;
214220
width: 100%;
215221
}
216222

packages/builder/src/components/design/settings/controls/DraggableList.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,17 @@
4343
let inactive = true
4444
4545
const buildDraggable = items => {
46+
const seenIds = new Set()
4647
return items
4748
.map(item => {
49+
let id = listItemKey ? item[listItemKey] : generate()
4850
return {
49-
id: listItemKey ? item[listItemKey] : generate(),
51+
id,
5052
item,
5153
type: zoneType,
5254
}
5355
})
54-
.filter(item => item.id)
56+
.filter(({ id }) => id && !seenIds.has(id) && seenIds.add(id))
5557
}
5658
5759
$: if (items) {

0 commit comments

Comments
 (0)