@exulu/backend 4.2.0 → 4.2.1
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.cjs +22 -5
- package/dist/index.js +21 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10800,6 +10800,10 @@ async function resolveEmbedder(input) {
|
|
|
10800
10800
|
};
|
|
10801
10801
|
}
|
|
10802
10802
|
|
|
10803
|
+
// types/rbac-rights-modes.ts
|
|
10804
|
+
init_cjs_shims();
|
|
10805
|
+
var VALID_RIGHTS_MODES = ["private", "users", "roles", "teams", "public"];
|
|
10806
|
+
|
|
10803
10807
|
// src/exulu/context.ts
|
|
10804
10808
|
init_statistics2();
|
|
10805
10809
|
init_statistics();
|
|
@@ -14066,6 +14070,13 @@ var bullmqDecorator = async ({
|
|
|
14066
14070
|
};
|
|
14067
14071
|
|
|
14068
14072
|
// src/exulu/context.ts
|
|
14073
|
+
function sanitizeItemRightsMode(rightsMode, defaultMode) {
|
|
14074
|
+
if (rightsMode == null) return rightsMode;
|
|
14075
|
+
if (VALID_RIGHTS_MODES.includes(rightsMode)) {
|
|
14076
|
+
return rightsMode;
|
|
14077
|
+
}
|
|
14078
|
+
return defaultMode ?? "private";
|
|
14079
|
+
}
|
|
14069
14080
|
var ExuluContext2 = class {
|
|
14070
14081
|
// Must begin with a letter (a-z) or underscore (_). Subsequent characters in a name can be letters, digits (0-9), or
|
|
14071
14082
|
// underscores and be a max length of 80 characters and at least 5 characters long.
|
|
@@ -14373,6 +14384,12 @@ var ExuluContext2 = class {
|
|
|
14373
14384
|
if (upsert2 && !item.id && !item.external_id) {
|
|
14374
14385
|
throw new Error("Item id or external id is required for upsert.");
|
|
14375
14386
|
}
|
|
14387
|
+
if (item.rights_mode != null && !VALID_RIGHTS_MODES.includes(item.rights_mode)) {
|
|
14388
|
+
console.warn(
|
|
14389
|
+
`[EXULU] createItem: invalid rights_mode "${item.rights_mode}" for context "${this.id}" (item ${item.id ?? item.external_id ?? "(new)"}) \u2014 falling back to the configured default.`
|
|
14390
|
+
);
|
|
14391
|
+
}
|
|
14392
|
+
item.rights_mode = sanitizeItemRightsMode(item.rights_mode, this.configuration.defaultRightsMode);
|
|
14376
14393
|
const { db: db2 } = await postgresClient();
|
|
14377
14394
|
Object.keys(item).forEach((key) => {
|
|
14378
14395
|
if (this.fields.find((field) => field.name === key)?.type === "json") {
|
|
@@ -16369,7 +16386,7 @@ var shouldGenerateEmbeddings = ({
|
|
|
16369
16386
|
};
|
|
16370
16387
|
|
|
16371
16388
|
// src/graphql/mutations/index.ts
|
|
16372
|
-
var
|
|
16389
|
+
var VALID_RIGHTS_MODES2 = ["private", "users", "roles", "teams", "public"];
|
|
16373
16390
|
var postprocessDeletion = async ({
|
|
16374
16391
|
table,
|
|
16375
16392
|
requestedFields,
|
|
@@ -16694,9 +16711,9 @@ function createMutations(table, contexts, tools, config) {
|
|
|
16694
16711
|
input.id = db2.fn.uuid();
|
|
16695
16712
|
}
|
|
16696
16713
|
}
|
|
16697
|
-
if (table.RBAC && input.rights_mode != null && !
|
|
16714
|
+
if (table.RBAC && input.rights_mode != null && !VALID_RIGHTS_MODES2.includes(input.rights_mode)) {
|
|
16698
16715
|
throw new Error(
|
|
16699
|
-
`Invalid rights_mode "${input.rights_mode}" \u2014 expected one of: ${
|
|
16716
|
+
`Invalid rights_mode "${input.rights_mode}" \u2014 expected one of: ${VALID_RIGHTS_MODES2.join(", ")}`
|
|
16700
16717
|
);
|
|
16701
16718
|
}
|
|
16702
16719
|
const columns = await db2(tableNamePlural).columnInfo();
|
|
@@ -17276,9 +17293,9 @@ function createMutations(table, contexts, tools, config) {
|
|
|
17276
17293
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
17277
17294
|
throw new Error("ids is required and must be a non-empty array.");
|
|
17278
17295
|
}
|
|
17279
|
-
if (!
|
|
17296
|
+
if (!VALID_RIGHTS_MODES2.includes(rights_mode)) {
|
|
17280
17297
|
throw new Error(
|
|
17281
|
-
`Invalid rights_mode "${rights_mode}" \u2014 expected one of: ${
|
|
17298
|
+
`Invalid rights_mode "${rights_mode}" \u2014 expected one of: ${VALID_RIGHTS_MODES2.join(", ")}`
|
|
17282
17299
|
);
|
|
17283
17300
|
}
|
|
17284
17301
|
for (const id of ids) {
|
package/dist/index.js
CHANGED
|
@@ -1299,6 +1299,9 @@ async function resolveEmbedder(input) {
|
|
|
1299
1299
|
};
|
|
1300
1300
|
}
|
|
1301
1301
|
|
|
1302
|
+
// types/rbac-rights-modes.ts
|
|
1303
|
+
var VALID_RIGHTS_MODES = ["private", "users", "roles", "teams", "public"];
|
|
1304
|
+
|
|
1302
1305
|
// src/utils/query-preprocessing.ts
|
|
1303
1306
|
import { franc } from "franc";
|
|
1304
1307
|
import natural from "natural";
|
|
@@ -4505,6 +4508,13 @@ var bullmqDecorator = async ({
|
|
|
4505
4508
|
};
|
|
4506
4509
|
|
|
4507
4510
|
// src/exulu/context.ts
|
|
4511
|
+
function sanitizeItemRightsMode(rightsMode, defaultMode) {
|
|
4512
|
+
if (rightsMode == null) return rightsMode;
|
|
4513
|
+
if (VALID_RIGHTS_MODES.includes(rightsMode)) {
|
|
4514
|
+
return rightsMode;
|
|
4515
|
+
}
|
|
4516
|
+
return defaultMode ?? "private";
|
|
4517
|
+
}
|
|
4508
4518
|
var ExuluContext2 = class {
|
|
4509
4519
|
// Must begin with a letter (a-z) or underscore (_). Subsequent characters in a name can be letters, digits (0-9), or
|
|
4510
4520
|
// underscores and be a max length of 80 characters and at least 5 characters long.
|
|
@@ -4812,6 +4822,12 @@ var ExuluContext2 = class {
|
|
|
4812
4822
|
if (upsert && !item.id && !item.external_id) {
|
|
4813
4823
|
throw new Error("Item id or external id is required for upsert.");
|
|
4814
4824
|
}
|
|
4825
|
+
if (item.rights_mode != null && !VALID_RIGHTS_MODES.includes(item.rights_mode)) {
|
|
4826
|
+
console.warn(
|
|
4827
|
+
`[EXULU] createItem: invalid rights_mode "${item.rights_mode}" for context "${this.id}" (item ${item.id ?? item.external_id ?? "(new)"}) \u2014 falling back to the configured default.`
|
|
4828
|
+
);
|
|
4829
|
+
}
|
|
4830
|
+
item.rights_mode = sanitizeItemRightsMode(item.rights_mode, this.configuration.defaultRightsMode);
|
|
4815
4831
|
const { db } = await postgresClient();
|
|
4816
4832
|
Object.keys(item).forEach((key) => {
|
|
4817
4833
|
if (this.fields.find((field) => field.name === key)?.type === "json") {
|
|
@@ -6756,7 +6772,7 @@ var shouldGenerateEmbeddings = ({
|
|
|
6756
6772
|
};
|
|
6757
6773
|
|
|
6758
6774
|
// src/graphql/mutations/index.ts
|
|
6759
|
-
var
|
|
6775
|
+
var VALID_RIGHTS_MODES2 = ["private", "users", "roles", "teams", "public"];
|
|
6760
6776
|
var postprocessDeletion = async ({
|
|
6761
6777
|
table,
|
|
6762
6778
|
requestedFields,
|
|
@@ -7081,9 +7097,9 @@ function createMutations(table, contexts, tools, config) {
|
|
|
7081
7097
|
input.id = db.fn.uuid();
|
|
7082
7098
|
}
|
|
7083
7099
|
}
|
|
7084
|
-
if (table.RBAC && input.rights_mode != null && !
|
|
7100
|
+
if (table.RBAC && input.rights_mode != null && !VALID_RIGHTS_MODES2.includes(input.rights_mode)) {
|
|
7085
7101
|
throw new Error(
|
|
7086
|
-
`Invalid rights_mode "${input.rights_mode}" \u2014 expected one of: ${
|
|
7102
|
+
`Invalid rights_mode "${input.rights_mode}" \u2014 expected one of: ${VALID_RIGHTS_MODES2.join(", ")}`
|
|
7087
7103
|
);
|
|
7088
7104
|
}
|
|
7089
7105
|
const columns = await db(tableNamePlural).columnInfo();
|
|
@@ -7663,9 +7679,9 @@ function createMutations(table, contexts, tools, config) {
|
|
|
7663
7679
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
7664
7680
|
throw new Error("ids is required and must be a non-empty array.");
|
|
7665
7681
|
}
|
|
7666
|
-
if (!
|
|
7682
|
+
if (!VALID_RIGHTS_MODES2.includes(rights_mode)) {
|
|
7667
7683
|
throw new Error(
|
|
7668
|
-
`Invalid rights_mode "${rights_mode}" \u2014 expected one of: ${
|
|
7684
|
+
`Invalid rights_mode "${rights_mode}" \u2014 expected one of: ${VALID_RIGHTS_MODES2.join(", ")}`
|
|
7669
7685
|
);
|
|
7670
7686
|
}
|
|
7671
7687
|
for (const id of ids) {
|