diff --git a/.github/workflows/publish-api-docs.yml b/.github/workflows/publish-api-docs.yml
index e54cd12976..47860cdd7f 100644
--- a/.github/workflows/publish-api-docs.yml
+++ b/.github/workflows/publish-api-docs.yml
@@ -4,7 +4,7 @@ on:
push:
branches: [ master ]
paths:
- - "scripts/sdk/swagger.json"
+ - "packages/nocodb/src/schema/swagger.json"
release:
types: [ published ]
@@ -22,7 +22,7 @@ jobs:
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }}
with:
- source_file: 'scripts/sdk/swagger.json'
+ source_file: 'packages/nocodb/src/schema/swagger.json'
destination_repo: 'nocodb/noco-apis-doc'
destination_folder: 'src'
user_email: 'oof1lab@gmail.com'
@@ -34,7 +34,7 @@ jobs:
env:
API_TOKEN_GITHUB: ${{ secrets.GH_TOKEN }}
with:
- source_file: 'scripts/sdk/swagger.json'
+ source_file: 'packages/nocodb/src/schema/swagger.json'
destination_repo: 'nocodb/noco-apis-doc'
destination_folder: 'meta-src'
user_email: 'oof1lab@gmail.com'
diff --git a/packages/nc-gui/components.d.ts b/packages/nc-gui/components.d.ts
index afd6d25ed1..e3914200e0 100644
--- a/packages/nc-gui/components.d.ts
+++ b/packages/nc-gui/components.d.ts
@@ -252,8 +252,12 @@ declare module '@vue/runtime-core' {
NcIconsRowHeightMedium: typeof import('~icons/nc-icons/row-height-medium')['default']
NcIconsRowHeightShort: typeof import('~icons/nc-icons/row-height-short')['default']
NcIconsRowHeightTall: typeof import('~icons/nc-icons/row-height-tall')['default']
+ PhChatTextThin: typeof import('~icons/ph/chat-text-thin')['default']
PhCloudLightningDuotone: typeof import('~icons/ph/cloud-lightning-duotone')['default']
+ PhCloudLightningThin: typeof import('~icons/ph/cloud-lightning-thin')['default']
PhFileCsv: typeof import('~icons/ph/file-csv')['default']
+ PhUserPlusThin: typeof import('~icons/ph/user-plus-thin')['default']
+ PhUsersThreeThin: typeof import('~icons/ph/users-three-thin')['default']
RiLineHeight: typeof import('~icons/ri/line-height')['default']
RiTeamFill: typeof import('~icons/ri/team-fill')['default']
RouterLink: typeof import('vue-router')['RouterLink']
diff --git a/packages/nc-gui/components/account/ResetPassword.vue b/packages/nc-gui/components/account/ResetPassword.vue
index 804196f102..dc3d17fb55 100644
--- a/packages/nc-gui/components/account/ResetPassword.vue
+++ b/packages/nc-gui/components/account/ResetPassword.vue
@@ -54,7 +54,7 @@ const passwordChange = async () => {
message.success(t('msg.success.passwordChanged'))
- signOut()
+ await signOut()
navigateTo('/signin')
}
diff --git a/packages/nc-gui/components/general/MiniSidebar.vue b/packages/nc-gui/components/general/MiniSidebar.vue
index d023994430..50c73fefd0 100644
--- a/packages/nc-gui/components/general/MiniSidebar.vue
+++ b/packages/nc-gui/components/general/MiniSidebar.vue
@@ -11,8 +11,8 @@ const route = useRoute()
const email = computed(() => user.value?.email ?? '---')
-const logout = () => {
- signOut()
+const logout = async () => {
+ await signOut()
navigateTo('/signin')
}
diff --git a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
index ee08312749..cf7404f03e 100644
--- a/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
+++ b/packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
@@ -232,7 +232,10 @@ useEventListener('keydown', (e: KeyboardEvent) => {
v-model:value="formState"
/>
-
+
diff --git a/packages/nc-gui/components/smartsheet/column/SpecificDBTypeOptions.vue b/packages/nc-gui/components/smartsheet/column/SpecificDBTypeOptions.vue
index cbfa30088c..04d85e1bdb 100644
--- a/packages/nc-gui/components/smartsheet/column/SpecificDBTypeOptions.vue
+++ b/packages/nc-gui/components/smartsheet/column/SpecificDBTypeOptions.vue
@@ -1,3 +1,3 @@
-
+
diff --git a/packages/nc-gui/components/smartsheet/header/Cell.vue b/packages/nc-gui/components/smartsheet/header/Cell.vue
index 6cb89e6438..f07c76fd18 100644
--- a/packages/nc-gui/components/smartsheet/header/Cell.vue
+++ b/packages/nc-gui/components/smartsheet/header/Cell.vue
@@ -7,6 +7,7 @@ interface Props {
required?: boolean | number
hideMenu?: boolean
}
+
const props = defineProps()
const hideMenu = toRef(props, 'hideMenu')
@@ -34,6 +35,12 @@ const closeAddColumnDropdown = () => {
columnOrder.value = null
editColumnDropdown.value = false
}
+
+const openHeaderMenu = () => {
+ if (!isForm.value && isUIAllowed('edit-column')) {
+ editColumnDropdown.value = true
+ }
+}
@@ -44,10 +51,11 @@ const closeAddColumnDropdown = () => {
{{ column.title }}
@@ -56,11 +64,7 @@ const closeAddColumnDropdown = () => {
-
+
{
if (isPrimaryKey(column)) {
return KeyIcon
+ } else if (isSpecificDBType(column)) {
+ return SpecificDBTypeIcon
} else if (isJSON(column)) {
return JSONIcon
} else if (isDate(column, abstractType)) {
@@ -102,8 +104,6 @@ const renderIcon = (column: ColumnType, abstractType: any) => {
return NumericIcon
} else if (isString(column, abstractType)) {
return StringIcon
- } else if (isSpecificDBType(column)) {
- return SpecificDBTypeIcon
} else {
return GenericIcon
}
diff --git a/packages/nc-gui/composables/useApi/interceptors.ts b/packages/nc-gui/composables/useApi/interceptors.ts
index a2f4cc5daa..4c12bc083c 100644
--- a/packages/nc-gui/composables/useApi/interceptors.ts
+++ b/packages/nc-gui/composables/useApi/interceptors.ts
@@ -66,7 +66,7 @@ export function addAxiosInterceptors(api: Api) {
})
})
.catch(async (error) => {
- state.signOut()
+ await state.signOut()
// todo: handle new user
navigateTo('/signIn')
diff --git a/packages/nc-gui/composables/useGlobal/actions.ts b/packages/nc-gui/composables/useGlobal/actions.ts
index 31223f24de..2eb9f23a18 100644
--- a/packages/nc-gui/composables/useGlobal/actions.ts
+++ b/packages/nc-gui/composables/useGlobal/actions.ts
@@ -7,9 +7,15 @@ export function useGlobalActions(state: State): Actions {
}
/** Sign out by deleting the token from localStorage */
- const signOut: Actions['signOut'] = () => {
+ const signOut: Actions['signOut'] = async () => {
state.token.value = null
state.user.value = null
+ try {
+ if (state.token.value) {
+ const nuxtApp = useNuxtApp()
+ await nuxtApp.$api.auth.signout()
+ }
+ } catch {}
}
/** Sign in by setting the token in localStorage */
@@ -42,9 +48,9 @@ export function useGlobalActions(state: State): Actions {
signIn(response.data.token)
}
})
- .catch((err) => {
+ .catch(async (err) => {
message.error(err.message || t('msg.error.youHaveBeenSignedOut'))
- signOut()
+ await signOut()
})
.finally(resolve)
})
diff --git a/packages/nc-gui/layouts/base.vue b/packages/nc-gui/layouts/base.vue
index 4e171c8e5f..e8c33c2cfa 100644
--- a/packages/nc-gui/layouts/base.vue
+++ b/packages/nc-gui/layouts/base.vue
@@ -13,8 +13,8 @@ const hasSider = ref(false)
const sidebar = ref()
-const logout = () => {
- signOut()
+const logout = async () => {
+ await signOut()
navigateTo('/signin')
}
diff --git a/packages/nc-gui/pages/[projectType]/[projectId]/index.vue b/packages/nc-gui/pages/[projectType]/[projectId]/index.vue
index 53081075a2..0872297303 100644
--- a/packages/nc-gui/pages/[projectType]/[projectId]/index.vue
+++ b/packages/nc-gui/pages/[projectType]/[projectId]/index.vue
@@ -71,8 +71,8 @@ const sidebar = ref()
const email = computed(() => user.value?.email ?? '---')
-const logout = () => {
- signOut()
+const logout = async () => {
+ await signOut()
navigateTo('/signin')
}
diff --git a/packages/nc-gui/pages/index/index/user.vue b/packages/nc-gui/pages/index/index/user.vue
index b518824dfa..93bbf7c46a 100644
--- a/packages/nc-gui/pages/index/index/user.vue
+++ b/packages/nc-gui/pages/index/index/user.vue
@@ -57,7 +57,7 @@ const passwordChange = async () => {
message.success(t('msg.success.passwordChanged'))
- signOut()
+ await signOut()
navigateTo('/signin')
}
diff --git a/packages/nc-gui/utils/columnUtils.ts b/packages/nc-gui/utils/columnUtils.ts
index b6e896ea50..bef799b692 100644
--- a/packages/nc-gui/utils/columnUtils.ts
+++ b/packages/nc-gui/utils/columnUtils.ts
@@ -221,6 +221,7 @@ const isTypableInputColumn = (colOrUidt: ColumnType | UITypes) => {
UITypes.Duration,
UITypes.JSON,
UITypes.URL,
+ UITypes.SpecificDBType,
].includes(uidt)
}
diff --git a/packages/nc-gui/utils/errorUtils.ts b/packages/nc-gui/utils/errorUtils.ts
index 6601b5b1dc..373881783c 100644
--- a/packages/nc-gui/utils/errorUtils.ts
+++ b/packages/nc-gui/utils/errorUtils.ts
@@ -1,14 +1,23 @@
export async function extractSdkResponseErrorMsg(e: Error & { response: any }) {
if (!e || !e.response) return e.message
let msg
+ let errors: any[] | null = null
if (e.response.data instanceof Blob) {
try {
- msg = JSON.parse(await e.response.data.text()).msg
+ const parsedData = JSON.parse(await e.response.data.text())
+ msg = parsedData.msg
+ errors = parsedData.errors
} catch {
msg = 'Some internal error occurred'
}
} else {
msg = e.response.data.msg || e.response.data.message || 'Some internal error occurred'
+ errors = e.response.data.errors
}
+
+ if (Array.isArray(errors) && errors.length) {
+ return errors.map((e: any) => (e.instancePath ? `${e.instancePath} - ` : '') + e.message).join(', ')
+ }
+
return msg || 'Some error occurred'
}
diff --git a/packages/noco-docs/content/en/setup-and-usages/column-types.md b/packages/noco-docs/content/en/setup-and-usages/column-types.md
index a6b11cca6d..182999b520 100644
--- a/packages/noco-docs/content/en/setup-and-usages/column-types.md
+++ b/packages/noco-docs/content/en/setup-and-usages/column-types.md
@@ -10,9 +10,7 @@ menuTitle: 'Column Types'
| Type | Description |
|---|---|
-
| [LinkToAnotherRecord](#linktoanotherrecord) | Has Many or Many To Many columns |
-
| [SingleLineText](#singlelinetext) | For short text |
| [LongText](#longtext) | For lengthy string content |
| [Attachment](#attachment) | File attachment column |
@@ -36,7 +34,6 @@ menuTitle: 'Column Types'
| [DateTime](#datetime)| Date & Time selector |
| [QR Code](#qr-code)| QR Code visualization of another referenced column |
| [Barcode](#barcode)| Barcode visualization of another referenced column |
-
| [Geometry](#geometry)| Geometry column |
| [GeoData](#geodata)| GeoData column |
| [Json](#json)| Json column |
diff --git a/packages/nocodb-sdk/package.json b/packages/nocodb-sdk/package.json
index ec22d9e676..442f2c9033 100644
--- a/packages/nocodb-sdk/package.json
+++ b/packages/nocodb-sdk/package.json
@@ -31,7 +31,7 @@
"test:prettier": "prettier \"src/**/*.ts\" --list-different",
"test:spelling": "cspell \"{README.md,.github/*.md,src/**/*.ts}\"",
"watch:build": "tsc -p tsconfig.json -w",
- "generate:sdk": "npx --yes swagger-typescript-api@10.0.3 -r -p ../../scripts/sdk/swagger.json -o ./src/lib/ --axios --unwrap-response-data --module-name-first-tag --type-suffix=Type --templates ../../scripts/sdk/templates"
+ "generate:sdk": "npx --yes swagger-typescript-api@10.0.3 -r -p ../nocodb/src/schema/swagger.json -o ./src/lib/ --axios --unwrap-response-data --module-name-first-tag --type-suffix=Type --templates ../../scripts/sdk/templates"
},
"dependencies": {
"axios": "^0.21.1",
@@ -63,4 +63,4 @@
"prettier": {
"singleQuote": true
}
-}
\ No newline at end of file
+}
diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts
index c8c9d0ed31..a2358937bb 100644
--- a/packages/nocodb-sdk/src/lib/Api.ts
+++ b/packages/nocodb-sdk/src/lib/Api.ts
@@ -45,7 +45,7 @@ export interface UserListType {
}
export interface ProjectReqType {
- title?: string;
+ title: string;
description?: string;
color?: string;
bases?: BaseReqType[];
@@ -56,12 +56,12 @@ export interface ProjectType {
title?: string;
status?: string;
description?: string;
- meta?: string | object;
+ meta?: MetaType;
color?: string;
- deleted?: string | boolean;
+ deleted?: BoolType;
order?: number;
bases?: BaseType[];
- is_meta?: boolean;
+ is_meta?: BoolType;
prefix?: string;
created_at?: any;
updated_at?: any;
@@ -78,14 +78,14 @@ export interface BaseType {
project_id?: string;
alias?: string;
type?: string;
- is_meta?: boolean;
+ is_meta?: BoolType;
config?: any;
created_at?: any;
updated_at?: any;
inflection_column?: string;
inflection_table?: string;
order?: number;
- enabled?: boolean;
+ enabled?: BoolType;
}
export interface BaseReqType {
@@ -113,33 +113,39 @@ export interface TableType {
table_name: string;
title: string;
type?: string;
- enabled?: boolean;
+ enabled?: BoolType;
parent_id?: string;
show_as?: string;
tags?: string;
- pinned?: boolean;
- deleted?: boolean;
+ pinned?: BoolType;
+ deleted?: BoolType;
order?: number;
columns?: ColumnType[];
columnsById?: object;
slug?: string;
- mm?: boolean | number;
- meta?: any;
+ mm?: BoolType;
+ meta?: MetaType;
}
export interface ViewType {
id?: string;
title: string;
- deleted?: boolean;
+ deleted?: BoolType;
order?: number;
fk_model_id?: string;
slug?: string;
uuid?: string;
- meta?: any;
- show_system_fields?: boolean;
+ meta?: MetaType;
+ show_system_fields?: BoolType;
lock_type?: 'collaborative' | 'locked' | 'personal';
type?: number;
- view?: FormType | GridType | GalleryType | KanbanType | MapType;
+ view?:
+ | FormType
+ | GridType
+ | GalleryType
+ | KanbanType
+ | MapType
+ | (FormType & GridType & GalleryType & KanbanType & MapType);
}
export interface TableInfoType {
@@ -153,8 +159,8 @@ export interface TableInfoType {
parent_id?: string;
show_as?: string;
tags?: string;
- pinned?: boolean;
- deleted?: boolean;
+ pinned?: BoolType;
+ deleted?: BoolType;
order?: number;
column?: ColumnType[];
filters?: FilterType[];
@@ -172,12 +178,12 @@ export interface TableReqType {
parent_id?: string;
show_as?: string;
tags?: string;
- pinned?: boolean;
- deleted?: boolean;
+ pinned?: BoolType;
+ deleted?: BoolType;
order?: number;
- mm?: boolean;
- columns: ColumnType[];
- meta?: any;
+ mm?: BoolType;
+ columns: NormalColumnRequestType[];
+ meta?: MetaType;
}
export interface TableListType {
@@ -191,14 +197,30 @@ export interface FilterType {
fk_column_id?: string;
logical_op?: string;
comparison_op?: string;
- value?: string | number | boolean | null;
- is_group?: boolean;
+ value?: any;
+ is_group?: boolean | number | null;
children?: FilterType[];
project_id?: string;
base_id?: string;
fk_parent_id?: string;
- fk_view_id?: string;
- fk_hook_id?: string;
+ fk_view_id?: StringOrNullType;
+ fk_hook_id?: StringOrNullType;
+}
+
+export interface FilterReqType {
+ id?: string;
+ fk_model_id?: string;
+ fk_column_id?: string;
+ logical_op?: string;
+ comparison_op?: string;
+ value?: any;
+ is_group?: boolean | number | null;
+ children?: FilterType[];
+ project_id?: string;
+ base_id?: string;
+ fk_parent_id?: string;
+ fk_view_id?: StringOrNullType;
+ fk_hook_id?: StringOrNullType;
}
export interface FilterListType {
@@ -217,6 +239,11 @@ export interface SortType {
base_id?: string;
}
+export interface SortReqType {
+ fk_column_id?: string;
+ direction?: string;
+}
+
export interface SortListType {
sorts: {
list: SharedViewType[];
@@ -228,39 +255,45 @@ export interface ColumnType {
base_id?: string;
fk_model_id?: string;
title?: string;
- uidt: string;
+ uidt?: string;
dt?: string;
- np?: string;
- ns?: string;
- clen?: string | number;
+ np?: string | number | null;
+ ns?: string | number | null;
+ clen?: string | number | null;
cop?: string;
- pk?: boolean;
- pv?: boolean;
- rqd?: boolean;
+ pk?: BoolType;
+ pv?: BoolType;
+ rqd?: BoolType;
column_name?: string;
- un?: boolean;
+ un?: BoolType;
ct?: string;
- ai?: boolean;
- unique?: boolean;
+ ai?: BoolType;
+ unique?: BoolType;
cdf?: string;
cc?: string;
csn?: string;
dtx?: string;
- dtxp?: string;
- dtxs?: string;
- au?: boolean;
- deleted?: boolean;
- visible?: boolean;
+ dtxp?: string | number | null;
+ dtxs?: string | number | null;
+ au?: BoolType;
+ deleted?: BoolType;
+ visible?: BoolType;
order?: number;
- system?: number | boolean;
- meta?: any;
+ system?: BoolType;
+ meta?: MetaType;
colOptions?:
| LinkToAnotherRecordType
| FormulaType
| RollupType
| LookupType
| SelectOptionsType
- | object;
+ | object
+ | (LinkToAnotherRecordType &
+ FormulaType &
+ RollupType &
+ LookupType &
+ SelectOptionsType &
+ object);
}
export interface ColumnListType {
@@ -272,7 +305,7 @@ export interface ColumnListType {
export interface LinkToAnotherRecordType {
id?: string;
type?: string;
- virtual?: boolean;
+ virtual?: BoolType;
fk_column_id?: string;
fk_child_column_id?: string;
fk_parent_column_id?: string;
@@ -290,7 +323,7 @@ export interface LinkToAnotherRecordType {
export interface LookupType {
id?: string;
type?: string;
- virtual?: boolean;
+ virtual?: BoolType;
fk_column_id?: string;
fk_relation_column_id?: string;
fk_lookup_column_id?: string;
@@ -301,7 +334,7 @@ export interface LookupType {
export interface RollupType {
id?: string;
type?: string;
- virtual?: boolean;
+ virtual?: BoolType;
fk_column_id?: string;
fk_relation_column_id?: string;
fk_rollup_column_id?: string;
@@ -313,7 +346,7 @@ export interface RollupType {
export interface FormulaType {
id?: string;
type?: string;
- virtual?: boolean;
+ virtual?: BoolType;
fk_column_id?: string;
formula?: string;
formula_raw?: string;
@@ -337,7 +370,14 @@ export interface GridType {
id?: string;
title?: string;
alias?: string;
- deleted?: boolean;
+ deleted?: BoolType;
+ order?: number;
+ lock_type?: 'collaborative' | 'locked' | 'personal';
+ row_height?: number;
+}
+
+export interface GridReqType {
+ title: string;
order?: number;
lock_type?: 'collaborative' | 'locked' | 'personal';
row_height?: number;
@@ -347,10 +387,10 @@ export interface GalleryType {
fk_view_id?: string;
title?: string;
alias?: string;
- deleted?: boolean;
+ deleted?: BoolType;
order?: number;
- next_enabled?: boolean;
- prev_enabled?: boolean;
+ next_enabled?: BoolType;
+ prev_enabled?: BoolType;
cover_image_idx?: number;
cover_image?: string;
restrict_types?: string;
@@ -362,6 +402,19 @@ export interface GalleryType {
lock_type?: 'collaborative' | 'locked' | 'personal';
}
+export interface GalleryReqType {
+ title: string;
+ next_enabled?: BoolType;
+ prev_enabled?: BoolType;
+ cover_image_idx?: number;
+ cover_image?: string;
+ restrict_types?: string;
+ restrict_size?: string;
+ restrict_number?: string;
+ fk_cover_image_col_id?: string;
+ lock_type?: 'collaborative' | 'locked' | 'personal';
+}
+
export interface GalleryColumnType {
id?: string;
label?: string;
@@ -370,6 +423,14 @@ export interface GalleryColumnType {
fk_gallery_id?: string;
}
+export interface GridColumnReqType {
+ label?: string;
+ help?: string;
+ fk_column_id?: string;
+ fk_gallery_id?: string;
+ width?: string;
+}
+
export interface GridColumnType {
id?: string;
label?: string;
@@ -393,9 +454,9 @@ export interface KanbanType {
alias?: string;
columns?: KanbanColumnType[];
fk_model_id?: string;
- fk_grp_col_id?: string | null;
+ fk_grp_col_id?: StringOrNullType;
fk_cover_image_col_id?: string;
- meta?: string | object;
+ meta?: MetaType;
}
export interface GeoLocationType {
@@ -412,9 +473,9 @@ export interface MapType {
initial_geo_position?: GeoLocationType;
fk_model_id?: string;
fk_view_id?: string;
- fk_geo_data_col_id?: string | null;
+ fk_geo_data_col_id?: StringOrNullType;
columns?: MapColumnType[];
- meta?: string | object;
+ meta?: MetaType;
}
export interface MapColumnType {
@@ -425,25 +486,56 @@ export interface MapColumnType {
fk_gallery_id?: string;
}
+export interface LicenseReqType {
+ key?: string;
+}
+
+export interface KanbanReqType {
+ title: string;
+ fk_grp_col_id?: StringOrNullType;
+}
+
+export interface KanbanUpdateReqType {
+ fk_grp_col_id?: StringOrNullType;
+}
+
export interface FormType {
id?: string;
title?: string;
heading?: string;
subheading?: string;
success_msg?: string;
- redirect_url?: string;
- redirect_after_secs?: string;
- email?: string;
- banner_image_url?: string;
- logo_url?: string;
- submit_another_form?: boolean;
- show_blank_form?: boolean;
+ redirect_url?: StringOrNullType;
+ redirect_after_secs?: StringOrNullType;
+ email?: StringOrNullType;
+ banner_image_url?: StringOrNullType;
+ logo_url?: StringOrNullType;
+ submit_another_form?: BoolType;
+ show_blank_form?: BoolType;
columns?: FormColumnType[];
fk_model_id?: string;
lock_type?: 'collaborative' | 'locked' | 'personal';
- meta?: any;
+ meta?: MetaType;
}
+export interface FormReqType {
+ title?: string;
+ heading?: string;
+ subheading?: string;
+ success_msg?: string;
+ redirect_url?: StringOrNullType;
+ redirect_after_secs?: StringOrNullType;
+ email?: StringOrNullType;
+ banner_image_url?: StringOrNullType;
+ logo_url?: StringOrNullType;
+ submit_another_form?: BoolType;
+ show_blank_form?: BoolType;
+ lock_type?: 'collaborative' | 'locked' | 'personal';
+ meta?: MetaType;
+}
+
+export type FormCreateReqType = FormReqType;
+
export interface FormColumnType {
fk_column_id?: string;
id?: string;
@@ -451,19 +543,30 @@ export interface FormColumnType {
uuid?: any;
label?: string;
help?: any;
- required?: boolean;
- show?: boolean;
+ required?: BoolType;
+ show?: BoolType;
order?: number;
created_at?: string;
updated_at?: string;
description?: string;
- meta?: any;
+ meta?: MetaType;
+}
+
+export interface FormColumnReqType {
+ uuid?: any;
+ label?: string;
+ help?: any;
+ required?: BoolType;
+ show?: BoolType;
+ order?: number;
+ description?: string;
+ meta?: MetaType;
}
export interface PaginatedType {
pageSize?: number;
totalRows?: number;
- sort?: string | any[];
+ sort?: string | SortType[];
isFirstPage?: boolean;
isLastPage?: boolean;
page?: number;
@@ -531,23 +634,67 @@ export interface HookType {
type?: string;
event?: 'after' | 'before';
operation?: 'insert' | 'delete' | 'update';
- async?: boolean;
- payload?: string;
- url?: string;
- headers?: string;
- condition?: boolean;
+ async?: BoolType;
notification?: string;
retries?: number;
retry_interval?: number;
timeout?: number;
- active?: boolean;
+ active?: BoolType;
+}
+
+export interface HookReqType {
+ id?: string;
+ fk_model_id?: string;
+ title: string;
+ description?: StringOrNullType;
+ env?: string;
+ event: 'after' | 'before';
+ operation: 'insert' | 'delete' | 'update';
+ async?: string | number | null;
+ notification: object;
+ retries?: number;
+ retry_interval?: number;
+ timeout?: number;
+ active?: BoolType;
+}
+
+export interface HookTestReqType {
+ payload: any;
+ hook: HookReqType;
+}
+
+export interface SignUpReqType {
+ email: string;
+ password: string;
+}
+
+export interface SignInReqType {
+ email: string;
+ password: string;
+}
+
+export interface PasswordForgotReqType {
+ email: string;
+}
+
+export interface PasswordResetReqType {
+ password: string;
+}
+
+export interface PasswordChangeReqType {
+ currentPassword: string;
+ newPassword: string;
+}
+
+export interface ApiTokenReqType {
+ description?: StringOrNullType;
}
export interface PluginType {
id?: string;
title?: string;
description?: string;
- active?: boolean;
+ active?: BoolType;
rating?: number;
version?: string;
docs?: string;
@@ -558,7 +705,7 @@ export interface PluginType {
tags?: string;
category?: string;
input_schema?: string;
- input?: string | null;
+ input?: number | StringOrNullType;
creator?: string;
creator_website?: string;
price?: string;
@@ -571,7 +718,7 @@ export interface ModelRoleVisibilityType {
fk_model_id?: string;
fk_view_id?: string;
role?: string;
- disabled?: boolean;
+ disabled?: BoolType;
}
export interface ApiTokenType {
@@ -587,12 +734,12 @@ export interface HookLogType {
id?: string;
base_id?: string;
project_id?: string;
- fk_hook_id?: string;
+ fk_hook_id?: StringOrNullType;
type?: string;
event?: string;
operation?: string;
- test_call?: boolean;
- payload?: string;
+ test_call?: BoolType;
+ payload?: any;
conditions?: string;
notifications?: string;
error_code?: string;
@@ -643,31 +790,29 @@ export interface NormalColumnRequestType {
fk_model_id?: string;
title?: string;
dt?: string;
- np?: string;
- ns?: string;
- clen?: string | number;
- cop?: string;
- pk?: boolean;
- pv?: boolean;
- rqd?: boolean;
+ np?: number | StringOrNullType;
+ ns?: number | StringOrNullType;
+ pk?: BoolType;
+ pv?: BoolType;
+ rqd?: BoolType;
column_name?: string;
- un?: boolean;
+ un?: BoolType;
ct?: string;
- ai?: boolean;
- unique?: boolean;
- cdf?: string;
+ ai?: BoolType;
+ unique?: BoolType;
+ cdf?: StringOrNullType;
cc?: string;
csn?: string;
dtx?: string;
- dtxp?: string;
- dtxs?: string;
- au?: boolean;
+ dtxp?: number | StringOrNullType;
+ dtxs?: number | StringOrNullType;
+ au?: BoolType;
}
export interface LinkToAnotherColumnReqType {
uidt: 'LinkToAnotherRecord';
title: string;
- virtual?: boolean;
+ virtual?: BoolType;
parentId: string;
childId: string;
type: 'hm' | 'bt' | 'mm';
@@ -696,11 +841,16 @@ export interface FormulaColumnReqType {
}
export type ColumnReqType = (
- | NormalColumnRequestType
| LinkToAnotherColumnReqType
| RollupColumnReqType
| FormulaColumnReqType
| LookupColumnReqType
+ | NormalColumnRequestType
+ | (LinkToAnotherColumnReqType &
+ RollupColumnReqType &
+ FormulaColumnReqType &
+ LookupColumnReqType &
+ NormalColumnRequestType)
) & {
column_name?: string;
title?: string;
@@ -719,6 +869,62 @@ export interface UserInfoType {
roles?: any;
}
+export type VisibilityRuleReqType = {
+ disabled?: {
+ commenter?: BoolType;
+ creator?: BoolType;
+ editor?: BoolType;
+ guest?: BoolType;
+ owner?: BoolType;
+ viewer?: BoolType;
+ };
+}[];
+
+export type BoolType = boolean | number | null;
+
+export type StringOrNullType = string | null;
+
+export type MetaType = object | string | null;
+
+export interface CommentReqType {
+ row_id: string;
+ fk_model_id: string;
+ description?: string;
+}
+
+export interface AuditRowUpdateReqType {
+ fk_model_id?: string;
+ column_name?: string;
+ row_id?: string;
+ value?: any;
+ prev_value?: any;
+}
+
+export interface OrgUserReqType {
+ email?: string;
+ roles?: string;
+}
+
+export interface ProjectUserReqType {
+ email?: string;
+ roles?: string;
+}
+
+export interface SharedBaseReqType {
+ uuid?: StringOrNullType;
+ roles?: StringOrNullType;
+}
+
+export interface PluginTestReqType {
+ title?: string;
+ input?: any;
+}
+
+export interface PluginReqType {
+ active?: BoolType;
+ input?: any;
+}
+
import axios, { AxiosInstance, AxiosRequestConfig, ResponseType } from 'axios';
export type QueryParamsType = Record;
@@ -904,13 +1110,7 @@ export class Api<
* @response `401` `void` Unauthorized
* @response `403` `void` Forbidden
*/
- signup: (
- data: {
- email?: string;
- password?: string;
- },
- params: RequestParams = {}
- ) =>
+ signup: (data: SignUpReqType, params: RequestParams = {}) =>
this.request<
{
token?: string;
@@ -926,6 +1126,31 @@ export class Api<
...params,
}),
+ /**
+ * @description Clear refresh token from the database and cookie.
+ *
+ * @tags Auth
+ * @name Signout
+ * @summary Signout
+ * @request POST:/api/v1/auth/user/signout
+ * @response `200` `{
+ msg?: string,
+
+}` OK
+ */
+ signout: (params: RequestParams = {}) =>
+ this.request<
+ {
+ msg?: string;
+ },
+ any
+ >({
+ path: `/api/v1/auth/user/signout`,
+ method: 'POST',
+ format: 'json',
+ ...params,
+ }),
+
/**
* @description Authenticate existing user with their email and password. Successful login will return a JWT access-token.
*
@@ -942,13 +1167,7 @@ export class Api<
}` Bad Request
*/
- signin: (
- data: {
- email: string;
- password: string;
- },
- params: RequestParams = {}
- ) =>
+ signin: (data: SignInReqType, params: RequestParams = {}) =>
this.request<
{
token?: string;
@@ -999,12 +1218,7 @@ export class Api<
* @response `200` `void` OK
* @response `401` `void` Unauthorized
*/
- passwordForgot: (
- data: {
- email?: string;
- },
- params: RequestParams = {}
- ) =>
+ passwordForgot: (data: PasswordForgotReqType, params: RequestParams = {}) =>
this.request({
path: `/api/v1/auth/password/forgot`,
method: 'POST',
@@ -1029,13 +1243,7 @@ export class Api<
}` Bad request
*/
- passwordChange: (
- data: {
- currentPassword?: string;
- newPassword?: string;
- },
- params: RequestParams = {}
- ) =>
+ passwordChange: (data: PasswordChangeReqType, params: RequestParams = {}) =>
this.request<
{
msg?: string;
@@ -1095,9 +1303,7 @@ export class Api<
*/
passwordReset: (
token: string,
- data: {
- new_password?: string;
- },
+ data: PasswordResetReqType,
params: RequestParams = {}
) =>
this.request({
@@ -1167,7 +1373,7 @@ export class Api<
*/
projectUserAdd: (
projectId: string,
- data: any,
+ data: ProjectUserReqType,
params: RequestParams = {}
) =>
this.request({
@@ -1191,7 +1397,7 @@ export class Api<
projectUserUpdate: (
projectId: string,
userId: string,
- data: any,
+ data: ProjectUserReqType,
params: RequestParams = {}
) =>
this.request({
@@ -1290,7 +1496,7 @@ export class Api<
* @request POST:/api/v1/tokens
* @response `200` `void` OK
*/
- create: (data: ApiTokenType, params: RequestParams = {}) =>
+ create: (data: ApiTokenReqType, params: RequestParams = {}) =>
this.request({
path: `/api/v1/tokens`,
method: 'POST',
@@ -1349,12 +1555,7 @@ export class Api<
* @request POST:/api/v1/license
* @response `200` `void` OK
*/
- set: (
- data: {
- key?: string;
- },
- params: RequestParams = {}
- ) =>
+ set: (data: LicenseReqType, params: RequestParams = {}) =>
this.request({
path: `/api/v1/license`,
method: 'POST',
@@ -1473,7 +1674,11 @@ export class Api<
* @request PATCH:/api/v1/users/{userId}
* @response `200` `void` OK
*/
- update: (userId: string, data: UserType, params: RequestParams = {}) =>
+ update: (
+ userId: string,
+ data: OrgUserReqType,
+ params: RequestParams = {}
+ ) =>
this.request({
path: `/api/v1/users/${userId}`,
method: 'PATCH',
@@ -1612,14 +1817,14 @@ export class Api<
* @tags Project
* @name ModelVisibilitySet
* @request POST:/api/v1/db/meta/projects/{projectId}/visibility-rules
- * @response `200` `any` OK
+ * @response `200` `VisibilityRuleReqType` OK
*/
modelVisibilitySet: (
projectId: string,
data: any,
params: RequestParams = {}
) =>
- this.request({
+ this.request({
path: `/api/v1/db/meta/projects/${projectId}/visibility-rules`,
method: 'POST',
body: data,
@@ -1771,18 +1976,13 @@ export class Api<
}),
/**
- * No description
- *
- * @tags Project
- * @name SharedBaseCreate
- * @request POST:/api/v1/db/meta/projects/{projectId}/shared
- * @response `200` `{
- uuid?: string,
- url?: string,
- roles?: string,
-
-}` OK
- */
+ * No description
+ *
+ * @tags Project
+ * @name SharedBaseCreate
+ * @request POST:/api/v1/db/meta/projects/{projectId}/shared
+ * @response `200` `SharedBaseReqType` OK
+ */
sharedBaseCreate: (
projectId: string,
data: {
@@ -1791,14 +1991,7 @@ export class Api<
},
params: RequestParams = {}
) =>
- this.request<
- {
- uuid?: string;
- url?: string;
- roles?: string;
- },
- any
- >({
+ this.request({
path: `/api/v1/db/meta/projects/${projectId}/shared`,
method: 'POST',
body: data,
@@ -2209,7 +2402,7 @@ export class Api<
table_name?: string;
title?: string;
project_id?: string;
- meta?: any;
+ meta?: MetaType;
},
params: RequestParams = {}
) =>
@@ -2381,7 +2574,7 @@ export class Api<
viewId: string,
data: {
order?: number;
- meta?: any;
+ meta?: MetaType;
title?: string;
show_system_fields?: boolean;
lock_type?: 'collaborative' | 'locked' | 'personal';
@@ -2463,7 +2656,11 @@ export class Api<
* @request POST:/api/v1/db/meta/tables/{tableId}/grids
* @response `200` `GridType` OK
*/
- gridCreate: (tableId: string, data: GridType, params: RequestParams = {}) =>
+ gridCreate: (
+ tableId: string,
+ data: GridReqType,
+ params: RequestParams = {}
+ ) =>
this.request({
path: `/api/v1/db/meta/tables/${tableId}/grids`,
method: 'POST',
@@ -2481,7 +2678,11 @@ export class Api<
* @request POST:/api/v1/db/meta/tables/{tableId}/forms
* @response `200` `FormType` OK
*/
- formCreate: (tableId: string, data: FormType, params: RequestParams = {}) =>
+ formCreate: (
+ tableId: string,
+ data: FormCreateReqType,
+ params: RequestParams = {}
+ ) =>
this.request({
path: `/api/v1/db/meta/tables/${tableId}/forms`,
method: 'POST',
@@ -2499,7 +2700,11 @@ export class Api<
* @request PATCH:/api/v1/db/meta/forms/{formId}
* @response `200` `void` OK
*/
- formUpdate: (formId: string, data: FormType, params: RequestParams = {}) =>
+ formUpdate: (
+ formId: string,
+ data: FormReqType,
+ params: RequestParams = {}
+ ) =>
this.request({
path: `/api/v1/db/meta/forms/${formId}`,
method: 'PATCH',
@@ -2534,7 +2739,7 @@ export class Api<
*/
formColumnUpdate: (
formViewColumnId: string,
- data: FormColumnType,
+ data: FormColumnReqType,
params: RequestParams = {}
) =>
this.request({
@@ -2590,7 +2795,7 @@ export class Api<
*/
gridColumnUpdate: (
columnId: string,
- data: GridColumnType,
+ data: GridColumnReqType,
params: RequestParams = {}
) =>
this.request({
@@ -2612,7 +2817,7 @@ export class Api<
*/
galleryCreate: (
tableId: string,
- data: GalleryType,
+ data: GalleryReqType,
params: RequestParams = {}
) =>
this.request