Browse Source

geodata: mapmetadata in mapview

pull/4140/head
flisowna 2 years ago
parent
commit
df11ad896c
  1. 3
      packages/nc-gui/components/smartsheet/Kanban.vue
  2. 24
      packages/nc-gui/components/smartsheet/Map.vue
  3. 62
      packages/nc-gui/composables/useMapViewDataStore.ts
  4. 20
      packages/nc-gui/composables/useViewData.ts
  5. 557
      packages/nocodb-sdk/src/lib/Api.ts

3
packages/nc-gui/components/smartsheet/Kanban.vue

@ -12,6 +12,7 @@ import {
IsPublicInj,
MetaInj,
OpenNewRecordFormHookInj,
ReadonlyInj,
inject,
onBeforeMount,
onBeforeUnmount,
@ -84,6 +85,8 @@ provide(IsGridInj, ref(false))
provide(IsKanbanInj, ref(true))
provide(ReadonlyInj, !isUIAllowed('xcDatatableEditable'))
const hasEditPermission = $computed(() => isUIAllowed('xcDatatableEditable'))
const fields = inject(FieldsInj, ref([]))

24
packages/nc-gui/components/smartsheet/Map.vue

@ -7,23 +7,28 @@ import { IsFormInj, IsGalleryInj, IsGridInj, IsMapInj, ReadonlyInj, onMounted, p
const { isUIAllowed } = useUIPermission()
provide(IsFormInj, ref(false))
// provide(IsFormInj, ref(false))
provide(IsGalleryInj, ref(false))
provide(IsGridInj, ref(false))
provide(IsMapInj, ref(true))
provide(ReadonlyInj, !isUIAllowed('xcDatatableEditable'))
const reloadViewDataHook = inject(ReloadViewDataHookInj)
// const meta = inject(MetaInj, ref())
// const view = inject(ActiveViewInj, ref())
const view = inject(ActiveViewInj, ref())
const meta = inject(MetaInj, ref())
const { formattedData, loadMapData, mapData } = useMapViewStoreOrThrow()
const reloadViewDataHook = inject(ReloadViewDataHookInj)
// const reloadViewMetaHook = inject(ReloadViewMetaHookInj)
const { formattedData, loadMapData, loadMapMeta, mapMetaData } = useMapViewStoreOrThrow()
// const { loadData, formattedData: data } = useViewData(meta, view)
// const { sharedView, sorts, nestedFilters } = useSharedView()
const {
showSystemFields,
// sortedAndFilteredFields,
@ -58,8 +63,10 @@ const markersRef = ref<L.MarkerClusterGroup | undefined>()
// const { isUIAllowed } = useUIPermission()
onMounted(async () => {
onBeforeMount(async () => {
await loadMapData()
await loadMapMeta()
console.log('on mapview mapMetaData', mapMetaData)
// const geodata = data.value[0].row.geo.split(';')
})
@ -71,10 +78,15 @@ onMounted(async () => {
// ),
// )
const { fk_geo_data_col_id } = mapMetaData.value
console.log('fk_geo_data_col_id', fk_geo_data_col_id)
watch(formattedData, () => {
markersRef.value?.clearLayers()
console.log('mapData', mapData?.value?.fk_geo_data_col_id)
console.log('mapMetaData', mapMetaData?.value?.fk_geo_data_col_id)
formattedData.value?.forEach((row) => {
console.log('fk_geo_data_col_id', fk_geo_data_col_id)
// const [lat, long] =
console.log('meta', meta?.value?.columns)
console.log('row', row)
@ -125,7 +137,7 @@ onMounted(async () => {
<template>
<div class="flex flex-col h-full w-full">
{{ JSON.stringify(mapData1) }}
{{ JSON.stringify(mapMetaData) }}
<!-- {{ JSON.stringify(selected) }} -->
<!-- {{ JSON.stringify(meta?.columns) }} -->
<!-- <div class="flex m-4 gap-4">

62
packages/nc-gui/composables/useMapViewDataStore.ts

@ -1,6 +1,6 @@
import type { ComputedRef, Ref } from 'vue'
import type { ColumnType, MapType, TableType, ViewType } from 'nocodb-sdk'
import { ref, useApi, useInjectionState } from '#imports'
import type { MapType, TableType, ViewType } from 'nocodb-sdk'
import { ref, useInjectionState } from '#imports'
import type { Row } from '~/lib'
const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
@ -10,58 +10,58 @@ const [useProvideMapViewStore, useMapViewStore] = useInjectionState(
) => {
const formattedData = ref<Row[]>()
const { api } = useApi()
const { project } = useProject()
// const { api } = useApi()
// const { project } = useProject()
// const { $e, $api } = useNuxtApp()
const { $api } = useNuxtApp()
const mapMetaData = ref<MapType>({})
const geoDataField = ref<string>('')
// const geoDataField = ref<string>('')
const geoDataFieldColumn = ref<ColumnType | undefined>()
// const geoDataFieldColumn = ref<ColumnType | undefined>()
async function loadMapData() {
async function loadMapMeta() {
if (!viewMeta?.value?.id || !meta?.value?.columns) return
mapMetaData.value = await $api.dbView.mapRead(viewMeta.value.id)
}
formattedData.value = []
const res = await api.dbViewRow.list(
'noco',
project.value.id!,
meta.value!.id!,
viewMeta.value!.id!,
geoDataFieldColumn!.value!.id,
)
async function loadMapData() {
// if (!viewMeta?.value?.id || !meta?.value?.columns) return
geoDataFieldColumn.value =
(meta.value.columns as ColumnType[]).filter((f) => f.id === mapMetaData.value.fk_geo_data_col_id)[0] || {}
// formattedData.value = []
geoDataField.value = geoDataFieldColumn.value.title!
// const res = await api.dbViewRow.list('noco', project.value.id!, meta.value!.id!, viewMeta.value!.id!)
const { fk_geo_data_col_id, meta: stack_meta } = mapMetaData.value
// // geoDataFieldColumn.value =
// // (meta.value.columns as ColumnType[]).filter((f) => f.id === mapMetaData.value.fk_geo_data_col_id)[0] || {}
const stackMetaObj: any.value = stack_meta ? JSON.parse(stack_meta as string) : {}
// geoDataField.value = geoDataFieldColumn!.value!.title!
console.log('column geodata', stackMetaObj.value[fk_geo_data_col_id])
// if ((!project?.value?.id || !meta.value?.id || !viewMeta?.value?.id) && !isPublic.value) return
// // const { fk_geo_data_col_id, meta: geo_meta } = mapMetaData.value
// reset formattedData & countByStack to avoid storing previous data after changing grouping field
// // const geoMetaObj: any.value = geo_meta ? JSON.parse(geo_meta as string) : {}
// // console.log('column geodata', stackMetaObj.value[fk_geo_data_col_id])
// // if ((!project?.value?.id || !meta.value?.id || !viewMeta?.value?.id) && !isPublic.value) return
// alert('in loadMapData')
// debugger
// // reset formattedData & countByStack to avoid storing previous data after changing grouping field
// // alert('in loadMapData')
// // debugger
console.log('res in mapviewdatastore', res)
// console.log('res in mapviewdatastore', res)
// for (const data of res.list) {
// formattedData.value = data.value
// }
formattedData.value = res.list
// // for (const data of res.list) {
// // formattedData.value = data.value
// // }
// formattedData.value = res.list
}
return {
formattedData,
loadMapData,
loadMapMeta,
mapMetaData,
}
},

20
packages/nc-gui/composables/useViewData.ts

@ -1,5 +1,5 @@
import { ViewTypes } from 'nocodb-sdk'
import type { Api, ColumnType, FormType, GalleryType, MapType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { Api, ColumnType, FormType, GalleryType, PaginatedType, TableType, ViewType } from 'nocodb-sdk'
import type { ComputedRef, Ref } from 'vue'
import {
IsPublicInj,
@ -202,6 +202,7 @@ export function useViewData(
async function insertRow(
currentRow: Row,
_rowIndex = formattedData.value?.length,
ltarState: Record<string, any> = {},
{ metaValue = meta.value, viewMetaValue = viewMeta.value }: { metaValue?: TableType; viewMetaValue?: ViewType } = {},
) {
@ -265,24 +266,15 @@ export function useViewData(
)
// audit
$api.utils.auditRowUpdate(id, {
fk_model_id: metaValue?.id as string,
fk_model_id: meta.value?.id as string,
column_name: property,
row_id: id,
value: getHTMLEncodedText(toUpdate.row[property]),
prev_value: getHTMLEncodedText(toUpdate.oldRow[property]),
})
/** update row data(to sync formula and other related columns)
* update only formula, rollup and auto updated datetime columns data to avoid overwriting any changes made by user
*/
Object.assign(
toUpdate.row,
metaValue!.columns!.reduce<Record<string, any>>((acc: Record<string, any>, col: ColumnType) => {
if (col.uidt === UITypes.Formula || col.uidt === UITypes.Rollup || col.au || col.cdf?.includes(' on update '))
acc[col.title!] = updatedRowData[col.title!]
return acc
}, {} as Record<string, any>),
)
/** update row data(to sync formula and other related columns) */
Object.assign(toUpdate.row, updatedRowData)
Object.assign(toUpdate.oldRow, updatedRowData)
} catch (e: any) {
message.error(`${t('msg.error.rowUpdateFailed')} ${await extractSdkResponseErrorMsg(e)}`)
@ -301,7 +293,7 @@ export function useViewData(
await until(() => !(row.rowMeta?.new && row.rowMeta?.saving)).toMatch((v) => v)
if (row.rowMeta.new) {
return await insertRow(row, ltarState, args)
return await insertRow(row, formattedData.value.indexOf(row), ltarState, args)
} else {
await updateRowProperty(row, property!, args)
}

557
packages/nocodb-sdk/src/lib/Api.ts

@ -14,17 +14,22 @@ export interface UserType {
id: string;
firstname: string;
lastname: string;
/** @format email */
email: string;
/** @format email */
roles?: string;
/**
* @format date
* @example 1997-10-31
*/
date_of_birth?: string;
/** Set to true if the user's email has been verified. */
email_verified: boolean;
/**
* The date that the user was created.
* @format date
@ -39,10 +44,7 @@ export interface PageReqQueryParamsType {
}
export interface UserListType {
users: {
list: UserType;
pageInfo: PaginatedType;
};
users: { list: UserType; pageInfo: PaginatedType };
}
export interface ProjectReqType {
@ -99,10 +101,7 @@ export interface BaseReqType {
}
export interface BaseListType {
bases: {
list: BaseType[];
pageInfo: PaginatedType;
};
bases: { list: BaseType[]; pageInfo: PaginatedType };
}
export interface TableType {
@ -188,7 +187,7 @@ export interface FilterType {
fk_column_id?: string;
logical_op?: string;
comparison_op?: string;
value?: string | number | boolean | null;
value?: string | number | number | boolean | null;
is_group?: boolean;
children?: FilterType[];
project_id?: string;
@ -199,9 +198,7 @@ export interface FilterType {
}
export interface FilterListType {
filters: {
list: FilterType[];
};
filters: { list: FilterType[] };
}
export interface SortType {
@ -215,9 +212,7 @@ export interface SortType {
}
export interface SortListType {
sorts: {
list: SharedViewType[];
};
sorts: { list: SharedViewType[] };
}
export interface ColumnType {
@ -261,9 +256,7 @@ export interface ColumnType {
}
export interface ColumnListType {
columns: {
list: ColumnType[];
};
columns: { list: ColumnType[] };
}
export interface LinkToAnotherRecordType {
@ -676,12 +669,7 @@ export type ColumnReqType =
fk_relation_column_id?: string;
fk_lookup_column_id?: string;
}
| {
uidt?: string;
formula_raw?: string;
formula?: string;
title?: string;
};
| { uidt?: string; formula_raw?: string; formula?: string; title?: string };
export interface UserInfoType {
id?: string;
@ -866,32 +854,16 @@ export class Api<
* @name Signup
* @summary Signup
* @request POST:/api/v1/auth/user/signup
* @response `200` `{
token?: string,
}` OK
* @response `400` `{
msg?: string,
}` Bad Request
* @response `200` `{ token?: string }` OK
* @response `400` `{ msg?: string }` Bad Request
* @response `401` `void` Unauthorized
* @response `403` `void` Forbidden
*/
signup: (
data: {
email?: string;
password?: string;
},
data: { email?: string; password?: string },
params: RequestParams = {}
) =>
this.request<
{
token?: string;
},
{
msg?: string;
} | void
>({
this.request<{ token?: string }, { msg?: string } | void>({
path: `/api/v1/auth/user/signup`,
method: 'POST',
body: data,
@ -906,30 +878,14 @@ export class Api<
* @name Signin
* @summary Signin
* @request POST:/api/v1/auth/user/signin
* @response `200` `{
token?: string,
}` OK
* @response `400` `{
msg?: string,
}` Bad Request
* @response `200` `{ token?: string }` OK
* @response `400` `{ msg?: string }` Bad Request
*/
signin: (
data: {
email: string;
password: string;
},
data: { email: string; password: string },
params: RequestParams = {}
) =>
this.request<
{
token?: string;
},
{
msg?: string;
}
>({
this.request<{ token?: string }, { msg?: string }>({
path: `/api/v1/auth/user/signin`,
method: 'POST',
body: data,
@ -947,13 +903,7 @@ export class Api<
* @request GET:/api/v1/auth/user/me
* @response `200` `UserInfoType` OK
*/
me: (
query?: {
/** Pass project id to get project specific roles along with user info */
project_id?: string;
},
params: RequestParams = {}
) =>
me: (query?: { project_id?: string }, params: RequestParams = {}) =>
this.request<UserInfoType, any>({
path: `/api/v1/auth/user/me`,
method: 'GET',
@ -972,12 +922,7 @@ export class Api<
* @response `200` `void` OK
* @response `401` `void` Unauthorized
*/
passwordForgot: (
data: {
email?: string;
},
params: RequestParams = {}
) =>
passwordForgot: (data: { email?: string }, params: RequestParams = {}) =>
this.request<void, void>({
path: `/api/v1/auth/password/forgot`,
method: 'POST',
@ -993,30 +938,14 @@ export class Api<
* @name PasswordChange
* @summary Password change
* @request POST:/api/v1/auth/password/change
* @response `200` `{
msg?: string,
}` OK
* @response `400` `{
msg?: string,
}` Bad request
* @response `200` `{ msg?: string }` OK
* @response `400` `{ msg?: string }` Bad request
*/
passwordChange: (
data: {
currentPassword?: string;
newPassword?: string;
},
data: { currentPassword?: string; newPassword?: string },
params: RequestParams = {}
) =>
this.request<
{
msg?: string;
},
{
msg?: string;
}
>({
this.request<{ msg?: string }, { msg?: string }>({
path: `/api/v1/auth/password/change`,
method: 'POST',
body: data,
@ -1068,9 +997,7 @@ export class Api<
*/
passwordReset: (
token: string,
data: {
new_password?: string;
},
data: { new_password?: string },
params: RequestParams = {}
) =>
this.request<void, any>({
@ -1104,23 +1031,11 @@ export class Api<
* @name ProjectUserList
* @summary Project users
* @request GET:/api/v1/db/meta/projects/{projectId}/users
* @response `200` `{
users?: {
list: (UserType)[],
pageInfo: PaginatedType,
},
}` OK
* @response `200` `{ users?: { list: (UserType)[], pageInfo: PaginatedType } }` OK
*/
projectUserList: (projectId: string, params: RequestParams = {}) =>
this.request<
{
users?: {
list: UserType[];
pageInfo: PaginatedType;
};
},
{ users?: { list: UserType[]; pageInfo: PaginatedType } },
any
>({
path: `/api/v1/db/meta/projects/${projectId}/users`,
@ -1225,17 +1140,7 @@ export class Api<
* @name MetaGet
* @summary Project info
* @request GET:/api/v1/db/meta/projects/{projectId}/info
* @response `200` `{
Node?: string,
Arch?: string,
Platform?: string,
Docker?: boolean,
Database?: string,
ProjectOnRootDB?: string,
RootDB?: string,
PackageVersion?: string,
}` OK
* @response `200` `{ Node?: string, Arch?: string, Platform?: string, Docker?: boolean, Database?: string, ProjectOnRootDB?: string, RootDB?: string, PackageVersion?: string }` OK
*/
metaGet: (projectId: string, params: RequestParams = {}, query: object) =>
this.request<
@ -1269,9 +1174,7 @@ export class Api<
*/
modelVisibilityList: (
projectId: string,
query?: {
includeM2M?: boolean;
},
query?: { includeM2M?: boolean },
params: RequestParams = {}
) =>
this.request<any[], any>({
@ -1314,11 +1217,7 @@ export class Api<
* @response `201` `ProjectListType`
*/
list: (
query?: {
page?: number;
pageSize?: number;
sort?: string;
},
query?: { page?: number; pageSize?: number; sort?: string },
params: RequestParams = {}
) =>
this.request<ProjectListType, any>({
@ -1338,9 +1237,7 @@ export class Api<
* @response `200` `ProjectType` OK
*/
create: (
data: ProjectType & {
external?: boolean;
},
data: ProjectType & { external?: boolean },
params: RequestParams = {}
) =>
this.request<ProjectType, any>({
@ -1409,22 +1306,10 @@ export class Api<
* @tags Project
* @name SharedBaseGet
* @request GET:/api/v1/db/meta/projects/{projectId}/shared
* @response `200` `{
uuid?: string,
url?: string,
roles?: string,
}` OK
* @response `200` `{ uuid?: string, url?: string, roles?: string }` OK
*/
sharedBaseGet: (projectId: string, params: RequestParams = {}) =>
this.request<
{
uuid?: string;
url?: string;
roles?: string;
},
any
>({
this.request<{ uuid?: string; url?: string; roles?: string }, any>({
path: `/api/v1/db/meta/projects/${projectId}/shared`,
method: 'GET',
format: 'json',
@ -1452,29 +1337,14 @@ export class Api<
* @tags Project
* @name SharedBaseCreate
* @request POST:/api/v1/db/meta/projects/{projectId}/shared
* @response `200` `{
uuid?: string,
url?: string,
roles?: string,
}` OK
* @response `200` `{ uuid?: string, url?: string, roles?: string }` OK
*/
sharedBaseCreate: (
projectId: string,
data: {
roles?: string;
password?: string;
},
data: { roles?: string; password?: string },
params: RequestParams = {}
) =>
this.request<
{
uuid?: string;
url?: string;
roles?: string;
},
any
>({
this.request<{ uuid?: string; url?: string; roles?: string }, any>({
path: `/api/v1/db/meta/projects/${projectId}/shared`,
method: 'POST',
body: data,
@ -1489,29 +1359,14 @@ export class Api<
* @tags Project
* @name SharedBaseUpdate
* @request PATCH:/api/v1/db/meta/projects/{projectId}/shared
* @response `200` `{
uuid?: string,
url?: string,
roles?: string,
}` OK
* @response `200` `{ uuid?: string, url?: string, roles?: string }` OK
*/
sharedBaseUpdate: (
projectId: string,
data: {
roles?: string;
password?: string;
},
data: { roles?: string; password?: string },
params: RequestParams = {}
) =>
this.request<
{
uuid?: string;
url?: string;
roles?: string;
},
any
>({
this.request<{ uuid?: string; url?: string; roles?: string }, any>({
path: `/api/v1/db/meta/projects/${projectId}/shared`,
method: 'PATCH',
body: data,
@ -1575,27 +1430,14 @@ export class Api<
* @tags Project
* @name AuditList
* @request GET:/api/v1/db/meta/projects/{projectId}/audits
* @response `200` `{
list: (AuditType)[],
pageInfo: PaginatedType,
}` OK
* @response `200` `{ list: (AuditType)[], pageInfo: PaginatedType }` OK
*/
auditList: (
projectId: string,
query?: {
offset?: string;
limit?: string;
},
query?: { offset?: string; limit?: string },
params: RequestParams = {}
) =>
this.request<
{
list: AuditType[];
pageInfo: PaginatedType;
},
any
>({
this.request<{ list: AuditType[]; pageInfo: PaginatedType }, any>({
path: `/api/v1/db/meta/projects/${projectId}/audits`,
method: 'GET',
query: query,
@ -1677,10 +1519,7 @@ export class Api<
*/
update: (
tableId: string,
data: {
table_name?: string;
project_id?: string;
},
data: { table_name?: string; project_id?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -1717,9 +1556,7 @@ export class Api<
*/
reorder: (
tableId: string,
data: {
order?: number;
},
data: { order?: number },
params: RequestParams = {}
) =>
this.request<void, any>({
@ -1873,9 +1710,7 @@ export class Api<
*/
showAllColumn: (
viewId: string,
query?: {
ignoreIds?: any[];
},
query?: { ignoreIds?: any[] },
params: RequestParams = {}
) =>
this.request<void, any>({
@ -1895,9 +1730,7 @@ export class Api<
*/
hideAllColumn: (
viewId: string,
query?: {
ignoreIds?: any[];
},
query?: { ignoreIds?: any[] },
params: RequestParams = {}
) =>
this.request<void, any>({
@ -2229,18 +2062,10 @@ export class Api<
* @tags DB view share
* @name Create
* @request POST:/api/v1/db/meta/views/{viewId}/share
* @response `200` `{
uuid?: string,
}` OK
* @response `200` `{ uuid?: string }` OK
*/
create: (viewId: string, params: RequestParams = {}) =>
this.request<
{
uuid?: string;
},
any
>({
this.request<{ uuid?: string }, any>({
path: `/api/v1/db/meta/views/${viewId}/share`,
method: 'POST',
format: 'json',
@ -2257,10 +2082,7 @@ export class Api<
*/
update: (
viewId: string,
data: {
password?: string;
meta?: any;
},
data: { password?: string; meta?: any },
params: RequestParams = {}
) =>
this.request<SharedViewType, any>({
@ -2348,23 +2170,10 @@ export class Api<
* @tags DB table sort
* @name List
* @request GET:/api/v1/db/meta/views/{viewId}/sorts
* @response `200` `{
sorts?: {
list?: (SortType)[],
},
}` OK
* @response `200` `{ sorts?: { list?: (SortType)[] } }` OK
*/
list: (viewId: string, params: RequestParams = {}) =>
this.request<
{
sorts?: {
list?: SortType[];
};
},
any
>({
this.request<{ sorts?: { list?: SortType[] } }, any>({
path: `/api/v1/db/meta/views/${viewId}/sorts`,
method: 'GET',
format: 'json',
@ -2637,11 +2446,7 @@ export class Api<
orgs: string,
projectName: string,
tableName: string,
query?: {
fields?: any[];
sort?: any[];
where?: string;
},
query?: { fields?: any[]; sort?: any[]; where?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -2666,7 +2471,6 @@ export class Api<
projectName: string,
tableName: string,
query?: {
/** Column name of the column you want to group by, eg. `column_name=column1` */
column_name?: string;
sort?: any[];
where?: string;
@ -2697,13 +2501,7 @@ export class Api<
projectName: string,
tableName: string,
columnId: string,
query?: {
fields?: any[];
sort?: any[];
where?: string;
/** Query params for nested data */
nested?: any;
},
query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -2898,9 +2696,7 @@ export class Api<
projectName: string,
tableName: string,
data: any,
query?: {
where?: string;
},
query?: { where?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -2927,9 +2723,7 @@ export class Api<
projectName: string,
tableName: string,
data: any,
query?: {
where?: string;
},
query?: { where?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3013,10 +2807,7 @@ export class Api<
relationType: 'mm' | 'hm' | 'bt',
columnName: string,
refRowId: string,
query?: {
limit?: string;
offset?: string;
},
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3100,13 +2891,7 @@ export class Api<
tableName: string,
viewName: string,
columnId: string,
query?: {
fields?: any[];
sort?: any[];
where?: string;
/** Query params for nested data */
nested?: any;
},
query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3131,13 +2916,7 @@ export class Api<
projectName: string,
tableName: string,
viewName: string,
query?: {
fields?: any[];
sort?: any[];
where?: string;
/** Query params for nested data */
nested?: any;
},
query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3188,13 +2967,7 @@ export class Api<
projectName: string,
tableName: string,
viewName: string,
query?: {
fields?: any[];
sort?: any[];
where?: string;
/** Query params for nested data */
nested?: any;
},
query?: { fields?: any[]; sort?: any[]; where?: string; nested?: any },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3220,7 +2993,6 @@ export class Api<
tableName: string,
viewName: string,
query?: {
/** Column name of the column you want to group by, eg. `column_name=column1` */
column_name?: string;
sort?: any[];
where?: string;
@ -3251,11 +3023,7 @@ export class Api<
projectName: string,
tableName: string,
viewName: string,
query?: {
where?: string;
/** Query params for nested data */
nested?: any;
},
query?: { where?: string; nested?: any },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3400,10 +3168,7 @@ export class Api<
groupedDataList: (
sharedViewUuid: string,
columnId: string,
query?: {
limit?: string;
offset?: string;
},
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3424,10 +3189,7 @@ export class Api<
*/
dataList: (
sharedViewUuid: string,
query?: {
limit?: string;
offset?: string;
},
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3473,10 +3235,7 @@ export class Api<
rowId: string,
relationType: 'mm' | 'hm' | 'bt',
columnName: string,
query?: {
limit?: string;
offset?: string;
},
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3518,10 +3277,7 @@ export class Api<
dataRelationList: (
sharedViewUuid: string,
columnName: string,
query?: {
limit?: string;
offset?: string;
},
query?: { limit?: string; offset?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3538,18 +3294,10 @@ export class Api<
* @tags Public
* @name SharedBaseGet
* @request GET:/api/v1/db/public/shared-base/{sharedBaseUuid}/meta
* @response `200` `{
project_id?: string,
}` OK
* @response `200` `{ project_id?: string }` OK
*/
sharedBaseGet: (sharedBaseUuid: string, params: RequestParams = {}) =>
this.request<
{
project_id?: string;
},
any
>({
this.request<{ project_id?: string }, any>({
path: `/api/v1/db/public/shared-base/${sharedBaseUuid}/meta`,
method: 'GET',
format: 'json',
@ -3562,16 +3310,7 @@ export class Api<
* @tags Public
* @name SharedViewMetaGet
* @request GET:/api/v1/db/public/shared-view/{sharedViewUuid}/meta
* @response `200` `(ViewType & {
relatedMetas?: any,
client?: string,
columns?: ((GridColumnType | FormColumnType | GalleryColumnType) & ColumnType),
model?: TableType,
} & {
view?: (FormType | GridType | GalleryType),
})` OK
* @response `200` `(ViewType & { relatedMetas?: any, client?: string, columns?: ((GridColumnType | FormColumnType | GalleryColumnType) & ColumnType), model?: TableType } & { view?: (FormType | GridType | GalleryType) })` OK
*/
sharedViewMetaGet: (sharedViewUuid: string, params: RequestParams = {}) =>
this.request<
@ -3581,9 +3320,7 @@ export class Api<
columns?: (GridColumnType | FormColumnType | GalleryColumnType) &
ColumnType;
model?: TableType;
} & {
view?: FormType | GridType | GalleryType;
},
} & { view?: FormType | GridType | GalleryType },
any
>({
path: `/api/v1/db/public/shared-view/${sharedViewUuid}/meta`,
@ -3602,11 +3339,7 @@ export class Api<
* @response `201` `any` Created
*/
commentList: (
query: {
row_id: string;
fk_model_id: string;
comments_only?: boolean;
},
query: { row_id: string; fk_model_id: string; comments_only?: boolean },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3626,11 +3359,7 @@ export class Api<
* @response `200` `void` OK
*/
commentRow: (
data: {
row_id: string;
fk_model_id: string;
description?: string;
},
data: { row_id: string; fk_model_id: string; description?: string },
params: RequestParams = {}
) =>
this.request<void, any>({
@ -3650,10 +3379,7 @@ export class Api<
* @response `201` `any` Created
*/
commentCount: (
query: {
ids: any[];
fk_model_id: string;
},
query: { ids: any[]; fk_model_id: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3697,20 +3423,10 @@ export class Api<
* @tags Utils
* @name TestConnection
* @request POST:/api/v1/db/meta/connection/test
* @response `200` `{
code?: number,
message?: string,
}` OK
* @response `200` `{ code?: number, message?: string }` OK
*/
testConnection: (data: any, params: RequestParams = {}) =>
this.request<
{
code?: number;
message?: string;
},
any
>({
this.request<{ code?: number; message?: string }, any>({
path: `/api/v1/db/meta/connection/test`,
method: 'POST',
body: data,
@ -3807,53 +3523,14 @@ export class Api<
* @tags Utils
* @name AggregatedMetaInfo
* @request GET:/api/v1/aggregated-meta-info
* @response `200` `{
projectCount?: number,
projects?: ({
tableCount?: {
table?: number,
view?: number,
},
external?: boolean,
viewCount?: {
formCount?: number,
gridCount?: number,
galleryCount?: number,
kanbanCount?: number,
total?: number,
sharedFormCount?: number,
sharedGridCount?: number,
sharedGalleryCount?: number,
sharedKanbanCount?: number,
sharedTotal?: number,
sharedLockedCount?: number,
},
webhookCount?: number,
filterCount?: number,
sortCount?: number,
rowCount?: ({
TotalRecords?: string,
})[],
userCount?: number,
})[],
userCount?: number,
sharedBaseCount?: number,
}` OK
* @response `200` `{ projectCount?: number, projects?: ({ tableCount?: { table?: number, view?: number }, external?: boolean, viewCount?: { formCount?: number, gridCount?: number, galleryCount?: number, kanbanCount?: number, total?: number, sharedFormCount?: number, sharedGridCount?: number, sharedGalleryCount?: number, sharedKanbanCount?: number, sharedTotal?: number, sharedLockedCount?: number }, webhookCount?: number, filterCount?: number, sortCount?: number, rowCount?: ({ TotalRecords?: string })[], userCount?: number })[], userCount?: number, sharedBaseCount?: number }` OK
*/
aggregatedMetaInfo: (params: RequestParams = {}) =>
this.request<
{
projectCount?: number;
projects?: {
tableCount?: {
table?: number;
view?: number;
};
tableCount?: { table?: number; view?: number };
external?: boolean;
viewCount?: {
formCount?: number;
@ -3871,9 +3548,7 @@ export class Api<
webhookCount?: number;
filterCount?: number;
sortCount?: number;
rowCount?: {
TotalRecords?: string;
}[];
rowCount?: { TotalRecords?: string }[];
userCount?: number;
}[];
userCount?: number;
@ -3924,20 +3599,10 @@ export class Api<
* @tags DB table webhook
* @name List
* @request GET:/api/v1/db/meta/tables/{tableId}/hooks
* @response `200` `{
list: (HookType)[],
pageInfo: PaginatedType,
}` OK
* @response `200` `{ list: (HookType)[], pageInfo: PaginatedType }` OK
*/
list: (tableId: string, params: RequestParams = {}) =>
this.request<
{
list: HookType[];
pageInfo: PaginatedType;
},
any
>({
this.request<{ list: HookType[]; pageInfo: PaginatedType }, any>({
path: `/api/v1/db/meta/tables/${tableId}/hooks`,
method: 'GET',
format: 'json',
@ -3972,13 +3637,7 @@ export class Api<
*/
test: (
tableId: string,
data: {
payload?: {
data?: any;
user?: any;
};
hook?: HookType;
},
data: { payload?: { data?: any; user?: any }; hook?: HookType },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -3996,14 +3655,7 @@ export class Api<
* @tags DB table webhook
* @name SamplePayloadGet
* @request GET:/api/v1/db/meta/tables/{tableId}/hooks/samplePayload/{operation}
* @response `200` `{
plugins?: {
list: (PluginType)[],
pageInfo: PaginatedType,
},
}` OK
* @response `200` `{ plugins?: { list: (PluginType)[], pageInfo: PaginatedType } }` OK
*/
samplePayloadGet: (
tableId: string,
@ -4011,12 +3663,7 @@ export class Api<
params: RequestParams = {}
) =>
this.request<
{
plugins?: {
list: PluginType[];
pageInfo: PaginatedType;
};
},
{ plugins?: { list: PluginType[]; pageInfo: PaginatedType } },
any
>({
path: `/api/v1/db/meta/tables/${tableId}/hooks/samplePayload/${operation}`,
@ -4065,20 +3712,10 @@ export class Api<
* @tags Plugin
* @name List
* @request GET:/api/v1/db/meta/plugins
* @response `200` `{
list?: (PluginType)[],
pageInfo?: PaginatedType,
}` OK
* @response `200` `{ list?: (PluginType)[], pageInfo?: PaginatedType }` OK
*/
list: (params: RequestParams = {}) =>
this.request<
{
list?: PluginType[];
pageInfo?: PaginatedType;
},
any
>({
this.request<{ list?: PluginType[]; pageInfo?: PaginatedType }, any>({
path: `/api/v1/db/meta/plugins`,
method: 'GET',
format: 'json',
@ -4112,12 +3749,7 @@ export class Api<
* @response `401` `void` Unauthorized
*/
test: (
data: {
id?: string;
title?: string;
input?: any;
category?: string;
},
data: { id?: string; title?: string; input?: any; category?: string },
params: RequestParams = {}
) =>
this.request<any, void>({
@ -4192,9 +3824,7 @@ export class Api<
*/
create: (
projectId: string,
data: {
description?: string;
},
data: { description?: string },
params: RequestParams = {}
) =>
this.request<void, any>({
@ -4230,13 +3860,8 @@ export class Api<
* @request POST:/api/v1/db/storage/upload
*/
upload: (
query: {
path: string;
},
data: {
files?: any;
json?: string;
},
query: { path: string },
data: { files?: any; json?: string },
params: RequestParams = {}
) =>
this.request<any, any>({
@ -4257,9 +3882,7 @@ export class Api<
* @request POST:/api/v1/db/storage/upload-by-url
*/
uploadByUrl: (
query: {
path: string;
},
query: { path: string },
data: {
url?: string;
fileName?: string;

Loading…
Cancel
Save