@lightdash/common 0.1936.2 → 0.1937.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.
Files changed (157) hide show
  1. package/dist/cjs/authorization/index.d.ts +8 -4
  2. package/dist/cjs/authorization/index.d.ts.map +1 -1
  3. package/dist/cjs/authorization/index.js +26 -3
  4. package/dist/cjs/authorization/index.js.map +1 -1
  5. package/dist/cjs/authorization/index.mock.d.ts +2 -0
  6. package/dist/cjs/authorization/index.mock.d.ts.map +1 -1
  7. package/dist/cjs/authorization/index.mock.js +2 -0
  8. package/dist/cjs/authorization/index.mock.js.map +1 -1
  9. package/dist/cjs/authorization/organizationMemberAbility.mock.d.ts.map +1 -1
  10. package/dist/cjs/authorization/organizationMemberAbility.mock.js +1 -0
  11. package/dist/cjs/authorization/organizationMemberAbility.mock.js.map +1 -1
  12. package/dist/cjs/authorization/parseScopes.d.ts +3 -2
  13. package/dist/cjs/authorization/parseScopes.d.ts.map +1 -1
  14. package/dist/cjs/authorization/parseScopes.js +17 -8
  15. package/dist/cjs/authorization/parseScopes.js.map +1 -1
  16. package/dist/cjs/authorization/parseScopes.test.js +9 -14
  17. package/dist/cjs/authorization/parseScopes.test.js.map +1 -1
  18. package/dist/cjs/authorization/projectMemberAbility.mock.d.ts.map +1 -1
  19. package/dist/cjs/authorization/projectMemberAbility.mock.js +1 -0
  20. package/dist/cjs/authorization/projectMemberAbility.mock.js.map +1 -1
  21. package/dist/cjs/authorization/roleToScopeMapping.d.ts +19 -0
  22. package/dist/cjs/authorization/roleToScopeMapping.d.ts.map +1 -0
  23. package/dist/cjs/authorization/roleToScopeMapping.js +163 -0
  24. package/dist/cjs/authorization/roleToScopeMapping.js.map +1 -0
  25. package/dist/cjs/authorization/roleToScopeMapping.test.d.ts +2 -0
  26. package/dist/cjs/authorization/roleToScopeMapping.test.d.ts.map +1 -0
  27. package/dist/cjs/authorization/roleToScopeMapping.test.js +549 -0
  28. package/dist/cjs/authorization/roleToScopeMapping.test.js.map +1 -0
  29. package/dist/cjs/authorization/roleToScopeMapping.testUtils.d.ts +1393 -0
  30. package/dist/cjs/authorization/roleToScopeMapping.testUtils.d.ts.map +1 -0
  31. package/dist/cjs/authorization/roleToScopeMapping.testUtils.js +329 -0
  32. package/dist/cjs/authorization/roleToScopeMapping.testUtils.js.map +1 -0
  33. package/dist/cjs/authorization/scopeAbilityBuilder.d.ts +14 -8
  34. package/dist/cjs/authorization/scopeAbilityBuilder.d.ts.map +1 -1
  35. package/dist/cjs/authorization/scopeAbilityBuilder.js +7 -7
  36. package/dist/cjs/authorization/scopeAbilityBuilder.js.map +1 -1
  37. package/dist/cjs/authorization/scopeAbilityBuilder.test.js +258 -185
  38. package/dist/cjs/authorization/scopeAbilityBuilder.test.js.map +1 -1
  39. package/dist/cjs/authorization/scopes.d.ts.map +1 -1
  40. package/dist/cjs/authorization/scopes.js +132 -187
  41. package/dist/cjs/authorization/scopes.js.map +1 -1
  42. package/dist/cjs/ee/AiAgent/schemas/tools/index.d.ts +1 -0
  43. package/dist/cjs/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
  44. package/dist/cjs/ee/AiAgent/schemas/tools/index.js +1 -0
  45. package/dist/cjs/ee/AiAgent/schemas/tools/index.js.map +1 -1
  46. package/dist/cjs/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts +2845 -0
  47. package/dist/cjs/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts.map +1 -0
  48. package/dist/cjs/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.js +41 -0
  49. package/dist/cjs/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.js.map +1 -0
  50. package/dist/cjs/types/organizationMemberProfile.d.ts +1 -0
  51. package/dist/cjs/types/organizationMemberProfile.d.ts.map +1 -1
  52. package/dist/cjs/types/organizationMemberProfile.js.map +1 -1
  53. package/dist/cjs/types/projectMemberProfile.d.ts +1 -0
  54. package/dist/cjs/types/projectMemberProfile.d.ts.map +1 -1
  55. package/dist/cjs/types/scopes.d.ts +19 -9
  56. package/dist/cjs/types/scopes.d.ts.map +1 -1
  57. package/dist/cjs/types/search.d.ts +20 -0
  58. package/dist/cjs/types/search.d.ts.map +1 -1
  59. package/dist/cjs/types/search.js.map +1 -1
  60. package/dist/cjs/types/user.d.ts +1 -0
  61. package/dist/cjs/types/user.d.ts.map +1 -1
  62. package/dist/cjs/types/user.js.map +1 -1
  63. package/dist/esm/authorization/index.d.ts +8 -4
  64. package/dist/esm/authorization/index.d.ts.map +1 -1
  65. package/dist/esm/authorization/index.js +26 -3
  66. package/dist/esm/authorization/index.js.map +1 -1
  67. package/dist/esm/authorization/index.mock.d.ts +2 -0
  68. package/dist/esm/authorization/index.mock.d.ts.map +1 -1
  69. package/dist/esm/authorization/index.mock.js +2 -0
  70. package/dist/esm/authorization/index.mock.js.map +1 -1
  71. package/dist/esm/authorization/organizationMemberAbility.mock.d.ts.map +1 -1
  72. package/dist/esm/authorization/organizationMemberAbility.mock.js +1 -0
  73. package/dist/esm/authorization/organizationMemberAbility.mock.js.map +1 -1
  74. package/dist/esm/authorization/parseScopes.d.ts +3 -2
  75. package/dist/esm/authorization/parseScopes.d.ts.map +1 -1
  76. package/dist/esm/authorization/parseScopes.js +15 -7
  77. package/dist/esm/authorization/parseScopes.js.map +1 -1
  78. package/dist/esm/authorization/parseScopes.test.js +9 -14
  79. package/dist/esm/authorization/parseScopes.test.js.map +1 -1
  80. package/dist/esm/authorization/projectMemberAbility.mock.d.ts.map +1 -1
  81. package/dist/esm/authorization/projectMemberAbility.mock.js +1 -0
  82. package/dist/esm/authorization/projectMemberAbility.mock.js.map +1 -1
  83. package/dist/esm/authorization/roleToScopeMapping.d.ts +19 -0
  84. package/dist/esm/authorization/roleToScopeMapping.d.ts.map +1 -0
  85. package/dist/esm/authorization/roleToScopeMapping.js +157 -0
  86. package/dist/esm/authorization/roleToScopeMapping.js.map +1 -0
  87. package/dist/esm/authorization/roleToScopeMapping.test.d.ts +2 -0
  88. package/dist/esm/authorization/roleToScopeMapping.test.d.ts.map +1 -0
  89. package/dist/esm/authorization/roleToScopeMapping.test.js +547 -0
  90. package/dist/esm/authorization/roleToScopeMapping.test.js.map +1 -0
  91. package/dist/esm/authorization/roleToScopeMapping.testUtils.d.ts +1393 -0
  92. package/dist/esm/authorization/roleToScopeMapping.testUtils.d.ts.map +1 -0
  93. package/dist/esm/authorization/roleToScopeMapping.testUtils.js +319 -0
  94. package/dist/esm/authorization/roleToScopeMapping.testUtils.js.map +1 -0
  95. package/dist/esm/authorization/scopeAbilityBuilder.d.ts +14 -8
  96. package/dist/esm/authorization/scopeAbilityBuilder.d.ts.map +1 -1
  97. package/dist/esm/authorization/scopeAbilityBuilder.js +7 -7
  98. package/dist/esm/authorization/scopeAbilityBuilder.js.map +1 -1
  99. package/dist/esm/authorization/scopeAbilityBuilder.test.js +259 -186
  100. package/dist/esm/authorization/scopeAbilityBuilder.test.js.map +1 -1
  101. package/dist/esm/authorization/scopes.d.ts.map +1 -1
  102. package/dist/esm/authorization/scopes.js +132 -187
  103. package/dist/esm/authorization/scopes.js.map +1 -1
  104. package/dist/esm/ee/AiAgent/schemas/tools/index.d.ts +1 -0
  105. package/dist/esm/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
  106. package/dist/esm/ee/AiAgent/schemas/tools/index.js +1 -0
  107. package/dist/esm/ee/AiAgent/schemas/tools/index.js.map +1 -1
  108. package/dist/esm/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts +2845 -0
  109. package/dist/esm/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts.map +1 -0
  110. package/dist/esm/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.js +38 -0
  111. package/dist/esm/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.js.map +1 -0
  112. package/dist/esm/types/organizationMemberProfile.d.ts +1 -0
  113. package/dist/esm/types/organizationMemberProfile.d.ts.map +1 -1
  114. package/dist/esm/types/organizationMemberProfile.js.map +1 -1
  115. package/dist/esm/types/projectMemberProfile.d.ts +1 -0
  116. package/dist/esm/types/projectMemberProfile.d.ts.map +1 -1
  117. package/dist/esm/types/scopes.d.ts +19 -9
  118. package/dist/esm/types/scopes.d.ts.map +1 -1
  119. package/dist/esm/types/search.d.ts +20 -0
  120. package/dist/esm/types/search.d.ts.map +1 -1
  121. package/dist/esm/types/search.js.map +1 -1
  122. package/dist/esm/types/user.d.ts +1 -0
  123. package/dist/esm/types/user.d.ts.map +1 -1
  124. package/dist/esm/types/user.js.map +1 -1
  125. package/dist/tsconfig.types.tsbuildinfo +1 -1
  126. package/dist/types/authorization/index.d.ts +8 -4
  127. package/dist/types/authorization/index.d.ts.map +1 -1
  128. package/dist/types/authorization/index.mock.d.ts +2 -0
  129. package/dist/types/authorization/index.mock.d.ts.map +1 -1
  130. package/dist/types/authorization/organizationMemberAbility.mock.d.ts.map +1 -1
  131. package/dist/types/authorization/parseScopes.d.ts +3 -2
  132. package/dist/types/authorization/parseScopes.d.ts.map +1 -1
  133. package/dist/types/authorization/projectMemberAbility.mock.d.ts.map +1 -1
  134. package/dist/types/authorization/roleToScopeMapping.d.ts +19 -0
  135. package/dist/types/authorization/roleToScopeMapping.d.ts.map +1 -0
  136. package/dist/types/authorization/roleToScopeMapping.test.d.ts +2 -0
  137. package/dist/types/authorization/roleToScopeMapping.test.d.ts.map +1 -0
  138. package/dist/types/authorization/roleToScopeMapping.testUtils.d.ts +1393 -0
  139. package/dist/types/authorization/roleToScopeMapping.testUtils.d.ts.map +1 -0
  140. package/dist/types/authorization/scopeAbilityBuilder.d.ts +14 -8
  141. package/dist/types/authorization/scopeAbilityBuilder.d.ts.map +1 -1
  142. package/dist/types/authorization/scopes.d.ts.map +1 -1
  143. package/dist/types/ee/AiAgent/schemas/tools/index.d.ts +1 -0
  144. package/dist/types/ee/AiAgent/schemas/tools/index.d.ts.map +1 -1
  145. package/dist/types/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts +2845 -0
  146. package/dist/types/ee/AiAgent/schemas/tools/toolSearchFieldValuesArgs.d.ts.map +1 -0
  147. package/dist/types/types/organizationMemberProfile.d.ts +1 -0
  148. package/dist/types/types/organizationMemberProfile.d.ts.map +1 -1
  149. package/dist/types/types/projectMemberProfile.d.ts +1 -0
  150. package/dist/types/types/projectMemberProfile.d.ts.map +1 -1
  151. package/dist/types/types/scopes.d.ts +19 -9
  152. package/dist/types/types/scopes.d.ts.map +1 -1
  153. package/dist/types/types/search.d.ts +20 -0
  154. package/dist/types/types/search.d.ts.map +1 -1
  155. package/dist/types/types/user.d.ts +1 -0
  156. package/dist/types/types/user.d.ts.map +1 -1
  157. package/package.json +1 -1
