@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.
- package/dist/cjs/authorization/parseScopes.d.ts +8 -0
- package/dist/cjs/authorization/parseScopes.d.ts.map +1 -0
- package/dist/cjs/authorization/parseScopes.js +27 -0
- package/dist/cjs/authorization/parseScopes.js.map +1 -0
- package/dist/cjs/authorization/parseScopes.test.d.ts +2 -0
- package/dist/cjs/authorization/parseScopes.test.d.ts.map +1 -0
- package/dist/cjs/authorization/parseScopes.test.js +109 -0
- package/dist/cjs/authorization/parseScopes.test.js.map +1 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.d.ts +23 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.d.ts.map +1 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.js +58 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.js.map +1 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.test.d.ts +2 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.test.d.ts.map +1 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.test.js +955 -0
- package/dist/cjs/authorization/scopeAbilityBuilder.test.js.map +1 -0
- package/dist/cjs/authorization/scopes.d.ts +8 -0
- package/dist/cjs/authorization/scopes.d.ts.map +1 -0
- package/dist/cjs/authorization/scopes.js +633 -0
- package/dist/cjs/authorization/scopes.js.map +1 -0
- package/dist/cjs/types/scopes.d.ts +30 -3
- package/dist/cjs/types/scopes.d.ts.map +1 -1
- package/dist/cjs/types/scopes.js.map +1 -1
- package/dist/esm/authorization/parseScopes.d.ts +8 -0
- package/dist/esm/authorization/parseScopes.d.ts.map +1 -0
- package/dist/esm/authorization/parseScopes.js +22 -0
- package/dist/esm/authorization/parseScopes.js.map +1 -0
- package/dist/esm/authorization/parseScopes.test.d.ts +2 -0
- package/dist/esm/authorization/parseScopes.test.d.ts.map +1 -0
- package/dist/esm/authorization/parseScopes.test.js +107 -0
- package/dist/esm/authorization/parseScopes.test.js.map +1 -0
- package/dist/esm/authorization/scopeAbilityBuilder.d.ts +23 -0
- package/dist/esm/authorization/scopeAbilityBuilder.d.ts.map +1 -0
- package/dist/esm/authorization/scopeAbilityBuilder.js +54 -0
- package/dist/esm/authorization/scopeAbilityBuilder.js.map +1 -0
- package/dist/esm/authorization/scopeAbilityBuilder.test.d.ts +2 -0
- package/dist/esm/authorization/scopeAbilityBuilder.test.d.ts.map +1 -0
- package/dist/esm/authorization/scopeAbilityBuilder.test.js +953 -0
- package/dist/esm/authorization/scopeAbilityBuilder.test.js.map +1 -0
- package/dist/esm/authorization/scopes.d.ts +8 -0
- package/dist/esm/authorization/scopes.d.ts.map +1 -0
- package/dist/esm/authorization/scopes.js +628 -0
- package/dist/esm/authorization/scopes.js.map +1 -0
- package/dist/esm/types/scopes.d.ts +30 -3
- package/dist/esm/types/scopes.d.ts.map +1 -1
- package/dist/esm/types/scopes.js.map +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/authorization/parseScopes.d.ts +8 -0
- package/dist/types/authorization/parseScopes.d.ts.map +1 -0
- package/dist/types/authorization/parseScopes.test.d.ts +2 -0
- package/dist/types/authorization/parseScopes.test.d.ts.map +1 -0
- package/dist/types/authorization/scopeAbilityBuilder.d.ts +23 -0
- package/dist/types/authorization/scopeAbilityBuilder.d.ts.map +1 -0
- package/dist/types/authorization/scopeAbilityBuilder.test.d.ts +2 -0
- package/dist/types/authorization/scopeAbilityBuilder.test.d.ts.map +1 -0
- package/dist/types/authorization/scopes.d.ts +8 -0
- package/dist/types/authorization/scopes.d.ts.map +1 -0
- package/dist/types/types/scopes.d.ts +30 -3
- package/dist/types/types/scopes.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/authorization/scopes/index.d.ts +0 -5
- package/dist/cjs/authorization/scopes/index.d.ts.map +0 -1
- package/dist/cjs/authorization/scopes/index.js +0 -372
- package/dist/cjs/authorization/scopes/index.js.map +0 -1
- package/dist/esm/authorization/scopes/index.d.ts +0 -5
- package/dist/esm/authorization/scopes/index.d.ts.map +0 -1
- package/dist/esm/authorization/scopes/index.js +0 -368
- package/dist/esm/authorization/scopes/index.js.map +0 -1
- package/dist/types/authorization/scopes/index.d.ts +0 -5
- package/dist/types/authorization/scopes/index.d.ts.map +0 -1
@@ -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:
|
43
|
+
* The name of the scope, based on ability and subject (e.g. "create:Project")
|
21
44
|
*/
|
22
|
-
name:
|
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,
|
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"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../../src/types/scopes.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../../src/types/scopes.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,CAAN,IAAY,UAQX;AARD,WAAY,UAAU;IAClB,iCAAmB,CAAA;IACnB,uDAAyC,CAAA;IACzC,iEAAmD,CAAA;IACnD,2BAAa,CAAA;IACb,iCAAmB,CAAA;IACnB,uBAAS,CAAA;IACT,qCAAuB,CAAA;AAC3B,CAAC,EARW,UAAU,KAAV,UAAU,QAQrB"}
|