Browse Source

fix: separate metaGet & metaFirst

nc-fix/meta-first
mertmit 5 months ago
parent
commit
c4066aaad8
  1. 10
      packages/nocodb/src/Noco.ts
  2. 11
      packages/nocodb/src/helpers/NcPluginMgrv2.ts
  3. 98
      packages/nocodb/src/meta/meta.service.ts
  4. 3
      packages/nocodb/src/models/ApiToken.ts
  5. 3
      packages/nocodb/src/models/BarcodeColumn.ts
  6. 11
      packages/nocodb/src/models/Base.ts
  7. 5
      packages/nocodb/src/models/CalendarRange.ts
  8. 5
      packages/nocodb/src/models/CalendarView.ts
  9. 4
      packages/nocodb/src/models/Column.ts
  10. 8
      packages/nocodb/src/models/Filter.ts
  11. 5
      packages/nocodb/src/models/FormView.ts
  12. 3
      packages/nocodb/src/models/FormulaColumn.ts
  13. 5
      packages/nocodb/src/models/GalleryView.ts
  14. 5
      packages/nocodb/src/models/GridView.ts
  15. 4
      packages/nocodb/src/models/HookFilter.ts
  16. 5
      packages/nocodb/src/models/KanbanView.ts
  17. 3
      packages/nocodb/src/models/LinkToAnotherRecordColumn.ts
  18. 3
      packages/nocodb/src/models/LookupColumn.ts
  19. 5
      packages/nocodb/src/models/MapView.ts
  20. 17
      packages/nocodb/src/models/Model.ts
  21. 8
      packages/nocodb/src/models/ModelRoleVisibility.ts
  22. 2
      packages/nocodb/src/models/Notification.ts
  23. 5
      packages/nocodb/src/models/Plugin.ts
  24. 3
      packages/nocodb/src/models/QrCodeColumn.ts
  25. 3
      packages/nocodb/src/models/RollupColumn.ts
  26. 2
      packages/nocodb/src/models/SelectOption.ts
  27. 4
      packages/nocodb/src/models/Source.ts
  28. 5
      packages/nocodb/src/models/Store.ts
  29. 12
      packages/nocodb/src/models/User.ts
  30. 5
      packages/nocodb/src/models/UserRefreshToken.ts
  31. 19
      packages/nocodb/src/models/View.ts
  32. 5
      packages/nocodb/src/providers/init-meta-service.provider.ts
  33. 2
      packages/nocodb/src/services/base-users/base-users.service.ts
  34. 2
      packages/nocodb/src/services/org-users.service.ts
  35. 20
      packages/nocodb/src/services/users/users.service.ts
  36. 2
      packages/nocodb/src/services/view-columns.service.ts
  37. 10
      packages/nocodb/src/utils/cloud/populateCloudPlugins.ts
  38. 5
      packages/nocodb/src/version-upgrader/NcUpgrader.ts
  39. 4
      packages/nocodb/src/version-upgrader/ncAttachmentUpgrader.ts
  40. 4
      packages/nocodb/src/version-upgrader/ncAttachmentUpgrader_0104002.ts
  41. 4
      packages/nocodb/src/version-upgrader/ncStickyColumnUpgrader.ts

10
packages/nocodb/src/Noco.ts

