@budibase/backend-core 2.22.17 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +51 -15
- package/dist/index.js.map +2 -2
- package/dist/index.js.meta.json +1 -1
- package/dist/package.json +4 -4
- package/dist/plugins.js.map +1 -1
- package/dist/plugins.js.meta.json +1 -1
- package/dist/src/constants/db.d.ts +1 -0
- package/dist/src/constants/db.js +2 -1
- package/dist/src/constants/db.js.map +1 -1
- package/dist/src/db/couch/DatabaseImpl.d.ts +1 -0
- package/dist/src/db/couch/DatabaseImpl.js +17 -0
- package/dist/src/db/couch/DatabaseImpl.js.map +1 -1
- package/dist/src/db/couch/connections.d.ts +1 -0
- package/dist/src/db/couch/connections.js +1 -0
- package/dist/src/db/couch/connections.js.map +1 -1
- package/dist/src/db/couch/utils.js +8 -2
- package/dist/src/db/couch/utils.js.map +1 -1
- package/dist/src/db/instrumentation.d.ts +1 -0
- package/dist/src/db/instrumentation.js +6 -0
- package/dist/src/db/instrumentation.js.map +1 -1
- package/dist/src/db/lucene.d.ts +12 -71
- package/dist/src/db/lucene.js +10 -48
- package/dist/src/db/lucene.js.map +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/tests/core/utilities/testContainerUtils.js +5 -0
- package/dist/tests/core/utilities/testContainerUtils.js.map +1 -1
- package/package.json +4 -4
- package/src/constants/db.ts +1 -0
- package/src/db/couch/DatabaseImpl.ts +16 -0
- package/src/db/couch/connections.ts +1 -0
- package/src/db/couch/utils.ts +7 -2
- package/src/db/instrumentation.ts +7 -0
- package/src/db/lucene.ts +43 -78
- package/src/db/tests/lucene.spec.ts +47 -15
- package/src/index.ts +0 -1
- package/tests/core/utilities/testContainerUtils.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -54138,6 +54138,7 @@ __export(src_exports, {
|
|
|
54138
54138
|
NotFoundError: () => NotFoundError,
|
|
54139
54139
|
RedisClient: () => redis_default,
|
|
54140
54140
|
SEPARATOR: () => SEPARATOR,
|
|
54141
|
+
SQLITE_DESIGN_DOC_ID: () => SQLITE_DESIGN_DOC_ID,
|
|
54141
54142
|
StaticDatabases: () => StaticDatabases,
|
|
54142
54143
|
UNICODE_MAX: () => UNICODE_MAX,
|
|
54143
54144
|
UsageLimitError: () => UsageLimitError,
|
|
@@ -54632,6 +54633,7 @@ __export(constants_exports2, {
|
|
|
54632
54633
|
MAX_VALID_DATE: () => MAX_VALID_DATE,
|
|
54633
54634
|
MIN_VALID_DATE: () => MIN_VALID_DATE,
|
|
54634
54635
|
SEPARATOR: () => SEPARATOR,
|
|
54636
|
+
SQLITE_DESIGN_DOC_ID: () => SQLITE_DESIGN_DOC_ID,
|
|
54635
54637
|
StaticDatabases: () => StaticDatabases,
|
|
54636
54638
|
UNICODE_MAX: () => UNICODE_MAX,
|
|
54637
54639
|
UserStatus: () => UserStatus,
|
|
@@ -54693,6 +54695,7 @@ var APP_PREFIX = prefixed("app" /* APP */);
|
|
|
54693
54695
|
var APP_DEV = prefixed("app_dev" /* APP_DEV */);
|
|
54694
54696
|
var APP_DEV_PREFIX = APP_DEV;
|
|
54695
54697
|
var BUDIBASE_DATASOURCE_TYPE = "budibase";
|
|
54698
|
+
var SQLITE_DESIGN_DOC_ID = "_design/sqlite";
|
|
54696
54699
|
|
|
54697
54700
|
// ../shared-core/src/constants/api.ts
|
|
54698
54701
|
var Header = /* @__PURE__ */ ((Header2) => {
|
|
@@ -55000,7 +55003,8 @@ var allowDisplayColumnByType = {
|
|
|
55000
55003
|
["bigint" /* BIGINT */]: true,
|
|
55001
55004
|
["boolean" /* BOOLEAN */]: false,
|
|
55002
55005
|
["array" /* ARRAY */]: false,
|
|
55003
|
-
["attachment" /*
|
|
55006
|
+
["attachment" /* ATTACHMENTS */]: false,
|
|
55007
|
+
["attachment_single" /* ATTACHMENT_SINGLE */]: false,
|
|
55004
55008
|
["link" /* LINK */]: false,
|
|
55005
55009
|
["json" /* JSON */]: false,
|
|
55006
55010
|
["bb_reference" /* BB_REFERENCE */]: false
|
|
@@ -55018,7 +55022,8 @@ var allowSortColumnByType = {
|
|
|
55018
55022
|
["boolean" /* BOOLEAN */]: true,
|
|
55019
55023
|
["json" /* JSON */]: true,
|
|
55020
55024
|
["formula" /* FORMULA */]: false,
|
|
55021
|
-
["attachment" /*
|
|
55025
|
+
["attachment" /* ATTACHMENTS */]: false,
|
|
55026
|
+
["attachment_single" /* ATTACHMENT_SINGLE */]: false,
|
|
55022
55027
|
["array" /* ARRAY */]: false,
|
|
55023
55028
|
["link" /* LINK */]: false,
|
|
55024
55029
|
["bb_reference" /* BB_REFERENCE */]: false
|
|
@@ -55419,6 +55424,7 @@ var getCouchInfo = (connection) => {
|
|
|
55419
55424
|
const authCookie = Buffer.from(`${username}:${password}`).toString("base64");
|
|
55420
55425
|
return {
|
|
55421
55426
|
url: urlInfo.url,
|
|
55427
|
+
sqlUrl: environment_default.COUCH_DB_SQL_URL,
|
|
55422
55428
|
auth: {
|
|
55423
55429
|
username,
|
|
55424
55430
|
password
|
|
@@ -55491,8 +55497,13 @@ async function directCouchUrlCall({
|
|
|
55491
55497
|
}
|
|
55492
55498
|
};
|
|
55493
55499
|
if (body2 && method !== "GET") {
|
|
55494
|
-
|
|
55495
|
-
|
|
55500
|
+
if (typeof body2 === "string") {
|
|
55501
|
+
params2.body = body2;
|
|
55502
|
+
params2.headers["Content-Type"] = "text/plain";
|
|
55503
|
+
} else {
|
|
55504
|
+
params2.body = JSON.stringify(body2);
|
|
55505
|
+
params2.headers["Content-Type"] = "application/json";
|
|
55506
|
+
}
|
|
55496
55507
|
}
|
|
55497
55508
|
return await (0, import_node_fetch.default)(checkSlashesInUrl(encodeURI(url)), params2);
|
|
55498
55509
|
}
|
|
@@ -55691,6 +55702,12 @@ var DDInstrumentedDatabase = class {
|
|
|
55691
55702
|
return this.db.getIndexes(...args);
|
|
55692
55703
|
});
|
|
55693
55704
|
}
|
|
55705
|
+
sql(sql) {
|
|
55706
|
+
return import_dd_trace.default.trace("db.sql", (span) => {
|
|
55707
|
+
span?.addTags({ db_name: this.name });
|
|
55708
|
+
return this.db.sql(sql);
|
|
55709
|
+
});
|
|
55710
|
+
}
|
|
55694
55711
|
};
|
|
55695
55712
|
|
|
55696
55713
|
// src/db/couch/DatabaseImpl.ts
|
|
@@ -55874,6 +55891,20 @@ var DatabaseImpl = class _DatabaseImpl {
|
|
|
55874
55891
|
return () => db.list(params2);
|
|
55875
55892
|
});
|
|
55876
55893
|
}
|
|
55894
|
+
async sql(sql) {
|
|
55895
|
+
const dbName = this.name;
|
|
55896
|
+
const url = `/${dbName}/${SQLITE_DESIGN_DOC_ID}`;
|
|
55897
|
+
const response = await directCouchUrlCall({
|
|
55898
|
+
url: `${this.couchInfo.sqlUrl}/${url}`,
|
|
55899
|
+
method: "POST",
|
|
55900
|
+
cookie: this.couchInfo.cookie,
|
|
55901
|
+
body: sql
|
|
55902
|
+
});
|
|
55903
|
+
if (response.status > 300) {
|
|
55904
|
+
throw new Error(await response.text());
|
|
55905
|
+
}
|
|
55906
|
+
return await response.json();
|
|
55907
|
+
}
|
|
55877
55908
|
async query(viewName, params2) {
|
|
55878
55909
|
return this.performCall((db) => {
|
|
55879
55910
|
const [database, view] = viewName.split("/");
|
|
@@ -56492,6 +56523,7 @@ __export(db_exports, {
|
|
|
56492
56523
|
QueryBuilder: () => QueryBuilder,
|
|
56493
56524
|
Replication: () => Replication_default,
|
|
56494
56525
|
SEPARATOR: () => SEPARATOR,
|
|
56526
|
+
SQLITE_DESIGN_DOC_ID: () => SQLITE_DESIGN_DOC_ID,
|
|
56495
56527
|
StaticDatabases: () => StaticDatabases,
|
|
56496
56528
|
UNICODE_MAX: () => UNICODE_MAX,
|
|
56497
56529
|
ViewName: () => ViewName,
|
|
@@ -57327,14 +57359,12 @@ var QueryBuilder = class _QueryBuilder {
|
|
|
57327
57359
|
return input.replace(/ /g, "_");
|
|
57328
57360
|
}
|
|
57329
57361
|
}
|
|
57330
|
-
|
|
57331
|
-
|
|
57332
|
-
|
|
57333
|
-
|
|
57334
|
-
|
|
57335
|
-
|
|
57336
|
-
*/
|
|
57337
|
-
preprocess(value, { escape, lowercase, wrap, type } = {}) {
|
|
57362
|
+
preprocess(value, {
|
|
57363
|
+
escape,
|
|
57364
|
+
lowercase,
|
|
57365
|
+
wrap,
|
|
57366
|
+
type
|
|
57367
|
+
} = {}) {
|
|
57338
57368
|
const hasVersion = !!this.#version;
|
|
57339
57369
|
const originalType = typeof value;
|
|
57340
57370
|
if (value && lowercase) {
|
|
@@ -57641,14 +57671,19 @@ async function runQuery(url, body2, cookie) {
|
|
|
57641
57671
|
async function recursiveSearch(dbName, index2, query, params2) {
|
|
57642
57672
|
const bookmark = params2.bookmark;
|
|
57643
57673
|
const rows = params2.rows || [];
|
|
57644
|
-
if (rows.length >= params2.limit) {
|
|
57674
|
+
if (params2.limit && rows.length >= params2.limit) {
|
|
57645
57675
|
return rows;
|
|
57646
57676
|
}
|
|
57647
57677
|
let pageSize = QueryBuilder.maxLimit;
|
|
57648
|
-
if (rows.length > params2.limit - QueryBuilder.maxLimit) {
|
|
57678
|
+
if (params2.limit && rows.length > params2.limit - QueryBuilder.maxLimit) {
|
|
57649
57679
|
pageSize = params2.limit - rows.length;
|
|
57650
57680
|
}
|
|
57651
|
-
const
|
|
57681
|
+
const queryBuilder = new QueryBuilder(dbName, index2, query);
|
|
57682
|
+
queryBuilder.setVersion(params2.version).setBookmark(bookmark).setLimit(pageSize).setSort(params2.sort).setSortOrder(params2.sortOrder).setSortType(params2.sortType);
|
|
57683
|
+
if (params2.tableId) {
|
|
57684
|
+
queryBuilder.setTable(params2.tableId);
|
|
57685
|
+
}
|
|
57686
|
+
const page = await queryBuilder.run();
|
|
57652
57687
|
if (!page.rows.length) {
|
|
57653
57688
|
return rows;
|
|
57654
57689
|
}
|
|
@@ -66092,6 +66127,7 @@ var init9 = (opts = {}) => {
|
|
|
66092
66127
|
NotFoundError,
|
|
66093
66128
|
RedisClient,
|
|
66094
66129
|
SEPARATOR,
|
|
66130
|
+
SQLITE_DESIGN_DOC_ID,
|
|
66095
66131
|
StaticDatabases,
|
|
66096
66132
|
UNICODE_MAX,
|
|
66097
66133
|
UsageLimitError,
|