@lightdash/common 0.1930.3 → 0.1931.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.
Files changed (70) hide show
  1. package/dist/cjs/authorization/parseScopes.d.ts +8 -0
  2. package/dist/cjs/authorization/parseScopes.d.ts.map +1 -0
  3. package/dist/cjs/authorization/parseScopes.js +27 -0
  4. package/dist/cjs/authorization/parseScopes.js.map +1 -0
  5. package/dist/cjs/authorization/parseScopes.test.d.ts +2 -0
  6. package/dist/cjs/authorization/parseScopes.test.d.ts.map +1 -0
  7. package/dist/cjs/authorization/parseScopes.test.js +109 -0
  8. package/dist/cjs/authorization/parseScopes.test.js.map +1 -0
  9. package/dist/cjs/authorization/scopeAbilityBuilder.d.ts +23 -0
  10. package/dist/cjs/authorization/scopeAbilityBuilder.d.ts.map +1 -0
  11. package/dist/cjs/authorization/scopeAbilityBuilder.js +58 -0
  12. package/dist/cjs/authorization/scopeAbilityBuilder.js.map +1 -0
  13. package/dist/cjs/authorization/scopeAbilityBuilder.test.d.ts +2 -0
  14. package/dist/cjs/authorization/scopeAbilityBuilder.test.d.ts.map +1 -0
  15. package/dist/cjs/authorization/scopeAbilityBuilder.test.js +955 -0
  16. package/dist/cjs/authorization/scopeAbilityBuilder.test.js.map +1 -0
  17. package/dist/cjs/authorization/scopes.d.ts +8 -0
  18. package/dist/cjs/authorization/scopes.d.ts.map +1 -0
  19. package/dist/cjs/authorization/scopes.js +633 -0
  20. package/dist/cjs/authorization/scopes.js.map +1 -0
  21. package/dist/cjs/types/scopes.d.ts +30 -3
  22. package/dist/cjs/types/scopes.d.ts.map +1 -1
  23. package/dist/cjs/types/scopes.js.map +1 -1
  24. package/dist/esm/authorization/parseScopes.d.ts +8 -0
  25. package/dist/esm/authorization/parseScopes.d.ts.map +1 -0
  26. package/dist/esm/authorization/parseScopes.js +22 -0
  27. package/dist/esm/authorization/parseScopes.js.map +1 -0
  28. package/dist/esm/authorization/parseScopes.test.d.ts +2 -0
  29. package/dist/esm/authorization/parseScopes.test.d.ts.map +1 -0
  30. package/dist/esm/authorization/parseScopes.test.js +107 -0
  31. package/dist/esm/authorization/parseScopes.test.js.map +1 -0
  32. package/dist/esm/authorization/scopeAbilityBuilder.d.ts +23 -0
  33. package/dist/esm/authorization/scopeAbilityBuilder.d.ts.map +1 -0
  34. package/dist/esm/authorization/scopeAbilityBuilder.js +54 -0
  35. package/dist/esm/authorization/scopeAbilityBuilder.js.map +1 -0
  36. package/dist/esm/authorization/scopeAbilityBuilder.test.d.ts +2 -0
  37. package/dist/esm/authorization/scopeAbilityBuilder.test.d.ts.map +1 -0
  38. package/dist/esm/authorization/scopeAbilityBuilder.test.js +953 -0
  39. package/dist/esm/authorization/scopeAbilityBuilder.test.js.map +1 -0
  40. package/dist/esm/authorization/scopes.d.ts +8 -0
  41. package/dist/esm/authorization/scopes.d.ts.map +1 -0
  42. package/dist/esm/authorization/scopes.js +628 -0
  43. package/dist/esm/authorization/scopes.js.map +1 -0
  44. package/dist/esm/types/scopes.d.ts +30 -3
  45. package/dist/esm/types/scopes.d.ts.map +1 -1
  46. package/dist/esm/types/scopes.js.map +1 -1
  47. package/dist/tsconfig.types.tsbuildinfo +1 -1
  48. package/dist/types/authorization/parseScopes.d.ts +8 -0
  49. package/dist/types/authorization/parseScopes.d.ts.map +1 -0
  50. package/dist/types/authorization/parseScopes.test.d.ts +2 -0
  51. package/dist/types/authorization/parseScopes.test.d.ts.map +1 -0
  52. package/dist/types/authorization/scopeAbilityBuilder.d.ts +23 -0
  53. package/dist/types/authorization/scopeAbilityBuilder.d.ts.map +1 -0
  54. package/dist/types/authorization/scopeAbilityBuilder.test.d.ts +2 -0
  55. package/dist/types/authorization/scopeAbilityBuilder.test.d.ts.map +1 -0
  56. package/dist/types/authorization/scopes.d.ts +8 -0
  57. package/dist/types/authorization/scopes.d.ts.map +1 -0
  58. package/dist/types/types/scopes.d.ts +30 -3
  59. package/dist/types/types/scopes.d.ts.map +1 -1
  60. package/package.json +1 -1
  61. package/dist/cjs/authorization/scopes/index.d.ts +0 -5
  62. package/dist/cjs/authorization/scopes/index.d.ts.map +0 -1
  63. package/dist/cjs/authorization/scopes/index.js +0 -372
  64. package/dist/cjs/authorization/scopes/index.js.map +0 -1
  65. package/dist/esm/authorization/scopes/index.d.ts +0 -5
  66. package/dist/esm/authorization/scopes/index.d.ts.map +0 -1
  67. package/dist/esm/authorization/scopes/index.js +0 -368
  68. package/dist/esm/authorization/scopes/index.js.map +0 -1
  69. package/dist/types/authorization/scopes/index.d.ts +0 -5
  70. package/dist/types/authorization/scopes/index.d.ts.map +0 -1