@ -150,9 +150,8 @@ export default class Noco {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.STORE,
{
key: 'nc_auth_jwt_secret',
},
'nc_auth_jwt_secret',
'key',
)
)?.value;
if (!secret) {
@ -181,9 +180,8 @@ export default class Noco {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.STORE,
{
key: 'nc_server_id',
},
'nc_server_id',
'key',
)
)?.value;
if (!serverId) {

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

@ -71,9 +71,8 @@ class NcPluginMgrv2 {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
{
title: plugin.title,
},
plugin.title,
'title',
);
if (!pluginConfig) {
@ -162,7 +161,7 @@ class NcPluginMgrv2 {
public static async storageAdapter(
ncMeta = Noco.ncMeta,
): Promise<IStorageAdapterV2> {
const pluginData = await ncMeta.metaGet(
const pluginData = await ncMeta.metaFirst(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
@ -192,7 +191,7 @@ class NcPluginMgrv2 {
isUserInvite = true,
ncMeta = Noco.ncMeta,
): Promise<IEmailAdapter> {
const pluginData = await ncMeta.metaGet(
const pluginData = await ncMeta.metaFirst(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
@ -227,7 +226,7 @@ class NcPluginMgrv2 {
title: string,
ncMeta = Noco.ncMeta,
): Promise<IWebhookNotificationAdapter> {
const pluginData = await ncMeta.metaGet(
const pluginData = await ncMeta.metaFirst(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,

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

@ -71,34 +71,93 @@ export class MetaService {
}
/***
* Get single record from meta data
* Get meta data
* @param workspace_id - Workspace id
* @param base_id - Base alias
* @param base_id - Base id
* @param target - Table name
* @param idValue - ID of the record
* @param idField - Field name of the ID
*/
public async metaGet(
workspace_id: string,
base_id: string,
target: string,
idValue: string,
idField = 'id',
fields?: string[],
): Promise<any> {
const query = this.knexConnection(target);
if (!idValue || !idField) {
NcError.metaError({
message: 'ID is required for metaGet',
sql: '',
});
}
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: '',
});
}
}
if (fields?.length) {
query.select(...fields);
}
query.where(idField, idValue);
this.checkConditionPresent(query, 'read');
this.contextCondition(query, workspace_id, base_id, target);
return query.first();
}
/***
* 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 metaGet(
public async metaFirst(
workspace_id: string,
base_id: string,
target: string,
idOrCondition: string | { [p: string]: any },
fields?: string[],
xcCondition?: Condition,
force = false,
): 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 (workspace_id === base_id) {
if (!Object.values(RootScopes).includes(workspace_id as RootScopes)) {
NcError.metaError({
message: 'Invalid scope',
@ -119,19 +178,26 @@ export class MetaService {
sql: '',
});
}
this.contextCondition(query, workspace_id, base_id, target);
}
if (!idOrCondition) {
return query.first();
if (xcCondition) {
query.condition(xcCondition);
}
if (typeof idOrCondition !== 'object') {
query.where('id', idOrCondition);
} else {
} else if (idOrCondition) {
query.where(idOrCondition);
}
// Check if a condition is present in the query builder and throw an error if not.
if (!force) {
this.checkConditionPresent(query, 'read');
}
// Apply context condition
this.contextCondition(query, workspace_id, base_id, target);
return query.first();
}
@ -725,7 +791,7 @@ export class MetaService {
*/
protected checkConditionPresent(
queryBuilder: Knex.QueryBuilder,
operation: 'delete' | 'update',
operation: 'read' | 'delete' | 'update',
) {
// Convert the query builder to a SQL string to inspect the presence of a WHERE clause.
const sql = queryBuilder.toString();

3
packages/nocodb/src/models/ApiToken.ts

@ -91,7 +91,8 @@ export default class ApiToken implements ApiTokenType {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.API_TOKENS,
{ token },
token,
'token',
);
await NocoCache.set(`${CacheScope.API_TOKEN}:${token}`, data);
}

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

@ -67,7 +67,8 @@ export default class BarcodeColumn {
context.workspace_id,
context.base_id,
MetaTable.COL_BARCODE,
{ fk_column_id: columnId },
columnId,
'fk_column_id',
);
await NocoCache.set(`${CacheScope.COL_BARCODE}:${columnId}`, column);
}

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

@ -175,7 +175,7 @@ export default class Base implements BaseType {
CacheGetType.TYPE_OBJECT,
));
if (!baseData) {
baseData = await ncMeta.metaGet(
baseData = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -219,7 +219,7 @@ export default class Base implements BaseType {
));
if (!baseData) {
baseData = await ncMeta.metaGet(
baseData = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -431,12 +431,13 @@ export default class Base implements BaseType {
));
let baseData = null;
if (!baseId) {
baseData = await Noco.ncMeta.metaGet(
baseData = await Noco.ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
{
uuid,
deleted: false,
},
);
if (baseData) {
@ -478,7 +479,7 @@ export default class Base implements BaseType {
));
let baseData = null;
if (!baseId) {
baseData = await ncMeta.metaGet(
baseData = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
@ -513,7 +514,7 @@ export default class Base implements BaseType {
));
let baseData = null;
if (!baseId) {
baseData = await ncMeta.metaGet(
baseData = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.PROJECT,

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

@ -103,9 +103,8 @@ export default class CalendarRange implements CalendarRangeType {
context.workspace_id,
context.base_id,
MetaTable.CALENDAR_VIEW_RANGE,
{
fk_view_id,
},
fk_view_id,
'fk_view_id',
);
return data && new CalendarRange(data);

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

@ -51,9 +51,8 @@ export default class CalendarView implements CalendarType {
context.workspace_id,
context.base_id,
MetaTable.CALENDAR_VIEW,
{
fk_view_id: viewId,
},
viewId,
'fk_view_id',
);
const calendarRange = await CalendarRange.read(context, viewId, ncMeta);
if (view && calendarRange) {

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

@ -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.metaGet(
return !(await ncMeta.metaFirst(
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.metaGet(
return !(await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,

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

@ -367,9 +367,7 @@ export default class Filter implements FilterType {
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,
{
id: this.fk_parent_id,
},
this.fk_parent_id,
);
await NocoCache.set(
`${CacheScope.FILTER_EXP}:${this.fk_parent_id}`,
@ -590,9 +588,7 @@ export default class Filter implements FilterType {
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,
{
id,
},
id,
);
await NocoCache.set(`${CacheScope.FILTER_EXP}:${id}`, filterObj);
}

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

@ -63,9 +63,8 @@ export default class FormView implements FormViewType {
context.workspace_id,
context.base_id,
MetaTable.FORM_VIEW,
{
fk_view_id: viewId,
},
viewId,
'fk_view_id',
);
if (view) {

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

@ -61,7 +61,8 @@ export default class FormulaColumn {
context.workspace_id,
context.base_id,
MetaTable.COL_FORMULA,
{ fk_column_id: columnId },
columnId,
'fk_column_id',
);
if (column) {
column.parsed_tree = parseMetaProp(column, 'parsed_tree');

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

@ -61,9 +61,8 @@ export default class GalleryView implements GalleryType {
context.workspace_id,
context.base_id,
MetaTable.GALLERY_VIEW,
{
fk_view_id: viewId,
},
viewId,
'fk_view_id',
);
await NocoCache.set(`${CacheScope.GALLERY_VIEW}:${viewId}`, view);
}

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

@ -41,9 +41,8 @@ export default class GridView implements GridType {
context.workspace_id,
context.base_id,
MetaTable.GRID_VIEW,
{
fk_view_id: viewId,
},
viewId,
'fk_view_id',
);
await NocoCache.set(`${CacheScope.GRID_VIEW}:${viewId}`, view);
}

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

@ -385,9 +385,7 @@ export default class Filter {
context.workspace_id,
context.base_id,
MetaTable.FILTER_EXP,
{
id,
},
id,
);
await NocoCache.set(`${CacheScope.FILTER_EXP}:${id}`, filterObj);
}

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

@ -52,9 +52,8 @@ export default class KanbanView implements KanbanType {
context.workspace_id,
context.base_id,
MetaTable.KANBAN_VIEW,
{
fk_view_id: viewId,
},
viewId,
'fk_view_id',
);
view = prepareForResponse(view);

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

@ -176,7 +176,8 @@ export default class LinkToAnotherRecordColumn {
context.workspace_id,
context.base_id,
MetaTable.COL_RELATIONS,
{ fk_column_id: columnId },
columnId,
'fk_column_id',
);
await NocoCache.set(`${CacheScope.COL_RELATION}:${columnId}`, colData);
}

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

@ -80,7 +80,8 @@ export default class LookupColumn implements LookupType {
context.workspace_id,
context.base_id,
MetaTable.COL_LOOKUP,
{ fk_column_id: columnId },
columnId,
'fk_column_id',
);
await NocoCache.set(`${CacheScope.COL_LOOKUP}:${columnId}`, colData);
}

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

@ -46,9 +46,8 @@ export default class MapView implements MapType {
context.workspace_id,
context.base_id,
MetaTable.MAP_VIEW,
{
fk_view_id: viewId,
},
viewId,
'fk_view_id',
);
await NocoCache.set(`${CacheScope.MAP_VIEW}:${viewId}`, view);
}

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

@ -384,7 +384,7 @@ export default class Model implements TableType {
CacheGetType.TYPE_OBJECT,
));
if (!modelData) {
modelData = await ncMeta.metaGet(
modelData = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -424,9 +424,8 @@ export default class Model implements TableType {
context.workspace_id,
context.base_id,
MetaTable.MODELS,
id || {
table_name,
},
id || table_name,
id ? 'id' : 'table_name',
);
if (modelData) {
modelData.meta = parseMetaProp(modelData);
@ -976,7 +975,7 @@ export default class Model implements TableType {
(await NocoCache.get(cacheKey, CacheGetType.TYPE_STRING));
if (!modelId) {
const model = source_id
? await ncMeta.metaGet(
? await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -997,11 +996,11 @@ export default class Model implements TableType {
],
},
)
: await ncMeta.metaGet(
: await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
{ base_id },
null,
null,
{
_or: [
@ -1032,7 +1031,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.metaGet(
return !(await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.MODELS,
@ -1049,7 +1048,7 @@ export default class Model implements TableType {
{ title, exclude_id }: { title; base_id; source_id; exclude_id? },
ncMeta = Noco.ncMeta,
) {
return !(await ncMeta.metaGet(
return !(await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.MODELS,

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

@ -64,16 +64,10 @@ export default class ModelRoleVisibility implements ModelRoleVisibilityType {
CacheGetType.TYPE_OBJECT,
));
if (!data) {
data = await ncMeta.metaGet(
data = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.MODEL_ROLE_VISIBILITY,
// args.fk_model_id
// ? {
// fk_model_id: args.fk_model_id,
// role: args.role
// }
// :
{
fk_view_id: args.fk_view_id,
role: args.role,

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.metaGet(
return await ncMeta.metaFirst(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.NOTIFICATION,

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

@ -113,9 +113,8 @@ export default class Plugin implements PluginType {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
{
title,
},
title,
'title',
);
await NocoCache.set(`${CacheScope.PLUGIN}:${title}`, plugin);
}

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

@ -63,7 +63,8 @@ export default class QrCodeColumn {
context.workspace_id,
context.base_id,
MetaTable.COL_QRCODE,
{ fk_column_id: columnId },
columnId,
'fk_column_id',
);
await NocoCache.set(`${CacheScope.COL_QRCODE}:${columnId}`, column);
}

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

@ -96,7 +96,8 @@ export default class RollupColumn implements RollupType {
context.workspace_id,
context.base_id,
MetaTable.COL_ROLLUP,
{ fk_column_id: columnId },
columnId,
'fk_column_id',
);
await NocoCache.set(`${CacheScope.COL_ROLLUP}:${columnId}`, column);
}

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

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

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.metaGet(
baseData = await ncMeta.metaFirst(
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.metaGet(
const source = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.BASES,

5
packages/nocodb/src/models/Store.ts

@ -44,9 +44,8 @@ export default class Store {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.STORE,
{
key,
},
key,
'key',
);
if (lookInCache)

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

@ -149,9 +149,8 @@ export default class User implements UserType {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
{
email,
},
email,
'email',
);
await NocoCache.set(`${CacheScope.USER}:${email}`, user);
}
@ -159,11 +158,14 @@ export default class User implements UserType {
}
static async isFirst(ncMeta = Noco.ncMeta) {
return !(await ncMeta.metaGet(
return !(await ncMeta.metaFirst(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
{},
null,
null,
null,
true,
));
}

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

@ -118,9 +118,8 @@ export default class UserRefreshToken {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USER_REFRESH_TOKENS,
{
token,
},
token,
'token',
);
if (!userToken) return null;

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

@ -138,7 +138,7 @@ export default class View implements ViewType {
CacheGetType.TYPE_STRING,
));
if (!viewId) {
const view = await ncMeta.metaGet(
const view = await ncMeta.metaFirst(
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.metaGet(
view = await ncMeta.metaFirst(
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.metaGet(
const viewColumn = await ncMeta.metaFirst(
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.metaGet(
const primary_value_column_meta = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,
@ -951,7 +951,7 @@ export default class View implements ViewType {
},
);
const primary_value_column = await ncMeta.metaGet(
const primary_value_column = await ncMeta.metaFirst(
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.metaGet(
const existingCol = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
table,
@ -1135,9 +1135,8 @@ export default class View implements ViewType {
context.workspace_id,
context.base_id,
MetaTable.VIEWS,
{
uuid,
},
uuid,
'uuid',
);
if (view) {
@ -1487,7 +1486,7 @@ export default class View implements ViewType {
const scope = this.extractViewColumnsTableNameScope(view);
if (view.type === ViewTypes.GRID) {
const primary_value_column = await ncMeta.metaGet(
const primary_value_column = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
MetaTable.COLUMNS,

5
packages/nocodb/src/providers/init-meta-service.provider.ts

@ -47,9 +47,8 @@ export const InitMetaServiceProvider: FactoryProvider = {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.STORE,
{
key: 'NC_CONFIG_MAIN',
},
'NC_CONFIG_MAIN',
'key',
)
: null;

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.metaGet(
const pluginData = await Noco.ncMeta.metaFirst(
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.metaGet(
const pluginData = await Noco.ncMeta.metaFirst(
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,

20
packages/nocodb/src/services/users/users.service.ts

@ -53,9 +53,8 @@ export class UsersService {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
{
email,
},
email,
'email',
);
return user;
@ -277,9 +276,8 @@ export class UsersService {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
{
reset_password_token: token,
},
token,
'reset_password_token',
);
if (!user || !user.email) {
@ -308,9 +306,8 @@ export class UsersService {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
{
reset_password_token: token,
},
token,
'reset_password_token',
);
if (!user) {
@ -361,9 +358,8 @@ export class UsersService {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.USERS,
{
email_verification_token: token,
},
token,
'email_verification_token',
);
if (!user) {

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.metaGet(
const existingCol = await ncMeta.metaFirst(
context.workspace_id,
context.base_id,
table,

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

@ -17,9 +17,8 @@ export const populatePluginsForCloud = async ({ ncMeta = Noco.ncMeta }) => {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
{
title: S3PluginConfig.title,
},
S3PluginConfig.title,
'title',
);
if (!s3PluginData) throw new Error('S3 plugin not found');
@ -66,9 +65,8 @@ export const populatePluginsForCloud = async ({ ncMeta = Noco.ncMeta }) => {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.PLUGIN,
{
title: SESPluginConfig.title,
},
SESPluginConfig.title,
'title',
);
if (!sesPluginData) throw new Error('SES plugin not found');

5
packages/nocodb/src/version-upgrader/NcUpgrader.ts

@ -44,9 +44,8 @@ export default class NcUpgrader {
RootScopes.ROOT,
RootScopes.ROOT,
MetaTable.STORE,
{
key: this.STORE_KEY,
},
this.STORE_KEY,
'key',
);
const NC_VERSIONS: any[] = this.getUpgraderList();

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

@ -65,9 +65,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
{
id: source.base_id,
},
source.base_id,
);
// skip if the base is missing

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

@ -56,9 +56,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
context.workspace_id,
context.base_id,
MetaTable.PROJECT,
{
id: source.base_id,
},
source.base_id,
);
// skip if the base is missing

4
packages/nocodb/src/version-upgrader/ncStickyColumnUpgrader.ts

@ -47,9 +47,7 @@ export default async function ({ ncMeta }: NcUpgraderCtx) {
workspace_id,
base_id,
MetaTable.COLUMNS,
{
id: col.fk_column_id,
},
col.fk_column_id,
);
view_columns_meta.push(col_meta);
}

Loading…
Cancel
Save