agentlang 0.0.32 → 0.0.34
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/README.md +10 -2
- package/out/api/http.d.ts.map +1 -1
- package/out/api/http.js +13 -6
- package/out/api/http.js.map +1 -1
- package/out/language/generated/ast.d.ts +1 -1
- package/out/language/generated/ast.d.ts.map +1 -1
- package/out/language/generated/grammar.js +1 -1
- package/out/language/main.cjs +1 -1
- package/out/language/main.cjs.map +1 -1
- package/out/language/parser.d.ts.map +1 -1
- package/out/language/parser.js +21 -8
- package/out/language/parser.js.map +1 -1
- package/out/language/syntax.d.ts +8 -1
- package/out/language/syntax.d.ts.map +1 -1
- package/out/language/syntax.js +23 -2
- package/out/language/syntax.js.map +1 -1
- package/out/runtime/defs.d.ts +1 -0
- package/out/runtime/defs.d.ts.map +1 -1
- package/out/runtime/defs.js +1 -0
- package/out/runtime/defs.js.map +1 -1
- package/out/runtime/interpreter.d.ts +2 -1
- package/out/runtime/interpreter.d.ts.map +1 -1
- package/out/runtime/interpreter.js +27 -6
- package/out/runtime/interpreter.js.map +1 -1
- package/out/runtime/module.d.ts +5 -1
- package/out/runtime/module.d.ts.map +1 -1
- package/out/runtime/module.js +15 -2
- package/out/runtime/module.js.map +1 -1
- package/out/runtime/modules/ai.js +1 -1
- package/out/runtime/modules/core.d.ts.map +1 -1
- package/out/runtime/modules/core.js +3 -2
- package/out/runtime/modules/core.js.map +1 -1
- package/out/runtime/resolvers/sqldb/database.d.ts +1 -0
- package/out/runtime/resolvers/sqldb/database.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/database.js +11 -1
- package/out/runtime/resolvers/sqldb/database.js.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.d.ts.map +1 -1
- package/out/runtime/resolvers/sqldb/impl.js +4 -2
- package/out/runtime/resolvers/sqldb/impl.js.map +1 -1
- package/package.json +1 -1
- package/src/api/http.ts +13 -5
- package/src/language/agentlang.langium +1 -1
- package/src/language/generated/ast.ts +1 -1
- package/src/language/generated/grammar.ts +1 -1
- package/src/language/parser.ts +24 -10
- package/src/language/syntax.ts +30 -4
- package/src/runtime/defs.ts +2 -0
- package/src/runtime/interpreter.ts +32 -6
- package/src/runtime/module.ts +18 -3
- package/src/runtime/modules/ai.ts +1 -1
- package/src/runtime/modules/core.ts +3 -2
- package/src/runtime/resolvers/sqldb/database.ts +22 -1
- package/src/runtime/resolvers/sqldb/impl.ts +4 -2
|
@@ -19,7 +19,12 @@ import {
|
|
|
19
19
|
} from '../../module.js';
|
|
20
20
|
import pgvector from 'pgvector';
|
|
21
21
|
import { isString } from '../../util.js';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
DeletedFlagAttributeName,
|
|
24
|
+
ForceReadPermFlag,
|
|
25
|
+
PathAttributeName,
|
|
26
|
+
UnauthorisedError,
|
|
27
|
+
} from '../../defs.js';
|
|
23
28
|
|
|
24
29
|
export let defaultDataSource: DataSource | undefined;
|
|
25
30
|
|
|
@@ -110,6 +115,10 @@ export class DbContext {
|
|
|
110
115
|
isInKernelMode(): boolean {
|
|
111
116
|
return this.inKernelMode;
|
|
112
117
|
}
|
|
118
|
+
|
|
119
|
+
forceReadPermission(): boolean {
|
|
120
|
+
return this.activeEnv.lookup(ForceReadPermFlag);
|
|
121
|
+
}
|
|
113
122
|
}
|
|
114
123
|
|
|
115
124
|
export type JoinOn = {
|
|
@@ -400,6 +409,8 @@ export async function insertRows(
|
|
|
400
409
|
if (!doUpsert) {
|
|
401
410
|
if (!ctx.isInKernelMode()) {
|
|
402
411
|
await createOwnership(tableName, rows, ctx);
|
|
412
|
+
} else if (ctx.forceReadPermission()) {
|
|
413
|
+
await createReadPermission(tableName, rows, ctx);
|
|
403
414
|
}
|
|
404
415
|
if (ctx.rbacRules) {
|
|
405
416
|
for (let i = 0; i < ctx.rbacRules.length; ++i) {
|
|
@@ -479,6 +490,16 @@ async function createOwnership(tableName: string, rows: object[], ctx: DbContext
|
|
|
479
490
|
await createLimitedOwnership(tableName, rows, ctx.authInfo.userId, AllPerms, ctx);
|
|
480
491
|
}
|
|
481
492
|
|
|
493
|
+
const ReadPermOnly = new Set<RbacPermissionFlag>().add(RbacPermissionFlag.READ);
|
|
494
|
+
|
|
495
|
+
async function createReadPermission(
|
|
496
|
+
tableName: string,
|
|
497
|
+
rows: object[],
|
|
498
|
+
ctx: DbContext
|
|
499
|
+
): Promise<void> {
|
|
500
|
+
await createLimitedOwnership(tableName, rows, ctx.authInfo.userId, ReadPermOnly, ctx);
|
|
501
|
+
}
|
|
502
|
+
|
|
482
503
|
async function createLimitedOwnership(
|
|
483
504
|
tableName: string,
|
|
484
505
|
rows: object[],
|
|
@@ -217,15 +217,17 @@ export class SqlDbResolver extends Resolver {
|
|
|
217
217
|
inst.addQuery(col, '=', connectedInstance.lookup(PathAttributeName));
|
|
218
218
|
return await this.queryInstances(inst, false);
|
|
219
219
|
} else {
|
|
220
|
+
const from = relationship.getAliasFor(connectedInstance);
|
|
221
|
+
const to = relationship.getInverseAliasFor(connectedInstance);
|
|
220
222
|
await getAllConnected(
|
|
221
223
|
asTableReference(inst.moduleName, inst.name),
|
|
222
224
|
inst.queryAttributesAsObject(),
|
|
223
225
|
inst.queryAttributeValuesAsObject(),
|
|
224
226
|
{
|
|
225
227
|
connectionTable: asTableReference(inst.moduleName, relationship.name),
|
|
226
|
-
fromColumn:
|
|
228
|
+
fromColumn: from,
|
|
227
229
|
fromValue: `'${connectedInstance.lookup(PathAttributeName)}'`,
|
|
228
|
-
toColumn:
|
|
230
|
+
toColumn: to,
|
|
229
231
|
toRef: PathAttributeName,
|
|
230
232
|
},
|
|
231
233
|
this.getDbContext(inst.getFqName())
|