Browse Source

fix: merge metaGet & metaGet2

nc-fix/meta-first
mertmit 5 months ago
parent
commit
8799c349da
  1. 6
      packages/nocodb/src/helpers/NcPluginMgrv2.ts
  2. 116
      packages/nocodb/src/meta/meta.service.ts
  3. 2
      packages/nocodb/src/models/Audit.ts
  4. 2
      packages/nocodb/src/models/BarcodeColumn.ts
  5. 10
      packages/nocodb/src/models/Base.ts
  6. 2
      packages/nocodb/src/models/CalendarRange.ts
  7. 2
      packages/nocodb/src/models/CalendarView.ts
  8. 2
      packages/nocodb/src/models/CalendarViewColumn.ts
  9. 6
      packages/nocodb/src/models/Column.ts
  10. 2
      packages/nocodb/src/models/Comment.ts
  11. 2
      packages/nocodb/src/models/Extension.ts
  12. 8
      packages/nocodb/src/models/Filter.ts
  13. 2
      packages/nocodb/src/models/FormView.ts
  14. 2
      packages/nocodb/src/models/FormViewColumn.ts
  15. 2
      packages/nocodb/src/models/FormulaColumn.ts
  16. 2
      packages/nocodb/src/models/GalleryView.ts
  17. 2
      packages/nocodb/src/models/GalleryViewColumn.ts
  18. 2
      packages/nocodb/src/models/GridView.ts
  19. 2
      packages/nocodb/src/models/GridViewColumn.ts
  20. 2
      packages/nocodb/src/models/Hook.ts
  21. 8
      packages/nocodb/src/models/HookFilter.ts
  22. 2
      packages/nocodb/src/models/KanbanView.ts
  23. 2
      packages/nocodb/src/models/KanbanViewColumn.ts
  24. 2
      packages/nocodb/src/models/LinkToAnotherRecordColumn.ts
  25. 2
      packages/nocodb/src/models/LookupColumn.ts
  26. 2
      packages/nocodb/src/models/MapView.ts
  27. 2
      packages/nocodb/src/models/MapViewColumn.ts
  28. 14
      packages/nocodb/src/models/Model.ts
  29. 2
      packages/nocodb/src/models/ModelRoleVisibility.ts
  30. 2
      packages/nocodb/src/models/Notification.ts
  31. 4
      packages/nocodb/src/models/Plugin.ts
  32. 2
      packages/nocodb/src/models/QrCodeColumn.ts
  33. 2
      packages/nocodb/src/models/RollupColumn.ts
  34. 4
      packages/nocodb/src/models/SelectOption.ts
  35. 2
      packages/nocodb/src/models/Sort.ts
  36. 4
      packages/nocodb/src/models/Source.ts
  37. 2
      packages/nocodb/src/models/SyncSource.ts
  38. 8
      packages/nocodb/src/models/User.ts
  39. 2
      packages/nocodb/src/models/UserRefreshToken.ts
  40. 20
      packages/nocodb/src/models/View.ts
  41. 2
      packages/nocodb/src/services/base-users/base-users.service.ts
  42. 2
      packages/nocodb/src/services/org-users.service.ts
  43. 2
      packages/nocodb/src/services/view-columns.service.ts
  44. 18
      packages/nocodb/src/utils/cloud/populateCloudPlugins.ts
  45. 2
      packages/nocodb/src/version-upgrader/ncAttachmentUpgrader.ts
  46. 2
      packages/nocodb/src/version-upgrader/ncAttachmentUpgrader_0104002.ts

6
packages/nocodb/src/helpers/NcPluginMgrv2.ts

