@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.js
CHANGED
|
@@ -157,17 +157,11 @@ var DEFAULT_SLASH_COMMANDS = [
|
|
|
157
157
|
requiredAnyPermissions: ["vault:author", "vault:publish"]
|
|
158
158
|
}
|
|
159
159
|
];
|
|
160
|
-
function hasCommandPermission(granted, requiredPermission) {
|
|
161
|
-
if (granted.has("*") || granted.has(requiredPermission)) return true;
|
|
162
|
-
if (!requiredPermission.includes(".")) return false;
|
|
163
|
-
const wildcard = requiredPermission.substring(0, requiredPermission.lastIndexOf(".")) + ".*";
|
|
164
|
-
return granted.has(wildcard);
|
|
165
|
-
}
|
|
166
160
|
function filterSlashCommands(commands, permissions) {
|
|
167
161
|
const granted = new Set(permissions ?? []);
|
|
168
162
|
return commands.filter((command) => {
|
|
169
163
|
const required = command.requiredAnyPermissions ?? [];
|
|
170
|
-
return required.length === 0 || required.some((permission) =>
|
|
164
|
+
return required.length === 0 || required.some((permission) => granted.has(permission));
|
|
171
165
|
});
|
|
172
166
|
}
|
|
173
167
|
function parseSlashCommand(content) {
|