@zenstackhq/plugin-policy 3.5.0-beta.3 → 3.5.0-beta.4
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 +11 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +12 -7
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1009,18 +1009,19 @@ var PolicyHandler = class extends import_kysely3.OperationNodeTransformer {
|
|
|
1009
1009
|
__name(this, "PolicyHandler");
|
|
1010
1010
|
}
|
|
1011
1011
|
client;
|
|
1012
|
+
options;
|
|
1012
1013
|
dialect;
|
|
1013
1014
|
eb = (0, import_kysely3.expressionBuilder)();
|
|
1014
|
-
constructor(client) {
|
|
1015
|
-
super(), this.client = client;
|
|
1015
|
+
constructor(client, options = {}) {
|
|
1016
|
+
super(), this.client = client, this.options = options;
|
|
1016
1017
|
this.dialect = (0, import_orm4.getCrudDialect)(this.client.$schema, this.client.$options);
|
|
1017
1018
|
}
|
|
1018
|
-
get kysely() {
|
|
1019
|
-
return this.client.$qb;
|
|
1020
|
-
}
|
|
1021
1019
|
// #region main entry point
|
|
1022
1020
|
async handle(node, proceed) {
|
|
1023
1021
|
if (!this.isCrudQueryNode(node)) {
|
|
1022
|
+
if (this.options.dangerouslyAllowRawSql && import_kysely3.RawNode.is(node)) {
|
|
1023
|
+
return proceed(node);
|
|
1024
|
+
}
|
|
1024
1025
|
throw createRejectedByPolicyError(void 0, import_orm4.RejectedByPolicyReason.OTHER, "non-CRUD queries are not allowed");
|
|
1025
1026
|
}
|
|
1026
1027
|
if (!this.isMutationQueryNode(node)) {
|
|
@@ -1947,6 +1948,10 @@ var PolicyPlugin = class {
|
|
|
1947
1948
|
static {
|
|
1948
1949
|
__name(this, "PolicyPlugin");
|
|
1949
1950
|
}
|
|
1951
|
+
options;
|
|
1952
|
+
constructor(options = {}) {
|
|
1953
|
+
this.options = options;
|
|
1954
|
+
}
|
|
1950
1955
|
get id() {
|
|
1951
1956
|
return "policy";
|
|
1952
1957
|
}
|
|
@@ -1962,7 +1967,7 @@ var PolicyPlugin = class {
|
|
|
1962
1967
|
};
|
|
1963
1968
|
}
|
|
1964
1969
|
onKyselyQuery({ query, client, proceed }) {
|
|
1965
|
-
const handler = new PolicyHandler(client);
|
|
1970
|
+
const handler = new PolicyHandler(client, this.options);
|
|
1966
1971
|
return handler.handle(query, proceed);
|
|
1967
1972
|
}
|
|
1968
1973
|
};
|