@balena/pinejs 22.1.4-build-renovate-bcrypt-6-x-6b995cfc00adc4154dc008a20bc666adc18c70f5-1 → 23.0.0-build-23-x-06bf0c67151995a64e8f502ea9dfb1232abb6001-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/.pinejs-cache.json +1 -1
- package/.versionbot/CHANGELOG.yml +534 -7
- package/CHANGELOG.md +110 -2
- package/VERSION +1 -1
- package/out/sbvr-api/abstract-sql.d.ts +1 -1
- package/out/sbvr-api/abstract-sql.js +1 -1
- package/out/sbvr-api/abstract-sql.js.map +1 -1
- package/out/sbvr-api/permissions.js +11 -1
- package/out/sbvr-api/permissions.js.map +1 -1
- package/out/sbvr-api/sbvr-utils.d.ts +1 -1
- package/out/sbvr-api/sbvr-utils.js +2 -2
- package/out/sbvr-api/sbvr-utils.js.map +1 -1
- package/out/sbvr-api/uri-parser.d.ts +1 -1
- package/package.json +7 -7
- package/src/migrator/migrations.ts +1 -1
- package/src/sbvr-api/abstract-sql.ts +1 -1
- package/src/sbvr-api/dev.ts +1 -1
- package/src/sbvr-api/permissions.ts +26 -4
- package/src/sbvr-api/sbvr-utils.ts +2 -2
- package/src/sbvr-api/uri-parser.ts +1 -1
- package/src/sbvr-api/user.ts +1 -1
- package/src/tasks/tasks.ts +1 -1
- package/src/webresource-handler/webresource.ts +1 -1
@@ -1,4 +1,5 @@
|
|
1
1
|
import type AuthModel from './user.js';
|
2
|
+
import { abstractSqlContainsNode } from '@balena/abstract-sql-compiler';
|
2
3
|
import type {
|
3
4
|
AbstractSqlModel,
|
4
5
|
AbstractSqlQuery,
|
@@ -1102,12 +1103,33 @@ const getBoundConstrainedMemoizer = memoizeWeak(
|
|
1102
1103
|
// * When the resolution reaches the last model in the chain (`<resource>$vDB$permissions"<permJson>"`) and tries to resolve it,
|
1103
1104
|
// the `generateConstrainedAbstractSql()` that's in the `onceGetter(permissionsTable, 'definition'` below get called, which reads
|
1104
1105
|
// the `$permissions"<permJson>"` suffix of the resource name and add a filter with the respective permissions to that last/deepest model in the chain.
|
1105
|
-
onceGetter(permissionsTable, 'definition', () =>
|
1106
|
-
|
1106
|
+
onceGetter(permissionsTable, 'definition', () => {
|
1107
|
+
const effectiveTableName =
|
1108
|
+
permissionsTable.modifyName ?? permissionsTable.name;
|
1109
|
+
if (
|
1110
|
+
abstractSqlContainsNode(
|
1111
|
+
tableDefinition.abstractSql,
|
1112
|
+
(n) => n[0] === 'Table' && n[1] === effectiveTableName,
|
1113
|
+
)
|
1114
|
+
) {
|
1115
|
+
const permissionsAbstractSql =
|
1116
|
+
generateConstrainedAbstractSql(
|
1117
|
+
permissionsLookup,
|
1118
|
+
JSON.parse(permissionsJSON),
|
1119
|
+
finalVocabulary,
|
1120
|
+
sqlNameToODataName(effectiveTableName),
|
1121
|
+
);
|
1122
|
+
if (permissionsAbstractSql != null) {
|
1123
|
+
// If we're targeting the table directly then we can just return the permissionsAbstractSql as both should be generated using the final model
|
1124
|
+
// TODO: in practice we could have a translation that targets the table directly rather than via a `Resource` node, so we should try to handle that
|
1125
|
+
return permissionsAbstractSql;
|
1126
|
+
}
|
1127
|
+
}
|
1128
|
+
return createVersionSpecificPermissionDefinition(
|
1107
1129
|
tableDefinition,
|
1108
1130
|
permissionsJSON,
|
1109
|
-
)
|
1110
|
-
);
|
1131
|
+
);
|
1132
|
+
});
|
1111
1133
|
} else {
|
1112
1134
|
onceGetter(permissionsTable, 'definition', () =>
|
1113
1135
|
// For $filter on eg a DELETE you need read permissions on the sub-resources,
|
@@ -24,7 +24,7 @@ import type { TypedError } from 'typed-error';
|
|
24
24
|
import { cachedCompile } from './cached-compile.js';
|
25
25
|
|
26
26
|
type LFModel = any[];
|
27
|
-
import AbstractSQLCompiler from '@balena/abstract-sql-compiler';
|
27
|
+
import * as AbstractSQLCompiler from '@balena/abstract-sql-compiler';
|
28
28
|
import AbstractSqlCompilerPackage from '@balena/abstract-sql-compiler/package.json' with { type: 'json' };
|
29
29
|
const { version: AbstractSQLCompilerVersion } = AbstractSqlCompilerPackage;
|
30
30
|
|
@@ -537,7 +537,7 @@ export const generateAbstractSqlModel = (
|
|
537
537
|
() =>
|
538
538
|
AbstractSQLCompiler.optimizeSchema(
|
539
539
|
LF2AbstractSQLTranslator(lfModel, 'Process'),
|
540
|
-
false,
|
540
|
+
{ createCheckConstraints: false },
|
541
541
|
),
|
542
542
|
);
|
543
543
|
|
package/src/sbvr-api/user.ts
CHANGED
package/src/tasks/tasks.ts
CHANGED