@imbue-ai/detent 1.15.1 → 1.16.0
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 +12 -0
- package/dist/src/schemas/generatedBuiltinSchemas.d.ts.map +1 -1
- package/dist/src/schemas/generatedBuiltinSchemas.js +823 -126
- package/dist/src/schemas/generatedBuiltinSchemas.js.map +1 -1
- package/dist/tests/builtinSchemas.test.js +287 -0
- package/dist/tests/builtinSchemas.test.js.map +1 -1
- package/package.json +1 -1
|
@@ -992,18 +992,42 @@ describe('builtin schemas: notion-mcp', () => {
|
|
|
992
992
|
const readAll = builtinRegistry.get('notion-mcp-read-all');
|
|
993
993
|
for (const tool of [
|
|
994
994
|
'notion-search',
|
|
995
|
+
'notion-ai-search',
|
|
995
996
|
'notion-fetch',
|
|
996
997
|
'notion-query-data-sources',
|
|
998
|
+
'notion-query-multiple-data-sources',
|
|
997
999
|
'notion-query-database-view',
|
|
1000
|
+
'notion-query-meeting-notes',
|
|
1001
|
+
'notion-list-recent-pages',
|
|
1002
|
+
'notion-list-private-pages',
|
|
1003
|
+
'notion-list-favorite-pages',
|
|
1004
|
+
'notion-list-shared-pages',
|
|
998
1005
|
'notion-get-comments',
|
|
999
1006
|
'notion-get-teams',
|
|
1007
|
+
'notion-get-users',
|
|
1000
1008
|
'notion-get-self',
|
|
1009
|
+
'notion-get-async-task',
|
|
1010
|
+
'notion-search-skills',
|
|
1011
|
+
'notion-download-skill',
|
|
1012
|
+
'notion-download-attachment',
|
|
1013
|
+
'notion-list-agents',
|
|
1014
|
+
'notion-search-agents',
|
|
1015
|
+
'notion-query-sessions',
|
|
1016
|
+
'notion-search-sessions',
|
|
1017
|
+
'notion-get-session-status',
|
|
1018
|
+
'notion-wait-session',
|
|
1019
|
+
'notion-list-session-events',
|
|
1020
|
+
'notion-read-session-event',
|
|
1021
|
+
'notion-check-mcp-next-steps',
|
|
1022
|
+
'notion-show-advanced-analysis-next-steps',
|
|
1001
1023
|
]) {
|
|
1002
1024
|
expect(readAll.match(mcpRequest(toolCall(tool))), `read-all should allow ${tool}`).toBe(true);
|
|
1003
1025
|
}
|
|
1004
1026
|
expect(readAll.match(mcpRequest(rpc('initialize')))).toBe(true);
|
|
1005
1027
|
expect(readAll.match(mcpRequest(toolCall('notion-create-pages')))).toBe(false);
|
|
1006
1028
|
expect(readAll.match(mcpRequest(toolCall('notion-update-page')))).toBe(false);
|
|
1029
|
+
expect(readAll.match(mcpRequest(toolCall('notion-spawn-session')))).toBe(false);
|
|
1030
|
+
expect(readAll.match(mcpRequest(toolCall('notion-create-attachment')))).toBe(false);
|
|
1007
1031
|
});
|
|
1008
1032
|
it('notion-mcp-write-all matches write tools and the handshake but not reads', () => {
|
|
1009
1033
|
expectSchemaExists('notion-mcp-write-all');
|
|
@@ -1013,17 +1037,84 @@ describe('builtin schemas: notion-mcp', () => {
|
|
|
1013
1037
|
'notion-update-page',
|
|
1014
1038
|
'notion-move-pages',
|
|
1015
1039
|
'notion-duplicate-page',
|
|
1040
|
+
'notion-convert-page-to-skill',
|
|
1041
|
+
'notion-create-file-upload',
|
|
1042
|
+
'notion-create-attachment',
|
|
1016
1043
|
'notion-create-database',
|
|
1044
|
+
'notion-create-folder',
|
|
1045
|
+
'notion-update-folder',
|
|
1017
1046
|
'notion-update-data-source',
|
|
1018
1047
|
'notion-create-view',
|
|
1019
1048
|
'notion-update-view',
|
|
1020
1049
|
'notion-create-comment',
|
|
1050
|
+
'notion-spawn-session',
|
|
1051
|
+
'notion-stop-session',
|
|
1052
|
+
'notion-send-message-to-session',
|
|
1021
1053
|
]) {
|
|
1022
1054
|
expect(writeAll.match(mcpRequest(toolCall(tool))), `write-all should allow ${tool}`).toBe(true);
|
|
1023
1055
|
}
|
|
1024
1056
|
expect(writeAll.match(mcpRequest(rpc('initialize')))).toBe(true);
|
|
1025
1057
|
expect(writeAll.match(mcpRequest(toolCall('notion-search')))).toBe(false);
|
|
1026
1058
|
expect(writeAll.match(mcpRequest(toolCall('notion-fetch')))).toBe(false);
|
|
1059
|
+
expect(writeAll.match(mcpRequest(toolCall('notion-list-private-pages')))).toBe(false);
|
|
1060
|
+
});
|
|
1061
|
+
it('notion-mcp-list-pages matches the undocumented page-listing tools', () => {
|
|
1062
|
+
expectSchemaExists('notion-mcp-list-pages');
|
|
1063
|
+
const listPages = builtinRegistry.get('notion-mcp-list-pages');
|
|
1064
|
+
for (const tool of [
|
|
1065
|
+
'notion-list-recent-pages',
|
|
1066
|
+
'notion-list-private-pages',
|
|
1067
|
+
'notion-list-favorite-pages',
|
|
1068
|
+
'notion-list-shared-pages',
|
|
1069
|
+
]) {
|
|
1070
|
+
expect(listPages.match(mcpRequest(toolCall(tool))), `should allow ${tool}`).toBe(true);
|
|
1071
|
+
}
|
|
1072
|
+
expect(listPages.match(mcpRequest(toolCall('notion-search')))).toBe(false);
|
|
1073
|
+
});
|
|
1074
|
+
it('notion-mcp-query-data-sources covers the single and multi data source tools', () => {
|
|
1075
|
+
expectSchemaExists('notion-mcp-query-data-sources');
|
|
1076
|
+
const query = builtinRegistry.get('notion-mcp-query-data-sources');
|
|
1077
|
+
expect(query.match(mcpRequest(toolCall('notion-query-data-sources')))).toBe(true);
|
|
1078
|
+
expect(query.match(mcpRequest(toolCall('notion-query-multiple-data-sources')))).toBe(true);
|
|
1079
|
+
expect(query.match(mcpRequest(toolCall('notion-query-database-view')))).toBe(false);
|
|
1080
|
+
});
|
|
1081
|
+
it('notion-mcp agent schemas separate reading sessions from driving them', () => {
|
|
1082
|
+
expectSchemaExists('notion-mcp-read-agents');
|
|
1083
|
+
expectSchemaExists('notion-mcp-write-agents');
|
|
1084
|
+
const readAgents = builtinRegistry.get('notion-mcp-read-agents');
|
|
1085
|
+
const writeAgents = builtinRegistry.get('notion-mcp-write-agents');
|
|
1086
|
+
expect(readAgents.match(mcpRequest(toolCall('notion-list-agents')))).toBe(true);
|
|
1087
|
+
expect(readAgents.match(mcpRequest(toolCall('notion-read-session-event')))).toBe(true);
|
|
1088
|
+
expect(readAgents.match(mcpRequest(toolCall('notion-spawn-session')))).toBe(false);
|
|
1089
|
+
expect(writeAgents.match(mcpRequest(toolCall('notion-spawn-session')))).toBe(true);
|
|
1090
|
+
expect(writeAgents.match(mcpRequest(toolCall('notion-send-message-to-session')))).toBe(true);
|
|
1091
|
+
expect(writeAgents.match(mcpRequest(toolCall('notion-get-session-status')))).toBe(false);
|
|
1092
|
+
});
|
|
1093
|
+
it('notion-mcp attachment schemas separate downloads from uploads', () => {
|
|
1094
|
+
expectSchemaExists('notion-mcp-read-attachments');
|
|
1095
|
+
expectSchemaExists('notion-mcp-write-attachments');
|
|
1096
|
+
const readAttachments = builtinRegistry.get('notion-mcp-read-attachments');
|
|
1097
|
+
const writeAttachments = builtinRegistry.get('notion-mcp-write-attachments');
|
|
1098
|
+
expect(readAttachments.match(mcpRequest(toolCall('notion-download-attachment')))).toBe(true);
|
|
1099
|
+
expect(readAttachments.match(mcpRequest(toolCall('notion-create-attachment')))).toBe(false);
|
|
1100
|
+
expect(writeAttachments.match(mcpRequest(toolCall('notion-create-file-upload')))).toBe(true);
|
|
1101
|
+
expect(writeAttachments.match(mcpRequest(toolCall('notion-create-attachment')))).toBe(true);
|
|
1102
|
+
expect(writeAttachments.match(mcpRequest(toolCall('notion-download-attachment')))).toBe(false);
|
|
1103
|
+
});
|
|
1104
|
+
it('notion-mcp single-tool schemas do not match the session handshake', () => {
|
|
1105
|
+
for (const schemaName of [
|
|
1106
|
+
'notion-mcp-ai-search',
|
|
1107
|
+
'notion-mcp-list-pages',
|
|
1108
|
+
'notion-mcp-query-meeting-notes',
|
|
1109
|
+
'notion-mcp-get-async-task',
|
|
1110
|
+
'notion-mcp-read-skills',
|
|
1111
|
+
'notion-mcp-next-steps',
|
|
1112
|
+
'notion-mcp-convert-page-to-skill',
|
|
1113
|
+
'notion-mcp-write-folders',
|
|
1114
|
+
]) {
|
|
1115
|
+
expectSchemaExists(schemaName);
|
|
1116
|
+
expect(builtinRegistry.get(schemaName).match(mcpRequest(rpc('initialize'))), `${schemaName} should not match the handshake`).toBe(false);
|
|
1117
|
+
}
|
|
1027
1118
|
});
|
|
1028
1119
|
});
|
|
1029
1120
|
describe('builtin schemas: sentry', () => {
|
|
@@ -1526,6 +1617,202 @@ describe('builtin schemas: slack', () => {
|
|
|
1526
1617
|
.get('slack-reminders-write')
|
|
1527
1618
|
.match(makeSlackRequest({ path: '/api/reminders.list' }))).toBe(false);
|
|
1528
1619
|
});
|
|
1620
|
+
const slackReadPermissionsByMethod = {
|
|
1621
|
+
'/api/api.test': 'slack-auth-read',
|
|
1622
|
+
'/api/team.info': 'slack-auth-read',
|
|
1623
|
+
'/api/team.profile.get': 'slack-auth-read',
|
|
1624
|
+
'/api/bots.info': 'slack-auth-read',
|
|
1625
|
+
'/api/drafts.list': 'slack-chat-read',
|
|
1626
|
+
'/api/client.counts': 'slack-conversations-read',
|
|
1627
|
+
'/api/client.userBoot': 'slack-conversations-read',
|
|
1628
|
+
'/api/client.init': 'slack-conversations-read',
|
|
1629
|
+
'/api/client.dms': 'slack-conversations-read',
|
|
1630
|
+
'/api/client.shouldReload': 'slack-conversations-read',
|
|
1631
|
+
'/api/conversations.view': 'slack-conversations-read',
|
|
1632
|
+
'/api/conversations.genericInfo': 'slack-conversations-read',
|
|
1633
|
+
'/api/conversations.listPrefs': 'slack-conversations-read',
|
|
1634
|
+
'/api/threads.getView': 'slack-conversations-read',
|
|
1635
|
+
'/api/subscriptions.thread.getView': 'slack-conversations-read',
|
|
1636
|
+
'/api/users.prefs.get': 'slack-users-read',
|
|
1637
|
+
'/api/users.counts': 'slack-users-read',
|
|
1638
|
+
'/api/users.channelSections.list': 'slack-users-read',
|
|
1639
|
+
'/api/users.priority.list': 'slack-users-read',
|
|
1640
|
+
'/api/usergroups.list': 'slack-users-read',
|
|
1641
|
+
'/api/usergroups.users.list': 'slack-users-read',
|
|
1642
|
+
'/api/dnd.info': 'slack-users-read',
|
|
1643
|
+
'/api/dnd.teamInfo': 'slack-users-read',
|
|
1644
|
+
'/api/canvases.sections.lookup': 'slack-files-read',
|
|
1645
|
+
'/api/emoji.list': 'slack-reactions-read',
|
|
1646
|
+
'/api/search.modules.channels': 'slack-search',
|
|
1647
|
+
'/api/search.modules.people': 'slack-search',
|
|
1648
|
+
'/api/search.inline': 'slack-search',
|
|
1649
|
+
'/api/search.autocomplete': 'slack-search',
|
|
1650
|
+
'/api/saved.list': 'slack-later-read',
|
|
1651
|
+
'/api/stars.list': 'slack-later-read',
|
|
1652
|
+
'/api/reminders.list': 'slack-later-read',
|
|
1653
|
+
};
|
|
1654
|
+
const slackWritePermissionsByMethod = {
|
|
1655
|
+
'/api/chat.command': 'slack-chat-write',
|
|
1656
|
+
'/api/drafts.create': 'slack-chat-write',
|
|
1657
|
+
'/api/drafts.update': 'slack-chat-write',
|
|
1658
|
+
'/api/drafts.delete': 'slack-chat-write',
|
|
1659
|
+
'/api/conversations.canvases.create': 'slack-conversations-write',
|
|
1660
|
+
'/api/subscriptions.thread.mark': 'slack-conversations-write',
|
|
1661
|
+
'/api/subscriptions.thread.add': 'slack-conversations-write',
|
|
1662
|
+
'/api/subscriptions.thread.remove': 'slack-conversations-write',
|
|
1663
|
+
'/api/users.prefs.set': 'slack-users-write',
|
|
1664
|
+
'/api/users.setActive': 'slack-users-write',
|
|
1665
|
+
'/api/users.setPhoto': 'slack-users-write',
|
|
1666
|
+
'/api/usergroups.create': 'slack-users-write',
|
|
1667
|
+
'/api/usergroups.users.update': 'slack-users-write',
|
|
1668
|
+
'/api/dnd.setSnooze': 'slack-users-write',
|
|
1669
|
+
'/api/dnd.endDnd': 'slack-users-write',
|
|
1670
|
+
'/api/files.edit': 'slack-files-write',
|
|
1671
|
+
'/api/files.share': 'slack-files-write',
|
|
1672
|
+
'/api/files.upload': 'slack-files-write',
|
|
1673
|
+
'/api/canvases.create': 'slack-files-write',
|
|
1674
|
+
'/api/canvases.access.set': 'slack-files-write',
|
|
1675
|
+
'/api/saved.add': 'slack-later-write',
|
|
1676
|
+
'/api/saved.delete': 'slack-later-write',
|
|
1677
|
+
'/api/saved.update': 'slack-later-write',
|
|
1678
|
+
'/api/saved.clearCompleted': 'slack-later-write',
|
|
1679
|
+
'/api/stars.add': 'slack-later-write',
|
|
1680
|
+
'/api/reminders.add': 'slack-later-write',
|
|
1681
|
+
};
|
|
1682
|
+
it('private and newly added read methods are covered by their cluster and by slack-read-all', () => {
|
|
1683
|
+
for (const [path, permission] of Object.entries(slackReadPermissionsByMethod)) {
|
|
1684
|
+
expectSchemaExists(permission);
|
|
1685
|
+
const request = makeSlackRequest({ path });
|
|
1686
|
+
expect(builtinRegistry.get(permission).match(request), `Expected ${permission} to match "${path}"`).toBe(true);
|
|
1687
|
+
expect(builtinRegistry.get('slack-read-all').match(request), `Expected slack-read-all to match "${path}"`).toBe(true);
|
|
1688
|
+
expect(builtinRegistry.get('slack-write-all').match(request), `Expected slack-write-all to reject "${path}"`).toBe(false);
|
|
1689
|
+
}
|
|
1690
|
+
});
|
|
1691
|
+
it('private and newly added write methods are covered by their cluster and by slack-write-all', () => {
|
|
1692
|
+
for (const [path, permission] of Object.entries(slackWritePermissionsByMethod)) {
|
|
1693
|
+
expectSchemaExists(permission);
|
|
1694
|
+
const request = makeSlackRequest({ path });
|
|
1695
|
+
expect(builtinRegistry.get(permission).match(request), `Expected ${permission} to match "${path}"`).toBe(true);
|
|
1696
|
+
expect(builtinRegistry.get('slack-write-all').match(request), `Expected slack-write-all to match "${path}"`).toBe(true);
|
|
1697
|
+
expect(builtinRegistry.get('slack-read-all').match(request), `Expected slack-read-all to reject "${path}"`).toBe(false);
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
it('slack-read-all and slack-write-all are exactly the union of the fine-grained clusters', () => {
|
|
1701
|
+
const readPermissions = Object.keys(getAllBuiltinSchemas()).filter((name) => name.startsWith('slack-') &&
|
|
1702
|
+
!name.endsWith('-all') &&
|
|
1703
|
+
!name.endsWith('-write') &&
|
|
1704
|
+
name !== 'slack-api');
|
|
1705
|
+
const writePermissions = Object.keys(getAllBuiltinSchemas()).filter((name) => name.startsWith('slack-') && name.endsWith('-write') && !name.endsWith('-all'));
|
|
1706
|
+
expect(readPermissions.length).toBeGreaterThan(5);
|
|
1707
|
+
expect(writePermissions.length).toBeGreaterThan(5);
|
|
1708
|
+
const probes = [
|
|
1709
|
+
...Object.keys(slackReadPermissionsByMethod),
|
|
1710
|
+
...Object.keys(slackWritePermissionsByMethod),
|
|
1711
|
+
'/api/chat.postMessage',
|
|
1712
|
+
'/api/conversations.history',
|
|
1713
|
+
'/api/users.info',
|
|
1714
|
+
'/api/files.delete',
|
|
1715
|
+
'/api/pins.add',
|
|
1716
|
+
'/api/bookmarks.list',
|
|
1717
|
+
'/api/auth.revoke',
|
|
1718
|
+
'/api/channels.delete',
|
|
1719
|
+
'/api/users.admin.invite',
|
|
1720
|
+
'/api/unknown.method',
|
|
1721
|
+
'/not-an-api-path',
|
|
1722
|
+
].map((path) => makeSlackRequest({ path }));
|
|
1723
|
+
probes.push(makeRequest({ domain: 'files.slack.com', path: '/files-pri/T1-F1/image.png' }), makeRequest({ domain: 'edgeapi.slack.com', path: '/cache/T1/users/search' }), makeRequest({ domain: 'edgeapi.slack.com', path: '/cache/T1/channels/membership' }), makeRequest({ domain: 'edgeapi.slack.com', path: '/cache/T1/unknown/thing' }));
|
|
1724
|
+
for (const request of probes) {
|
|
1725
|
+
const matchedByReadCluster = readPermissions.some((name) => builtinRegistry.get(name).match(request));
|
|
1726
|
+
const matchedByWriteCluster = writePermissions.some((name) => builtinRegistry.get(name).match(request));
|
|
1727
|
+
const label = `${request.domain}${request.path}`;
|
|
1728
|
+
expect(builtinRegistry.get('slack-read-all').match(request), `slack-read-all drifted from its clusters for "${label}"`).toBe(matchedByReadCluster);
|
|
1729
|
+
expect(builtinRegistry.get('slack-write-all').match(request), `slack-write-all drifted from its clusters for "${label}"`).toBe(matchedByWriteCluster);
|
|
1730
|
+
expect(matchedByReadCluster && matchedByWriteCluster, `"${label}" is matched by both a read and a write cluster`).toBe(false);
|
|
1731
|
+
}
|
|
1732
|
+
});
|
|
1733
|
+
it('destructive admin methods are not covered by any slack permission', () => {
|
|
1734
|
+
const slackPermissions = Object.keys(getAllBuiltinSchemas()).filter((name) => name.startsWith('slack-') && name !== 'slack-api');
|
|
1735
|
+
for (const path of [
|
|
1736
|
+
'/api/channels.delete',
|
|
1737
|
+
'/api/conversations.delete',
|
|
1738
|
+
'/api/users.admin.invite',
|
|
1739
|
+
'/api/users.admin.setInactive',
|
|
1740
|
+
]) {
|
|
1741
|
+
for (const name of slackPermissions) {
|
|
1742
|
+
expect(builtinRegistry.get(name).match(makeSlackRequest({ path })), `Expected ${name} to reject "${path}"`).toBe(false);
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
});
|
|
1746
|
+
it('slack-later-read and slack-later-write are supersets of the reminders permissions', () => {
|
|
1747
|
+
expectSchemaExists('slack-later-read');
|
|
1748
|
+
expectSchemaExists('slack-later-write');
|
|
1749
|
+
for (const path of ['/api/reminders.info', '/api/reminders.list', '/api/saved.list']) {
|
|
1750
|
+
expect(builtinRegistry.get('slack-later-read').match(makeSlackRequest({ path }))).toBe(true);
|
|
1751
|
+
expect(builtinRegistry.get('slack-later-write').match(makeSlackRequest({ path }))).toBe(false);
|
|
1752
|
+
}
|
|
1753
|
+
for (const path of ['/api/reminders.add', '/api/saved.add', '/api/saved.update']) {
|
|
1754
|
+
expect(builtinRegistry.get('slack-later-write').match(makeSlackRequest({ path }))).toBe(true);
|
|
1755
|
+
expect(builtinRegistry.get('slack-later-read').match(makeSlackRequest({ path }))).toBe(false);
|
|
1756
|
+
}
|
|
1757
|
+
expect(builtinRegistry
|
|
1758
|
+
.get('slack-reminders-read')
|
|
1759
|
+
.match(makeSlackRequest({ path: '/api/saved.list' }))).toBe(false);
|
|
1760
|
+
expect(builtinRegistry
|
|
1761
|
+
.get('slack-reminders-write')
|
|
1762
|
+
.match(makeSlackRequest({ path: '/api/saved.add' }))).toBe(false);
|
|
1763
|
+
});
|
|
1764
|
+
it('slack permissions accept workspace subdomains as API hosts', () => {
|
|
1765
|
+
for (const domain of ['slack.com', 'my-team.slack.com', 'my-team.enterprise.slack.com']) {
|
|
1766
|
+
expect(builtinRegistry.get('slack-api').match(makeRequest({ domain }))).toBe(true);
|
|
1767
|
+
expect(builtinRegistry
|
|
1768
|
+
.get('slack-conversations-read')
|
|
1769
|
+
.match(makeRequest({ domain, path: '/api/conversations.history' })), `Expected slack-conversations-read to match on ${domain}`).toBe(true);
|
|
1770
|
+
expect(builtinRegistry
|
|
1771
|
+
.get('slack-chat-write')
|
|
1772
|
+
.match(makeRequest({ domain, path: '/api/chat.postMessage' })), `Expected slack-chat-write to match on ${domain}`).toBe(true);
|
|
1773
|
+
}
|
|
1774
|
+
for (const domain of ['slack.com.example.com', 'notslack.com', 'slack.company.com']) {
|
|
1775
|
+
expect(builtinRegistry.get('slack-api').match(makeRequest({ domain }))).toBe(false);
|
|
1776
|
+
expect(builtinRegistry
|
|
1777
|
+
.get('slack-read-all')
|
|
1778
|
+
.match(makeRequest({ domain, path: '/api/conversations.history' }))).toBe(false);
|
|
1779
|
+
}
|
|
1780
|
+
});
|
|
1781
|
+
it('API methods are not accepted on the file-storage or edge hosts', () => {
|
|
1782
|
+
for (const domain of ['files.slack.com', 'edgeapi.slack.com']) {
|
|
1783
|
+
expect(builtinRegistry
|
|
1784
|
+
.get('slack-read-all')
|
|
1785
|
+
.match(makeRequest({ domain, path: '/api/conversations.history' }))).toBe(false);
|
|
1786
|
+
expect(builtinRegistry
|
|
1787
|
+
.get('slack-write-all')
|
|
1788
|
+
.match(makeRequest({ domain, path: '/api/chat.postMessage' }))).toBe(false);
|
|
1789
|
+
}
|
|
1790
|
+
});
|
|
1791
|
+
it('edge cache lookups are covered by the matching read clusters', () => {
|
|
1792
|
+
const edgePermissionsByPath = {
|
|
1793
|
+
'/cache/T0123/users/info': 'slack-users-read',
|
|
1794
|
+
'/cache/T0123/users/list': 'slack-users-read',
|
|
1795
|
+
'/cache/T0123/users/search': 'slack-users-read',
|
|
1796
|
+
'/cache/T0123/users/counts': 'slack-users-read',
|
|
1797
|
+
'/cache/E0123/channels/info': 'slack-conversations-read',
|
|
1798
|
+
'/cache/E0123/channels/search': 'slack-conversations-read',
|
|
1799
|
+
'/cache/E0123/channels/membership': 'slack-conversations-read',
|
|
1800
|
+
'/cache/E0123/huddles/info': 'slack-conversations-read',
|
|
1801
|
+
'/cache/E0123/emojis/info': 'slack-reactions-read',
|
|
1802
|
+
'/cache/E0123/permissions/info': 'slack-auth-read',
|
|
1803
|
+
};
|
|
1804
|
+
for (const [path, permission] of Object.entries(edgePermissionsByPath)) {
|
|
1805
|
+
const request = makeRequest({ domain: 'edgeapi.slack.com', path });
|
|
1806
|
+
expect(builtinRegistry.get('slack-api').match(request)).toBe(true);
|
|
1807
|
+
expect(builtinRegistry.get(permission).match(request), `Expected ${permission} to match "${path}" on edgeapi.slack.com`).toBe(true);
|
|
1808
|
+
expect(builtinRegistry.get('slack-read-all').match(request)).toBe(true);
|
|
1809
|
+
expect(builtinRegistry.get('slack-write-all').match(request)).toBe(false);
|
|
1810
|
+
expect(builtinRegistry.get(permission).match(makeSlackRequest({ path })), `Expected ${permission} to reject "${path}" on slack.com`).toBe(false);
|
|
1811
|
+
}
|
|
1812
|
+
expect(builtinRegistry
|
|
1813
|
+
.get('slack-read-all')
|
|
1814
|
+
.match(makeRequest({ domain: 'edgeapi.slack.com', path: '/cache/E0123/users/delete' }))).toBe(false);
|
|
1815
|
+
});
|
|
1529
1816
|
});
|
|
1530
1817
|
describe('builtin schemas: stripe', () => {
|
|
1531
1818
|
it('stripe scope matches api.stripe.com', () => {
|