@@ -0,0 +1,8 @@
1
+ import { type ScopeName } from '../types/scopes';
2
+ import { type AbilityAction, type CaslSubjectNames } from './types';
3
+ export declare const parseScope: (scope: string) => [AbilityAction, CaslSubjectNames];
4
+ export declare const parseScopes: ({ scopes, isEnterprise, }: {
5
+ scopes: string[];
6
+ isEnterprise: boolean;
7
+ }) => Set<ScopeName>;
8
+ //# sourceMappingURL=parseScopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseScopes.d.ts","sourceRoot":"","sources":["../../../src/authorization/parseScopes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEpE,eAAO,MAAM,UAAU,UACZ,MAAM,KACd,CAAC,aAAa,EAAE,gBAAgB,CAKlC,CAAC;AAEF,eAAO,MAAM,WAAW,8BAGrB;IACC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;CACzB,KAAG,GAAG,CAAC,SAAS,CAiBhB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parseScopes.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseScopes.test.d.ts","sourceRoot":"","sources":["../../../src/authorization/parseScopes.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import { type MemberAbility } from './types';
2
+ type BuilderOptions = {
3
+ organizationUuid: string;
4
+ projectUuid: string;
5
+ userUuid?: string;
6
+ scopes: string[];
7
+ isEnterprise: boolean;
8
+ organizationRole: string;
9
+ permissionsConfig?: {
10
+ pat: {
11
+ enabled: boolean;
12
+ allowedOrgRoles: string[];
13
+ };
14
+ };
15
+ };
16
+ /**
17
+ * Build a complete CASL ability from scope names and context
18
+ * @param context - Context containing organization, project, user, and space access information
19
+ * @returns CASL Ability with applied permissions
20
+ */
21
+ export declare const buildAbilityFromScopes: (context: BuilderOptions) => MemberAbility;
22
+ export {};
23
+ //# sourceMappingURL=scopeAbilityBuilder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeAbilityBuilder.d.ts","sourceRoot":"","sources":["../../../src/authorization/scopeAbilityBuilder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAoD7C,KAAK,cAAc,GAAG;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE;QAChB,GAAG,EAAE;YACD,OAAO,EAAE,OAAO,CAAC;YACjB,eAAe,EAAE,MAAM,EAAE,CAAC;SAC7B,CAAC;KACL,CAAC;CACL,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,YACtB,cAAc,KACxB,aAcF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=scopeAbilityBuilder.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopeAbilityBuilder.test.d.ts","sourceRoot":"","sources":["../../../src/authorization/scopeAbilityBuilder.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { type Scope, type ScopeName } from '../types/scopes';
2
+ export declare const getScopes: ({ isEnterprise }?: {
3
+ isEnterprise?: boolean | undefined;
4
+ }) => Scope[];
5
+ export declare const getAllScopeMap: ({ isEnterprise }?: {
6
+ isEnterprise?: boolean | undefined;
7
+ }) => Record<ScopeName, Scope>;
8
+ //# sourceMappingURL=scopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/authorization/scopes.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,KAAK,EAGV,KAAK,SAAS,EACjB,MAAM,iBAAiB,CAAC;AAmoBzB,eAAO,MAAM,SAAS;;MAAoC,KAAK,EACX,CAAC;AAErD,eAAO,MAAM,cAAc;;MAAoC,MAAM,CACjE,SAAS,EACT,KAAK,CAQJ,CAAC"}
@@ -1,4 +1,3 @@
1
- import { type SnakeCase } from 'type-fest';
2
1
  import { type AbilityAction, type CaslSubjectNames } from '../authorization/types';
