Fixing viewname enumeration.
This commit is contained in:
parent
b920f8cb05
commit
86ab50fe33
|
@ -1,5 +1,5 @@
|
||||||
const {
|
const {
|
||||||
ViewNames,
|
ViewName,
|
||||||
generateMemoryViewID,
|
generateMemoryViewID,
|
||||||
getMemoryViewParams,
|
getMemoryViewParams,
|
||||||
DocumentType,
|
DocumentType,
|
||||||
|
@ -32,7 +32,7 @@ exports.getViews = async () => {
|
||||||
const designDoc = await db.get("_design/database")
|
const designDoc = await db.get("_design/database")
|
||||||
for (let name of Object.keys(designDoc.views)) {
|
for (let name of Object.keys(designDoc.views)) {
|
||||||
// Only return custom views, not built ins
|
// Only return custom views, not built ins
|
||||||
if (Object.values(ViewNames).indexOf(name) !== -1) {
|
if (Object.values(ViewName).indexOf(name) !== -1) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
response.push({
|
response.push({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const Sentry = require("@sentry/node")
|
const Sentry = require("@sentry/node")
|
||||||
const { ViewNames, getQueryIndex } = require("../utils")
|
const { ViewName, getQueryIndex } = require("../utils")
|
||||||
const { FieldTypes } = require("../../constants")
|
const { FieldTypes } = require("../../constants")
|
||||||
const { createLinkView } = require("../views/staticViews")
|
const { createLinkView } = require("../views/staticViews")
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB } = require("@budibase/backend-core/context")
|
||||||
|
@ -41,7 +41,7 @@ exports.getLinkDocuments = async function (args) {
|
||||||
}
|
}
|
||||||
params.include_docs = !!includeDocs
|
params.include_docs = !!includeDocs
|
||||||
try {
|
try {
|
||||||
let linkRows = (await db.query(getQueryIndex(ViewNames.LINK), params)).rows
|
let linkRows = (await db.query(getQueryIndex(ViewName.LINK), params)).rows
|
||||||
// filter to get unique entries
|
// filter to get unique entries
|
||||||
const foundIds = []
|
const foundIds = []
|
||||||
linkRows = linkRows.filter(link => {
|
linkRows = linkRows.filter(link => {
|
||||||
|
|
|
@ -12,7 +12,7 @@ const {
|
||||||
getDevelopmentAppID,
|
getDevelopmentAppID,
|
||||||
generateAppID,
|
generateAppID,
|
||||||
getQueryIndex,
|
getQueryIndex,
|
||||||
ViewNames,
|
ViewName,
|
||||||
} = require("@budibase/backend-core/db")
|
} = require("@budibase/backend-core/db")
|
||||||
|
|
||||||
const UNICODE_MAX = "\ufff0"
|
const UNICODE_MAX = "\ufff0"
|
||||||
|
@ -69,7 +69,7 @@ exports.isProdAppID = isProdAppID
|
||||||
exports.USER_METDATA_PREFIX = `${DocumentType.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
|
exports.USER_METDATA_PREFIX = `${DocumentType.ROW}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
|
||||||
exports.LINK_USER_METADATA_PREFIX = `${DocumentType.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
|
exports.LINK_USER_METADATA_PREFIX = `${DocumentType.LINK}${SEPARATOR}${InternalTables.USER_METADATA}${SEPARATOR}`
|
||||||
exports.TABLE_ROW_PREFIX = `${DocumentType.ROW}${SEPARATOR}${DocumentType.TABLE}`
|
exports.TABLE_ROW_PREFIX = `${DocumentType.ROW}${SEPARATOR}${DocumentType.TABLE}`
|
||||||
exports.ViewNames = ViewNames
|
exports.ViewName = ViewName
|
||||||
exports.InternalTables = InternalTables
|
exports.InternalTables = InternalTables
|
||||||
exports.DocumentType = DocumentType
|
exports.DocumentType = DocumentType
|
||||||
exports.SEPARATOR = SEPARATOR
|
exports.SEPARATOR = SEPARATOR
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB } = require("@budibase/backend-core/context")
|
||||||
const {
|
const { DocumentType, SEPARATOR, ViewName, SearchIndexes } = require("../utils")
|
||||||
DocumentType,
|
|
||||||
SEPARATOR,
|
|
||||||
ViewNames,
|
|
||||||
SearchIndexes,
|
|
||||||
} = require("../utils")
|
|
||||||
const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR
|
const SCREEN_PREFIX = DocumentType.SCREEN + SEPARATOR
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
|
@ -53,7 +48,7 @@ exports.createLinkView = async () => {
|
||||||
}
|
}
|
||||||
designDoc.views = {
|
designDoc.views = {
|
||||||
...designDoc.views,
|
...designDoc.views,
|
||||||
[ViewNames.LINK]: view,
|
[ViewName.LINK]: view,
|
||||||
}
|
}
|
||||||
await db.put(designDoc)
|
await db.put(designDoc)
|
||||||
}
|
}
|
||||||
|
@ -74,7 +69,7 @@ exports.createRoutingView = async () => {
|
||||||
}
|
}
|
||||||
designDoc.views = {
|
designDoc.views = {
|
||||||
...designDoc.views,
|
...designDoc.views,
|
||||||
[ViewNames.ROUTING]: view,
|
[ViewName.ROUTING]: view,
|
||||||
}
|
}
|
||||||
await db.put(designDoc)
|
await db.put(designDoc)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
const { createRoutingView } = require("../../db/views/staticViews")
|
const { createRoutingView } = require("../../db/views/staticViews")
|
||||||
const { ViewNames, getQueryIndex, UNICODE_MAX } = require("../../db/utils")
|
const { ViewName, getQueryIndex, UNICODE_MAX } = require("../../db/utils")
|
||||||
const { getAppDB } = require("@budibase/backend-core/context")
|
const { getAppDB } = require("@budibase/backend-core/context")
|
||||||
|
|
||||||
exports.getRoutingInfo = async () => {
|
exports.getRoutingInfo = async () => {
|
||||||
const db = getAppDB()
|
const db = getAppDB()
|
||||||
try {
|
try {
|
||||||
const allRouting = await db.query(getQueryIndex(ViewNames.ROUTING), {
|
const allRouting = await db.query(getQueryIndex(ViewName.ROUTING), {
|
||||||
startKey: "",
|
startKey: "",
|
||||||
endKey: UNICODE_MAX,
|
endKey: UNICODE_MAX,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue