π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
chore: sync changes
mertmit36299e0d397a
diff --git a/packages/nc-gui/components/actions/Pane.vue b/packages/nc-gui/components/actions/Pane.vuenew file mode 100644index 0000000000..7c3f5c658a--- /dev/null+++ b/packages/nc-gui/components/actions/Pane.vue@@ -0,0 +1,3 @@+<template>+ <NcSpanHidden />+</template>diff --git a/packages/nc-gui/components/dashboard/settings/sync/DestinationSchema.vue b/packages/nc-gui/components/dashboard/settings/sync/DestinationSchema.vueindex 0663f7ed8a..0664f99b13 100644--- a/packages/nc-gui/components/dashboard/settings/sync/DestinationSchema.vue+++ b/packages/nc-gui/components/dashboard/settings/sync/DestinationSchema.vue@@ -409,7 +409,6 @@ onMounted(async () => {</td><td class="center-column"><a-checkbox- :disabled="editMode":checked="isPrimaryKeyColumn(column.title)"@update:checked="(checked) => togglePrimaryKey(column.title, checked)"/>diff --git a/packages/nc-gui/components/dlg/InviteDlg.vue b/packages/nc-gui/components/dlg/InviteDlg.vueindex 4a29da055f..6b7946208d 100644--- a/packages/nc-gui/components/dlg/InviteDlg.vue+++ b/packages/nc-gui/components/dlg/InviteDlg.vue@@ -393,7 +393,7 @@ const removeEmail = (index: number) => {<div class="flex flex-row text-2xl font-bold items-center gap-x-2">{{type === 'organization'- ? $t('labels.addMembersToOrganization')+ ? 'Invite Members to Workspaces': type === 'base'? $t('activity.addMember'): $t('activity.inviteToWorkspace')diff --git a/packages/nc-gui/components/smartsheet/Row.vue b/packages/nc-gui/components/smartsheet/Row.vueindex 2b65b2379d..0ea549cc24 100644--- a/packages/nc-gui/components/smartsheet/Row.vue+++ b/packages/nc-gui/components/smartsheet/Row.vue@@ -20,9 +20,9 @@ reloadHook.on((params) => {})})-const { eventBus: scriptEventBus } = useScriptExecutor()+const { eventBus } = useScriptExecutor()-scriptEventBus.on(async (event, payload) => {+eventBus.on(async (event, payload) => {if (event === SmartsheetScriptActions.RELOAD_ROW) {// eslint-disable-next-line eqeqeqif (payload.rowId == pk.value) {diff --git a/packages/nc-gui/components/smartsheet/Toolbar.vue b/packages/nc-gui/components/smartsheet/Toolbar.vueindex d8094c255e..51bbe03452 100644--- a/packages/nc-gui/components/smartsheet/Toolbar.vue+++ b/packages/nc-gui/components/smartsheet/Toolbar.vue@@ -5,11 +5,18 @@ const isPublic = inject(IsPublicInj, ref(false))const { isGrid, isGallery, isKanban, isMap, isCalendar } = useSmartsheetStoreOrThrow()+const { isUIAllowed } = useRoles()++const { isSharedBase } = useBase()+const { isMobileMode } = useGlobal()+const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())const { isViewsLoading } = storeToRefs(useViewsStore())+const { isViewActionsEnabled } = useActionPane()+const { isLocalMode } = useViewColumnsOrThrow()const containerRef = ref<HTMLElement>()@@ -76,6 +83,10 @@ provide(IsToolbarIconMode, isToolbarIconMode)<LazySmartsheetToolbarRowColorFilterDropdown v-if="!isPublic && (isGrid || isGallery || isKanban || isMap)" />+ <LazySmartsheetToolbarBulkAction+ v-if="(isGrid || isGallery) && !isPublic && !isSharedBase && isUIAllowed('scriptExecute') && isViewActionsEnabled"+ />+<LazySmartsheetToolbarOpenedViewAction v-if="isCalendar" /></div>diff --git a/packages/nc-gui/components/smartsheet/Topbar.vue b/packages/nc-gui/components/smartsheet/Topbar.vueindex d03e89acaf..29522f7606 100644--- a/packages/nc-gui/components/smartsheet/Topbar.vue+++ b/packages/nc-gui/components/smartsheet/Topbar.vue@@ -18,6 +18,8 @@ const { appInfo } = useGlobal()const { toggleExtensionPanel, isPanelExpanded } = useExtensions()+const { toggleActionPanel, isPanelExpanded: isActionPanelExpanded, isViewActionsEnabled } = useActionPane()+const { isFeatureEnabled } = useBetaFeatureToggle()const isSharedBase = computed(() => route.value.params.typeOrId === 'base')@@ -99,6 +101,38 @@ const topbarBreadcrumbItemWidth = computed(() => {</div></NcButton>+ <NcButton+ v-if="+ !isSharedBase &&+ !activeAutomationId &&+ !activeDashboardId &&+ openedViewsTab === 'view' &&+ !isMobileMode &&+ isViewActionsEnabled+ "+ v-e="['c:action-toggle']"+ type="secondary"+ size="small"+ class="nc-topbar-action-btn"+ :class="{ '!bg-brand-50 !hover:bg-brand-100/70 !text-brand-500': isActionPanelExpanded }"+ data-testid="nc-topbar-action-btn"+ @click="toggleActionPanel"+ >+ <div class="flex items-center justify-center min-w-[28.69px]">+ <GeneralIcon+ :icon="isActionPanelExpanded ? 'play' : 'play'"+ class="w-4 h-4 !stroke-transparent"+ :class="{ 'border-l-1 border-transparent': isActionPanelExpanded }"+ />+ <span+ class="overflow-hidden trasition-all duration-200"+ :class="{ 'w-[0px] invisible': isActionPanelExpanded, 'ml-1 w-[54px]': !isActionPanelExpanded }"+ >+ {{ $t('general.actions') }}+ </span>+ </div>+ </NcButton>+<div v-if="!isSharedBase" class="flex gap-2 items-center empty:hidden"><LazySmartsheetTopbarDashboardState v-if="activeDashboardId && isUIAllowed('dashboardEdit')" /><LazySmartsheetTopbarScriptAction v-if="activeAutomationId && appInfo.ee" />diff --git a/packages/nc-gui/components/smartsheet/column/ButtonOptions/index.vue b/packages/nc-gui/components/smartsheet/column/ButtonOptions/index.vueindex 9b0acdee80..ca3864002e 100644--- a/packages/nc-gui/components/smartsheet/column/ButtonOptions/index.vue+++ b/packages/nc-gui/components/smartsheet/column/ButtonOptions/index.vue@@ -33,6 +33,8 @@ const { isAiBetaFeaturesEnabled } = useNocoAi()const { isEdit, setAdditionalValidations, validateInfos, sqlUi, column, isAiMode } = useColumnCreateStoreOrThrow()+const { isRowActionsEnabled } = useActionPane()+const uiTypesNotSupportedInFormulas = [UITypes.QrCode, UITypes.Barcode, UITypes.Button]const webhooksStore = useWebhooksStore()@@ -75,35 +77,31 @@ const isAiButtonEnabled = computed(() => {return isAiBetaFeaturesEnabled.value})-const isScriptButtonEnabled = computed(() => {- if (isEdit.value) {- return true- }-- return isAiBetaFeaturesEnabled.value-})-const buttonTypes = computed(() => [{+ icon: 'ncLink',label: t('labels.openUrl'),value: ButtonActionsType.Url,},{label: t('labels.runWebHook'),value: ButtonActionsType.Webhook,+ icon: 'ncWebhook',},...(isAiButtonEnabled.value? [{+ icon: 'ncAutoAwesome',label: t('labels.generateFieldDataUsingAi'),value: ButtonActionsType.Ai,tooltip: t('tooltip.generateFieldDataUsingAiButtonOption'),},]: []),- ...(isEeUI && isScriptButtonEnabled.value+ ...(isEeUI && isRowActionsEnabled.value? [{+ icon: 'ncScript',label: t('labels.runScript'),value: ButtonActionsType.Script,},@@ -516,6 +514,7 @@ const handleUpdateActionType = () => {<a-select-option v-for="(type, i) of buttonTypes" :key="i" :value="type.value"><NcTooltip :disabled="!type.tooltip" placement="right" class="w-full" :title="type.tooltip"><div class="flex gap-2 w-full capitalize text-gray-800 truncate items-center">+ <GeneralIcon :icon="type.icon" /><div class="flex-1">{{ type.label }}</div>@@ -550,7 +549,7 @@ const handleUpdateActionType = () => {v-model:selected-webhook="selectedWebhook"/><SmartsheetColumnButtonOptionsScript- v-if="vModel?.type === buttonActionsType.Script"+ v-if="vModel?.type === buttonActionsType.Script && isRowActionsEnabled"v-model:model-value="vModel"v-model:selected-script="selectedScript"/>diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button.ts b/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button.tsindex b9b8f539f4..8e5d03e181 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button.ts+++ b/packages/nc-gui/components/smartsheet/grid/canvas/cells/Button.ts@@ -238,6 +238,9 @@ export const ButtonCellRenderer: CellRenderer = {cellRenderStore,t,} = props++ const isQueued = actionManager.isQueued(pk, column.id!)+const isLoading = actionManager.isLoading(pk, column.id!)const afterActionStatus = actionManager.getAfterActionStatus(pk, column.id!)@@ -251,14 +254,14 @@ export const ButtonCellRenderer: CellRenderer = {})}- let disabledState = isLoading || disabled?.isInvalid+ let disabledState = isLoading || disabled?.isInvalid || isQueuedctx.textAlign = 'left'const colOptions = column.colOptions as ButtonTypeif (!colOptions) returnconst buttonMeta = {- label: colOptions.label || '',+ label: isQueued ? 'Queued...' : colOptions?.label || '',icon: colOptions.icon,theme: colOptions.theme || 'solid',color: colOptions.color || 'brand',@@ -294,13 +297,17 @@ export const ButtonCellRenderer: CellRenderer = {let contentWidth = 0let labelWidth = 0- let truncatedLabel = buttonMeta.label- if (hasLabel) {+ // Show step title when loading, otherwise show button label+ const currentStepTitle = isLoading ? actionManager.getCurrentStepTitle(pk, column.id!) : undefined+ let truncatedLabel = currentStepTitle || buttonMeta.label++ if (hasLabel || currentStepTitle) {ctx.font = '550 13px Inter'const maxTextWidth = maxButtonWidth - horizontalPadding * 2 - (hasIcon ? iconSize + iconSpacing : 0)- const truncatedInfo = truncateText(ctx, buttonMeta.label, maxTextWidth, true)+ const labelToTruncate = currentStepTitle || buttonMeta.label+ const truncatedInfo = truncateText(ctx, labelToTruncate, maxTextWidth, true)truncatedLabel = truncatedInfo.textlabelWidth = truncatedInfo.widthcontentWidth += labelWidth@@ -370,7 +377,7 @@ export const ButtonCellRenderer: CellRenderer = {contentX += iconSize + (hasLabel ? iconSpacing : 0)}- if (hasLabel) {+ if (hasLabel || currentStepTitle) {ctx.fillStyle = colors.textctx.textBaseline = 'middle'ctx.fillText(truncatedLabel, contentX, startY + 13)diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts b/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.tsindex 3269fe927a..2d1a1a6a4d 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts+++ b/packages/nc-gui/components/smartsheet/grid/canvas/cells/index.ts@@ -230,17 +230,31 @@ export function useGridCellHandler(params: {}}}- const cellType = cellTypesRegistry.get(column.uidt)- if (actionManager?.isLoading(pk, column.id) && !isAIPromptCol(column) && !isButton(column)) {- const loadingStartTime = actionManager?.getLoadingStartTime(pk, column.id)+ const cellType = cellTypesRegistry.get(column.uidt!)++ const cellRenderStore = getCellRenderStore(`${column.id}-${pk}`)++ if (actionManager?.isCellUpdating(pk, column.id!) && !isAIPromptCol(column) && !isButton(column)) {+ return renderSingleLineText(ctx, {+ x: x + padding,+ y,+ text: 'Updating ...',+ fontFamily: `500 13px Inter`,+ fillStyle: '#374151',+ height,+ py: padding,+ cellRenderStore,+ })+ }++ if (actionManager?.isLoading(pk, column.id!) && !isAIPromptCol(column) && !isButton(column)) {+ const loadingStartTime = actionManager?.getLoadingStartTime(pk, column.id!)if (loadingStartTime) {renderSpinner(ctx, x + width / 2, y + 8, 16, '#3366FF', loadingStartTime, 1.5)return}}- const cellRenderStore = getCellRenderStore(`${column.id}-${pk}`)-// TODO: Reset all the styles herectx.textAlign = 'left'diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasTable.ts b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasTable.tsindex d949969512..d4b60cecff 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasTable.ts+++ b/packages/nc-gui/components/smartsheet/grid/canvas/composables/useCanvasTable.ts@@ -261,8 +261,18 @@ export function useCanvasTable({const isPublicView = inject(IsPublicInj, ref(false))const readOnly = inject(ReadonlyInj, ref(false))+ const { eventBus: scriptEventBus } = useScriptExecutor()+const { loadAutomation } = automationStore- const actionManager = new ActionManager($api, loadAutomation, generateRows, meta, triggerRefreshCanvas, getDataCache)+ const actionManager = new ActionManager(+ $api,+ loadAutomation,+ generateRows,+ meta,+ triggerRefreshCanvas,+ getDataCache,+ scriptEventBus,+ )const isGroupBy = computed(() => !!groupByColumns.value?.length)diff --git a/packages/nc-gui/components/smartsheet/grid/canvas/loaders/ActionManager.ts b/packages/nc-gui/components/smartsheet/grid/canvas/loaders/ActionManager.tsindex e57d83f474..5122227b1c 100644--- a/packages/nc-gui/components/smartsheet/grid/canvas/loaders/ActionManager.ts+++ b/packages/nc-gui/components/smartsheet/grid/canvas/loaders/ActionManager.ts@@ -1,5 +1,22 @@import type { Api, ButtonType, TableType } from 'nocodb-sdk'+interface ActionState {+ status: 'loading' | 'success' | 'error' | 'queued'+ startTime?: number+ stepTitle?: string+ error?: string+}++interface BulkRowState extends ActionState {+ status: 'queued' | 'loading' | 'success' | 'error'+}++interface CellUpdate {+ fieldName: string+ scriptExecutionId: string+ startTime: number+}+export class ActionManager {private api: Api<any>private readonly loadAutomation: (id: string) => Promise<any>@@ -14,6 +31,17 @@ export class ActionManager {isRowSortRequiredRows: ComputedRef<Array<Row>>}+ private eventBus?: any++ // Consolidated state maps+ private loadingColumns = new Map<string, number>()+ private afterActionStatus = new Map<string, Omit<ActionState, 'startTime'>>()+ private currentStepTitles = new Map<string, string>()+ private cellUpdates = new Map<string, CellUpdate>()+ private activeBulkExecs = new Map<string, boolean>()+ private bulkRowStates = new Map<string, BulkRowState>()+ private rafId: number | null = null+constructor(api: Api<any>,loadAutomation: (id: string) => Promise<any>,@@ -27,6 +55,7 @@ export class ActionManager {selectedRows: ComputedRef<Array<Row>>isRowSortRequiredRows: ComputedRef<Array<Row>>},+ eventBus?: any,) {this.api = apithis.loadAutomation = loadAutomation@@ -34,24 +63,84 @@ export class ActionManager {this.meta = metathis.triggerRefreshCanvas = triggerRefreshCanvasthis.getDataCache = getDataCache+ this.eventBus = eventBus++ this.setupEventListeners()}- // key is rowId-columnId, value is startTime- private loadingColumns = new Map<string, number>()- private afterActionStatus = new Map<- string,- {- status: 'success' | 'error'- tooltip?: string+ private setupEventListeners() {+ if (!this.eventBus) return++ const eventHandlers = {+ [SmartsheetScriptActions.BULK_ACTION_START]: (payload: any) => {+ this.activeBulkExecs.set(payload.columnId, true)+ this.startAnimationLoop()+ },+ [SmartsheetScriptActions.BULK_ACTION_END]: (payload: any) => {+ if (payload.columnId) {+ this.activeBulkExecs.delete(payload.columnId)+ this.clearBulkRowStatesForColumn(payload.columnId)+ }+ },+ [SmartsheetScriptActions.BUTTON_ACTION_START]: (payload: any) => {+ this.setBulkRowState(payload.rowId, payload.columnId, {+ status: 'loading',+ startTime: Date.now(),+ stepTitle: payload.stepTitle,+ })+ },+ [SmartsheetScriptActions.BUTTON_ACTION_PROGRESS]: (payload: any) => {+ console.log('BUTTON_ACTION_PROGRESS', payload)+ const rowState = this.getBulkRowState(payload.rowId, payload.columnId)+ if (rowState) {+ this.setBulkRowState(payload.rowId, payload.columnId, {+ ...rowState,+ stepTitle: payload.stepTitle,+ })+ }+ },+ [SmartsheetScriptActions.BUTTON_ACTION_COMPLETE]: (payload: any) => {+ this.setBulkRowState(payload.rowId, payload.columnId, {+ status: payload.success ? 'success' : 'error',+ error: payload.error,+ })+ },+ [SmartsheetScriptActions.BUTTON_ACTION_ERROR]: (payload: any) => {+ this.setBulkRowState(payload.rowId, payload.columnId, {+ status: 'error',+ error: payload.error,+ })+ },+ [SmartsheetScriptActions.UPDATE_STEP_TITLE]: (payload: any) => {+ this.setCurrentStepTitle(payload.pk, payload.fieldId, payload.title)+ },+ [SmartsheetScriptActions.START_CELL_UPDATE]: (payload: any) => {+ this.startCellUpdate(payload.recordId, payload.fieldId, payload.fieldName, payload.scriptId)+ },+ [SmartsheetScriptActions.COMPLETE_CELL_UPDATE]: (payload: any) => {+ this.completeCellUpdate(payload.recordId, payload.fieldId)+ },+ [SmartsheetScriptActions.CLEAR_SCRIPT_CELL_UPDATES]: (payload: any) => {+ this.clearScriptCellUpdates(payload.scriptId)+ },}- >()- private rafId: number | null = null+ this.eventBus.on((event: string, payload: any) => {+ eventHandlers[event]?.(payload)+ })+ }private getKey(rowId: string, columnId: string): string {return `${rowId}-${columnId}`}+ private updateRowStates(rowIds: string[], columnId: string, affectedColumnIds: string[], updateFn: (key: string) => void) {+ rowIds.forEach((rowId) => {+ updateFn(this.getKey(rowId, columnId))+ affectedColumnIds.forEach((colId) => updateFn(this.getKey(rowId, colId)))+ })+ }+private async executeAction(rowId: string | string[],columnId: string,@@ -59,124 +148,115 @@ export class ActionManager {action: () => Promise<any>,) {const startTime = Date.now()-const rowIds = Array.isArray(rowId) ? rowId : [rowId]- rowIds.forEach((id) => {- this.loadingColumns.set(this.getKey(id, columnId), startTime)-- // If action is triggered again, clear after action status- this.afterActionStatus.delete(this.getKey(id, columnId))-- affectedColumnIds.forEach((colId) => {- this.loadingColumns.set(this.getKey(id, colId), startTime)-- // If action is triggered again, clear after action status- this.afterActionStatus.delete(this.getKey(id, columnId))- })+ // Set loading state+ this.updateRowStates(rowIds, columnId, affectedColumnIds, (key) => {+ this.loadingColumns.set(key, startTime)+ this.afterActionStatus.delete(key)})this.startAnimationLoop()- let isErrorOccured = false-try {const res = await action()- rowIds.forEach((id) => {- this.afterActionStatus.set(this.getKey(id, columnId), { status: 'success' })-- affectedColumnIds.forEach((colId) => {- this.afterActionStatus.set(this.getKey(id, colId), { status: 'success' })- })+ // Set success state+ this.updateRowStates(rowIds, columnId, affectedColumnIds, (key) => {+ this.afterActionStatus.set(key, { status: 'success' })})return res} catch (e: any) {- isErrorOccured = true-const errorMsg = await extractSdkResponseErrorMsg(e)- rowIds.forEach((id) => {- this.afterActionStatus.set(this.getKey(id, columnId), { status: 'error', tooltip: errorMsg ?? 'Something went wrong' })- affectedColumnIds.forEach((colId) => {- this.afterActionStatus.set(this.getKey(id, colId), { status: 'error', tooltip: errorMsg ?? 'Something went wrong' })+ // Set error state+ this.updateRowStates(rowIds, columnId, affectedColumnIds, (key) => {+ this.afterActionStatus.set(key, {+ status: 'error',+ tooltip: errorMsg ?? 'Something went wrong',})})throw e} finally {- rowIds.forEach((id) => {- this.loadingColumns.delete(this.getKey(id, columnId))-- affectedColumnIds.forEach((colId) => {- this.loadingColumns.delete(this.getKey(id, colId))- })+ // Clean up loading state+ this.updateRowStates(rowIds, columnId, affectedColumnIds, (key) => {+ this.loadingColumns.delete(key)+ this.currentStepTitles.delete(key)})- // Remove error columns after 3 seconds if error occured, otherwise after 2 seconds- ncDelay(isErrorOccured ? 3000 : 2000).then(() => {- rowIds.forEach((id) => {- this.afterActionStatus.delete(this.getKey(id, columnId))-- affectedColumnIds.forEach((colId) => {- this.afterActionStatus.delete(this.getKey(id, colId))- })+ // Clean up after action status with delay+ const isError = this.afterActionStatus.get(this.getKey(rowIds[0], columnId))?.status === 'error'+ ncDelay(isError ? 3000 : 2000).then(() => {+ this.updateRowStates(rowIds, columnId, affectedColumnIds, (key) => {+ this.afterActionStatus.delete(key)})})}}private startAnimationLoop() {- if (this.rafId === null && (this.loadingColumns.size > 0 || this.afterActionStatus.size > 0)) {- let cooldownTimeout: number | null = null- let isCoolingDown = false+ const hasActivity = this.loadingColumns.size > 0 || this.afterActionStatus.size > 0 || this.activeBulkExecs.size > 0++ if (this.rafId !== null || !hasActivity) return++ let cooldownTimeout: number | null = null+ let isCoolingDown = false- const animate = () => {- if ((this.loadingColumns.size > 0 || this.afterActionStatus.size > 0) && cooldownTimeout) {+ const animate = () => {+ const currentActivity = this.loadingColumns.size > 0 || this.afterActionStatus.size > 0 || this.activeBulkExecs.size > 0++ if (currentActivity) {+ if (cooldownTimeout) {clearTimeout(cooldownTimeout)cooldownTimeout = nullisCoolingDown = false}+ this.triggerRefreshCanvas()+ this.rafId = requestAnimationFrame(animate)+ } else if (!isCoolingDown) {+ isCoolingDown = true+ this.triggerRefreshCanvas()++ cooldownTimeout = window.setTimeout(() => {+ if (this.rafId) {+ cancelAnimationFrame(this.rafId)+ this.rafId = null+ }+ cooldownTimeout = null+ isCoolingDown = false+ }, 1000)- if (this.loadingColumns.size > 0 || this.afterActionStatus.size > 0) {- this.triggerRefreshCanvas()- this.rafId = requestAnimationFrame(animate)- } else if (!isCoolingDown) {- isCoolingDown = true- this.triggerRefreshCanvas()-- cooldownTimeout = window.setTimeout(() => {- if (this.rafId) {- cancelAnimationFrame(this.rafId)- this.rafId = null- }- cooldownTimeout = null- isCoolingDown = false- }, 1000)-- this.rafId = requestAnimationFrame(() => {- this.triggerRefreshCanvas()- })- }+ this.rafId = requestAnimationFrame(() => this.triggerRefreshCanvas())}-- this.rafId = requestAnimationFrame(animate)}++ this.rafId = requestAnimationFrame(animate)}- private handleUrl(colOptions: any, url: string, allowLocalUrl: boolean) {- url = addMissingUrlSchma(url)+ private handleUrl(colOptions: any, url: string, allowLocalUrl: boolean = false) {+ if (!url) returntry {+ url = addMissingUrlSchma(url)url = decodeURI(url) === url ? encodeURI(url) : url+ confirmPageLeavingRedirect(url, '_blank', allowLocalUrl)} catch {- url = encodeURI(url)+ confirmPageLeavingRedirect(encodeURI(url), '_blank', allowLocalUrl)}+ }- if (url) {- confirmPageLeavingRedirect(url, '_blank', allowLocalUrl)+ private getRecordDisplayValue(row?: Record<string, any>): string {+ if (!row?.row) return ''++ const displayField = this.meta.value?.columns?.find((col) => col.pv || col.pk)+ if (displayField?.title && row.row[displayField.title]) {+ return String(row.row[displayField.title])}++ const firstValue = Object.values(row.row).find((val) => val !== null && val !== undefined && val !== '')+ return firstValue ? String(firstValue) : ''}async executeButtonAction(@@ -185,79 +265,93 @@ export class ActionManager {extra: {row?: Row[]isAiPromptCol?: boolean- path: Array<number>+ path?: Array<number>allowLocalUrl?: boolean- },+ } = {},) {const colOptions = column?.columnObj.colOptions as ButtonType- if (!colOptions) return-- if (!extra.path) {- extra.path = []- }+ if (!colOptions || column.isInvalidColumn?.isInvalid) return+ extra.path = extra.path || []const { cachedRows } = this.getDataCache(extra.path)- if (column.isInvalidColumn?.isInvalid) {- return- }-- if (extra?.isAiPromptCol) {+ if (extra.isAiPromptCol) {colOptions.type = 'ai'}- const { runScript } = useScriptExecutor()+ const { runScript, activeExecutions } = useScriptExecutor()+ const { addScriptExecution } = useActionPane()try {switch (colOptions.type) {case 'url': {- const value = extra?.row?.[0]?.row?.[column.columnObj.title]+ const value = extra.row?.[0]?.row?.[column.columnObj.title]this.handleUrl(colOptions, value?.url?.toString() ?? '', extra.allowLocalUrl)break}+case 'webhook': {const webhookId = colOptions.fk_webhook_idif (!webhookId) throw new Error('No webhook configured')for (const rowId of rowIds) {- await this.executeAction(rowId, column.id, [], async () => {- await this.api.dbTableWebhook.trigger(webhookId, rowId)- })+ await this.executeAction(rowId, column.id, [], () => this.api.dbTableWebhook.trigger(webhookId, rowId))}break}+case 'script': {const script = await this.loadAutomation(colOptions.fk_script_id)+for (let i = 0; i < rowIds.length; i++) {- this.executeAction(rowIds[i]!, column.id, [], async () => {- await runScript(script, extra?.row?.[i], {- pk: rowIds[i]!,+ const rowId = rowIds[i]!+ const row = extra.row?.[i]+ const displayValue = this.getRecordDisplayValue(row) || `Record ${rowId}`++ await this.executeAction(rowId, column.id, [], async () => {+ const scriptExecutionId = await runScript(script, row, {+ pk: rowId,fieldId: column.columnObj.id!,+ executionId: `${rowId}-${column.columnObj.id!}-${Date.now()}`,+ })++ addScriptExecution(scriptExecutionId, {+ recordId: rowId,+ displayValue,+ scriptId: script.id!,+ scriptName: script.title || 'Untitled Script',+ buttonFieldName: column.columnObj.title || 'Button',+ })++ await pollUntil(() => {+ const execution = activeExecutions.value.get(scriptExecutionId)+ return execution?.status === 'finished' || execution?.status === 'error'})})}break}+case 'ai': {- const outputColumnIds = extra?.isAiPromptCol+ const outputColumnIds = extra.isAiPromptCol? [column.id]: colOptions.output_column_ids?.split(',').filter(Boolean) || []+const outputColumns = outputColumnIds.map((id) => this.meta.value?.columnsById[id])await this.executeAction(rowIds, column.id, outputColumnIds, async () => {const res = await this.generateRows(column.id, rowIds)if (res?.length) {- for (let i = 0; i < res.length; i++) {- const row = cachedRows.value.get(extra?.row?.[i]?.rowMeta?.rowIndex)+ res.forEach((data, i) => {+ const row = cachedRows.value.get(extra.row?.[i]?.rowMeta?.rowIndex)if (row) {- const data = res[i]- for (const col of outputColumns) {- row.row[col.title] = data[col.title]- }- cachedRows.value.set(extra?.row?.[i]?.rowMeta?.rowIndex, row)+ outputColumns.forEach((col) => {+ if (col?.title) row.row[col.title] = data[col.title]+ })+ cachedRows.value.set(extra.row[i]?.rowMeta?.rowIndex, row)}- }+ })}})break@@ -268,19 +362,108 @@ export class ActionManager {}}+ // Public state query methodsisLoading(rowId: string, columnId: string): boolean {- return this.loadingColumns.has(this.getKey(rowId, columnId))+ const key = this.getKey(rowId, columnId)+ return this.loadingColumns.has(key) || this.getBulkRowState(rowId, columnId)?.status === 'loading'}getLoadingStartTime(rowId: string, columnId: string): number | null {- return this.loadingColumns.get(this.getKey(rowId, columnId)) ?? null+ const key = this.getKey(rowId, columnId)+ return this.loadingColumns.get(key) ?? this.getBulkRowState(rowId, columnId)?.startTime ?? null}getAfterActionStatus(rowId: string, columnId: string) {- return this.afterActionStatus.get(this.getKey(rowId, columnId))+ const key = this.getKey(rowId, columnId)+ const directStatus = this.afterActionStatus.get(key)++ if (directStatus) return directStatus++ const bulkState = this.getBulkRowState(rowId, columnId)+ if (bulkState?.status === 'success') return { status: 'success' as const }+ if (bulkState?.status === 'error') {+ return { status: 'error' as const, tooltip: bulkState.error ?? 'Something went wrong' }+ }++ return undefined+ }++ isQueued(rowId: string, columnId: string): boolean {+ return this.isBulkExecutionRunning(columnId) && !this.bulkRowStates.has(this.getKey(rowId, columnId))+ }++ getCurrentStepTitle(rowId: string, columnId: string): string | undefined {+ const key = this.getKey(rowId, columnId)+ return this.getBulkRowState(rowId, columnId)?.stepTitle ?? this.currentStepTitles.get(key)+ }++ setCurrentStepTitle(rowId: string, columnId: string, title: string) {+ this.currentStepTitles.set(this.getKey(rowId, columnId), title)+ }++ clearCurrentStepTitle(rowId: string, columnId: string) {+ this.currentStepTitles.delete(this.getKey(rowId, columnId))+ }++ // Cell update methods+ startCellUpdate(recordId: string, fieldId: string, fieldName: string, scriptExecutionId: string) {+ this.cellUpdates.set(`${recordId}:${fieldId}`, {+ fieldName,+ scriptExecutionId,+ startTime: Date.now(),+ })+ }++ completeCellUpdate(recordId: string, fieldId: string) {+ this.cellUpdates.delete(`${recordId}:${fieldId}`)+ }++ getCellUpdateStartTime(recordId: string, fieldId: string): number | null {+ return this.cellUpdates.get(`${recordId}:${fieldId}`)?.startTime ?? null+ }++ isCellUpdating(recordId: string, fieldId: string): boolean {+ return this.cellUpdates.has(`${recordId}:${fieldId}`)+ }++ clearScriptCellUpdates(scriptExecutionId: string) {+ for (const [key, value] of this.cellUpdates.entries()) {+ if (value.scriptExecutionId === scriptExecutionId) {+ this.cellUpdates.delete(key)+ }+ }+ }++ // Bulk execution methods+ isBulkExecutionRunning(columnId: string): boolean {+ return this.activeBulkExecs.get(columnId) ?? false+ }++ getBulkRowState(rowId: string, columnId: string): BulkRowState | undefined {+ return this.bulkRowStates.get(this.getKey(rowId, columnId))+ }++ setBulkRowState(rowId: string, columnId: string, state: BulkRowState) {+ this.bulkRowStates.set(this.getKey(rowId, columnId), state)+ }++ clearBulkRowState(rowId: string, columnId: string) {+ this.bulkRowStates.delete(this.getKey(rowId, columnId))+ }++ clearBulkRowStatesForColumn(columnId: string) {+ for (const [key] of this.bulkRowStates.entries()) {+ if (key.endsWith(`-${columnId}`)) {+ this.bulkRowStates.delete(key)+ }+ }}clear() {this.loadingColumns.clear()+ this.currentStepTitles.clear()+ this.cellUpdates.clear()+ this.activeBulkExecs.clear()+ this.bulkRowStates.clear()}}diff --git a/packages/nc-gui/components/smartsheet/toolbar/BulkAction.vue b/packages/nc-gui/components/smartsheet/toolbar/BulkAction.vueindex 0ada1d8a6a..7c3f5c658a 100644--- a/packages/nc-gui/components/smartsheet/toolbar/BulkAction.vue+++ b/packages/nc-gui/components/smartsheet/toolbar/BulkAction.vue@@ -1 +1,3 @@-<template><div></div></template>+<template>+ <NcSpanHidden />+</template>diff --git a/packages/nc-gui/components/tabs/Smartsheet.vue b/packages/nc-gui/components/tabs/Smartsheet.vueindex e18567031e..f6474fbcea 100644--- a/packages/nc-gui/components/tabs/Smartsheet.vue+++ b/packages/nc-gui/components/tabs/Smartsheet.vue@@ -88,6 +88,8 @@ const grid = ref()const extensionPaneRef = ref()+const actionPaneRef = ref()+const onDrop = async (event: DragEvent) => {event.preventDefault()try {@@ -171,16 +173,20 @@ const { leftSidebarWidth, windowSize } = storeToRefs(useSidebarStore())const { isPanelExpanded, extensionPanelSize } = useExtensions()+const { isPanelExpanded: isActionPanelExpanded, actionPanelSize } = useActionPane()+const contentSize = computed(() => {if (isPanelExpanded.value && extensionPanelSize.value) {return 100 - extensionPanelSize.value+ } else if (isActionPanelExpanded.value && actionPanelSize.value) {+ return 100 - actionPanelSize.value} else {return 100}})const contentMaxSize = computed(() => {- if (!isPanelExpanded.value) {+ if (!isPanelExpanded.value && !isActionPanelExpanded.value) {return 100} else {return ((windowSize.value - leftSidebarWidth.value - 300) / (windowSize.value - leftSidebarWidth.value)) * 100@@ -191,12 +197,16 @@ const onResize = () => {if (isPanelExpanded.value && !extensionPaneRef.value?.isReady) {extensionPaneRef.value?.onReady()}+ if (isActionPanelExpanded.value && !actionPaneRef.value?.isReady) {+ actionPaneRef.value?.onReady()+ }}const onResized = (sizes: { min: number; max: number; size: number }[]) => {if (sizes.length === 2) {- if (!sizes[1].size) return- if (isPanelExpanded.value) extensionPanelSize.value = sizes[1].size+ if (!sizes[1]?.size) return+ if (isPanelExpanded.value) extensionPanelSize.value = sizes[1]!.size+ if (isActionPanelExpanded.value) actionPanelSize.value = sizes[1]!.size}}@@ -207,6 +217,12 @@ const onReady = () => {extensionPaneRef.value?.onReady()}, 300)}+ if (isActionPanelExpanded.value && actionPaneRef.value) {+ // wait until action pane animation complete+ setTimeout(() => {+ actionPaneRef.value?.onReady()+ }, 300)+ }}</script>@@ -224,6 +240,7 @@ const onReady = () => {class="nc-extensions-content-resizable-wrapper":class="{'nc-is-open-extensions': isPanelExpanded,+ 'nc-is-open-actions': isActionPanelExpanded,}"@ready="() => onReady()"@resize="onResize"@@ -257,6 +274,7 @@ const onReady = () => {</div></Pane><ExtensionsPane v-if="isPanelExpanded" ref="extensionPaneRef" />+ <ActionsPane v-if="isActionPanelExpanded" ref="actionPaneRef" /></Splitpanes><SmartsheetDetails v-else /></div>@@ -272,7 +290,7 @@ const onReady = () => {}.nc-extensions-content-resizable-wrapper {- &:not(.nc-is-open-extensions) > {+ &:not(.nc-is-open-extensions) &:not(.nc-is-open-actions) > {.splitpanes__splitter {@apply hidden;}diff --git a/packages/nc-gui/components/webhook/index.vue b/packages/nc-gui/components/webhook/index.vueindex 6841e98277..01f10452f4 100644--- a/packages/nc-gui/components/webhook/index.vue+++ b/packages/nc-gui/components/webhook/index.vue@@ -1,5 +1,5 @@<script setup lang="ts">-import { type HookReqType, type HookTestReqType, type HookType, PlanLimitTypes } from 'nocodb-sdk'+import { type HookReqType, type HookTestReqType, type HookType, PlanLimitTypes, hasInputCalls } from 'nocodb-sdk'import type { Ref } from 'vue'import { onKeyDown } from '@vueuse/core'import { UITypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'@@ -47,6 +47,8 @@ const { activeTable } = toRefs(useTablesStore())const { updateStatLimit, showWebhookLogsFeatureAccessModal } = useEeConfig()+const { activeBaseAutomations } = storeToRefs(useAutomationStore())+const defaultHookName = t('labels.webhook')const testSuccess = ref()@@ -170,6 +172,26 @@ const isDropdownOpen = ref()const titleDomRef = ref<HTMLInputElement | undefined>()+const notificationTypes = ref([+ {+ type: 'URL',+ label: 'HTTP Webhook',+ },+ {+ type: 'Script',+ label: 'Run Script',+ },+])++const automationOptions = computed(() => {+ return activeBaseAutomations.value+ .filter((automation) => automation.script && !hasInputCalls(automation.script))+ .map((automation) => ({+ label: automation.title,+ value: automation.id,+ }))+})+const toggleOperation = (operation: string) => {const ops = [...hookRef.operation]const index = ops?.indexOf(operation) ?? -1@@ -390,6 +412,9 @@ const validators = computed(() => {'notification.payload.body': [fieldRequiredValidator()],'notification.payload.to': [fieldRequiredValidator()],}),+ ...(hookRef.notification.type === 'Script' && {+ 'notification.payload.scriptId': [fieldRequiredValidator()],+ }),}})const { validate, validateInfos } = useForm(hookRef, validators)@@ -430,12 +455,17 @@ function onNotificationTypeChange(reset = false) {mattermostChannels.value = getChannelsArray(apps?.value?.Mattermost?.parsedInput)}+ if (hookRef.notification.type === 'Script') {+ hookRef.notification.payload.scriptId = hookRef.notification.payload.scriptId || undefined+ }+if (hookRef.notification.type === 'URL') {const body = hookRef.notification.payload.bodyhookRef.notification.payload.body = body ? (body === '{{ json data }}' ? '{{ json event }}' : body) : '{{ json event }}'hookRef.notification.payload.parameters = hookRef.notification.payload.parameters || [{}]hookRef.notification.payload.headers = hookRef.notification.payload.headers || [{}]hookRef.notification.payload.method = hookRef.notification.payload.method || 'POST'+ hookRef.notification.payload.path = hookRef.notification.payload.path || ''hookRef.notification.payload.auth = hookRef.notification.payload.auth ?? ''}}@@ -897,11 +927,19 @@ const webhookV2AndV3Diff = computed(() => {<div class="flex justify-end items-center gap-3 flex-1"><template v-if="activeTab === HookTab.Configuration">- <NcTooltip v-if="!showUpgradeModal" :disabled="!testConnectionError">- <template #title>+ <NcTooltip v-if="!showUpgradeModal" :disabled="!testConnectionError && hookRef.notification.type !== 'Script'">+ <template v-if="hookRef.notification.type === 'Script'" #title> Test webhook is disabled for scripts </template>+ <template v-else #title>{{ testConnectionError }}</template>- <NcButton :loading="isTestLoading" type="secondary" size="small" icon-position="right" @click="testWebhook">+ <NcButton+ :loading="isTestLoading"+ type="secondary"+ size="small"+ icon-position="right"+ :disabled="hookRef.notification.type === 'Script'"+ @click="testWebhook"+ ><template #icon><GeneralIcon v-if="testSuccess" icon="circleCheckSolid" class="!text-green-700 w-4 h-4 flex-none" /><GeneralIcon@@ -1178,7 +1216,43 @@ const webhookV2AndV3Diff = computed(() => {{{ $t('general.action') }}</div>- <div class="mt-3 border-1 custom-select border-nc-border-gray-medium p-4 border-b-0 rounded-t-2xl">+ <div+ class="mt-3 border-1 custom-select border-nc-border-gray-medium p-4"+ :class="{+ 'rounded-t-2xl border-b-0': hookRef.notification.type !== 'Script',+ 'rounded-2xl': hookRef.notification.type === 'Script',+ }"+ >+ <div v-if="isEeUI" class="flex w-full my-3">+ <a-form-item v-bind="validateInfos['notification.type']" class="w-full">+ <NcSelect+ v-model:value="hookRef.notification.type"+ class="w-full nc-select-shadow nc-select-hook-notification-type"+ data-testid="nc-dropdown-hook-notification-type"+ @change="onNotificationTypeChange(true)"+ >+ <a-select-option v-for="type in notificationTypes" :key="type.type" :value="type.type">+ <div class="flex items-center">+ <component :is="iconMap[type.type]" class="text-gray-700 mr-2" />+ {{ type.label }}+ </div>+ </a-select-option>+ </NcSelect>+ </a-form-item>+ </div>++ <template v-if="isEeUI && hookRef.notification.type === 'Script'">+ <a-form-item class="flex w-full my-3" v-bind="validateInfos['notification.payload.scriptId']">+ <NcSelect+ v-model:value="hookRef.notification.payload.scriptId"+ :options="automationOptions"+ class="w-full nc-select-shadow nc-select-hook-scrip-type"+ data-testid="nc-dropdown-hook-notification-type"+ placeholder="Select a script"+ ></NcSelect>+ </a-form-item>+ </template>+<template v-if="hookRef.notification.type === 'URL'"><div class="flex gap-3"><a-form-item class="w-1/3">@@ -1337,7 +1411,7 @@ const webhookV2AndV3Diff = computed(() => {</div></div>- <div v-if="isEeUI">+ <div v-if="isEeUI && hookRef.notification.type !== 'Script'"><div><div class="w-full cursor-pointer flex items-center" @click.prevent="toggleIncludeUser"><NcSwitch :checked="Boolean(hookRef.notification.include_user)" class="nc-check-box-include-user">@@ -1375,7 +1449,7 @@ const webhookV2AndV3Diff = computed(() => {</div></a-form-item>- <div>+ <div v-if="hookRef.notification.type !== 'Script'"><NcDivider /><div class="flex items-center justify-between -ml-1.5 !mt-[32px]"><NcButton type="text" class="mb-3" size="small" @click="toggleSamplePayload()">diff --git a/packages/nc-gui/components/workspace/View.vue b/packages/nc-gui/components/workspace/View.vueindex f91b2e8f96..532644a17a 100644--- a/packages/nc-gui/components/workspace/View.vue+++ b/packages/nc-gui/components/workspace/View.vue@@ -190,7 +190,9 @@ onBeforeUnmount(() => {<WorkspaceCollaboratorsList :workspace-id="currentWorkspace.id" /></a-tab-pane></template>- <template v-if="isEeUI && !props.workspaceId && isPaymentEnabled && isUIAllowed('workspaceBilling')">+ <template+ v-if="isEeUI && !props.workspaceId && !currentWorkspace?.fk_org_id && isPaymentEnabled && isUIAllowed('workspaceBilling')"+ ><a-tab-pane key="billing" class="w-full"><template #tab><div class="tab-title" data-testid="nc-workspace-settings-tab-billing">@@ -216,7 +218,7 @@ onBeforeUnmount(() => {</a-tab-pane></template>- <template v-if="isWorkspaceSsoAvail && isUIAllowed('workspaceSSO')">+ <template v-if="isWorkspaceSsoAvail && !currentWorkspace?.fk_org_id && isUIAllowed('workspaceSSO')"><a-tab-pane key="sso" class="w-full"><template #tab><div class="tab-title" data-testid="nc-workspace-settings-tab-billing">diff --git a/packages/nc-gui/composables/useActionPane.ts b/packages/nc-gui/composables/useActionPane.tsnew file mode 100644index 0000000000..771315a4e9--- /dev/null+++ b/packages/nc-gui/composables/useActionPane.ts@@ -0,0 +1,33 @@+export const useActionPane = createSharedComposable(() => {+ const isViewActionsEnabled = computed(() => false)++ const isRowActionsEnabled = computed(() => false)++ const actionPanelSize = ref(40)+ const isPanelExpanded = ref(false)++ const toggleActionPanel = () => {}++ const openActionPane = () => {}++ const addScriptExecution = (..._args: any) => {}++ const removeScriptExecution = (..._args: any) => {}++ const clearAllExecutions = () => {}++ const executions = computed(() => [])++ return {+ isPanelExpanded,+ actionPanelSize,+ toggleActionPanel,+ openActionPane,+ addScriptExecution,+ removeScriptExecution,+ clearAllExecutions,+ executions,+ isViewActionsEnabled,+ isRowActionsEnabled,+ }+})diff --git a/packages/nc-gui/composables/useBetaFeatureToggle.ts b/packages/nc-gui/composables/useBetaFeatureToggle.tsindex 0072c4587a..4cd9027dba 100644--- a/packages/nc-gui/composables/useBetaFeatureToggle.ts+++ b/packages/nc-gui/composables/useBetaFeatureToggle.ts@@ -66,15 +66,6 @@ const FEATURES = [isEE: true,isOnPrem: false,},- {- id: 'row_action',- title: 'Row Actions',- description: 'Allows user to execute script on a row.',- enabled: false,- version: 0,- isEngineering: true,- isEE: true,- },{id: 'integrations',title: 'Integrations',@@ -165,6 +156,24 @@ const FEATURES = [version: 2,isEE: true,},+ {+ id: 'view_actions',+ title: 'View Actions',+ description: 'Execute scripts and webhooks to all records in a view.',+ enabled: false,+ version: 1,+ isEngineering: true,+ isEE: true,+ },+ {+ id: 'row_actions',+ title: 'Row Actions',+ description: 'Execute scripts and webhooks to a record.',+ enabled: false,+ version: 1,+ isEngineering: true,+ isEE: true,+ },] as constexport const FEATURE_FLAG = Object.fromEntries(FEATURES.map((feature) => [feature.id.toUpperCase(), feature.id])) as Record<diff --git a/packages/nc-gui/composables/useGlobal/actions.ts b/packages/nc-gui/composables/useGlobal/actions.tsindex d7720c9fdc..a45aa5f821 100644--- a/packages/nc-gui/composables/useGlobal/actions.ts+++ b/packages/nc-gui/composables/useGlobal/actions.ts@@ -142,7 +142,8 @@ export function useGlobalActions(state: State, _getters: Getters): Actions {query,tableId,viewId,- replace,+ replace = false,+ newTab = false,}: {workspaceId?: stringbaseId?: string@@ -150,6 +151,7 @@ export function useGlobalActions(state: State, _getters: Getters): Actions {tableId?: stringviewId?: stringreplace?: boolean+ newTab?: boolean}) => {const tablePath = tableId ? `/${tableId}${viewId ? `/${viewId}` : ''}` : ''const workspaceId = _workspaceId || 'nc'@@ -163,10 +165,14 @@ export function useGlobalActions(state: State, _getters: Getters): Actions {path = `/${workspaceId}${queryParams}`}- return navigateTo({- path,- replace,- })+ if (newTab) {+ window.open(`${window.location.origin}#${path}`, '_blank')+ } else {+ return navigateTo({+ path,+ replace,+ })+ }}const getBaseUrl = (workspaceId: string) => {diff --git a/packages/nc-gui/composables/useGlobal/types.ts b/packages/nc-gui/composables/useGlobal/types.tsindex 75a8dfea12..2b2772e97b 100644--- a/packages/nc-gui/composables/useGlobal/types.ts+++ b/packages/nc-gui/composables/useGlobal/types.ts@@ -112,6 +112,7 @@ export interface Actions {automationId?: stringreplace?: booleandashboardId?: string+ newTab?: boolean}) => voidgetBaseUrl: (workspaceId: string) => string | undefinedgetMainUrl: (workspaceId: string) => string | undefineddiff --git a/packages/nc-gui/composables/useScriptExecutor.ts b/packages/nc-gui/composables/useScriptExecutor.tsindex 2ffba8dec9..14bbefe794 100644--- a/packages/nc-gui/composables/useScriptExecutor.ts+++ b/packages/nc-gui/composables/useScriptExecutor.ts@@ -1,7 +1,5 @@export const useScriptExecutor = createSharedComposable(() => {- const eventBus = useEventBus<SmartsheetScriptActions>(Symbol('SmartSheetActions'))-- const libCode = ref<string>('')+ const libCode = ref('')const isRunning = ref(false)const isFinished = ref(false)@@ -9,10 +7,12 @@ export const useScriptExecutor = createSharedComposable(() => {const fieldIDRowMapping = computed(() => new Map<string, string>())- const runScript = async (_args, _args_2?, _args_3?) => {}+ const runScript = async (..._args: any) => {}const stopExecution = (_args?: string) => {}+ const eventBus = useEventBus<SmartsheetScriptActions>(EventBusEnum.SmartsheetScript)+return {runScript,stopExecution,@@ -22,5 +22,6 @@ export const useScriptExecutor = createSharedComposable(() => {activeExecutions,libCode,fieldIDRowMapping,+ eventBus,}})diff --git a/packages/nc-gui/composables/useSmartsheetStore.ts b/packages/nc-gui/composables/useSmartsheetStore.tsindex 1a84ce753d..6e633ef4b2 100644--- a/packages/nc-gui/composables/useSmartsheetStore.ts+++ b/packages/nc-gui/composables/useSmartsheetStore.ts@@ -129,10 +129,6 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(return `${where ? `${where}~and` : ''}${colWhereQuery}`})- const isActionPaneActive = ref(false)-- const actionPaneSize = ref(40)-const isSqlView = computed(() => (meta.value as TableType)?.type === 'view')const isSyncedTable = computed(() => !!(meta.value as TableType)?.synced)@@ -212,8 +208,6 @@ const [useProvideSmartsheetStore, useSmartsheetStore] = useInjectionState(sqlUi,allFilters,isDefaultView,- actionPaneSize,- isActionPaneActive,viewColumnsMap,getViewColumns,isExternalSource,diff --git a/packages/nc-gui/lib/enums.ts b/packages/nc-gui/lib/enums.tsindex c35b5a947b..f1daa923b7 100644--- a/packages/nc-gui/lib/enums.ts+++ b/packages/nc-gui/lib/enums.ts@@ -91,6 +91,18 @@ export enum SmartsheetScriptActions {RELOAD_VIEW = 'reload-view',RELOAD_ROW = 'reload-row',++ UPDATE_STEP_TITLE = 'update-step-title',+ START_CELL_UPDATE = 'start-cell-update',+ COMPLETE_CELL_UPDATE = 'complete-cell-update',+ CLEAR_SCRIPT_CELL_UPDATES = 'clear-script-cell-updates',++ BULK_ACTION_START = 'bulk-action-start',+ BULK_ACTION_END = 'bulk-action-end',+ BUTTON_ACTION_START = 'button-action-start',+ BUTTON_ACTION_COMPLETE = 'button-action-complete',+ BUTTON_ACTION_PROGRESS = 'button-action-progress',+ BUTTON_ACTION_ERROR = 'button-action-error',}export enum DataSourcesSubTab {@@ -203,4 +215,5 @@ export enum WorkspaceIconType {export const EventBusEnum = {SmartsheetStore: Symbol('SmartsheetStore'),Realtime: Symbol('Realtime'),+ SmartsheetActions: Symbol('SmartSheetActions'),}diff --git a/packages/nc-gui/lib/types.ts b/packages/nc-gui/lib/types.tsindex 10ab88470c..13f062596b 100644--- a/packages/nc-gui/lib/types.ts+++ b/packages/nc-gui/lib/types.ts@@ -90,6 +90,7 @@ interface RowMetaRowColorInfo {rowLeftBorderColor?: string | nullrowHoverColor?: string | nullrowBorderColor?: string | null+ is_set_as_background?: boolean}interface Row {diff --git a/packages/nc-gui/store/automation.ts b/packages/nc-gui/store/automation.tsindex 39d61fa6cb..368f19062c 100644--- a/packages/nc-gui/store/automation.ts+++ b/packages/nc-gui/store/automation.ts@@ -48,8 +48,3 @@ export const useAutomationStore = defineStore('automation', () => {openNewScriptModal,}})--// Enable HMR-if (import.meta.hot) {- import.meta.hot.accept(acceptHMRUpdate(useAutomationStore, import.meta.hot))-}diff --git a/packages/nc-gui/utils/commonUtils.ts b/packages/nc-gui/utils/commonUtils.tsindex 568f55fc4f..fe3c4423b1 100644--- a/packages/nc-gui/utils/commonUtils.ts+++ b/packages/nc-gui/utils/commonUtils.ts@@ -186,3 +186,22 @@ export function waitForCondition(conditionFn: () => unknown, interval: number =check()})}++export const pollUntil = <T>(conditionFn: () => T | null | undefined | false, interval: number = 100): Promise<T> => {+ return new Promise((resolve, reject) => {+ const check = () => {+ try {+ const result = conditionFn()+ if (result) {+ resolve(result)+ } else {+ setTimeout(check, interval)+ }+ } catch (error) {+ reject(error)+ }+ }++ check()+ })+}diff --git a/packages/nocodb-sdk/src/lib/index.ts b/packages/nocodb-sdk/src/lib/index.tsindex cef42cd994..bbf287876d 100644--- a/packages/nocodb-sdk/src/lib/index.ts+++ b/packages/nocodb-sdk/src/lib/index.ts@@ -71,3 +71,4 @@ export * from '~/lib/filter';export * from '~/lib/dashboard';export * from '~/lib/arrayHelpers';export * from '~/lib/roleHelpers';+export * from '~/lib/system';diff --git a/packages/nocodb-sdk/src/lib/ncTypes.ts b/packages/nocodb-sdk/src/lib/ncTypes.tsindex d773578796..5eee3dafcb 100644--- a/packages/nocodb-sdk/src/lib/ncTypes.ts+++ b/packages/nocodb-sdk/src/lib/ncTypes.ts@@ -14,6 +14,7 @@ export interface NcContext {};fk_model_id?: string;socket_id?: string;+ nc_site_url?: string;}export interface NcRequest extends Partial<Request> {diff --git a/packages/nocodb-sdk/src/lib/payment/index.ts b/packages/nocodb-sdk/src/lib/payment/index.tsindex c92975b031..caba4fe089 100644--- a/packages/nocodb-sdk/src/lib/payment/index.ts+++ b/packages/nocodb-sdk/src/lib/payment/index.ts@@ -160,7 +160,7 @@ export const HigherPlan = {export const GRACE_PERIOD_DURATION = 14;-export const LOYALTY_GRACE_PERIOD_END_DATE = '2025-07-31';+export const LOYALTY_GRACE_PERIOD_END_DATE = '2025-08-27';export const SEAT_PRICE_CAP = 9;diff --git a/packages/nocodb-sdk/src/lib/system/index.ts b/packages/nocodb-sdk/src/lib/system/index.tsnew file mode 100644index 0000000000..4250cd5ff1--- /dev/null+++ b/packages/nocodb-sdk/src/lib/system/index.ts@@ -0,0 +1 @@+export * from './serviceUser';diff --git a/packages/nocodb-sdk/src/lib/system/serviceUser.ts b/packages/nocodb-sdk/src/lib/system/serviceUser.tsnew file mode 100644index 0000000000..74ecdec8a5--- /dev/null+++ b/packages/nocodb-sdk/src/lib/system/serviceUser.ts@@ -0,0 +1,17 @@+const NOCO_SERVICE_USERS = {+ AUTOMATION_USER: {+ id: 'usrautomation',+ email: '[email protected]',+ display_name: 'NocoDB Automation',+ email_verified: true,+ },+};++const isAutomationUser = (user: any) => {+ return (+ user.email === NOCO_SERVICE_USERS.AUTOMATION_USER.email ||+ user.id === NOCO_SERVICE_USERS.AUTOMATION_USER.id+ );+};++export { NOCO_SERVICE_USERS, isAutomationUser };diff --git a/packages/nocodb/src/Noco.ts b/packages/nocodb/src/Noco.tsindex 36c42ef1ca..5318411486 100644--- a/packages/nocodb/src/Noco.ts+++ b/packages/nocodb/src/Noco.ts@@ -140,6 +140,9 @@ export default class Noco {try {this.sharp = (await import('sharp')).default;++ this.sharp.concurrency(1);+ this.sharp.cache(false);} catch {console.error('Sharp is not available for your platform, thumbnail generation will be skipped',diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.tsindex 8ab0c7e74d..15d6bd311e 100644--- a/packages/nocodb/src/db/BaseModelSqlv2.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2.ts@@ -5508,6 +5508,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {if (userColumns.length) {const baseUsers = await BaseUser.getUsersList(this.context, {base_id: this.model.base_id,+ include_internal_user: true,});await PresignedUrl.signMetaIconImage(baseUsers);@@ -6746,6 +6747,7 @@ class BaseModelSqlv2 implements IBaseModelSqlV2 {// deleted user may still exists on some fields// it's still valid as a historical recordinclude_ws_deleted: true,+ include_internal_user: true,});if (typeof data[column.column_name] === 'object') {diff --git a/packages/nocodb/src/db/BaseModelSqlv2/group-by.ts b/packages/nocodb/src/db/BaseModelSqlv2/group-by.tsindex aec6955574..f5af32a29e 100644--- a/packages/nocodb/src/db/BaseModelSqlv2/group-by.ts+++ b/packages/nocodb/src/db/BaseModelSqlv2/group-by.ts@@ -301,6 +301,7 @@ export const groupBy = (baseModel: IBaseModelSqlV2, logger: Logger) => {) {const baseUsers = await BaseUser.getUsersList(baseModel.context, {base_id: column.base_id,+ include_internal_user: true,});let finalStatement = '';@@ -1252,6 +1253,7 @@ export const groupBy = (baseModel: IBaseModelSqlV2, logger: Logger) => {);const baseUsers = await BaseUser.getUsersList(baseModel.context, {base_id: column.base_id,+ include_internal_user: true,});// create nested replace statement for each userdiff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.tsindex 870a7bd3a3..78fd0a9119 100644--- a/packages/nocodb/src/db/conditionV2.ts+++ b/packages/nocodb/src/db/conditionV2.ts@@ -4,7 +4,6 @@ import {getEquivalentUIType,isAIPromptCol,isDateMonthFormat,- isLinksOrLTAR,isNumericCol,UITypes,} from 'nocodb-sdk';@@ -251,6 +250,7 @@ const parseConditionV2 = async (const baseUsers = await BaseUser.getUsersList(context, {base_id: column.base_id,+ include_internal_user: true,});return {diff --git a/packages/nocodb/src/db/field-handler/handlers/user/user.general.handler.ts b/packages/nocodb/src/db/field-handler/handlers/user/user.general.handler.tsindex 9449895e2f..45b38891ba 100644--- a/packages/nocodb/src/db/field-handler/handlers/user/user.general.handler.ts+++ b/packages/nocodb/src/db/field-handler/handlers/user/user.general.handler.ts@@ -67,6 +67,7 @@ export class UserGeneralHandler extends GenericFieldHandler {// deleted user may still exists on some fields// it's still valid as a historical recordinclude_ws_deleted: true,+ include_internal_user: true,},);@@ -222,6 +223,7 @@ export class UserGeneralHandler extends GenericFieldHandler {const baseUsers = await BaseUser.getUsersList(context, {base_id: column.base_id,+ include_internal_user: true,});const users = baseUsers.filter((user) => {const filterVal = val.toLowerCase();diff --git a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.tsindex 7d3e5f43ba..085ac986ba 100644--- a/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts+++ b/packages/nocodb/src/db/formulav2/formulaQueryBuilderv2.ts@@ -231,6 +231,7 @@ async function _formulaQueryBuilder(params: FormulaQueryBuilderBaseParams) {baseUsers ??(await BaseUser.getUsersList(context, {base_id: model.base_id,+ include_internal_user: true,}));let finalStatement = '';diff --git a/packages/nocodb/src/db/sortV2.ts b/packages/nocodb/src/db/sortV2.tsindex dd06541a27..072ac9d7d1 100644--- a/packages/nocodb/src/db/sortV2.ts+++ b/packages/nocodb/src/db/sortV2.ts@@ -162,6 +162,7 @@ export default async function sortV2(const base = await Base.get(context, model.base_id);const baseUsers = await BaseUser.getUsersList(context, {base_id: base.id,+ include_internal_user: true,});// create nested replace statement for each userdiff --git a/packages/nocodb/src/helpers/webhookHelpers.ts b/packages/nocodb/src/helpers/webhookHelpers.tsindex d91df7cfbb..925597d4a4 100644--- a/packages/nocodb/src/helpers/webhookHelpers.ts+++ b/packages/nocodb/src/helpers/webhookHelpers.ts@@ -8,8 +8,10 @@ import Handlebars from 'handlebars';import handlebarsHelpers from 'handlebars-helpers-v2';import {ColumnHelper,+ hasInputCalls,HookOperationCode,isDateMonthFormat,+ NOCO_SERVICE_USERS,UITypes,} from 'nocodb-sdk';import { useAgent } from 'request-filtering-agent';@@ -28,11 +30,15 @@ import type {import type { NcContext } from '~/interface/config';import type { Column, FormView, Hook, Model, View } from '~/models';import type { AxiosResponse } from 'axios';-import { Filter, HookLog, Source } from '~/models';+import { Filter, HookLog, Script, Source } from '~/models';import { addDummyRootAndNest } from '~/services/v3/filters-v3.service';import { isEE, isOnPrem, populateUpdatePayloadDiff } from '~/utils';import { parseMetaProp } from '~/utils/modelUtils';import { filterBuilder } from '~/utils/api-v3-data-transformation.builder';+import { JobTypes } from '~/interface/Jobs';+import Noco from '~/Noco';+import { genJwt } from '~/services/users/helpers';+import { NcError } from '~/helpers/ncError';handlebarsHelpers({ handlebars: Handlebars });@@ -682,6 +688,8 @@ export async function invokeWebhook(testFilters?;throwErrorOnFailure?: boolean;testHook?: boolean;+ ncSiteUrl?: string;+ addJob?: (name: string, data: any) => Promise<void>;},) {const {@@ -694,6 +702,8 @@ export async function invokeWebhook(testFilters = null,throwErrorOnFailure = false,testHook = false,+ ncSiteUrl,+ addJob,} = param;let { newData } = param;@@ -722,8 +732,12 @@ export async function invokeWebhook(const isBulkOperation = Array.isArray(newData);- if (isBulkOperation && notification?.type !== 'URL') {- // only URL hook is supported for bulk operations+ if (+ isBulkOperation &&+ notification?.type !== 'URL' &&+ notification?.type !== 'Script'+ ) {+ // only URL & Script hooks are supported for bulk operationsreturn;}@@ -858,6 +872,50 @@ export async function invokeWebhook(}}break;+ case 'Script':+ {+ const datas = Array.isArray(newData) ? newData : [newData];++ const script = await Script.get(+ context,+ notification?.payload?.scriptId,+ );++ if (!script.script || hasInputCalls(script.script)) {+ NcError._.notImplemented(+ 'Script with input calls is not supported',+ );+ }++ await addJob?.(JobTypes.ExecuteAction, {+ context,+ scriptId: notification?.payload?.scriptId,+ modelId: model.id,+ records: datas,+ req: {+ user: NOCO_SERVICE_USERS.AUTOMATION_USER,+ headers: {+ 'xc-auth': genJwt(+ {+ ...NOCO_SERVICE_USERS.AUTOMATION_USER,+ extra: {+ context: {+ ...context,+ script_id: notification?.payload?.scriptId,+ },+ },+ },+ Noco.getConfig(),+ {+ expiresIn: '10m',+ },+ ),+ },+ ncSiteUrl,+ },+ });+ }+ break;default:{const webhookData = constructHookDataForNonURLHooks({diff --git a/packages/nocodb/src/integrations/index.ts b/packages/nocodb/src/integrations/index.tsindex cb2629fde8..6d8bf731be 100644--- a/packages/nocodb/src/integrations/index.ts+++ b/packages/nocodb/src/integrations/index.ts@@ -3,10 +3,6 @@!!! Do not edit this file manually !!!*/--import type { IntegrationEntry } from '@noco-local-integrations/core';-export default [--] as IntegrationEntry[];+export default [] as IntegrationEntry[];diff --git a/packages/nocodb/src/interface/Jobs.ts b/packages/nocodb/src/interface/Jobs.tsindex 7c1a5790fb..526ce37a6e 100644--- a/packages/nocodb/src/interface/Jobs.ts+++ b/packages/nocodb/src/interface/Jobs.ts@@ -52,6 +52,7 @@ export enum JobTypes {UpdateUsageStats = 'update-usage-stats',CloudDbMigrate = 'cloud-db-migrate',AttachmentUrlUpload = 'attachment-url-upload',+ ExecuteAction = 'execute-action',}export const SKIP_STORING_JOB_META = [@@ -130,6 +131,7 @@ export interface AtImportJobData extends JobData {syncRollup?: boolean;syncUsers?: boolean;syncData?: boolean;+ syncFormula?: boolean;};user: any;}@@ -183,6 +185,7 @@ export interface HandleWebhookJobData extends JobData {modelId: string;viewId: string;hookName: string;+ ncSiteUrl: string;prevData;newData;}@@ -231,3 +234,11 @@ export interface SyncDataSyncModuleJobData extends JobData {}export type AttachmentUrlUploadJobData = AttachmentUrlUploadParam & JobData;++export interface ExecuteActionJobData extends JobData {+ req: NcRequest;+ records?: any[];+ modelId?: string;+ viewId?: string;+ scriptId: string;+}diff --git a/packages/nocodb/src/interface/Mail.ts b/packages/nocodb/src/interface/Mail.tsindex 1acc61557d..093aa5d14f 100644--- a/packages/nocodb/src/interface/Mail.ts+++ b/packages/nocodb/src/interface/Mail.ts@@ -130,4 +130,11 @@ type MailParams =payload: FormSubmissionPayload;};-export { MailEvent, MailParams, FormSubmissionPayload };+interface RawMailParams {+ to: string;+ subject: string;+ html: string;+ text?: string;+}++export { MailEvent, MailParams, FormSubmissionPayload, RawMailParams };diff --git a/packages/nocodb/src/models/BaseUser.ts b/packages/nocodb/src/models/BaseUser.tsindex 6f0d1e52b3..ae9a5714ec 100644--- a/packages/nocodb/src/models/BaseUser.ts+++ b/packages/nocodb/src/models/BaseUser.ts@@ -200,12 +200,15 @@ export default class BaseUser {strict_in_record = false,// eslint-disable-next-line @typescript-eslint/no-unused-varsinclude_ws_deleted = true,+ // eslint-disable-next-line @typescript-eslint/no-unused-vars+ include_internal_user = false,user_ids,}: {base_id: string;mode?: 'full' | 'viewer';strict_in_record?: boolean;include_ws_deleted?: boolean;+ include_internal_user?: boolean;user_ids?: string[];},ncMeta = Noco.ncMeta,diff --git a/packages/nocodb/src/models/ButtonColumn.ts b/packages/nocodb/src/models/ButtonColumn.tsindex 8bfd815b22..03cd7d031a 100644--- a/packages/nocodb/src/models/ButtonColumn.ts+++ b/packages/nocodb/src/models/ButtonColumn.ts@@ -184,4 +184,19 @@ export default class ButtonColumn {public getParsedTree() {return this.parsed_tree;}++ public static async buttonUsages(+ context: NcContext,+ scriptId: string,+ ncMeta = Noco.ncMeta,+ ) {+ return await ncMeta.metaList2(+ context.workspace_id,+ context.base_id,+ MetaTable.COL_BUTTON,+ {+ condition: { fk_script_id: scriptId },+ },+ );+ }}diff --git a/packages/nocodb/src/modules/jobs/jobs.processor.ts b/packages/nocodb/src/modules/jobs/jobs.processor.tsindex d69a7569a3..4b43fd0816 100644--- a/packages/nocodb/src/modules/jobs/jobs.processor.ts+++ b/packages/nocodb/src/modules/jobs/jobs.processor.ts@@ -2,7 +2,12 @@ import { Process, Processor } from '@nestjs/bull';import { Inject, Logger } from '@nestjs/common';import { Job } from 'bull';import type { JobData } from '~/interface/Jobs';-import { JOB_REQUEUE_LIMIT, JOBS_QUEUE, JobVersions } from '~/interface/Jobs';+import {+ JOB_REQUEUE_LIMIT,+ JOBS_QUEUE,+ JobTypes,+ JobVersions,+} from '~/interface/Jobs';import { IJobsService } from '~/modules/jobs/jobs-service.interface';import { JobsMap } from '~/modules/jobs/jobs-map.service';import { JobsEventService } from '~/modules/jobs/jobs-event.service';@@ -10,6 +15,14 @@ import { JobStatus } from '~/interface/Jobs';const NC_WORKER_CONCURRENCY = process.env.NC_WORKER_CONCURRENCY ?? 10;+const LOCAL_CONCURRENCY_LIMIT = {+ [JobTypes.AtImport]: 2,+ [JobTypes.ThumbnailGenerator]: 1,+ [JobTypes.AttachmentUrlUpload]: 1,+};++const LOCAL_JOB_COUNT_MAP = new Map<string, number>();+@Processor(JOBS_QUEUE)export class JobsProcessor {private logger = new Logger(JobsProcessor.name);@@ -48,10 +61,37 @@ export class JobsProcessor {}}+ const localRunning = LOCAL_JOB_COUNT_MAP.get(jobName)!;++ if (localRunning && localRunning >= LOCAL_CONCURRENCY_LIMIT[jobName]) {+ job.data._jobDelay = 0;+ job.data._jobAttempt = 1;++ await this.requeue(job);+ return;+ }++ if (localRunning) {+ LOCAL_JOB_COUNT_MAP.set(jobName, localRunning + 1);+ } else {+ LOCAL_JOB_COUNT_MAP.set(jobName, 1);+ }+try {- return await processor[fn](job);+ const result = await processor[fn](job);++ const localRunning = LOCAL_JOB_COUNT_MAP.get(jobName)!;++ LOCAL_JOB_COUNT_MAP.set(jobName, localRunning - 1);++ return result;} catch (e) {this.logger.error(`Error processing job ${jobName}`, e);++ const localRunning = LOCAL_JOB_COUNT_MAP.get(jobName)!;++ LOCAL_JOB_COUNT_MAP.set(jobName, localRunning - 1);+throw e;}}diff --git a/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts b/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.tsindex dfeb9f2bd2..865eda2d03 100644--- a/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts+++ b/packages/nocodb/src/modules/jobs/jobs/at-import/at-import.processor.ts@@ -618,13 +618,36 @@ export class AtImportProcessor {// not supported datatype: pure formula field// allow formula based computed fields (created time/ modified time to go through)if (ncCol.uidt === UITypes.Formula) {- updateMigrationSkipLog(- tblSchema[i].name,- ncName.title,- col.type,- 'column type not supported yet',- );- continue;+ if (!syncDB.options.syncFormula) {+ updateMigrationSkipLog(+ tblSchema[i].name,+ ncName.title,+ col.type,+ 'column type not supported yet',+ );+ continue;+ } else {+ ncCol.formula = '""';+ ncCol.formula_raw = '""';++ let formulaTextParsed = col.typeOptions?.formulaTextParsed || '';+ // Replace any column_*_fldId pattern with the corresponding column title+ formulaTextParsed = formulaTextParsed.replace(+ /{column_[^{}]*?_(fld[a-zA-Z0-9]+)}/g,+ (match, fldId) => {+ const colSchema = aTbl_getColumnName(fldId);+ return colSchema ? `{${colSchema.cn}}` : match;+ },+ );+ formulaTextParsed = formulaTextParsed.replace(+ /column_[^{}]*?_(fld[a-zA-Z0-9]+)/g,+ (match, fldId) => {+ const colSchema = aTbl_getColumnName(fldId);+ return colSchema ? `{${colSchema.cn}}` : match;+ },+ );+ ncCol.description = formulaTextParsed;+ }}// not supported datatype: pure button field@@ -1491,12 +1514,13 @@ export class AtImportProcessor {// retrieve datatypeconst dt = table.columns.find((x) => x.title === key)?.uidt;- // always process LTAR, Lookup, and Rollup columns as we delete the key after processing+ // always process LTAR, Lookup, Formula and Rollup columns as we delete the key after processingif (!value &&!isLinksOrLTAR(dt) &&dt !== UITypes.Lookup &&- dt !== UITypes.Rollup+ dt !== UITypes.Rollup &&+ dt !== UITypes.Formula) {rec[key] = null;continue;@@ -1641,6 +1665,11 @@ export class AtImportProcessor {rec[key] = value.replace(/\u0000/g, '');break;+ case UITypes.Formula:+ // we need to delete to avoid writing+ delete rec[key];+ break;+default:break;}diff --git a/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts b/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.tsindex bc07c9826f..91e8aa99eb 100644--- a/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts+++ b/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts@@ -620,7 +620,6 @@ export class ExportService {entity: permission.entity,entity_id: idMap.get(permission.entity_id),permission: permission.permission,- created_by: permission.created_by,enforce_for_form: permission.enforce_for_form,enforce_for_automation: permission.enforce_for_automation,granted_type: permission.granted_type,diff --git a/packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts b/packages/nocodb/src/modules/jobs/jobs/export-import/import.service.tsindex 14d74e41bc..0c6b9ee3ec 100644--- a/packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts+++ b/packages/nocodb/src/modules/jobs/jobs/export-import/import.service.ts@@ -2058,7 +2058,7 @@ export class ImportService {skipDuplicates = false,} = param;- const dataHashSet: Set<string> = new Set();+ const dataHashMap: Map<string, boolean> = new Map();const headers: string[] = [];let chunk = [];@@ -2124,8 +2124,8 @@ export class ImportService {if (skipDuplicates) {// check if the row already existsconst rowHash = hash(row);- if (!dataHashSet.has(rowHash)) {- dataHashSet.add(rowHash);+ if (!dataHashMap.has(rowHash)) {+ dataHashMap.set(rowHash, true);chunk.push(row);}} else {diff --git a/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts b/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.tsindex 034e39aad4..4df375f290 100644--- a/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts+++ b/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts@@ -46,8 +46,6 @@ export class ThumbnailGeneratorProcessor {return null;}- sharp.concurrency(1);-try {const storageAdapter = await NcPluginMgrv2.storageAdapter();diff --git a/packages/nocodb/src/modules/jobs/jobs/webhook-handler/webhook-handler.processor.ts b/packages/nocodb/src/modules/jobs/jobs/webhook-handler/webhook-handler.processor.tsindex 6b6197a36f..3e2cc5a5b9 100644--- a/packages/nocodb/src/modules/jobs/jobs/webhook-handler/webhook-handler.processor.ts+++ b/packages/nocodb/src/modules/jobs/jobs/webhook-handler/webhook-handler.processor.ts@@ -1,12 +1,17 @@-import { Logger } from '@nestjs/common';+import { Inject, Logger } from '@nestjs/common';import type { Job } from 'bull';import { invokeWebhook } from '~/helpers/webhookHelpers';import { Hook, Model, View } from '~/models';import { type HandleWebhookJobData } from '~/interface/Jobs';+import { IJobsService } from '~/modules/jobs/jobs-service.interface';export class WebhookHandlerProcessor {protected logger = new Logger(WebhookHandlerProcessor.name);+ constructor(+ @Inject('JobsService') private readonly jobsService: IJobsService,+ ) {}+async job(job: Job<HandleWebhookJobData>) {const {context,@@ -17,6 +22,7 @@ export class WebhookHandlerProcessor {newData,user,hookName,+ ncSiteUrl,} = job.data;const hook = await Hook.get(context, hookId);@@ -41,6 +47,8 @@ export class WebhookHandlerProcessor {newData,user,hookName,+ ncSiteUrl,+ addJob: this.jobsService.add.bind(this.jobsService),});}}diff --git a/packages/nocodb/src/services/comments.service.ts b/packages/nocodb/src/services/comments.service.tsindex 8fc21c0c8f..6f30f079ec 100644--- a/packages/nocodb/src/services/comments.service.ts+++ b/packages/nocodb/src/services/comments.service.ts@@ -147,7 +147,7 @@ export class CommentsService {});const model = await Model.getByIdOrName(context, {- id: param.body.fk_model_id,+ id: comment.fk_model_id,});const base = await Base.getByTitleOrId(context, model.base_id);diff --git a/packages/nocodb/src/services/hook-handler.service.ts b/packages/nocodb/src/services/hook-handler.service.tsindex 8cfc20e59d..a59f0cfd53 100644--- a/packages/nocodb/src/services/hook-handler.service.ts+++ b/packages/nocodb/src/services/hook-handler.service.ts@@ -158,6 +158,7 @@ export class HookHandlerService implements OnModuleInit, OnModuleDestroy {newData,user,hookName,+ ncSiteUrl: context.nc_site_url,});} catch (e) {this.logger.error({diff --git a/packages/nocodb/src/services/hooks.service.ts b/packages/nocodb/src/services/hooks.service.tsindex d6db30d64d..2804bca373 100644--- a/packages/nocodb/src/services/hooks.service.ts+++ b/packages/nocodb/src/services/hooks.service.ts@@ -35,8 +35,12 @@ export class HooksService {: notificationJsonOrObject;} catch {}- if (notification.type !== 'URL' && process.env.NC_CLOUD === 'true') {- NcError.badRequest('Only URL notification is supported');+ if (+ notification.type !== 'URL' &&+ notification.type !== 'Script' &&+ process.env.NC_CLOUD === 'true'+ ) {+ NcError.badRequest('Only URL and Script notifications are supported');}}@@ -234,6 +238,7 @@ export class HooksService {user: param.req.user,context,hookName: 'manual.trigger',+ ncSiteUrl: param.req.ncSiteUrl,});} catch (e) {throw e;@@ -281,6 +286,8 @@ export class HooksService {throwErrorOnFailure: true,testHook: true,hookName: hook.event + '.' + hook.operation[0],+ ncSiteUrl: param.req.ncSiteUrl,+ addJob: this.jobsService.add.bind(this.jobsService),});} catch (e) {throw e;diff --git a/packages/nocodb/src/services/mail/mail.service.ts b/packages/nocodb/src/services/mail/mail.service.tsindex c5618d7f42..ef62b65971 100644--- a/packages/nocodb/src/services/mail/mail.service.ts+++ b/packages/nocodb/src/services/mail/mail.service.ts@@ -2,7 +2,7 @@ import { Injectable, Logger } from '@nestjs/common';import { RoleLabels } from 'nocodb-sdk';import { render } from '@react-email/render';import type { NcRequest } from 'nocodb-sdk';-import type { MailParams } from '~/interface/Mail';+import type { MailParams, RawMailParams } from '~/interface/Mail';import type { ComponentProps } from 'react';import * as MailTemplates from '~/services/mail/templates';import { MailEvent } from '~/interface/Mail';@@ -107,6 +107,33 @@ export class MailService {return url;}+ async sendMailRaw(params: RawMailParams, ncMeta = Noco.ncMeta) {+ const mailerAdapter = await this.getAdapter(ncMeta);+ if (!mailerAdapter) {+ this.logger.error('Email Plugin not configured / active');+ return false;+ }++ if (!params.to || !params.subject || (!params.html && !params.text)) {+ this.logger.error('Missing required parameters');+ return false;+ }++ try {+ await mailerAdapter.mailSend({+ to: params.to,+ subject: params.subject,+ text: params.text,+ html: params.html,+ });+ } catch (e) {+ this.logger.error(e);+ return false;+ }++ return true;+ }+async sendMail(params: MailParams, ncMeta = Noco.ncMeta) {const mailerAdapter = await this.getAdapter(ncMeta);if (!mailerAdapter) {diff --git a/packages/nocodb/src/services/public-metas.service.ts b/packages/nocodb/src/services/public-metas.service.tsindex ecd5904450..09d1a197b2 100644--- a/packages/nocodb/src/services/public-metas.service.ts+++ b/packages/nocodb/src/services/public-metas.service.ts@@ -1,6 +1,5 @@import { Injectable } from '@nestjs/common';import {- BoolType,isCreatedOrLastModifiedByCol,isLinksOrLTAR,ncIsObject,diff --git a/packages/nocodb/src/services/users/helpers.ts b/packages/nocodb/src/services/users/helpers.tsindex 234e26fad3..0163060022 100644--- a/packages/nocodb/src/services/users/helpers.ts+++ b/packages/nocodb/src/services/users/helpers.ts@@ -8,6 +8,9 @@ import { NC_REFRESH_TOKEN_EXP_IN_DAYS } from '~/constants';export function genJwt(user: User & { extra?: Record<string, any> },config: NcConfig,+ jwtOptions: {+ expiresIn?: string;+ } = {},) {return jwt.sign({@@ -19,7 +22,7 @@ export function genJwt(},config.auth.jwt.secret,// todo: better typing- { expiresIn: '10h', ...(config.auth.jwt.options as any) },+ { expiresIn: '10h', ...(config.auth.jwt.options as any), ...jwtOptions },);}diff --git a/packages/nocodb/src/services/v3/base-members-v3.service.ts b/packages/nocodb/src/services/v3/base-members-v3.service.tsindex e315e9f5f4..ce3694a4ad 100644--- a/packages/nocodb/src/services/v3/base-members-v3.service.ts+++ b/packages/nocodb/src/services/v3/base-members-v3.service.ts@@ -85,7 +85,7 @@ export class BaseMembersV3Service {for (const baseUser of param.baseMembers) {let user: User;let userEmail: string;-+if ('user_id' in baseUser && baseUser.user_id) {user = await User.get(baseUser.user_id, ncMeta);if (!user) {diff --git a/packages/nocodb/src/services/v3/data-v3.service.ts b/packages/nocodb/src/services/v3/data-v3.service.tsindex 185bd39443..5e431dc336 100644--- a/packages/nocodb/src/services/v3/data-v3.service.ts+++ b/packages/nocodb/src/services/v3/data-v3.service.ts@@ -278,7 +278,7 @@ export class DataV3Service {/*** Transform multiple records to v3 format*/- private async transformRecordsToV3Format(param: {+ public async transformRecordsToV3Format(param: {context: NcContext;records: any[];primaryKey: Column;diff --git a/packages/nocodb/tests/unit/rest/tests/dataApiV3/audit-log.test.ts b/packages/nocodb/tests/unit/rest/tests/dataApiV3/audit-log.test.tsindex faf08a50c5..b7f837c35b 100644--- a/packages/nocodb/tests/unit/rest/tests/dataApiV3/audit-log.test.ts+++ b/packages/nocodb/tests/unit/rest/tests/dataApiV3/audit-log.test.ts@@ -1,6 +1,6 @@/* eslint-disable @typescript-eslint/no-unused-vars */import { expect } from 'chai';-import { checkboxTypeMap, ClientType, type ColumnType } from 'nocodb-sdk';+import { checkboxTypeMap, type ColumnType } from 'nocodb-sdk';import {beforeEachAttachment,beforeEachCheckbox,@@ -12,7 +12,7 @@ import {import { ncAxios } from './ncAxios';import { getUsers } from './helpers';import type { ITestContext } from './helpers';-import { Base, type Column, type Model } from '../../../../../src/models';+import type { Column, Model } from '../../../../../src/models';import type { INcAxios } from './ncAxios';const API_VERSION = 'v3';@@ -70,20 +70,6 @@ describe('dataApiV3', () => {};it('audit log', async function () {- const source = (- await (- await Base.get(- {- fk_workspace_id: testContext.context.fk_workspace_id,- base_id: testContext.base.id,- },- testContext.base.id,- )- ).getSources()- )[0];- if(source.type === ClientType.SQLITE) {- return;- }const rsp = await ncAxiosPost({url: `${urlPrefix}/${table.id}/records`,body: newRecord,@@ -102,7 +88,6 @@ describe('dataApiV3', () => {row_id: expectedId,},});-expect(rsp2.body.list.length).to.greaterThan(0);await ncAxiosPatch({url: `${urlPrefix}/${table.id}/records`,