@@ -3,6 +3,7 @@ export const PROJECT_VIEWER = {
3
3
  userUuid: 'user-uuid-1234',
4
4
  projectUuid: 'project-uuid-1234',
5
5
  role: ProjectMemberRole.VIEWER,
6
+ roleUuid: undefined,
6
7
  email: '',
7
8
  firstName: '',
8
9
  lastName: '',
@@ -1 +1 @@
1
- {"version":3,"file":"projectMemberAbility.mock.js","sourceRoot":"","sources":["../../../src/authorization/projectMemberAbility.mock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAyB;IAChD,QAAQ,EAAE,gBAAgB;IAC1B,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,iBAAiB,CAAC,MAAM;IAC9B,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAyB;IAC5D,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,kBAAkB;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAyB;IAChD,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,MAAM;CACjC,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAyB;IACnD,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,SAAS;CACpC,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAyB;IAC/C,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,KAAK;CAChC,CAAC"}
1
+ {"version":3,"file":"projectMemberAbility.mock.js","sourceRoot":"","sources":["../../../src/authorization/projectMemberAbility.mock.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAyB;IAChD,QAAQ,EAAE,gBAAgB;IAC1B,WAAW,EAAE,mBAAmB;IAChC,IAAI,EAAE,iBAAiB,CAAC,MAAM;IAC9B,QAAQ,EAAE,SAAS;IACnB,KAAK,EAAE,EAAE;IACT,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAyB;IAC5D,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,kBAAkB;CAC7C,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAyB;IAChD,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,MAAM;CACjC,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAyB;IACnD,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,SAAS;CACpC,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAyB;IAC/C,GAAG,cAAc;IACjB,IAAI,EAAE,iBAAiB,CAAC,KAAK;CAChC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { ProjectMemberRole } from '../types/projectMemberRole';
2
+ /**
3
+ * Maps project member roles to their equivalent scopes based on projectMemberAbility.ts analysis
4
+ * Each role inherits permissions from the roles below it in the hierarchy
5
+ */
6
+ export declare const PROJECT_ROLE_TO_SCOPES_MAP: Record<ProjectMemberRole, string[]>;
7
+ /**
8
+ * Gets the scopes required for a specific project member role
9
+ */
10
+ export declare const getScopesForRole: (role: ProjectMemberRole) => string[];
11
+ /**
12
+ * Gets only the non-enterprise scopes for a role (filters out enterprise-only features)
13
+ */
14
+ export declare const getNonEnterpriseScopesForRole: (role: ProjectMemberRole) => string[];
15
+ /**
16
+ * Gets the incremental scopes added by a specific role (not inherited from lower roles)
17
+ */
18
+ export declare const getIncrementalScopesForRole: (role: ProjectMemberRole) => string[];
19
+ //# sourceMappingURL=roleToScopeMapping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roleToScopeMapping.d.ts","sourceRoot":"","sources":["../../../src/authorization/roleToScopeMapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AA0G/D;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,EAAE,CAoBnE,CAAC;AAET;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAAU,iBAAiB,KAAG,MAAM,EAEhE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B,SAChC,iBAAiB,KACxB,MAAM,EAkBR,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,2BAA2B,SAC9B,iBAAiB,KACxB,MAAM,EAqBR,CAAC"}
@@ -0,0 +1,157 @@
1
+ import { ProjectMemberRole } from '../types/projectMemberRole';
2
+ /**
3
+ * Utility functions to convert project member roles to equivalent scope sets
4
+ * for testing migration compatibility between role-based and scope-based authorization
5
+ */
6
+ /**
7
+ * Base scopes for each role level (without inheritance)
8
+ */
9
+ const BASE_ROLE_SCOPES = {
10
+ [ProjectMemberRole.VIEWER]: [
11
+ // Basic viewing permissions
12
+ 'view:Dashboard',
13
+ 'view:SavedChart',
14
+ 'view:Space',
15
+ 'view:Project',
16
+ 'view:PinnedItems',
17
+ 'view:DashboardComments',
18
+ 'view:Tags',
19
+ 'view:Job', // For viewing job status created by user
20
+ 'manage:ExportCsv',
21
+ // Enterprise scopes (when available)
22
+ 'view:MetricsTree',
23
+ 'view:SpotlightTableConfig',
24
+ 'view:AiAgentThread',
25
+ ],
26
+ [ProjectMemberRole.INTERACTIVE_VIEWER]: [
27
+ // Additional interactive viewer permissions
28
+ 'view:UnderlyingData',
29
+ 'view:SemanticViewer',
30
+ 'manage:Explore',
31
+ 'manage:ChangeCsvResults',
32
+ 'create:ScheduledDeliveries',
33
+ 'create:DashboardComments',
34
+ 'create:Job',
35
+ // Space-level content management (requires space admin/editor role)
36
+ 'manage:Dashboard', // Via space access
37
+ 'manage:SavedChart', // Via space access
38
+ 'manage:Space', // Via space access (admin role)
39
+ // Enterprise scopes
40
+ 'view:AiAgent',
41
+ 'create:AiAgentThread',
42
+ ],
43
+ [ProjectMemberRole.EDITOR]: [
44
+ // Editor-specific permissions
45
+ 'create:Space',
46
+ 'manage:Space', // For non-private spaces (requires manage:Project)
47
+ 'manage:Job',
48
+ 'manage:PinnedItems',
49
+ 'manage:ScheduledDeliveries',
50
+ 'manage:DashboardComments',
51
+ 'manage:Tags',
52
+ // Enterprise scopes
53
+ 'manage:MetricsTree',
54
+ 'manage:AiAgentThread', // User's own threads
55
+ ],
56
+ [ProjectMemberRole.DEVELOPER]: [
57
+ // Developer-specific permissions
58
+ 'manage:VirtualView',
59
+ 'manage:CustomSql',
60
+ 'manage:SqlRunner',
61
+ 'manage:Validation',
62
+ 'manage:CompileProject',
63
+ 'create:Project', // Preview projects
64
+ 'delete:Project', // Preview projects created by user
65
+ 'update:Project',
66
+ 'view:JobStatus', // All jobs in project
67
+ // Enterprise scopes
68
+ 'manage:SpotlightTableConfig',
69
+ 'manage:ContentAsCode',
70
+ 'manage:AiAgent',
71
+ 'manage:AiAgentThread', // User's own threads
72
+ ],
73
+ [ProjectMemberRole.ADMIN]: [
74
+ // Admin-specific permissions
75
+ 'delete:Project', // Any project
76
+ 'view:Analytics',
77
+ 'manage:Dashboard', // All dashboards
78
+ 'manage:Project', // Required for managing non-private spaces
79
+ 'manage:SavedChart', // All saved charts
80
+ 'view:AiAgentThread', // All threads in project
81
+ 'manage:AiAgentThread', // All threads in project
82
+ ],
83
+ };
84
+ /**
85
+ * Role hierarchy for inheritance
86
+ */
87
+ const ROLE_HIERARCHY = [
88
+ ProjectMemberRole.VIEWER,
89
+ ProjectMemberRole.INTERACTIVE_VIEWER,
90
+ ProjectMemberRole.EDITOR,
91
+ ProjectMemberRole.DEVELOPER,
92
+ ProjectMemberRole.ADMIN,
93
+ ];
94
+ /**
95
+ * Maps project member roles to their equivalent scopes based on projectMemberAbility.ts analysis
96
+ * Each role inherits permissions from the roles below it in the hierarchy
97
+ */
98
+ export const PROJECT_ROLE_TO_SCOPES_MAP = (() => {
99
+ const result = {};
100
+ for (const role of ROLE_HIERARCHY) {
101
+ const roleIndex = ROLE_HIERARCHY.indexOf(role);
102
+ const inheritedScopes = new Set();
103
+ // Add scopes from all lower-level roles
104
+ for (let i = 0; i <= roleIndex; i += 1) {
105
+ const currentRole = ROLE_HIERARCHY[i];
106
+ BASE_ROLE_SCOPES[currentRole].forEach((scope) => inheritedScopes.add(scope));
107
+ }
108
+ result[role] = Array.from(inheritedScopes);
109
+ }
110
+ return result;
111
+ })();
112
+ /**
113
+ * Gets the scopes required for a specific project member role
114
+ */
115
+ export const getScopesForRole = (role) => [
116
+ ...PROJECT_ROLE_TO_SCOPES_MAP[role],
117
+ ];
118
+ /**
119
+ * Gets only the non-enterprise scopes for a role (filters out enterprise-only features)
120
+ */
121
+ export const getNonEnterpriseScopesForRole = (role) => {
122
+ const enterpriseScopes = new Set([
123
+ 'view:MetricsTree',
124
+ 'manage:MetricsTree',
125
+ 'view:SpotlightTableConfig',
126
+ 'manage:SpotlightTableConfig',
127
+ 'view:AiAgent',
128
+ 'view:AiAgentThread',
129
+ 'create:AiAgentThread',
130
+ 'manage:AiAgent',
131
+ 'manage:AiAgentThread',
132
+ 'manage:ContentAsCode',
133
+ 'manage:PersonalAccessToken',
134
+ ]);
135
+ return PROJECT_ROLE_TO_SCOPES_MAP[role].filter((scope) => !enterpriseScopes.has(scope));
136
+ };
137
+ /**
138
+ * Gets the incremental scopes added by a specific role (not inherited from lower roles)
139
+ */
140
+ export const getIncrementalScopesForRole = (role) => {
141
+ const roleOrder = [
142
+ ProjectMemberRole.VIEWER,
143
+ ProjectMemberRole.INTERACTIVE_VIEWER,
144
+ ProjectMemberRole.EDITOR,
145
+ ProjectMemberRole.DEVELOPER,
146
+ ProjectMemberRole.ADMIN,
147
+ ];
148
+ const roleIndex = roleOrder.indexOf(role);
149
+ if (roleIndex === 0) {
150
+ return getScopesForRole(role);
151
+ }
152
+ const previousRole = roleOrder[roleIndex - 1];
153
+ const currentScopes = new Set(getScopesForRole(role));
154
+ const previousScopes = new Set(getScopesForRole(previousRole));
155
+ return Array.from(currentScopes).filter((scope) => !previousScopes.has(scope));
156
+ };
157
+ //# sourceMappingURL=roleToScopeMapping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roleToScopeMapping.js","sourceRoot":"","sources":["../../../src/authorization/roleToScopeMapping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D;;;GAGG;AAEH;;GAEG;AACH,MAAM,gBAAgB,GAAG;IACrB,CAAC,iBAAiB,CAAC,MAAM,CAAC,EAAE;QACxB,4BAA4B;QAC5B,gBAAgB;QAChB,iBAAiB;QACjB,YAAY;QACZ,cAAc;QACd,kBAAkB;QAClB,wBAAwB;QACxB,WAAW;QACX,UAAU,EAAE,yCAAyC;QACrD,kBAAkB;QAElB,qCAAqC;QACrC,kBAAkB;QAClB,2BAA2B;QAC3B,oBAAoB;KACvB;IAED,CAAC,iBAAiB,CAAC,kBAAkB,CAAC,EAAE;QACpC,4CAA4C;QAC5C,qBAAqB;QACrB,qBAAqB;QACrB,gBAAgB;QAChB,yBAAyB;QACzB,4BAA4B;QAC5B,0BAA0B;QAC1B,YAAY;QAEZ,oEAAoE;QACpE,kBA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C,MAAM,2BAA2B,GAAG,CACvC,IAAuB,EACf,EAAE;IACV,MAAM,SAAS,GAAG;QACd,iBAAiB,CAAC,MAAM;QACxB,iBAAiB,CAAC,kBAAkB;QACpC,iBAAiB,CAAC,MAAM;QACxB,iBAAiB,CAAC,SAAS;QAC3B,iBAAiB,CAAC,KAAK;KAC1B,CAAC;IAEF,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QAClB,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,YAAY,GAAG,SAAS,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;IAC9C,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAAC;IAE/D,OAAO,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,MAAM,CACnC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CACxC,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=roleToScopeMapping.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roleToScopeMapping.test.d.ts","sourceRoot":"","sources":["../../../src/authorization/roleToScopeMapping.test.ts"],"names":[],"mappings":""}