@ -162,7 +162,7 @@ class NcPluginMgrv2 {
public static async storageAdapter(
ncMeta = Noco.ncMeta,
): Promise<IStorageAdapterV2> {
const pluginData = await ncMeta.metaGet2(
const pluginData = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
@ -192,7 +192,7 @@ class NcPluginMgrv2 {
isUserInvite = true,
ncMeta = Noco.ncMeta,
): Promise<IEmailAdapter> {
const pluginData = await ncMeta.metaGet2(
const pluginData = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
@ -227,7 +227,7 @@ class NcPluginMgrv2 {
title: string,
ncMeta = Noco.ncMeta,
): Promise<IWebhookNotificationAdapter> {
const pluginData = await ncMeta.metaGet2(
const pluginData = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,

116
packages/nocodb/src/meta/meta.service.ts

@ -84,9 +84,55 @@ export class MetaService {
target: string,
idOrCondition: string | { [p: string]: any },
fields?: string[],
// xcCondition?
xcCondition?: Condition,
): Promise<any> {
return this.metaGet2(workspace_id, base_id, target, idOrCondition, fields);
const query = this.knexConnection(target);
if (xcCondition) {
query.condition(xcCondition);
}
if (fields?.length) {
query.select(...fields);
}
if (workspace_id === RootScopes.BYPASS && base_id === RootScopes.BYPASS) {
// bypass
} else if (workspace_id === base_id) {
if (!Object.values(RootScopes).includes(workspace_id as RootScopes)) {
NcError.metaError({
message: 'Invalid scope',
sql: '',
});
}
if (!RootScopeTables[workspace_id].includes(target)) {
NcError.metaError({
message: 'Table not accessible from this scope',
sql: '',
});
}
} else {
if (!base_id) {
NcError.metaError({
message: 'Base ID is required',
sql: '',
});
}
this.contextCondition(query, workspace_id, base_id, target);
}
if (!idOrCondition) {
return query.first();
}
if (typeof idOrCondition !== 'object') {
query.where('id', idOrCondition);
} else {
query.where(idOrCondition);
}
return query.first();
}
/***
@ -326,72 +372,6 @@ export class MetaService {
return query.del();
}
/***
* Get meta data
* @param workspace_id - Workspace id
* @param base_id - Base id
* @param target - Table name
* @param idOrCondition - If string, will get the record with the given id. If object, will get the record with the given condition.
* @param fields - Fields to be selected
* @param xcCondition - Additional nested or complex condition to be added to the query.
*/
public async metaGet2(
workspace_id: string,
base_id: string,
target: string,
idOrCondition: string | { [p: string]: any },
fields?: string[],
xcCondition?: Condition,
): Promise<any> {
const query = this.knexConnection(target);
if (xcCondition) {
query.condition(xcCondition);
}
if (fields?.length) {
query.select(...fields);
}
if (workspace_id === RootScopes.BYPASS && base_id === RootScopes.BYPASS) {
// bypass
} else if (workspace_id === base_id) {
if (!Object.values(RootScopes).includes(workspace_id as RootScopes)) {
NcError.metaError({
message: 'Invalid scope',
sql: '',
});
}
if (!RootScopeTables[workspace_id].includes(target)) {
NcError.metaError({
message: 'Table not accessible from this scope',
sql: '',
});
}
} else {
if (!base_id) {
NcError.metaError({
message: 'Base ID is required',
sql: '',
});
}
this.contextCondition(query, workspace_id, base_id, target);
}
if (!idOrCondition) {
return query.first();
}
if (typeof idOrCondition !== 'object') {
query.where('id', idOrCondition);
} else {
query.where(idOrCondition);
}
return query.first();
}
/***
* Get order value for the next record
* @param target - Table name

2
packages/nocodb/src/models/Audit.ts

@ -65,7 +65,7 @@ export default class Audit implements AuditType {
}
public static async get(auditId: string) {
const audit = await Noco.ncMeta.metaGet2(
const audit = await Noco.ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.AUDIT,

2
packages/nocodb/src/models/BarcodeColumn.ts

@ -63,7 +63,7 @@ export default class BarcodeColumn {
CacheGetType.TYPE_OBJECT,
));
if (!column) {
column = await ncMeta.metaGet2(
column = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_BARCODE,

10
packages/nocodb/src/models/Base.ts

@ -175,7 +175,7 @@ export default class Base implements BaseType {
CacheGetType.TYPE_OBJECT,
));
if (!baseData) {
baseData = await ncMeta.metaGet2(
baseData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -219,7 +219,7 @@ export default class Base implements BaseType {
));
if (!baseData) {
baseData = await ncMeta.metaGet2(
baseData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -431,7 +431,7 @@ export default class Base implements BaseType {
));
let baseData = null;
if (!baseId) {
baseData = await Noco.ncMeta.metaGet2(
baseData = await Noco.ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -478,7 +478,7 @@ export default class Base implements BaseType {
));
let baseData = null;
if (!baseId) {
baseData = await ncMeta.metaGet2(
baseData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -513,7 +513,7 @@ export default class Base implements BaseType {
));
let baseData = null;
if (!baseId) {
baseData = await ncMeta.metaGet2(
baseData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,

2
packages/nocodb/src/models/CalendarRange.ts

@ -99,7 +99,7 @@ export default class CalendarRange implements CalendarRangeType {
fk_view_id: string,
ncMeta = Noco.ncMeta,
): Promise<CalendarRange> {
const data = await ncMeta.metaGet2(
const data = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.CALENDAR_VIEW_RANGE,

2
packages/nocodb/src/models/CalendarView.ts

@ -47,7 +47,7 @@ export default class CalendarView implements CalendarType {
view.calendar_range = [];
}
} else {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.CALENDAR_VIEW,

2
packages/nocodb/src/models/CalendarViewColumn.ts

@ -37,7 +37,7 @@ export default class CalendarViewColumn {
CacheGetType.TYPE_OBJECT,
));
if (!viewColumn) {
viewColumn = await ncMeta.metaGet2(
viewColumn = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.CALENDAR_VIEW_COLUMNS,

6
packages/nocodb/src/models/Column.ts

@ -635,7 +635,7 @@ export default class Column<T = any> implements ColumnType {
CacheGetType.TYPE_OBJECT,
));
if (!colData) {
colData = await ncMeta.metaGet2(
colData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,
@ -1311,7 +1311,7 @@ export default class Column<T = any> implements ColumnType {
}: { column_name; fk_model_id; exclude_id? },
ncMeta = Noco.ncMeta,
) {
return !(await ncMeta.metaGet2(
return !(await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,
@ -1329,7 +1329,7 @@ export default class Column<T = any> implements ColumnType {
{ title, fk_model_id, exclude_id }: { title; fk_model_id; exclude_id? },
ncMeta = Noco.ncMeta,
) {
return !(await ncMeta.metaGet2(
return !(await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,

2
packages/nocodb/src/models/Comment.ts

@ -31,7 +31,7 @@ export default class Comment implements CommentType {
commentId: string,
ncMeta = Noco.ncMeta,
) {
const comment = await ncMeta.metaGet2(
const comment = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COMMENTS,

2
packages/nocodb/src/models/Extension.ts

@ -36,7 +36,7 @@ export default class Extension {
);
if (!extension) {
extension = await ncMeta.metaGet2(
extension = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.EXTENSIONS,

8
packages/nocodb/src/models/Filter.ts

@ -170,7 +170,7 @@ export default class Filter implements FilterType {
let value = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (!value) {
/* get from db */
value = await ncMeta.metaGet2(
value = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,
@ -363,7 +363,7 @@ export default class Filter implements FilterType {
2,
);
if (!filterObj) {
filterObj = await ncMeta.metaGet2(
filterObj = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,
@ -420,7 +420,7 @@ export default class Filter implements FilterType {
// }): Promise<Filter> {
// if (!viewId) return null;
//
// const filterObj = await ncMeta.metaGet2(
// const filterObj = await ncMeta.metaGet(
// context.workspace_id,
// context.base_id,
// MetaTable.FILTER_EXP,
@ -586,7 +586,7 @@ export default class Filter implements FilterType {
CacheGetType.TYPE_OBJECT,
));
if (!filterObj) {
filterObj = await ncMeta.metaGet2(
filterObj = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,

2
packages/nocodb/src/models/FormView.ts

@ -59,7 +59,7 @@ export default class FormView implements FormViewType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FORM_VIEW,

2
packages/nocodb/src/models/FormViewColumn.ts

@ -46,7 +46,7 @@ export default class FormViewColumn implements FormColumnType {
CacheGetType.TYPE_OBJECT,
));
if (!viewColumn) {
viewColumn = await ncMeta.metaGet2(
viewColumn = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FORM_VIEW_COLUMNS,

2
packages/nocodb/src/models/FormulaColumn.ts

@ -57,7 +57,7 @@ export default class FormulaColumn {
CacheGetType.TYPE_OBJECT,
));
if (!column) {
column = await ncMeta.metaGet2(
column = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_FORMULA,

2
packages/nocodb/src/models/GalleryView.ts

@ -57,7 +57,7 @@ export default class GalleryView implements GalleryType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.GALLERY_VIEW,

2
packages/nocodb/src/models/GalleryViewColumn.ts

@ -34,7 +34,7 @@ export default class GalleryViewColumn {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.GALLERY_VIEW_COLUMNS,

2
packages/nocodb/src/models/GridView.ts

@ -37,7 +37,7 @@ export default class GridView implements GridType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.GRID_VIEW,

2
packages/nocodb/src/models/GridViewColumn.ts

@ -74,7 +74,7 @@ export default class GridViewColumn implements GridColumnType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.GRID_VIEW_COLUMNS,

2
packages/nocodb/src/models/Hook.ts

@ -55,7 +55,7 @@ export default class Hook implements HookType {
CacheGetType.TYPE_OBJECT,
));
if (!hook) {
hook = await ncMeta.metaGet2(
hook = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.HOOKS,

8
packages/nocodb/src/models/HookFilter.ts

@ -114,7 +114,7 @@ export default class Filter {
let value = await NocoCache.get(key, CacheGetType.TYPE_OBJECT);
if (!value) {
/* get from db */
value = await ncMeta.metaGet2(
value = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,
@ -230,7 +230,7 @@ export default class Filter {
// 2
// );
// if (!filterObj) {
// filterObj = await ncMeta.metaGet2(context.workspace_id, context.base_id, MetaTable.FILTER_EXP, {
// filterObj = await ncMeta.metaGet(context.workspace_id, context.base_id, MetaTable.FILTER_EXP, {
// id: this.fk_parent_id
// });
// await NocoCache.set(
@ -277,7 +277,7 @@ export default class Filter {
// }): Promise<Filter> {
// if (!viewId) return null;
//
// const filterObj = await ncMeta.metaGet2(
// const filterObj = await ncMeta.metaGet(
// context.workspace_id,
// context.base_id,
// MetaTable.FILTER_EXP,
@ -381,7 +381,7 @@ export default class Filter {
CacheGetType.TYPE_OBJECT,
));
if (!filterObj) {
filterObj = await ncMeta.metaGet2(
filterObj = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,

2
packages/nocodb/src/models/KanbanView.ts

@ -48,7 +48,7 @@ export default class KanbanView implements KanbanType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.KANBAN_VIEW,

2
packages/nocodb/src/models/KanbanViewColumn.ts

@ -34,7 +34,7 @@ export default class KanbanViewColumn implements KanbanColumnType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.KANBAN_VIEW_COLUMNS,

2
packages/nocodb/src/models/LinkToAnotherRecordColumn.ts

@ -172,7 +172,7 @@ export default class LinkToAnotherRecordColumn {
CacheGetType.TYPE_OBJECT,
));
if (!colData) {
colData = await ncMeta.metaGet2(
colData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_RELATIONS,

2
packages/nocodb/src/models/LookupColumn.ts

@ -76,7 +76,7 @@ export default class LookupColumn implements LookupType {
CacheGetType.TYPE_OBJECT,
));
if (!colData) {
colData = await ncMeta.metaGet2(
colData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_LOOKUP,

2
packages/nocodb/src/models/MapView.ts

@ -42,7 +42,7 @@ export default class MapView implements MapType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MAP_VIEW,

2
packages/nocodb/src/models/MapViewColumn.ts

@ -33,7 +33,7 @@ export default class MapViewColumn {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MAP_VIEW_COLUMNS,

14
packages/nocodb/src/models/Model.ts

@ -348,7 +348,7 @@ export default class Model implements TableType {
CacheGetType.TYPE_OBJECT,
));
if (!modelData) {
modelData = await ncMeta.metaGet2(
modelData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -384,7 +384,7 @@ export default class Model implements TableType {
CacheGetType.TYPE_OBJECT,
));
if (!modelData) {
modelData = await ncMeta.metaGet2(
modelData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -420,7 +420,7 @@ export default class Model implements TableType {
CacheGetType.TYPE_OBJECT,
));
if (!modelData) {
modelData = await ncMeta.metaGet2(
modelData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -976,7 +976,7 @@ export default class Model implements TableType {
(await NocoCache.get(cacheKey, CacheGetType.TYPE_STRING));
if (!modelId) {
const model = source_id
? await ncMeta.metaGet2(
? await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -997,7 +997,7 @@ export default class Model implements TableType {
],
},
)
: await ncMeta.metaGet2(
: await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -1032,7 +1032,7 @@ export default class Model implements TableType {
{ table_name, exclude_id }: { table_name; base_id; source_id; exclude_id? },
ncMeta = Noco.ncMeta,
) {
return !(await ncMeta.metaGet2(
return !(await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -1049,7 +1049,7 @@ export default class Model implements TableType {
{ title, exclude_id }: { title; base_id; source_id; exclude_id? },
ncMeta = Noco.ncMeta,
) {
return !(await ncMeta.metaGet2(
return !(await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODELS,

2
packages/nocodb/src/models/ModelRoleVisibility.ts

@ -64,7 +64,7 @@ export default class ModelRoleVisibility implements ModelRoleVisibilityType {
CacheGetType.TYPE_OBJECT,
));
if (!data) {
data = await ncMeta.metaGet2(
data = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.MODEL_ROLE_VISIBILITY,

2
packages/nocodb/src/models/Notification.ts

@ -47,7 +47,7 @@ export default class Notification {
) {
const condition = extractProps(params, ['id', 'fk_user_id']);
return await ncMeta.metaGet2(
return await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.NOTIFICATION,

4
packages/nocodb/src/models/Plugin.ts

@ -41,7 +41,7 @@ export default class Plugin implements PluginType {
CacheGetType.TYPE_OBJECT,
));
if (!plugin) {
plugin = await ncMeta.metaGet2(
plugin = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
@ -109,7 +109,7 @@ export default class Plugin implements PluginType {
CacheGetType.TYPE_OBJECT,
));
if (!plugin) {
plugin = await ncMeta.metaGet2(
plugin = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,

2
packages/nocodb/src/models/QrCodeColumn.ts

@ -59,7 +59,7 @@ export default class QrCodeColumn {
CacheGetType.TYPE_OBJECT,
));
if (!column) {
column = await ncMeta.metaGet2(
column = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_QRCODE,

2
packages/nocodb/src/models/RollupColumn.ts

@ -92,7 +92,7 @@ export default class RollupColumn implements RollupType {
CacheGetType.TYPE_OBJECT,
));
if (!column) {
column = await ncMeta.metaGet2(
column = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_ROLLUP,

4
packages/nocodb/src/models/SelectOption.ts

@ -115,7 +115,7 @@ export default class SelectOption implements SelectOptionType {
CacheGetType.TYPE_OBJECT,
));
if (!data) {
data = await ncMeta.metaGet2(
data = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_SELECT_OPTIONS,
@ -168,7 +168,7 @@ export default class SelectOption implements SelectOptionType {
title: string,
ncMeta = Noco.ncMeta,
): Promise<SelectOption> {
const data = await ncMeta.metaGet2(
const data = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COL_SELECT_OPTIONS,

2
packages/nocodb/src/models/Sort.ts

@ -271,7 +271,7 @@ export default class Sort {
CacheGetType.TYPE_OBJECT,
));
if (!sortData) {
sortData = await ncMeta.metaGet2(
sortData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.SORT,

4
packages/nocodb/src/models/Source.ts

@ -272,7 +272,7 @@ export default class Source implements SourceType {
CacheGetType.TYPE_OBJECT,
));
if (!baseData) {
baseData = await ncMeta.metaGet2(
baseData = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.BASES,
@ -310,7 +310,7 @@ export default class Source implements SourceType {
uuid: string,
ncMeta = Noco.ncMeta,
) {
const source = await ncMeta.metaGet2(
const source = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.BASES,

2
packages/nocodb/src/models/SyncSource.ts

@ -30,7 +30,7 @@ export default class SyncSource {
syncSourceId: string,
ncMeta = Noco.ncMeta,
) {
const syncSource = await ncMeta.metaGet2(
const syncSource = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.SYNC_SOURCE,

8
packages/nocodb/src/models/User.ts

@ -145,7 +145,7 @@ export default class User implements UserType {
CacheGetType.TYPE_OBJECT,
));
if (!user) {
user = await ncMeta.metaGet2(
user = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
@ -159,7 +159,7 @@ export default class User implements UserType {
}
static async isFirst(ncMeta = Noco.ncMeta) {
return !(await ncMeta.metaGet2(
return !(await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
@ -192,7 +192,7 @@ export default class User implements UserType {
CacheGetType.TYPE_OBJECT,
));
if (!user) {
user = await ncMeta.metaGet2(
user = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
@ -213,7 +213,7 @@ export default class User implements UserType {
return null;
}
return await ncMeta.metaGet2(
return await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,

2
packages/nocodb/src/models/UserRefreshToken.ts

@ -114,7 +114,7 @@ export default class UserRefreshToken {
token: string,
ncMeta = Noco.ncMeta,
): Promise<UserRefreshToken> {
const userToken = await ncMeta.metaGet2(
const userToken = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USER_REFRESH_TOKENS,

20
packages/nocodb/src/models/View.ts

@ -111,7 +111,7 @@ export default class View implements ViewType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.VIEWS,
@ -138,7 +138,7 @@ export default class View implements ViewType {
CacheGetType.TYPE_STRING,
));
if (!viewId) {
const view = await ncMeta.metaGet2(
const view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.VIEWS,
@ -189,7 +189,7 @@ export default class View implements ViewType {
CacheGetType.TYPE_OBJECT,
));
if (!view) {
view = await ncMeta.metaGet2(
view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.VIEWS,
@ -880,7 +880,7 @@ export default class View implements ViewType {
const o = await NocoCache.get(key, CacheGetType.TYPE_STRING);
if (o) return o;
const viewColumn = await ncMeta.metaGet2(
const viewColumn = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
tableName,
@ -941,7 +941,7 @@ export default class View implements ViewType {
// keep primary_value_column always visible and first in grid view
if (view.type === ViewTypes.GRID) {
const primary_value_column_meta = await ncMeta.metaGet2(
const primary_value_column_meta = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,
@ -951,7 +951,7 @@ export default class View implements ViewType {
},
);
const primary_value_column = await ncMeta.metaGet2(
const primary_value_column = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.GRID_VIEW_COLUMNS,
@ -1010,7 +1010,7 @@ export default class View implements ViewType {
const view = await this.get(context, viewId, ncMeta);
const table = this.extractViewColumnsTableName(view);
const existingCol = await ncMeta.metaGet2(
const existingCol = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
table,
@ -1131,7 +1131,7 @@ export default class View implements ViewType {
uuid: string,
ncMeta = Noco.ncMeta,
) {
const view = await ncMeta.metaGet2(
const view = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.VIEWS,
@ -1487,7 +1487,7 @@ export default class View implements ViewType {
const scope = this.extractViewColumnsTableNameScope(view);
if (view.type === ViewTypes.GRID) {
const primary_value_column = await ncMeta.metaGet2(
const primary_value_column = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,
@ -1604,7 +1604,7 @@ export default class View implements ViewType {
// get column meta for each view column
for (const col of view_columns) {
const col_meta = await ncMeta.metaGet2(
const col_meta = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,

2
packages/nocodb/src/services/base-users/base-users.service.ts

@ -333,7 +333,7 @@ export class BaseUsersService {
invite_token_expires: new Date(Date.now() + 24 * 60 * 60 * 1000),
});
const pluginData = await Noco.ncMeta.metaGet2(
const pluginData = await Noco.ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PLUGIN,

2
packages/nocodb/src/services/org-users.service.ts

@ -218,7 +218,7 @@ export class OrgUsersService {
invite_token_expires: new Date(Date.now() + 24 * 60 * 60 * 1000),
});
const pluginData = await Noco.ncMeta.metaGet2(
const pluginData = await Noco.ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,

2
packages/nocodb/src/services/view-columns.service.ts

@ -141,7 +141,7 @@ export class ViewColumnsService {
const columnId =
typeof param.columns === 'object' ? indexOrId : column['id'];
const existingCol = await ncMeta.metaGet2(
const existingCol = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
table,

18
packages/nocodb/src/utils/cloud/populateCloudPlugins.ts

@ -13,9 +13,14 @@ export const populatePluginsForCloud = async ({ ncMeta = Noco.ncMeta }) => {
throw new Error('S3 env variables not found');
}
const s3PluginData = await ncMeta.metaGet2(null, null, MetaTable.PLUGIN, {
const s3PluginData = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
{
title: S3PluginConfig.title,
});
},
);
if (!s3PluginData) throw new Error('S3 plugin not found');
@ -57,9 +62,14 @@ export const populatePluginsForCloud = async ({ ncMeta = Noco.ncMeta }) => {
// throw new Error('SES env variables not found');
// }
const sesPluginData = await ncMeta.metaGet2(null, null, MetaTable.PLUGIN, {
const sesPluginData = await ncMeta.metaGet(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
{
title: SESPluginConfig.title,
});
},
);
if (!sesPluginData) throw new Error('SES plugin not found');

2
packages/nocodb/src/version-upgrader/ncAttachmentUpgrader.ts

@ -61,7 +61,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
base_id: source.base_id,
};
const base = await ncMeta.metaGet2(
const base = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,

2
packages/nocodb/src/version-upgrader/ncAttachmentUpgrader_0104002.ts

@ -52,7 +52,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
base_id: source.base_id,
};
const base = await ncMeta.metaGet2(
const base = await ncMeta.metaGet(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,

Loading…
Cancel
Save