3
2
  /**
4
3
  * Scope groups to organize permissions in the UI for admins.
@@ -12,14 +11,38 @@ export declare enum ScopeGroup {
12
11
  AI = "ai",
13
12
  SPOTLIGHT = "spotlight"
14
13
  }
14
+ /**
15
+ * Context given to scope getCondition functions
16
+ */
17
+ export type ScopeContext = {
18
+ organizationUuid: string;
19
+ projectUuid: string;
20
+ userUuid?: string;
21
+ /** The scopes available to the current user */
22
+ scopes: Set<ScopeName>;
23
+ isEnterprise: boolean;
24
+ /** The user's role name in the organization (for dynamic permission logic) */
25
+ organizationRole: string;
26
+ /** Configuration for dynamic permissions like PAT */
27
+ permissionsConfig?: {
28
+ pat: {
29
+ enabled: boolean;
30
+ allowedOrgRoles: string[];
31
+ };
32
+ };
33
+ };
34
+ /**
35
+ * The name of the scope, based on ability and subject (e.g. "create:project")
36
+ */
37
+ export type ScopeName = `${AbilityAction}:${CaslSubjectNames}`;
15
38
  /**
16
39
  * A scope defines a specific permission in the system
17
40
  */
18
41
  export type Scope = {
19
42
  /**
20
- * The name of the scope, based on ability and subject (e.g. "create:project")
43
+ * The name of the scope, based on ability and subject (e.g. "create:Project")
21
44
  */
22
- name: Lowercase<`${AbilityAction}:${SnakeCase<CaslSubjectNames>}`>;
45
+ name: ScopeName;
23
46
  /**
24
47
  * A helpful description of the permission
25
48
  */
@@ -32,5 +55,9 @@ export type Scope = {
32
55
  * The grouping from the ScopeGroup enum
33
56
  */
34
57
  group: ScopeGroup;
58
+ /**
59
+ * Get the conditions to be applied to the CASL ability derived from the scope
60
+ */
61
+ getConditions?: (context: ScopeContext) => Record<string, unknown>[];
35
62
  };
36
63
  //# sourceMappingURL=scopes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/types/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,oBAAY,UAAU;IAClB,OAAO,YAAY;IACnB,kBAAkB,uBAAuB;IACzC,uBAAuB,4BAA4B;IACnD,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,EAAE,OAAO;IACT,SAAS,cAAc;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAChB;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC,GAAG,aAAa,IAAI,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IACnE;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../../../src/types/scopes.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACxB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,oBAAY,UAAU;IAClB,OAAO,YAAY;IACnB,kBAAkB,uBAAuB;IACzC,uBAAuB,4BAA4B;IACnD,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,EAAE,OAAO;IACT,SAAS,cAAc;CAC1B;AAED;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,gBAAgB,EAAE,MAAM,CAAC;IACzB,qDAAqD;IACrD,iBAAiB,CAAC,EAAE;QAChB,GAAG,EAAE;YACD,OAAO,EAAE,OAAO,CAAC;YACjB,eAAe,EAAE,MAAM,EAAE,CAAC;SAC7B,CAAC;KACL,CAAC;CACL,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,aAAa,IAAI,gBAAgB,EAAE,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,KAAK,GAAG;IAChB;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,UAAU,CAAC;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;CACxE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1930.3",
3
+ "version": "0.1931.0",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -1,5 +0,0 @@
1
- import { type Scope } from '../../types/scopes';
2
- export declare const getScopes: ({ isEnterprise }?: {
3
- isEnterprise?: boolean | undefined;
4
- }) => Scope[];
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/authorization/scopes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,oBAAoB,CAAC;AAwX5D,eAAO,MAAM,SAAS;;MAAoC,KAAK,EACX,CAAC"}
@@ -1,372 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getScopes = void 0;
4
- const scopes_1 = require("../../types/scopes");
5
- const scopes = [
6
- {
7
- name: 'view:dashboard',
8
- description: 'View dashboards',
9
- isEnterprise: false,
10
- group: scopes_1.ScopeGroup.CONTENT,
11
- },
12
- {
13
- name: 'manage:dashboard',
14
- description: 'Create, edit, and delete dashboards',
15
- isEnterprise: false,
16
- group: scopes_1.ScopeGroup.CONTENT,
17
- },
18
- {
19
- name: 'view:saved_chart',
20
- description: 'View saved charts',
21
- isEnterprise: false,
22
- group: scopes_1.ScopeGroup.CONTENT,
23
- },
24
- {
25
- name: 'manage:saved_chart',
26
- description: 'Create, edit, and delete saved charts',
27
- isEnterprise: false,
28
- group: scopes_1.ScopeGroup.CONTENT,
29
- },
30
- {
31
- name: 'view:space',
32
- description: 'View spaces',
33
- isEnterprise: false,
34
- group: scopes_1.ScopeGroup.CONTENT,
35
- },
36
- {
37
- name: 'create:space',
38
- description: 'Create new spaces',
39
- isEnterprise: false,
40
- group: scopes_1.ScopeGroup.CONTENT,
41
- },
42
- {
43
- name: 'manage:space',
44
- description: 'Edit and delete spaces',
45
- isEnterprise: false,
46
- group: scopes_1.ScopeGroup.CONTENT,
47
- },
48
- {
49
- name: 'view:dashboard_comments',
50
- description: 'View dashboard comments',
51
- isEnterprise: false,
52
- group: scopes_1.ScopeGroup.CONTENT,
53
- },
54
- {
55
- name: 'create:dashboard_comments',
56
- description: 'Create dashboard comments',
57
- isEnterprise: false,
58
- group: scopes_1.ScopeGroup.CONTENT,
59
- },
60
- {
61
- name: 'manage:dashboard_comments',
62
- description: 'Edit and delete dashboard comments',
63
- isEnterprise: false,
64
- group: scopes_1.ScopeGroup.CONTENT,
65
- },
66
- {
67
- name: 'view:tags',
68
- description: 'View tags',
69
- isEnterprise: false,
70
- group: scopes_1.ScopeGroup.CONTENT,
71
- },
72
- {
73
- name: 'manage:tags',
74
- description: 'Create, edit, and delete tags',
75
- isEnterprise: false,
76
- group: scopes_1.ScopeGroup.CONTENT,
77
- },
78
- {
79
- name: 'view:pinned_items',
80
- description: 'View pinned items',
81
- isEnterprise: false,
82
- group: scopes_1.ScopeGroup.CONTENT,
83
- },
84
- {
85
- name: 'manage:pinned_items',
86
- description: 'Pin and unpin items',
87
- isEnterprise: false,
88
- group: scopes_1.ScopeGroup.CONTENT,
89
- },
90
- {
91
- name: 'promote:saved_chart',
92
- description: 'Promote saved charts to spaces',
93
- isEnterprise: false,
94
- group: scopes_1.ScopeGroup.CONTENT,
95
- },
96
- {
97
- name: 'promote:dashboard',
98
- description: 'Promote dashboards to spaces',
99
- isEnterprise: false,
100
- group: scopes_1.ScopeGroup.CONTENT,
101
- },
102
- // Project Management Scopes
103
- {
104
- name: 'view:project',
105
- description: 'View project details',
106
- isEnterprise: false,
107
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
108
- },
109
- {
110
- name: 'create:project',
111
- description: 'Create new projects',
112
- isEnterprise: false,
113
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
114
- },
115
- {
116
- name: 'update:project',
117
- description: 'Update project settings',
118
- isEnterprise: false,
119
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
120
- },
121
- {
122
- name: 'delete:project',
123
- description: 'Delete projects',
124
- isEnterprise: false,
125
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
126
- },
127
- {
128
- name: 'manage:project',
129
- description: 'Full project management permissions',
130
- isEnterprise: false,
131
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
132
- },
133
- {
134
- name: 'manage:compile_project',
135
- description: 'Compile and refresh dbt projects',
136
- isEnterprise: false,
137
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
138
- },
139
- {
140
- name: 'manage:validation',
141
- description: 'Manage data validation rules',
142
- isEnterprise: false,
143
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
144
- },
145
- {
146
- name: 'create:scheduled_deliveries',
147
- description: 'Create scheduled deliveries',
148
- isEnterprise: false,
149
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
150
- },
151
- {
152
- name: 'manage:scheduled_deliveries',
153
- description: 'Manage scheduled deliveries',
154
- isEnterprise: false,
155
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
156
- },
157
- {
158
- name: 'view:analytics',
159
- description: 'View usage analytics',
160
- isEnterprise: false,
161
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
162
- },
163
- {
164
- name: 'create:job',
165
- description: 'Create background jobs',
166
- isEnterprise: false,
167
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
168
- },
169
- {
170
- name: 'view:job',
171
- description: 'View job details',
172
- isEnterprise: false,
173
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
174
- },
175
- {
176
- name: 'manage:job',
177
- description: 'Manage background jobs',
178
- isEnterprise: false,
179
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
180
- },
181
- {
182
- name: 'view:job_status',
183
- description: 'View job status',
184
- isEnterprise: false,
185
- group: scopes_1.ScopeGroup.PROJECT_MANAGEMENT,
186
- },
187
- // Organization Management Scopes
188
- {
189
- name: 'view:organization',
190
- description: 'View organization details',
191
- isEnterprise: false,
192
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
193
- },
194
- {
195
- name: 'manage:organization',
196
- description: 'Manage organization settings',
197
- isEnterprise: false,
198
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
199
- },
200
- {
201
- name: 'view:organization_member_profile',
202
- description: 'View organization member profiles',
203
- isEnterprise: false,
204
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
205
- },
206
- {
207
- name: 'manage:organization_member_profile',
208
- description: 'Manage organization member profiles and roles',
209
- isEnterprise: false,
210
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
211
- },
212
- {
213
- name: 'manage:invite_link',
214
- description: 'Create and manage invite links',
215
- isEnterprise: false,
216
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
217
- },
218
- {
219
- name: 'manage:group',
220
- description: 'Manage user groups',
221
- isEnterprise: false,
222
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
223
- },
224
- {
225
- name: 'manage:content_as_code',
226
- description: 'Manage content as code features',
227
- isEnterprise: true,
228
- group: scopes_1.ScopeGroup.ORGANIZATION_MANAGEMENT,
229
- },
230
- // Data Scopes
231
- {
232
- name: 'view:underlying_data',
233
- description: 'View underlying data in charts',
234
- isEnterprise: false,
235
- group: scopes_1.ScopeGroup.DATA,
236
- },
237
- {
238
- name: 'view:semantic_viewer',
239
- description: 'View data in semantic viewer',
240
- isEnterprise: false,
241
- group: scopes_1.ScopeGroup.DATA,
242
- },
243
- {
244
- name: 'manage:semantic_viewer',
245
- description: 'Create and edit semantic viewer queries',
246
- isEnterprise: false,
247
- group: scopes_1.ScopeGroup.DATA,
248
- },
249
- {
250
- name: 'manage:explore',
251
- description: 'Explore and query data',
252
- isEnterprise: false,
253
- group: scopes_1.ScopeGroup.DATA,
254
- },
255
- {
256
- name: 'manage:sql_runner',
257
- description: 'Run SQL queries directly',
258
- isEnterprise: false,
259
- group: scopes_1.ScopeGroup.DATA,
260
- },
261
- {
262
- name: 'manage:custom_sql',
263
- description: 'Create custom SQL queries',
264
- isEnterprise: false,
265
- group: scopes_1.ScopeGroup.DATA,
266
- },
267
- {
268
- name: 'manage:virtual_view',
269
- description: 'Create and manage virtual views',
270
- isEnterprise: false,
271
- group: scopes_1.ScopeGroup.DATA,
272
- },
273
- {
274
- name: 'manage:export_csv',
275
- description: 'Export data to CSV',
276
- isEnterprise: false,
277
- group: scopes_1.ScopeGroup.DATA,
278
- },
279
- {
280
- name: 'manage:change_csv_results',
281
- description: 'Modify CSV export results',
282
- isEnterprise: false,
283
- group: scopes_1.ScopeGroup.DATA,
284
- },
285
- // Sharing Scopes
286
- {
287
- name: 'export:dashboard_csv',
288
- description: 'Can export dashboards and charts to CSV',
289
- isEnterprise: false,
290
- group: scopes_1.ScopeGroup.SHARING,
291
- },
292
- {
293
- name: 'export:dashboard_image',
294
- description: 'Can export dashboards and charts to images',
295
- isEnterprise: false,
296
- group: scopes_1.ScopeGroup.SHARING,
297
- },
298
- {
299
- name: 'export:dashboard_pdf',
300
- description: 'Can export dashboards and charts to PDF',
301
- isEnterprise: false,
302
- group: scopes_1.ScopeGroup.SHARING,
303
- },
304
- // AI Agent
305
- {
306
- name: 'manage:personal_access_token',
307
- description: 'Create and manage personal access tokens',
308
- isEnterprise: true,
309
- group: scopes_1.ScopeGroup.AI,
310
- },
311
- {
312
- name: 'view:ai_agent',
313
- description: 'View AI agent features',
314
- isEnterprise: true,
315
- group: scopes_1.ScopeGroup.AI,
316
- },
317
- {
318
- name: 'manage:ai_agent',
319
- description: 'Configure AI agent settings',
320
- isEnterprise: true,
321
- group: scopes_1.ScopeGroup.AI,
322
- },
323
- {
324
- name: 'view:ai_agent_thread',
325
- description: 'View AI agent conversation threads',
326
- isEnterprise: true,
327
- group: scopes_1.ScopeGroup.AI,
328
- },
329
- {
330
- name: 'create:ai_agent_thread',
331
- description: 'Start new AI agent conversations',
332
- isEnterprise: true,
333
- group: scopes_1.ScopeGroup.AI,
334
- },
335
- {
336
- name: 'manage:ai_agent_thread',
337
- description: 'Manage AI agent conversation threads',
338
- isEnterprise: true,
339
- group: scopes_1.ScopeGroup.AI,
340
- },
341
- // Spotlight Scopes
342
- {
343
- name: 'manage:spotlight_table_config',
344
- description: 'Configure spotlight table settings',
345
- isEnterprise: true,
346
- group: scopes_1.ScopeGroup.SPOTLIGHT,
347
- },
348
- {
349
- name: 'view:spotlight_table_config',
350
- description: 'View spotlight table configuration',
351
- isEnterprise: true,
352
- group: scopes_1.ScopeGroup.SPOTLIGHT,
353
- },
354
- {
355
- name: 'view:metrics_tree',
356
- description: 'View metrics tree',
357
- isEnterprise: true,
358
- group: scopes_1.ScopeGroup.SPOTLIGHT,
359
- },
360
- {
361
- name: 'manage:metrics_tree',
362
- description: 'Manage metrics tree configuration',
363
- isEnterprise: true,
364
- group: scopes_1.ScopeGroup.SPOTLIGHT,
365
- },
366
- ];
367
- const getNonEnterpriseScopes = () => scopes.filter((scope) => !scope.isEnterprise);
368
- // We will be using this
369
- // eslint-disable-next-line import/export
370
- const getScopes = ({ isEnterprise = false } = {}) => isEnterprise ? scopes : getNonEnterpriseScopes();
371
- exports.getScopes = getScopes;
372
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/authorization/scopes/index.ts"],"names":[],"mappings":";;;AAAA,+CAA4D;AAE5D,MAAM,MAAM,GAAY;IACpB;QACI,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,iBAAiB;QAC9B,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,mBAAU,CAAC,OAAO;KAC5B;IACD;QACI,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,qCAAqC;QAClD,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,mBAAU,CAAC,OAAO;KAC5B;IACD;QACI,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE,mBAAmB;QAChC,YAAY,EAAE,KAAK;QACnB,KAAK,EAAE,mBAAU,CAAC,OAAO;KAC5B;IACD;QACI,IA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CAAC,MAAM,CAAC,CAAC,CAAC,sBAAsB,EAAE,CAAC;AADxC,QAAA,SAAS,aAC+B"}
@@ -1,5 +0,0 @@
1
- import { type Scope } from '../../types/scopes';
2
- export declare const getScopes: ({ isEnterprise }?: {
3
- isEnterprise?: boolean | undefined;
4
- }) => Scope[];
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/authorization/scopes/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,oBAAoB,CAAC;AAwX5D,eAAO,MAAM,SAAS;;MAAoC,KAAK,EACX,CAAC"}