From a4c8fcb2aceb819e3e4621f521ce9bb7cce6063a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 3 Apr 2024 16:43:12 +0200 Subject: [PATCH 01/17] Clean and populate url --- .../server/src/utilities/rowProcessor/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index c421929888..e69cfa471a 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -155,6 +155,11 @@ export async function inputProcessing( delete attachment.url }) } + } else if (field.type === FieldType.ATTACHMENT_SINGLE) { + const attachment = clonedRow[key] + if (attachment?.url) { + delete clonedRow[key].url + } } if (field.type === FieldType.BB_REFERENCE && value) { @@ -227,6 +232,16 @@ export async function outputProcessing( } }) } + } else if (column.type === FieldType.ATTACHMENT_SINGLE) { + for (let row of enriched) { + if (!row[property]) { + continue + } + + if (!row[property].url) { + row[property].url = objectStore.getAppFileUrl(row[property].key) + } + } } else if ( !opts.skipBBReferences && column.type == FieldType.BB_REFERENCE From 7d0090a8e24fc8e653410287554ea849fe85cad8 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 3 Apr 2024 17:01:36 +0200 Subject: [PATCH 02/17] Fix import/export --- packages/server/src/utilities/schema.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/server/src/utilities/schema.ts b/packages/server/src/utilities/schema.ts index 85dfdd3506..4c7f0b7423 100644 --- a/packages/server/src/utilities/schema.ts +++ b/packages/server/src/utilities/schema.ts @@ -54,7 +54,7 @@ export function validate(rows: Rows, schema: TableSchema): ValidationResults { type: columnType, subtype: columnSubtype, autocolumn: isAutoColumn, - } = schema[columnName] + } = schema[columnName] || {} // If the column had an invalid value we don't want to override it if (results.schemaValidation[columnName] === false) { @@ -147,6 +147,12 @@ export function parse(rows: Rows, schema: TableSchema): Rows { utils.unreachable(columnSubtype) } } + } else if ( + (columnType === FieldType.ATTACHMENTS || + columnType === FieldType.ATTACHMENT_SINGLE) && + typeof columnData === "string" + ) { + parsedRow[columnName] = parseCsvExport(columnData) } else { parsedRow[columnName] = columnData } From 543718838597a8c2779c34a7394705f9455893fc Mon Sep 17 00:00:00 2001 From: Michael Drury Date: Wed, 3 Apr 2024 16:05:18 +0100 Subject: [PATCH 03/17] Revert "Revert "Single attachment column type"" --- packages/bbui/src/Form/Core/Dropzone.svelte | 2 +- .../components/backend/DataTable/formula.js | 2 +- .../DataTable/modals/CreateEditColumn.svelte | 3 +- .../controls/FieldConfiguration/utils.js | 3 +- .../builder/src/constants/backend/index.js | 16 ++- packages/builder/tsconfig.json | 3 - packages/client/manifest.json | 99 ++++++++++++++++++- .../app/blocks/FormBlockComponent.svelte | 5 +- .../app/forms/AttachmentField.svelte | 15 ++- .../app/forms/AttachmentSingleField.svelte | 16 +++ .../client/src/components/app/forms/index.js | 1 + .../src/components/app/forms/validation.js | 2 +- .../grid/cells/AttachmentCell.svelte | 3 +- .../grid/cells/AttachmentSingleCell.svelte | 20 ++++ .../src/components/grid/lib/renderers.js | 4 +- .../src/components/grid/lib/utils.js | 3 +- .../server/src/api/controllers/table/utils.ts | 22 ----- .../server/src/api/routes/tests/row.spec.ts | 4 +- .../db/defaultData/datasource_bb_default.ts | 4 +- .../server/src/sdk/app/rows/attachments.ts | 2 +- packages/server/src/sdk/app/rows/utils.ts | 4 +- .../src/utilities/rowProcessor/attachments.ts | 6 +- .../src/utilities/rowProcessor/index.ts | 4 +- .../server/src/utilities/rowProcessor/map.ts | 2 +- .../rowProcessor/tests/attachments.spec.ts | 2 +- .../tests/outputProcessing.spec.ts | 2 +- packages/shared-core/src/table.ts | 7 +- packages/types/src/documents/app/row.ts | 7 +- .../types/src/documents/app/table/schema.ts | 10 +- 29 files changed, 200 insertions(+), 73 deletions(-) create mode 100644 packages/client/src/components/app/forms/AttachmentSingleField.svelte create mode 100644 packages/frontend-core/src/components/grid/cells/AttachmentSingleCell.svelte diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index 3d803c0961..dd72167791 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -67,7 +67,7 @@ } $: showDropzone = - (!maximum || (maximum && value?.length < maximum)) && !disabled + (!maximum || (maximum && (value?.length || 0) < maximum)) && !disabled async function processFileList(fileList) { if ( diff --git a/packages/builder/src/components/backend/DataTable/formula.js b/packages/builder/src/components/backend/DataTable/formula.js index e3da4249bc..b339729391 100644 --- a/packages/builder/src/components/backend/DataTable/formula.js +++ b/packages/builder/src/components/backend/DataTable/formula.js @@ -9,7 +9,7 @@ const MAX_DEPTH = 1 const TYPES_TO_SKIP = [ FieldType.FORMULA, FieldType.LONGFORM, - FieldType.ATTACHMENT, + FieldType.ATTACHMENTS, //https://github.com/Budibase/budibase/issues/3030 FieldType.INTERNAL, ] diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index cfc6e9a7be..92501bec3b 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -394,7 +394,8 @@ FIELDS.BIGINT, FIELDS.BOOLEAN, FIELDS.DATETIME, - FIELDS.ATTACHMENT, + FIELDS.ATTACHMENT_SINGLE, + FIELDS.ATTACHMENTS, FIELDS.LINK, FIELDS.FORMULA, FIELDS.JSON, diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/utils.js b/packages/builder/src/components/design/settings/controls/FieldConfiguration/utils.js index 18ebf57d98..d0f9afda40 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/utils.js +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/utils.js @@ -41,7 +41,8 @@ export const FieldTypeToComponentMap = { [FieldType.BOOLEAN]: "booleanfield", [FieldType.LONGFORM]: "longformfield", [FieldType.DATETIME]: "datetimefield", - [FieldType.ATTACHMENT]: "attachmentfield", + [FieldType.ATTACHMENTS]: "attachmentfield", + [FieldType.ATTACHMENT_SINGLE]: "attachmentsinglefield", [FieldType.LINK]: "relationshipfield", [FieldType.JSON]: "jsonfield", [FieldType.BARCODEQR]: "codescanner", diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index dd751d4e13..e3888a52e0 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -107,10 +107,18 @@ export const FIELDS = { }, }, }, - ATTACHMENT: { + ATTACHMENT_SINGLE: { name: "Attachment", - type: FieldType.ATTACHMENT, - icon: "Folder", + type: FieldType.ATTACHMENT_SINGLE, + icon: "Document", + constraints: { + presence: false, + }, + }, + ATTACHMENTS: { + name: "Attachment List", + type: FieldType.ATTACHMENTS, + icon: "AppleFiles", constraints: { type: "array", presence: false, @@ -299,7 +307,7 @@ export const PaginationLocations = [ export const BannedSearchTypes = [ FieldType.LINK, - FieldType.ATTACHMENT, + FieldType.ATTACHMENTS, FieldType.FORMULA, FieldType.JSON, "jsonarray", diff --git a/packages/builder/tsconfig.json b/packages/builder/tsconfig.json index be79dfd85c..a7a4c3d800 100644 --- a/packages/builder/tsconfig.json +++ b/packages/builder/tsconfig.json @@ -1,9 +1,6 @@ { "extends": "./tsconfig.build.json", "compilerOptions": { - "composite": true, - "declaration": true, - "sourceMap": true, "baseUrl": ".", "paths": { "assets/*": ["./assets/*"], diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 08d614391b..cc5c68ea83 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -4226,7 +4226,7 @@ ] }, "attachmentfield": { - "name": "Attachment", + "name": "Attachment list", "icon": "Attach", "styles": ["size"], "requiredAncestors": ["form"], @@ -4322,6 +4322,103 @@ } ] }, + "attachmentsinglefield": { + "name": "Single Attachment", + "icon": "Attach", + "styles": ["size"], + "requiredAncestors": ["form"], + "editable": true, + "size": { + "width": 400, + "height": 200 + }, + "settings": [ + { + "type": "field/attachment_single", + "label": "Field", + "key": "field", + "required": true + }, + { + "type": "text", + "label": "Label", + "key": "label" + }, + { + "type": "text", + "label": "Help text", + "key": "helpText" + }, + { + "type": "text", + "label": "Extensions", + "key": "extensions" + }, + { + "type": "number", + "label": "Max attachments", + "key": "maximum", + "min": 1 + }, + { + "type": "event", + "label": "On change", + "key": "onChange", + "context": [ + { + "label": "Field Value", + "key": "value" + } + ] + }, + { + "type": "boolean", + "label": "Compact", + "key": "compact", + "defaultValue": false + }, + { + "type": "boolean", + "label": "Read only", + "key": "disabled", + "defaultValue": false + }, + { + "type": "validation/attachment", + "label": "Validation", + "key": "validation" + }, + { + "type": "select", + "label": "Layout", + "key": "span", + "defaultValue": 6, + "hidden": true, + "showInBar": true, + "barStyle": "buttons", + "options": [ + { + "label": "1 column", + "value": 6, + "barIcon": "Stop", + "barTitle": "1 column" + }, + { + "label": "2 columns", + "value": 3, + "barIcon": "ColumnTwoA", + "barTitle": "2 columns" + }, + { + "label": "3 columns", + "value": 2, + "barIcon": "ViewColumn", + "barTitle": "3 columns" + } + ] + } + ] + }, "relationshipfield": { "name": "Relationship Picker", "icon": "TaskList", diff --git a/packages/client/src/components/app/blocks/FormBlockComponent.svelte b/packages/client/src/components/app/blocks/FormBlockComponent.svelte index 34168355c4..968ed36b8b 100644 --- a/packages/client/src/components/app/blocks/FormBlockComponent.svelte +++ b/packages/client/src/components/app/blocks/FormBlockComponent.svelte @@ -15,7 +15,8 @@ [FieldType.BOOLEAN]: "booleanfield", [FieldType.LONGFORM]: "longformfield", [FieldType.DATETIME]: "datetimefield", - [FieldType.ATTACHMENT]: "attachmentfield", + [FieldType.ATTACHMENTS]: "attachmentfield", + [FieldType.ATTACHMENT_SINGLE]: "attachmentsinglefield", [FieldType.LINK]: "relationshipfield", [FieldType.JSON]: "jsonfield", [FieldType.BARCODEQR]: "codescanner", @@ -60,7 +61,7 @@ function getPropsByType(field) { const propsMapByType = { - [FieldType.ATTACHMENT]: (_field, schema) => { + [FieldType.ATTACHMENTS]: (_field, schema) => { return { maximum: schema?.constraints?.length?.maximum, } diff --git a/packages/client/src/components/app/forms/AttachmentField.svelte b/packages/client/src/components/app/forms/AttachmentField.svelte index b61f88daeb..8be70bc011 100644 --- a/packages/client/src/components/app/forms/AttachmentField.svelte +++ b/packages/client/src/components/app/forms/AttachmentField.svelte @@ -1,6 +1,7 @@ @@ -78,14 +85,14 @@ {validation} {span} {helpText} - type="attachment" + {type} bind:fieldState bind:fieldApi defaultValue={[]} > {#if fieldState} + import { FieldType } from "@budibase/types" + import AttachmentField from "./AttachmentField.svelte" + + const fieldApiMapper = { + get: value => (!Array.isArray(value) && value ? [value] : value) || [], + set: value => value[0] || null, + } + + + diff --git a/packages/client/src/components/app/forms/index.js b/packages/client/src/components/app/forms/index.js index 5804d3a79d..aa54204454 100644 --- a/packages/client/src/components/app/forms/index.js +++ b/packages/client/src/components/app/forms/index.js @@ -9,6 +9,7 @@ export { default as booleanfield } from "./BooleanField.svelte" export { default as longformfield } from "./LongFormField.svelte" export { default as datetimefield } from "./DateTimeField.svelte" export { default as attachmentfield } from "./AttachmentField.svelte" +export { default as attachmentsinglefield } from "./AttachmentSingleField.svelte" export { default as relationshipfield } from "./RelationshipField.svelte" export { default as passwordfield } from "./PasswordField.svelte" export { default as formstep } from "./FormStep.svelte" diff --git a/packages/client/src/components/app/forms/validation.js b/packages/client/src/components/app/forms/validation.js index 3b3a5d6e1d..cdedd85cf2 100644 --- a/packages/client/src/components/app/forms/validation.js +++ b/packages/client/src/components/app/forms/validation.js @@ -192,7 +192,7 @@ const parseType = (value, type) => { } // Parse attachments, treating no elements as null - if (type === FieldTypes.ATTACHMENT) { + if (type === FieldTypes.ATTACHMENTS) { if (!Array.isArray(value) || !value.length) { return null } diff --git a/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte b/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte index a1f5c4f2aa..3a1f165b6e 100644 --- a/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte +++ b/packages/frontend-core/src/components/grid/cells/AttachmentCell.svelte @@ -10,6 +10,7 @@ export let invertX = false export let invertY = false export let schema + export let maximum const { API, notifications } = getContext("grid") const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"] @@ -98,7 +99,7 @@ {value} compact on:change={e => onChange(e.detail)} - maximum={schema.constraints?.length?.maximum} + maximum={maximum || schema.constraints?.length?.maximum} {processFiles} {deleteAttachments} {handleFileTooLarge} diff --git a/packages/frontend-core/src/components/grid/cells/AttachmentSingleCell.svelte b/packages/frontend-core/src/components/grid/cells/AttachmentSingleCell.svelte new file mode 100644 index 0000000000..c2e29b6ede --- /dev/null +++ b/packages/frontend-core/src/components/grid/cells/AttachmentSingleCell.svelte @@ -0,0 +1,20 @@ + + + diff --git a/packages/frontend-core/src/components/grid/lib/renderers.js b/packages/frontend-core/src/components/grid/lib/renderers.js index 19bf63312d..c3ee276ff9 100644 --- a/packages/frontend-core/src/components/grid/lib/renderers.js +++ b/packages/frontend-core/src/components/grid/lib/renderers.js @@ -11,6 +11,7 @@ import BooleanCell from "../cells/BooleanCell.svelte" import FormulaCell from "../cells/FormulaCell.svelte" import JSONCell from "../cells/JSONCell.svelte" import AttachmentCell from "../cells/AttachmentCell.svelte" +import AttachmentSingleCell from "../cells/AttachmentSingleCell.svelte" import BBReferenceCell from "../cells/BBReferenceCell.svelte" const TypeComponentMap = { @@ -22,7 +23,8 @@ const TypeComponentMap = { [FieldType.ARRAY]: MultiSelectCell, [FieldType.NUMBER]: NumberCell, [FieldType.BOOLEAN]: BooleanCell, - [FieldType.ATTACHMENT]: AttachmentCell, + [FieldType.ATTACHMENTS]: AttachmentCell, + [FieldType.ATTACHMENT_SINGLE]: AttachmentSingleCell, [FieldType.LINK]: RelationshipCell, [FieldType.FORMULA]: FormulaCell, [FieldType.JSON]: JSONCell, diff --git a/packages/frontend-core/src/components/grid/lib/utils.js b/packages/frontend-core/src/components/grid/lib/utils.js index 8382bfece8..49d6b0a439 100644 --- a/packages/frontend-core/src/components/grid/lib/utils.js +++ b/packages/frontend-core/src/components/grid/lib/utils.js @@ -16,7 +16,8 @@ const TypeIconMap = { [FieldType.ARRAY]: "Dropdown", [FieldType.NUMBER]: "123", [FieldType.BOOLEAN]: "Boolean", - [FieldType.ATTACHMENT]: "AppleFiles", + [FieldType.ATTACHMENTS]: "AppleFiles", + [FieldType.ATTACHMENT_SINGLE]: "Document", [FieldType.LINK]: "DataCorrelated", [FieldType.FORMULA]: "Calculator", [FieldType.JSON]: "Brackets", diff --git a/packages/server/src/api/controllers/table/utils.ts b/packages/server/src/api/controllers/table/utils.ts index 0c9933a4cf..5649a1d996 100644 --- a/packages/server/src/api/controllers/table/utils.ts +++ b/packages/server/src/api/controllers/table/utils.ts @@ -30,8 +30,6 @@ import { View, RelationshipFieldMetadata, FieldType, - FieldTypeSubtypes, - AttachmentFieldMetadata, } from "@budibase/types" export async function clearColumns(table: Table, columnNames: string[]) { @@ -91,26 +89,6 @@ export async function checkForColumnUpdates( await checkForViewUpdates(updatedTable, deletedColumns, columnRename) } - const changedAttachmentSubtypeColumns = Object.values( - updatedTable.schema - ).filter( - (column): column is AttachmentFieldMetadata => - column.type === FieldType.ATTACHMENT && - column.subtype !== oldTable?.schema[column.name]?.subtype - ) - for (const attachmentColumn of changedAttachmentSubtypeColumns) { - if (attachmentColumn.subtype === FieldTypeSubtypes.ATTACHMENT.SINGLE) { - attachmentColumn.constraints ??= { length: {} } - attachmentColumn.constraints.length ??= {} - attachmentColumn.constraints.length.maximum = 1 - attachmentColumn.constraints.length.message = - "cannot contain multiple files" - } else { - delete attachmentColumn.constraints?.length?.maximum - delete attachmentColumn.constraints?.length?.message - } - } - return { rows: updatedRows, table: updatedTable } } diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index 8910522565..0fe8beb7ea 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -234,7 +234,7 @@ describe.each([ constraints: { type: "string", presence: false }, } const attachment: FieldSchema = { - type: FieldType.ATTACHMENT, + type: FieldType.ATTACHMENTS, name: "attachment", constraints: { type: "array", presence: false }, } @@ -790,7 +790,7 @@ describe.each([ defaultTable({ schema: { attachment: { - type: FieldType.ATTACHMENT, + type: FieldType.ATTACHMENTS, name: "attachment", constraints: { type: "array", presence: false }, }, diff --git a/packages/server/src/db/defaultData/datasource_bb_default.ts b/packages/server/src/db/defaultData/datasource_bb_default.ts index 03aed3c118..68d49b2d8b 100644 --- a/packages/server/src/db/defaultData/datasource_bb_default.ts +++ b/packages/server/src/db/defaultData/datasource_bb_default.ts @@ -299,7 +299,7 @@ export const DEFAULT_EMPLOYEE_TABLE_SCHEMA: Table = { sortable: false, }, "Badge Photo": { - type: FieldType.ATTACHMENT, + type: FieldType.ATTACHMENTS, constraints: { type: FieldType.ARRAY, presence: false, @@ -607,7 +607,7 @@ export const DEFAULT_EXPENSES_TABLE_SCHEMA: Table = { ignoreTimezones: true, }, Attachment: { - type: FieldType.ATTACHMENT, + type: FieldType.ATTACHMENTS, constraints: { type: FieldType.ARRAY, presence: false, diff --git a/packages/server/src/sdk/app/rows/attachments.ts b/packages/server/src/sdk/app/rows/attachments.ts index 2ab9e83c47..8fd2ccf795 100644 --- a/packages/server/src/sdk/app/rows/attachments.ts +++ b/packages/server/src/sdk/app/rows/attachments.ts @@ -30,7 +30,7 @@ export async function getRowsWithAttachments(appId: string, table: Table) { const db = dbCore.getDB(appId) const attachmentCols: string[] = [] for (let [key, column] of Object.entries(table.schema)) { - if (column.type === FieldType.ATTACHMENT) { + if (column.type === FieldType.ATTACHMENTS) { attachmentCols.push(key) } } diff --git a/packages/server/src/sdk/app/rows/utils.ts b/packages/server/src/sdk/app/rows/utils.ts index 8aa017d238..e1a0fbb5c4 100644 --- a/packages/server/src/sdk/app/rows/utils.ts +++ b/packages/server/src/sdk/app/rows/utils.ts @@ -175,13 +175,13 @@ export async function validate({ errors[fieldName] = [`${fieldName} is required`] } } else if ( - (type === FieldType.ATTACHMENT || type === FieldType.JSON) && + (type === FieldType.ATTACHMENTS || type === FieldType.JSON) && typeof row[fieldName] === "string" ) { // this should only happen if there is an error try { const json = JSON.parse(row[fieldName]) - if (type === FieldType.ATTACHMENT) { + if (type === FieldType.ATTACHMENTS) { if (Array.isArray(json)) { row[fieldName] = json } else { diff --git a/packages/server/src/utilities/rowProcessor/attachments.ts b/packages/server/src/utilities/rowProcessor/attachments.ts index e1c83352d4..652851a48b 100644 --- a/packages/server/src/utilities/rowProcessor/attachments.ts +++ b/packages/server/src/utilities/rowProcessor/attachments.ts @@ -34,7 +34,7 @@ export class AttachmentCleanup { let files: string[] = [] const tableSchema = opts.oldTable?.schema || table.schema for (let [key, schema] of Object.entries(tableSchema)) { - if (schema.type !== FieldType.ATTACHMENT) { + if (schema.type !== FieldType.ATTACHMENTS) { continue } const columnRemoved = opts.oldTable && !table.schema[key] @@ -68,7 +68,7 @@ export class AttachmentCleanup { return AttachmentCleanup.coreCleanup(() => { let files: string[] = [] for (let [key, schema] of Object.entries(table.schema)) { - if (schema.type !== FieldType.ATTACHMENT) { + if (schema.type !== FieldType.ATTACHMENTS) { continue } rows.forEach(row => { @@ -88,7 +88,7 @@ export class AttachmentCleanup { return AttachmentCleanup.coreCleanup(() => { let files: string[] = [] for (let [key, schema] of Object.entries(table.schema)) { - if (schema.type !== FieldType.ATTACHMENT) { + if (schema.type !== FieldType.ATTACHMENTS) { continue } const oldKeys = diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index 0015680e77..c421929888 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -148,7 +148,7 @@ export async function inputProcessing( } // remove any attachment urls, they are generated on read - if (field.type === FieldType.ATTACHMENT) { + if (field.type === FieldType.ATTACHMENTS) { const attachments = clonedRow[key] if (attachments?.length) { attachments.forEach((attachment: RowAttachment) => { @@ -216,7 +216,7 @@ export async function outputProcessing( // process complex types: attachements, bb references... for (let [property, column] of Object.entries(table.schema)) { - if (column.type === FieldType.ATTACHMENT) { + if (column.type === FieldType.ATTACHMENTS) { for (let row of enriched) { if (row[property] == null || !Array.isArray(row[property])) { continue diff --git a/packages/server/src/utilities/rowProcessor/map.ts b/packages/server/src/utilities/rowProcessor/map.ts index 60fe5a001b..2e0ac9efe1 100644 --- a/packages/server/src/utilities/rowProcessor/map.ts +++ b/packages/server/src/utilities/rowProcessor/map.ts @@ -106,7 +106,7 @@ export const TYPE_TRANSFORM_MAP: any = { return date }, }, - [FieldType.ATTACHMENT]: { + [FieldType.ATTACHMENTS]: { //@ts-ignore [null]: [], //@ts-ignore diff --git a/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts b/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts index cefea7e504..1b36a4cb81 100644 --- a/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts +++ b/packages/server/src/utilities/rowProcessor/tests/attachments.spec.ts @@ -34,7 +34,7 @@ function table(): Table { schema: { attach: { name: "attach", - type: FieldType.ATTACHMENT, + type: FieldType.ATTACHMENTS, constraints: {}, }, }, diff --git a/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts b/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts index a17bd5f393..93404e0469 100644 --- a/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts +++ b/packages/server/src/utilities/rowProcessor/tests/outputProcessing.spec.ts @@ -82,7 +82,7 @@ describe("rowProcessor - outputProcessing", () => { sourceType: TableSourceType.INTERNAL, schema: { attach: { - type: FieldType.ATTACHMENT, + type: FieldType.ATTACHMENTS, name: "attach", constraints: {}, }, diff --git a/packages/shared-core/src/table.ts b/packages/shared-core/src/table.ts index 5eab2fc340..26a7e77cd0 100644 --- a/packages/shared-core/src/table.ts +++ b/packages/shared-core/src/table.ts @@ -11,10 +11,10 @@ const allowDisplayColumnByType: Record = { [FieldType.INTERNAL]: true, [FieldType.BARCODEQR]: true, [FieldType.BIGINT]: true, - [FieldType.BOOLEAN]: false, [FieldType.ARRAY]: false, - [FieldType.ATTACHMENT]: false, + [FieldType.ATTACHMENTS]: false, + [FieldType.ATTACHMENT_SINGLE]: false, [FieldType.LINK]: false, [FieldType.JSON]: false, [FieldType.BB_REFERENCE]: false, @@ -34,7 +34,8 @@ const allowSortColumnByType: Record = { [FieldType.JSON]: true, [FieldType.FORMULA]: false, - [FieldType.ATTACHMENT]: false, + [FieldType.ATTACHMENTS]: false, + [FieldType.ATTACHMENT_SINGLE]: false, [FieldType.ARRAY]: false, [FieldType.LINK]: false, [FieldType.BB_REFERENCE]: false, diff --git a/packages/types/src/documents/app/row.ts b/packages/types/src/documents/app/row.ts index aa8f50d4a8..222c346591 100644 --- a/packages/types/src/documents/app/row.ts +++ b/packages/types/src/documents/app/row.ts @@ -8,7 +8,8 @@ export enum FieldType { BOOLEAN = "boolean", ARRAY = "array", DATETIME = "datetime", - ATTACHMENT = "attachment", + ATTACHMENTS = "attachment", + ATTACHMENT_SINGLE = "attachment_single", LINK = "link", FORMULA = "formula", AUTO = "auto", @@ -38,7 +39,6 @@ export interface Row extends Document { export enum FieldSubtype { USER = "user", USERS = "users", - SINGLE = "single", } // The 'as' are required for typescript not to type the outputs as generic FieldSubtype @@ -47,7 +47,4 @@ export const FieldTypeSubtypes = { USER: FieldSubtype.USER as FieldSubtype.USER, USERS: FieldSubtype.USERS as FieldSubtype.USERS, }, - ATTACHMENT: { - SINGLE: FieldSubtype.SINGLE as FieldSubtype.SINGLE, - }, } diff --git a/packages/types/src/documents/app/table/schema.ts b/packages/types/src/documents/app/table/schema.ts index 45e39268ac..86c34b6a5c 100644 --- a/packages/types/src/documents/app/table/schema.ts +++ b/packages/types/src/documents/app/table/schema.ts @@ -112,10 +112,8 @@ export interface BBReferenceFieldMetadata relationshipType?: RelationshipType } -export interface AttachmentFieldMetadata - extends Omit { - type: FieldType.ATTACHMENT - subtype?: FieldSubtype.SINGLE +export interface AttachmentFieldMetadata extends BaseFieldSchema { + type: FieldType.ATTACHMENTS } export interface FieldConstraints { @@ -164,7 +162,7 @@ interface OtherFieldMetadata extends BaseFieldSchema { | FieldType.NUMBER | FieldType.LONGFORM | FieldType.BB_REFERENCE - | FieldType.ATTACHMENT + | FieldType.ATTACHMENTS > } @@ -217,5 +215,5 @@ export function isBBReferenceField( export function isAttachmentField( field: FieldSchema ): field is AttachmentFieldMetadata { - return field.type === FieldType.ATTACHMENT + return field.type === FieldType.ATTACHMENTS } From 6d9d1acfcd5360de0742baa84a743cb6d439e358 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 Apr 2024 10:01:05 +0200 Subject: [PATCH 04/17] Update yarn.lock --- yarn.lock | 165 +++++++++--------------------------------------------- 1 file changed, 25 insertions(+), 140 deletions(-) diff --git a/yarn.lock b/yarn.lock index 4deda92484..545ee21c84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7261,37 +7261,7 @@ axios-retry@^3.1.9: "@babel/runtime" "^7.15.4" is-retry-allowed "^2.2.0" -axios@0.24.0: - version "0.24.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.24.0.tgz#804e6fa1e4b9c5288501dd9dff56a7a0940d20d6" - integrity sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA== - dependencies: - follow-redirects "^1.14.4" - -axios@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/axios/-/axios-1.1.3.tgz#8274250dada2edf53814ed7db644b9c2866c1e35" - integrity sha512-00tXVRwKx/FZr/IDVFt4C+f9FYairX517WoGCL6dpOntqLkZofjhu43F/Xl44UOpqa+9sLFDrG/XAnFsUYgkDA== - dependencies: - follow-redirects "^1.15.0" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - -axios@^0.21.1, axios@^0.21.4: - version "0.21.4" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" - integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== - dependencies: - follow-redirects "^1.14.0" - -axios@^0.26.0: - version "0.26.1" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" - integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== - dependencies: - follow-redirects "^1.14.8" - -axios@^1.0.0, axios@^1.1.3, axios@^1.5.0: +axios@0.24.0, axios@1.1.3, axios@1.6.3, axios@^0.21.1, axios@^0.21.4, axios@^0.26.0, axios@^1.0.0, axios@^1.1.3, axios@^1.5.0: version "1.6.3" resolved "https://registry.yarnpkg.com/axios/-/axios-1.6.3.tgz#7f50f23b3aa246eff43c54834272346c396613f4" integrity sha512-fWyNdeawGam70jXSVlKl+SUNVcL6j6W79CuSIPfi6HnDUmSCH6gyUys/HrqHeA/wU0Az41rRgean494d0Jb+ww== @@ -11242,11 +11212,6 @@ fn.name@1.x.x: resolved "https://registry.yarnpkg.com/fn.name/-/fn.name-1.1.0.tgz#26cad8017967aea8731bc42961d04a3d5988accc" integrity sha512-GRnmB5gPyJpAhTQdSZTSp9uaPSvl09KoYcMQtsB9rQoOmzs9dH6ffeccH+Z+cv6P68Hu5bC6JjRh4Ah/mHSNRw== -follow-redirects@^1.14.0, follow-redirects@^1.14.4, follow-redirects@^1.14.8: - version "1.15.6" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.6.tgz#7f815c0cda4249c74ff09e95ef97c23b5fd0399b" - integrity sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA== - follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" @@ -12365,12 +12330,7 @@ http-assert@^1.3.0: deep-equal "~1.0.1" http-errors "~1.8.0" -http-cache-semantics@3.8.1: - version "3.8.1" - resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" - integrity sha512-5ai2iksyV8ZXmnZhHH4rWPoxxistEexSi5936zIQ1bnNTW5VnA85B6P/VpXiRM017IgRvb2kKo1a//y+0wSp3w== - -http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: +http-cache-semantics@3.8.1, http-cache-semantics@4.1.1, http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0, http-cache-semantics@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a" integrity sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ== @@ -13315,6 +13275,11 @@ isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg== +isobject@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" + integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== + isolated-vm@^4.7.2: version "4.7.2" resolved "https://registry.yarnpkg.com/isolated-vm/-/isolated-vm-4.7.2.tgz#5670d5cce1d92004f9b825bec5b0b11fc7501b65" @@ -15909,7 +15874,7 @@ msgpackr-extract@^3.0.2: "@msgpackr-extract/msgpackr-extract-linux-x64" "3.0.2" "@msgpackr-extract/msgpackr-extract-win32-x64" "3.0.2" -msgpackr@^1.5.2: +msgpackr@1.10.1, msgpackr@^1.5.2: version "1.10.1" resolved "https://registry.yarnpkg.com/msgpackr/-/msgpackr-1.10.1.tgz#51953bb4ce4f3494f0c4af3f484f01cfbb306555" integrity sha512-r5VRLv9qouXuLiIBrLpl2d5ZvPt8svdQTl5/vMvE4nzDMyEX4sgW5yWhuBBj5UmgwOTWj8CIdSXn5sAfsHAWIQ== @@ -16113,25 +16078,13 @@ node-addon-api@^6.1.0: resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-6.1.0.tgz#ac8470034e58e67d0c6f1204a18ae6995d9c0d76" integrity sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA== -node-fetch@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" - integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== - -node-fetch@2.6.7, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7: +node-fetch@2.6.0, node-fetch@2.6.7, node-fetch@^2.6.0, node-fetch@^2.6.1, node-fetch@^2.6.7, node-fetch@^2.6.9, node-fetch@^2.7.0: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" integrity sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ== dependencies: whatwg-url "^5.0.0" -node-fetch@^2.6.9, node-fetch@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" - integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== - dependencies: - whatwg-url "^5.0.0" - node-forge@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3" @@ -17276,15 +17229,7 @@ passport-strategy@1.x.x, passport-strategy@^1.0.0: resolved "https://registry.yarnpkg.com/passport-strategy/-/passport-strategy-1.0.0.tgz#b5539aa8fc225a3d1ad179476ddf236b440f52e4" integrity sha512-CB97UUvDKJde2V0KDWWB3lyf6PC3FaZP7YxZ2G8OAtn9p4HI9j9JLP9qjOGZFvyl8uwNT8qM+hGnz/n16NI7oA== -passport@^0.4.0: - version "0.4.1" - resolved "https://registry.yarnpkg.com/passport/-/passport-0.4.1.tgz#941446a21cb92fc688d97a0861c38ce9f738f270" - integrity sha512-IxXgZZs8d7uFSt3eqNjM9NQ3g3uQCW5avD8mRNoXV99Yig50vjuaez6dQK2qC0kVWPRTujxY0dWgGfT09adjYg== - dependencies: - passport-strategy "1.x.x" - pause "0.0.1" - -passport@^0.6.0: +passport@0.6.0, passport@^0.4.0, passport@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/passport/-/passport-0.6.0.tgz#e869579fab465b5c0b291e841e6cc95c005fac9d" integrity sha512-0fe+p3ZnrWRW74fe8+SvCyf4a3Pb2/h7gFkQ8yTJpAO50gDzlfjZUZTO1k5Eg9kUct22OxHLqDZoKUWRHOh9ug== @@ -18585,7 +18530,7 @@ pseudomap@^1.0.2: resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" integrity sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ== -psl@^1.1.28, psl@^1.1.33: +psl@^1.1.33: version "1.9.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7" integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag== @@ -19602,11 +19547,6 @@ sax@1.2.1: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.1.tgz#7b8e656190b228e81a66aea748480d828cd2d37a" integrity sha512-8I2a3LovHTOpm7NV5yOyO8IHqgVsfK4+UuySrXU8YXkSRX7k6hCV9b3HrkKCr3nMpgj+0bmocaJJWpvp1oc7ZA== -sax@>=0.1.1: - version "1.3.0" - resolved "https://registry.yarnpkg.com/sax/-/sax-1.3.0.tgz#a5dbe77db3be05c9d1ee7785dbd3ea9de51593d0" - integrity sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA== - sax@>=0.6.0: version "1.2.4" resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" @@ -19688,40 +19628,13 @@ semver-diff@^3.1.1: dependencies: semver "^6.3.0" -"semver@2 || 3 || 4 || 5", semver@^5.5.0, semver@^5.6.0, semver@^5.7.1: - version "5.7.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.2.tgz#48d55db737c3287cd4835e17fa13feace1c41ef8" - integrity sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g== - -semver@7.5.3, semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3: +"semver@2 || 3 || 4 || 5", semver@7.5.3, semver@^5.5.0, semver@^5.6.0, semver@^5.7.1, semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1, semver@^7.0.0, semver@^7.1.1, semver@^7.1.2, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semver@^7.3.7, semver@^7.3.8, semver@^7.5.3, semver@^7.5.4, semver@~2.3.1, semver@~7.0.0: version "7.5.3" resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e" integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ== dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: - version "6.3.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" - integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== - -semver@^7.5.4: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" - -semver@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" - integrity sha512-abLdIKCosKfpnmhS52NCTjO4RiLspDfsn37prjzGrp9im5DPJOgh82Os92vtwGh6XdQryKI/7SREZnV+aqiXrA== - -semver@~7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" - integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== - seq-queue@^0.0.5: version "0.0.5" resolved "https://registry.yarnpkg.com/seq-queue/-/seq-queue-0.0.5.tgz#d56812e1c017a6e4e7c3e3a37a1da6d78dd3c93e" @@ -21307,7 +21220,7 @@ touch@^3.1.0: dependencies: nopt "~1.0.10" -"tough-cookie@^2.3.3 || ^3.0.1 || ^4.0.0", tough-cookie@^4.0.0, tough-cookie@^4.1.2: +tough-cookie@4.1.3, "tough-cookie@^2.3.3 || ^3.0.1 || ^4.0.0", tough-cookie@^4.0.0, tough-cookie@^4.1.2, tough-cookie@~2.5.0: version "4.1.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== @@ -21317,14 +21230,6 @@ touch@^3.1.0: universalify "^0.2.0" url-parse "^1.5.3" -tough-cookie@~2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - tr46@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" @@ -21801,6 +21706,14 @@ unpipe@1.0.0: resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== +unset-value@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/unset-value/-/unset-value-2.0.1.tgz#57bed0c22d26f28d69acde5df9a11b77c74d2df3" + integrity sha512-2hvrBfjUE00PkqN+q0XP6yRAOGrR06uSiUoIQGZkc7GxvQ9H7v8quUPNtZjMg4uux69i8HWpIjLPUKwCuRGyNg== + dependencies: + has-value "^2.0.2" + isobject "^4.0.0" + untildify@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" @@ -22571,33 +22484,10 @@ xml-parse-from-string@^1.0.0: resolved "https://registry.yarnpkg.com/xml-parse-from-string/-/xml-parse-from-string-1.0.1.tgz#a9029e929d3dbcded169f3c6e28238d95a5d5a28" integrity sha512-ErcKwJTF54uRzzNMXq2X5sMIy88zJvfN2DmdoQvy7PAFJ+tPRU6ydWuOKNMyfmOjdyBQTFREi60s0Y0SyI0G0g== -xml2js@0.1.x: - version "0.1.14" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.1.14.tgz#5274e67f5a64c5f92974cd85139e0332adc6b90c" - integrity sha512-pbdws4PPPNc1HPluSUKamY4GWMk592K7qwcj6BExbVOhhubub8+pMda/ql68b6L3luZs/OGjGSB5goV7SnmgnA== - dependencies: - sax ">=0.1.1" - -xml2js@0.4.19: - version "0.4.19" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.19.tgz#686c20f213209e94abf0d1bcf1efaa291c7827a7" - integrity sha512-esZnJZJOiJR9wWKMyuvSE1y6Dq5LCuJanqhxslH2bxM6duahNZ+HMpCLhBQGZkbX6xRf8x1Y2eJlgt2q3qo49Q== - dependencies: - sax ">=0.6.0" - xmlbuilder "~9.0.1" - -xml2js@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.5.0.tgz#d9440631fbb2ed800203fad106f2724f62c493b7" - integrity sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA== - dependencies: - sax ">=0.6.0" - xmlbuilder "~11.0.0" - -xml2js@^0.4.19, xml2js@^0.4.5: - version "0.4.23" - resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.4.23.tgz#a0c69516752421eb2ac758ee4d4ccf58843eac66" - integrity sha512-ySPiMjM0+pLDftHgXY4By0uswI3SPKLDw/i3UXbnO8M/p28zqexCUoPmQFrYD+/1BzhGJSs2i1ERWKJAtiLrug== +xml2js@0.1.x, xml2js@0.4.19, xml2js@0.5.0, xml2js@0.6.2, xml2js@^0.4.19, xml2js@^0.4.5: + version "0.6.2" + resolved "https://registry.yarnpkg.com/xml2js/-/xml2js-0.6.2.tgz#dd0b630083aa09c161e25a4d0901e2b2a929b499" + integrity sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA== dependencies: sax ">=0.6.0" xmlbuilder "~11.0.0" @@ -22607,11 +22497,6 @@ xmlbuilder@~11.0.0: resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-11.0.1.tgz#be9bae1c8a046e76b31127726347d0ad7002beb3" integrity sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA== -xmlbuilder@~9.0.1: - version "9.0.7" - resolved "https://registry.yarnpkg.com/xmlbuilder/-/xmlbuilder-9.0.7.tgz#132ee63d2ec5565c557e20f4c22df9aca686b10d" - integrity sha512-7YXTQc3P2l9+0rjaUbLwMKRhtmwg1M1eDf6nag7urC7pIPYLD9W/jmzQ4ptRSUbodw5S0jfoGTflLemQibSpeQ== - xmlchars@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" From 0cb956a7b5cd3c623bc74587162b7ce6ecc7644b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 Apr 2024 10:10:32 +0200 Subject: [PATCH 05/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 011fa3c175..532c4db35c 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit 011fa3c175ae0a1bbbb0f6e1341ba0154bca5c76 +Subproject commit 532c4db35cecd346b5c24f0b89ab7b397a122a36 diff --git a/packages/pro b/packages/pro index 6b62505be0..f8e8f87bd5 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 6b62505be0c0b50a57b4f4980d86541ebdc86428 +Subproject commit f8e8f87bd52081e1303a5ae92c432ea5b38f3bb4 From 28d10ec086d4ca59ab404d9c73fdddb87f7f24f6 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 4 Apr 2024 19:58:25 +0200 Subject: [PATCH 06/17] Fix --- .../ExistingTableDataImport.svelte | 27 +++++++++++-------- .../server/src/sdk/tests/attachments.spec.ts | 2 +- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte b/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte index efbfd26565..6901503071 100644 --- a/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte +++ b/packages/builder/src/components/backend/TableNavigator/ExistingTableDataImport.svelte @@ -1,6 +1,7 @@ Date: Wed, 10 Apr 2024 10:10:15 +0200 Subject: [PATCH 14/17] Fix merge conflicts --- packages/server/src/sdk/app/tables/internal/sqs.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server/src/sdk/app/tables/internal/sqs.ts b/packages/server/src/sdk/app/tables/internal/sqs.ts index da947c62c2..79d9be2348 100644 --- a/packages/server/src/sdk/app/tables/internal/sqs.ts +++ b/packages/server/src/sdk/app/tables/internal/sqs.ts @@ -27,7 +27,8 @@ const FieldTypeMap: Record = { [FieldType.JSON]: SQLiteType.BLOB, [FieldType.INTERNAL]: SQLiteType.BLOB, [FieldType.BARCODEQR]: SQLiteType.BLOB, - [FieldType.ATTACHMENT]: SQLiteType.BLOB, + [FieldType.ATTACHMENTS]: SQLiteType.BLOB, + [FieldType.ATTACHMENT_SINGLE]: SQLiteType.BLOB, [FieldType.ARRAY]: SQLiteType.BLOB, [FieldType.LINK]: SQLiteType.BLOB, [FieldType.BIGINT]: SQLiteType.REAL, From 5a93f2b5421f9e0d558d110a78e59f9ef8a78b18 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 10 Apr 2024 12:53:42 +0200 Subject: [PATCH 15/17] Change icons to attach --- packages/client/manifest.json | 2 +- packages/frontend-core/src/constants.js | 4 ++-- packages/frontend-core/src/utils/rows.js | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 7689907e3c..40abc7a9a0 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -4324,7 +4324,7 @@ }, "attachmentsinglefield": { "name": "Single Attachment", - "icon": "Document", + "icon": "Attach", "styles": ["size"], "requiredAncestors": ["form"], "editable": true, diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index e6860da52d..95228c3bdc 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -124,8 +124,8 @@ export const TypeIconMap = { [FieldType.ARRAY]: "Duplicate", [FieldType.NUMBER]: "123", [FieldType.BOOLEAN]: "Boolean", - [FieldType.ATTACHMENTS]: "AppleFiles", - [FieldType.ATTACHMENT_SINGLE]: "Document", + [FieldType.ATTACHMENTS]: "Attach", + [FieldType.ATTACHMENT_SINGLE]: "Attach", [FieldType.LINK]: "DataCorrelated", [FieldType.FORMULA]: "Calculator", [FieldType.JSON]: "Brackets", diff --git a/packages/frontend-core/src/utils/rows.js b/packages/frontend-core/src/utils/rows.js index ea43d63734..1fb26eabd5 100644 --- a/packages/frontend-core/src/utils/rows.js +++ b/packages/frontend-core/src/utils/rows.js @@ -21,6 +21,8 @@ const isBetterSample = (newValue, oldValue) => { } if ( newType === "object" && + Array.isArray(newValue) && + Array.isArray(oldValue) && Object.keys(newValue).length > Object.keys(oldValue).length ) { return true From 38f53020eb03a0c2107f067de3bd4c0dfa4c2b44 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 10 Apr 2024 13:19:22 +0200 Subject: [PATCH 16/17] Revert check --- packages/frontend-core/src/utils/rows.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/frontend-core/src/utils/rows.js b/packages/frontend-core/src/utils/rows.js index 1fb26eabd5..ea43d63734 100644 --- a/packages/frontend-core/src/utils/rows.js +++ b/packages/frontend-core/src/utils/rows.js @@ -21,8 +21,6 @@ const isBetterSample = (newValue, oldValue) => { } if ( newType === "object" && - Array.isArray(newValue) && - Array.isArray(oldValue) && Object.keys(newValue).length > Object.keys(oldValue).length ) { return true From b707514deb62c07008ad3b65d53f390587e46554 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 10 Apr 2024 13:40:38 +0200 Subject: [PATCH 17/17] Update pro ref to fix flakiness --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index f8e8f87bd5..ef186d0024 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit f8e8f87bd52081e1303a5ae92c432ea5b38f3bb4 +Subproject commit ef186d00241f96037f9fd34d7a3826041977ab3a