@paymanai/payman-ask-sdk 4.0.3 → 4.0.5
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.js +1 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -131,17 +131,11 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
131
131
|
requiredAnyPermissions: ["vault:author", "vault:publish"]
|
|
132
132
|
}
|
|
133
133
|
];
|
|
134
|
-
function hasCommandPermission(granted, requiredPermission) {
|
|
135
|
-
if (granted.has("*") || granted.has(requiredPermission)) return true;
|
|
136
|
-
if (!requiredPermission.includes(".")) return false;
|
|
137
|
-
const wildcard = requiredPermission.substring(0, requiredPermission.lastIndexOf(".")) + ".*";
|
|
138
|
-
return granted.has(wildcard);
|
|
139
|
-
}
|
|
140
134
|
function filterSlashCommands(commands, permissions) {
|
|
141
135
|
const granted = new Set(permissions ?? []);
|
|
142
136
|
return commands.filter((command) => {
|
|
143
137
|
const required = command.requiredAnyPermissions ?? [];
|
|
144
|
-
return required.length === 0 || required.some((permission) =>
|
|
138
|
+
return required.length === 0 || required.some((permission) => granted.has(permission));
|
|
145
139
|
});
|
|
146
140
|
}
|
|
147
141
|
function parseSlashCommand(content) {
|