@budibase/shared-core 2.29.27 → 2.29.29
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/filters.d.ts +7 -1
- package/dist/helpers/schema.d.ts +2 -0
- package/dist/index.js +51 -9
- package/dist/index.js.map +3 -3
- package/dist/index.js.meta.json +1 -1
- package/dist/table.d.ts +1 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils.d.ts +1 -0
- package/package.json +3 -3
package/dist/filters.d.ts
CHANGED
|
@@ -45,10 +45,16 @@ export declare class ColumnSplitter {
|
|
|
45
45
|
tableIds: string[];
|
|
46
46
|
relationshipColumnNames: string[];
|
|
47
47
|
relationships: string[];
|
|
48
|
-
|
|
48
|
+
aliases?: Record<string, string>;
|
|
49
|
+
columnPrefix?: string;
|
|
50
|
+
constructor(tables: Table[], opts?: {
|
|
51
|
+
aliases?: Record<string, string>;
|
|
52
|
+
columnPrefix?: string;
|
|
53
|
+
});
|
|
49
54
|
run(key: string): {
|
|
50
55
|
numberPrefix?: string;
|
|
51
56
|
relationshipPrefix?: string;
|
|
57
|
+
tableName?: string;
|
|
52
58
|
column: string;
|
|
53
59
|
};
|
|
54
60
|
}
|
package/dist/helpers/schema.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export declare function isDeprecatedSingleUserColumn(schema: Pick<FieldSchema, "
|
|
|
4
4
|
subtype: BBReferenceFieldSubType.USER;
|
|
5
5
|
};
|
|
6
6
|
export declare function isRequired(constraints: FieldConstraints | undefined): boolean;
|
|
7
|
+
export declare function encodeNonAscii(str: string): string;
|
|
8
|
+
export declare function decodeNonAscii(str: string): string;
|
package/dist/index.js
CHANGED
|
@@ -10097,7 +10097,7 @@ var AnalyticsEvent = {
|
|
|
10097
10097
|
PluginInit: "plugin:init" /* PLUGIN_INIT */
|
|
10098
10098
|
};
|
|
10099
10099
|
|
|
10100
|
-
// ../types/src/documents/app/automation.ts
|
|
10100
|
+
// ../types/src/documents/app/automation/automation.ts
|
|
10101
10101
|
var AutomationTriggerStepId = /* @__PURE__ */ ((AutomationTriggerStepId2) => {
|
|
10102
10102
|
AutomationTriggerStepId2["ROW_SAVED"] = "ROW_SAVED";
|
|
10103
10103
|
AutomationTriggerStepId2["ROW_UPDATED"] = "ROW_UPDATED";
|
|
@@ -10538,6 +10538,8 @@ function validate(cronExpression) {
|
|
|
10538
10538
|
// src/helpers/schema.ts
|
|
10539
10539
|
var schema_exports = {};
|
|
10540
10540
|
__export(schema_exports, {
|
|
10541
|
+
decodeNonAscii: () => decodeNonAscii,
|
|
10542
|
+
encodeNonAscii: () => encodeNonAscii,
|
|
10541
10543
|
isDeprecatedSingleUserColumn: () => isDeprecatedSingleUserColumn,
|
|
10542
10544
|
isRequired: () => isRequired
|
|
10543
10545
|
});
|
|
@@ -10549,6 +10551,17 @@ function isRequired(constraints) {
|
|
|
10549
10551
|
const isRequired2 = !!constraints && (typeof constraints.presence !== "boolean" && constraints.presence?.allowEmpty === false || constraints.presence === true);
|
|
10550
10552
|
return isRequired2;
|
|
10551
10553
|
}
|
|
10554
|
+
function encodeNonAscii(str) {
|
|
10555
|
+
return str.split("").map((char) => {
|
|
10556
|
+
return char.charCodeAt(0) > 127 ? "\\u" + char.charCodeAt(0).toString(16).padStart(4, "0") : char;
|
|
10557
|
+
}).join("");
|
|
10558
|
+
}
|
|
10559
|
+
function decodeNonAscii(str) {
|
|
10560
|
+
return str.replace(
|
|
10561
|
+
/\\u([0-9a-fA-F]{4})/g,
|
|
10562
|
+
(match, p1) => String.fromCharCode(parseInt(p1, 16))
|
|
10563
|
+
);
|
|
10564
|
+
}
|
|
10552
10565
|
|
|
10553
10566
|
// src/filters.ts
|
|
10554
10567
|
var import_lodash = __toESM(require_lodash());
|
|
@@ -10652,7 +10665,7 @@ var getKeyNumbering = (key) => {
|
|
|
10652
10665
|
}
|
|
10653
10666
|
};
|
|
10654
10667
|
var ColumnSplitter = class {
|
|
10655
|
-
constructor(tables) {
|
|
10668
|
+
constructor(tables, opts) {
|
|
10656
10669
|
this.tableNames = tables.map((table) => table.name);
|
|
10657
10670
|
this.tableIds = tables.map((table) => table._id);
|
|
10658
10671
|
this.relationshipColumnNames = tables.flatMap(
|
|
@@ -10661,11 +10674,28 @@ var ColumnSplitter = class {
|
|
|
10661
10674
|
)
|
|
10662
10675
|
);
|
|
10663
10676
|
this.relationships = this.tableNames.concat(this.tableIds).concat(this.relationshipColumnNames).sort((a, b) => b.length - a.length);
|
|
10677
|
+
if (opts?.aliases) {
|
|
10678
|
+
this.aliases = {};
|
|
10679
|
+
for (const [key, value] of Object.entries(opts.aliases)) {
|
|
10680
|
+
this.aliases[value] = key;
|
|
10681
|
+
}
|
|
10682
|
+
}
|
|
10683
|
+
this.columnPrefix = opts?.columnPrefix;
|
|
10664
10684
|
}
|
|
10665
10685
|
run(key) {
|
|
10666
10686
|
let { prefix, key: splitKey } = getKeyNumbering(key);
|
|
10687
|
+
let tableName = void 0;
|
|
10688
|
+
if (this.aliases) {
|
|
10689
|
+
for (const possibleAlias of Object.keys(this.aliases || {})) {
|
|
10690
|
+
const withDot = `${possibleAlias}.`;
|
|
10691
|
+
if (splitKey.startsWith(withDot)) {
|
|
10692
|
+
tableName = this.aliases[possibleAlias];
|
|
10693
|
+
splitKey = splitKey.slice(withDot.length);
|
|
10694
|
+
}
|
|
10695
|
+
}
|
|
10696
|
+
}
|
|
10667
10697
|
let relationship;
|
|
10668
|
-
for (
|
|
10698
|
+
for (const possibleRelationship of this.relationships) {
|
|
10669
10699
|
const withDot = `${possibleRelationship}.`;
|
|
10670
10700
|
if (splitKey.startsWith(withDot)) {
|
|
10671
10701
|
const finalKeyParts = splitKey.split(withDot);
|
|
@@ -10675,7 +10705,13 @@ var ColumnSplitter = class {
|
|
|
10675
10705
|
break;
|
|
10676
10706
|
}
|
|
10677
10707
|
}
|
|
10708
|
+
if (this.columnPrefix) {
|
|
10709
|
+
if (splitKey.startsWith(this.columnPrefix)) {
|
|
10710
|
+
splitKey = decodeNonAscii(splitKey.slice(this.columnPrefix.length));
|
|
10711
|
+
}
|
|
10712
|
+
}
|
|
10678
10713
|
return {
|
|
10714
|
+
tableName,
|
|
10679
10715
|
numberPrefix: prefix,
|
|
10680
10716
|
relationshipPrefix: relationship,
|
|
10681
10717
|
column: splitKey
|
|
@@ -11064,6 +11100,7 @@ __export(utils_exports, {
|
|
|
11064
11100
|
filterValueToLabel: () => filterValueToLabel,
|
|
11065
11101
|
hasSchema: () => hasSchema,
|
|
11066
11102
|
parallelForeach: () => parallelForeach,
|
|
11103
|
+
trimOtherProps: () => trimOtherProps,
|
|
11067
11104
|
unreachable: () => unreachable
|
|
11068
11105
|
});
|
|
11069
11106
|
function unreachable(value, message = `No such case in exhaustive switch: ${value}`) {
|
|
@@ -11110,6 +11147,13 @@ function filterValueToLabel() {
|
|
|
11110
11147
|
function hasSchema(test) {
|
|
11111
11148
|
return typeof test === "object" && !Array.isArray(test) && test !== null && !(test instanceof Date) && Object.keys(test).length > 0;
|
|
11112
11149
|
}
|
|
11150
|
+
function trimOtherProps(object, allowedProps) {
|
|
11151
|
+
const result = Object.keys(object).filter((key) => allowedProps.includes(key)).reduce(
|
|
11152
|
+
(acc, key) => ({ ...acc, [key]: object[key] }),
|
|
11153
|
+
{}
|
|
11154
|
+
);
|
|
11155
|
+
return result;
|
|
11156
|
+
}
|
|
11113
11157
|
|
|
11114
11158
|
// src/sdk/index.ts
|
|
11115
11159
|
var sdk_exports = {};
|
|
@@ -11324,7 +11368,7 @@ function canBeDisplayColumn(type) {
|
|
|
11324
11368
|
function canBeSortColumn(type) {
|
|
11325
11369
|
return !!allowSortColumnByType[type];
|
|
11326
11370
|
}
|
|
11327
|
-
function findDuplicateInternalColumns(table
|
|
11371
|
+
function findDuplicateInternalColumns(table) {
|
|
11328
11372
|
const casedKeys = Object.keys(table.schema);
|
|
11329
11373
|
const uncasedKeys = casedKeys.map((colName) => colName.toLowerCase());
|
|
11330
11374
|
const set = new Set(uncasedKeys);
|
|
@@ -11337,11 +11381,9 @@ function findDuplicateInternalColumns(table, opts) {
|
|
|
11337
11381
|
}
|
|
11338
11382
|
}
|
|
11339
11383
|
}
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
duplicates.push(internalColumn);
|
|
11344
|
-
}
|
|
11384
|
+
for (let internalColumn of PROTECTED_INTERNAL_COLUMNS) {
|
|
11385
|
+
if (casedKeys.find((key) => key === internalColumn)) {
|
|
11386
|
+
duplicates.push(internalColumn);
|
|
11345
11387
|
}
|
|
11346
11388
|
}
|
|
11347
11389
|
return duplicates;
|