@mondaydotcomorg/monday-authorization 3.7.0-feat-shaime-support-entity-attributes-4-49e1de0 → 3.7.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.
- package/README.md +7 -1
- package/dist/authorization-attributes-ms-service.d.ts +20 -40
- package/dist/authorization-attributes-ms-service.d.ts.map +1 -1
- package/dist/authorization-attributes-ms-service.js +48 -103
- package/dist/authorization-attributes-service.d.ts +12 -10
- package/dist/authorization-attributes-service.d.ts.map +1 -1
- package/dist/authorization-attributes-service.js +17 -15
- package/dist/authorization-attributes-sns-service.d.ts +37 -44
- package/dist/authorization-attributes-sns-service.d.ts.map +1 -1
- package/dist/authorization-attributes-sns-service.js +53 -90
- package/dist/authorization-service.d.ts +0 -1
- package/dist/authorization-service.d.ts.map +1 -1
- package/dist/authorization-service.js +2 -22
- package/dist/base-attribute-assignment.d.ts +6 -7
- package/dist/base-attribute-assignment.d.ts.map +1 -1
- package/dist/base-attribute-assignment.js +5 -7
- package/dist/base-authorization-attributes-service.d.ts +32 -0
- package/dist/base-authorization-attributes-service.d.ts.map +1 -0
- package/dist/base-authorization-attributes-service.js +63 -0
- package/dist/entity-attribute-assignment.d.ts +4 -8
- package/dist/entity-attribute-assignment.d.ts.map +1 -1
- package/dist/entity-attribute-assignment.js +3 -4
- package/dist/esm/authorization-attributes-ms-service.d.ts +20 -40
- package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-ms-service.mjs +48 -103
- package/dist/esm/authorization-attributes-service.d.ts +12 -10
- package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-service.mjs +17 -15
- package/dist/esm/authorization-attributes-sns-service.d.ts +37 -44
- package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-sns-service.mjs +53 -90
- package/dist/esm/authorization-service.d.ts +0 -1
- package/dist/esm/authorization-service.d.ts.map +1 -1
- package/dist/esm/authorization-service.mjs +3 -23
- package/dist/esm/base-attribute-assignment.d.ts +6 -7
- package/dist/esm/base-attribute-assignment.d.ts.map +1 -1
- package/dist/esm/base-attribute-assignment.mjs +5 -7
- package/dist/esm/base-authorization-attributes-service.d.ts +32 -0
- package/dist/esm/base-authorization-attributes-service.d.ts.map +1 -0
- package/dist/esm/base-authorization-attributes-service.mjs +61 -0
- package/dist/esm/entity-attribute-assignment.d.ts +4 -8
- package/dist/esm/entity-attribute-assignment.d.ts.map +1 -1
- package/dist/esm/entity-attribute-assignment.mjs +3 -4
- package/dist/esm/index.d.ts +6 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.mjs +6 -0
- package/dist/esm/resource-attribute-assignment.d.ts +3 -7
- package/dist/esm/resource-attribute-assignment.d.ts.map +1 -1
- package/dist/esm/resource-attribute-assignment.mjs +8 -2
- package/dist/esm/resource-attributes-constants.d.ts +12 -10
- package/dist/esm/resource-attributes-constants.d.ts.map +1 -1
- package/dist/esm/resource-attributes-constants.mjs +4 -2
- package/dist/esm/testKit/index.d.ts +4 -4
- package/dist/esm/testKit/index.d.ts.map +1 -1
- package/dist/esm/types/authorization-attributes-contracts.d.ts +7 -21
- package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +4 -3
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/utils/assignment-schema.d.ts +51 -0
- package/dist/esm/utils/assignment-schema.d.ts.map +1 -0
- package/dist/esm/utils/assignment-schema.mjs +54 -0
- package/dist/esm/utils/resource-schema.d.ts +9 -0
- package/dist/esm/utils/resource-schema.d.ts.map +1 -0
- package/dist/esm/utils/resource-schema.mjs +16 -0
- package/dist/esm/utils/validation.d.ts +11 -28
- package/dist/esm/utils/validation.d.ts.map +1 -1
- package/dist/esm/utils/validation.mjs +61 -118
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -0
- package/dist/resource-attribute-assignment.d.ts +3 -7
- package/dist/resource-attribute-assignment.d.ts.map +1 -1
- package/dist/resource-attribute-assignment.js +8 -2
- package/dist/resource-attributes-constants.d.ts +12 -10
- package/dist/resource-attributes-constants.d.ts.map +1 -1
- package/dist/resource-attributes-constants.js +4 -2
- package/dist/testKit/index.d.ts +4 -4
- package/dist/testKit/index.d.ts.map +1 -1
- package/dist/types/authorization-attributes-contracts.d.ts +7 -21
- package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/types/general.d.ts +4 -3
- package/dist/types/general.d.ts.map +1 -1
- package/dist/utils/assignment-schema.d.ts +51 -0
- package/dist/utils/assignment-schema.d.ts.map +1 -0
- package/dist/utils/assignment-schema.js +63 -0
- package/dist/utils/resource-schema.d.ts +9 -0
- package/dist/utils/resource-schema.d.ts.map +1 -0
- package/dist/utils/resource-schema.js +22 -0
- package/dist/utils/validation.d.ts +11 -28
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +61 -118
- package/package.json +2 -3
- package/src/authorization-attributes-ms-service.ts +92 -154
- package/src/authorization-attributes-service.ts +18 -16
- package/src/authorization-attributes-sns-service.ts +132 -131
- package/src/authorization-service.ts +3 -28
- package/src/base-attribute-assignment.ts +10 -26
- package/src/base-authorization-attributes-service.ts +90 -0
- package/src/entity-attribute-assignment.ts +7 -6
- package/src/index.ts +17 -0
- package/src/resource-attribute-assignment.ts +13 -10
- package/src/resource-attributes-constants.ts +4 -2
- package/src/testKit/index.ts +5 -5
- package/src/types/authorization-attributes-contracts.ts +7 -27
- package/src/types/general.ts +4 -3
- package/src/utils/assignment-schema.ts +56 -0
- package/src/utils/resource-schema.ts +16 -0
- package/src/utils/validation.ts +90 -137
- package/dist/esm/types/authorization-attributes-service.interface.d.ts +0 -57
- package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +0 -1
- package/dist/esm/types/authorization-attributes-service.interface.mjs +0 -1
- package/dist/types/authorization-attributes-service.interface.d.ts +0 -57
- package/dist/types/authorization-attributes-service.interface.d.ts.map +0 -1
- package/dist/types/authorization-attributes-service.interface.js +0 -1
- package/src/types/authorization-attributes-service.interface.ts +0 -101
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
1
|
+
const RESOURCE_ATTRIBUTES_CONSTANTS = Object.freeze({
|
|
2
2
|
ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
3
3
|
ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
|
|
4
4
|
},
|
|
@@ -9,7 +9,7 @@ const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
|
9
9
|
IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
|
|
10
10
|
SYSTEM_ENTITY_TYPE: 'system_entity_type',
|
|
11
11
|
},
|
|
12
|
-
};
|
|
12
|
+
});
|
|
13
13
|
var ResourceType;
|
|
14
14
|
(function (ResourceType) {
|
|
15
15
|
ResourceType["Account"] = "account";
|
|
@@ -21,6 +21,8 @@ var ResourceType;
|
|
|
21
21
|
ResourceType["Overview"] = "overview";
|
|
22
22
|
ResourceType["Document"] = "document";
|
|
23
23
|
ResourceType["Crm"] = "crm";
|
|
24
|
+
ResourceType["Feature"] = "feature";
|
|
25
|
+
ResourceType["POST"] = "post";
|
|
24
26
|
})(ResourceType || (ResourceType = {}));
|
|
25
27
|
// Define the array of strings and use 'as const' to make its contents literal types
|
|
26
28
|
const RESOURCE_TYPES = Object.freeze(Object.values(ResourceType));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { BaseRequest, BaseResponse, ContextGetter, Resource, ResourceGetter } from '../types/general';
|
|
1
|
+
import { Action, BaseRequest, BaseResponse, ContextGetter, Resource, ResourceGetter } from '../types/general';
|
|
2
2
|
import type { NextFunction } from 'express';
|
|
3
3
|
export type TestPermittedAction = {
|
|
4
4
|
accountId: number;
|
|
5
5
|
userId: number;
|
|
6
6
|
resources: Resource[];
|
|
7
|
-
action:
|
|
7
|
+
action: Action;
|
|
8
8
|
};
|
|
9
|
-
export declare const addTestPermittedAction: (accountId: number, userId: number, resources: Resource[], action:
|
|
9
|
+
export declare const addTestPermittedAction: (accountId: number, userId: number, resources: Resource[], action: Action) => void;
|
|
10
10
|
export declare const clearTestPermittedActions: () => void;
|
|
11
|
-
export declare const getTestAuthorizationMiddleware: (action:
|
|
11
|
+
export declare const getTestAuthorizationMiddleware: (action: Action, resourceGetter: ResourceGetter, contextGetter?: ContextGetter) => (request: BaseRequest, response: BaseResponse, next: NextFunction) => Promise<void>;
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testKit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testKit/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAG9G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,EAAE,QAAQ,MAAM,EAAE,WAAW,QAAQ,EAAE,EAAE,QAAQ,MAAM,SAE9G,CAAC;AAEF,eAAO,MAAM,yBAAyB,YAErC,CAAC;AA4BF,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EACd,gBAAgB,cAAc,EAC9B,gBAAgB,aAAa,MAG3B,SAAS,WAAW,EACpB,UAAU,YAAY,EACtB,MAAM,YAAY,KACjB,OAAO,CAAC,IAAI,CAYhB,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Resource } from './general';
|
|
2
1
|
import type { EntityType } from '../entity-attributes-constants';
|
|
3
2
|
import type { ResourceType } from '../resource-attributes-constants';
|
|
4
|
-
interface AttributeAssignment {
|
|
3
|
+
export interface AttributeAssignment {
|
|
5
4
|
key: string;
|
|
6
5
|
value: string;
|
|
7
6
|
}
|
|
@@ -9,35 +8,22 @@ export interface ResourceAttributeAssignment extends AttributeAssignment {
|
|
|
9
8
|
resourceId: number;
|
|
10
9
|
resourceType: ResourceType;
|
|
11
10
|
}
|
|
11
|
+
export type ResourceAttributeDeleteAssignment = Omit<ResourceAttributeAssignment, 'value'>;
|
|
12
12
|
export interface EntityAttributeAssignment extends AttributeAssignment {
|
|
13
13
|
entityId: number;
|
|
14
14
|
entityType: EntityType;
|
|
15
15
|
}
|
|
16
|
-
export
|
|
17
|
-
resourceType: Resource['type'];
|
|
18
|
-
resourceId: Resource['id'];
|
|
19
|
-
key: string;
|
|
20
|
-
}
|
|
21
|
-
export interface EntityAttributeDelete {
|
|
22
|
-
entityType: EntityType;
|
|
23
|
-
entityId: number;
|
|
24
|
-
key: string;
|
|
25
|
-
}
|
|
16
|
+
export type EntityAttributeDeleteAssignment = Omit<EntityAttributeAssignment, 'value'>;
|
|
26
17
|
export declare enum AttributeOperation {
|
|
27
18
|
UPSERT = "upsert",
|
|
28
19
|
DELETE = "delete"
|
|
29
20
|
}
|
|
30
|
-
export interface
|
|
31
|
-
attributes: ResourceAttributeAssignment[];
|
|
32
|
-
}
|
|
33
|
-
export interface EntityAttributeResponse {
|
|
34
|
-
attributes: EntityAttributeAssignment[];
|
|
35
|
-
}
|
|
36
|
-
export interface ResourceAttributeOperation extends ResourceAttributeAssignment {
|
|
21
|
+
export interface ResourceAttributeUpsertOperation extends ResourceAttributeAssignment {
|
|
37
22
|
operationType: AttributeOperation;
|
|
38
23
|
}
|
|
39
|
-
export
|
|
24
|
+
export type ResourceAttributeDeleteOperation = Omit<ResourceAttributeUpsertOperation, 'value'>;
|
|
25
|
+
export interface EntityAttributeUpsertOperation extends EntityAttributeAssignment {
|
|
40
26
|
operationType: AttributeOperation;
|
|
41
27
|
}
|
|
42
|
-
export
|
|
28
|
+
export type EntityAttributeDeleteOperation = Omit<EntityAttributeUpsertOperation, 'value'>;
|
|
43
29
|
//# sourceMappingURL=authorization-attributes-contracts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CAC5B;AACD,MAAM,MAAM,iCAAiC,GAAG,IAAI,CAAC,2BAA2B,EAAE,OAAO,CAAC,CAAC;AAI3F,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB;AACD,MAAM,MAAM,+BAA+B,GAAG,IAAI,CAAC,yBAAyB,EAAE,OAAO,CAAC,CAAC;AAEvF,oBAAY,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AACD,MAAM,WAAW,gCAAiC,SAAQ,2BAA2B;IACnF,aAAa,EAAE,kBAAkB,CAAC;CACnC;AACD,MAAM,MAAM,gCAAgC,GAAG,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;AAE/F,MAAM,WAAW,8BAA+B,SAAQ,yBAAyB;IAC/E,aAAa,EAAE,kBAAkB,CAAC;CACnC;AACD,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAAC,8BAA8B,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Request, Response } from 'express';
|
|
2
|
+
import type { ResourceType } from '../resource-attributes-constants';
|
|
2
3
|
export interface Resource {
|
|
3
|
-
id
|
|
4
|
-
type:
|
|
4
|
+
id: number;
|
|
5
|
+
type: ResourceType;
|
|
5
6
|
wrapperData?: object;
|
|
6
7
|
}
|
|
7
8
|
export type Action = string;
|
|
@@ -11,7 +12,7 @@ export interface Context {
|
|
|
11
12
|
}
|
|
12
13
|
export interface AuthorizationObject {
|
|
13
14
|
resource_id?: Resource['id'];
|
|
14
|
-
resource_type:
|
|
15
|
+
resource_type: string;
|
|
15
16
|
wrapper_data?: Resource['wrapperData'];
|
|
16
17
|
action: Action;
|
|
17
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/types/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/types/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;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
+
} & {
|
|
7
|
+
value: any;
|
|
8
|
+
} & {
|
|
9
|
+
key: any;
|
|
10
|
+
} & {
|
|
11
|
+
entityId: any;
|
|
12
|
+
} & {
|
|
13
|
+
entityType: any;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const entityDeleteAssignmentSchema: import("ajv").ValidateFunction<{
|
|
16
|
+
key: any;
|
|
17
|
+
entityId: any;
|
|
18
|
+
entityType: any;
|
|
19
|
+
} & {
|
|
20
|
+
key: any;
|
|
21
|
+
} & {
|
|
22
|
+
entityId: any;
|
|
23
|
+
} & {
|
|
24
|
+
entityType: any;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const resourceDeleteAssignmentSchema: import("ajv").ValidateFunction<{
|
|
27
|
+
resourceId: any;
|
|
28
|
+
resourceType: any;
|
|
29
|
+
key: any;
|
|
30
|
+
} & {
|
|
31
|
+
resourceId: any;
|
|
32
|
+
} & {
|
|
33
|
+
resourceType: any;
|
|
34
|
+
} & {
|
|
35
|
+
key: any;
|
|
36
|
+
}>;
|
|
37
|
+
export declare const resourceUpsertAssignmentSchema: import("ajv").ValidateFunction<{
|
|
38
|
+
value: any;
|
|
39
|
+
resourceId: any;
|
|
40
|
+
resourceType: any;
|
|
41
|
+
key: any;
|
|
42
|
+
} & {
|
|
43
|
+
value: any;
|
|
44
|
+
} & {
|
|
45
|
+
resourceId: any;
|
|
46
|
+
} & {
|
|
47
|
+
resourceType: any;
|
|
48
|
+
} & {
|
|
49
|
+
key: any;
|
|
50
|
+
}>;
|
|
51
|
+
//# sourceMappingURL=assignment-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assignment-schema.d.ts","sourceRoot":"","sources":["../../../src/utils/assignment-schema.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;EAWvC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;;;;EAUvC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;EAUzC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;EAWzC,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import { EntityType } from '../entity-attributes-constants.mjs';
|
|
3
|
+
import { ResourceType } from '../resource-attributes-constants.mjs';
|
|
4
|
+
import { AttributeOperation } from '../types/authorization-attributes-contracts.mjs';
|
|
5
|
+
|
|
6
|
+
const ajv = new Ajv({ allErrors: true });
|
|
7
|
+
const entityUpsertAssignmentSchema = ajv.compile({
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
entityId: { type: 'number', multipleOf: 1 },
|
|
11
|
+
entityType: { type: 'string', enum: Object.values(EntityType) },
|
|
12
|
+
key: { type: 'string', minLength: 1 },
|
|
13
|
+
value: { type: 'string', minLength: 1 },
|
|
14
|
+
operationType: { type: 'string', enum: Object.values(AttributeOperation) },
|
|
15
|
+
},
|
|
16
|
+
required: ['entityId', 'entityType', 'key', 'value'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
});
|
|
19
|
+
const entityDeleteAssignmentSchema = ajv.compile({
|
|
20
|
+
type: 'object',
|
|
21
|
+
properties: {
|
|
22
|
+
entityId: { type: 'number', multipleOf: 1 },
|
|
23
|
+
entityType: { type: 'string', enum: Object.values(EntityType) },
|
|
24
|
+
key: { type: 'string', minLength: 1 },
|
|
25
|
+
operationType: { type: 'string', enum: Object.values(AttributeOperation) },
|
|
26
|
+
},
|
|
27
|
+
required: ['entityId', 'entityType', 'key'],
|
|
28
|
+
additionalProperties: false,
|
|
29
|
+
});
|
|
30
|
+
const resourceDeleteAssignmentSchema = ajv.compile({
|
|
31
|
+
type: 'object',
|
|
32
|
+
properties: {
|
|
33
|
+
resourceId: { type: 'number', multipleOf: 1 },
|
|
34
|
+
resourceType: { type: 'string', enum: Object.values(ResourceType) },
|
|
35
|
+
key: { type: 'string', minLength: 1 },
|
|
36
|
+
operationType: { type: 'string', enum: Object.values(AttributeOperation) },
|
|
37
|
+
},
|
|
38
|
+
required: ['resourceId', 'resourceType', 'key'],
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
});
|
|
41
|
+
const resourceUpsertAssignmentSchema = ajv.compile({
|
|
42
|
+
type: 'object',
|
|
43
|
+
properties: {
|
|
44
|
+
resourceId: { type: 'number', multipleOf: 1 },
|
|
45
|
+
resourceType: { type: 'string', enum: Object.values(ResourceType) },
|
|
46
|
+
key: { type: 'string', minLength: 1 },
|
|
47
|
+
value: { type: 'string', minLength: 1 },
|
|
48
|
+
operationType: { type: 'string', enum: Object.values(AttributeOperation) },
|
|
49
|
+
},
|
|
50
|
+
required: ['resourceId', 'resourceType', 'key', 'value'],
|
|
51
|
+
additionalProperties: false,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export { entityDeleteAssignmentSchema, entityUpsertAssignmentSchema, resourceDeleteAssignmentSchema, resourceUpsertAssignmentSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-schema.d.ts","sourceRoot":"","sources":["../../../src/utils/resource-schema.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,cAAc;;;;;;;EAUzB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Ajv from 'ajv';
|
|
2
|
+
import { RESOURCE_TYPES } from '../resource-attributes-constants.mjs';
|
|
3
|
+
|
|
4
|
+
const ajv = new Ajv({ allErrors: true });
|
|
5
|
+
const resourceSchema = ajv.compile({
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
id: { type: 'number', multipleOf: 1 },
|
|
9
|
+
type: { type: 'string', enum: RESOURCE_TYPES },
|
|
10
|
+
wrapperData: { type: 'object' },
|
|
11
|
+
},
|
|
12
|
+
required: ['id', 'type'],
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { resourceSchema };
|
|
@@ -1,45 +1,28 @@
|
|
|
1
|
+
import { ResourceAttributeAssignment, EntityAttributeAssignment, ResourceAttributeDeleteAssignment, EntityAttributeDeleteAssignment } from '../types/authorization-attributes-contracts';
|
|
1
2
|
import { Resource } from '../types/general';
|
|
2
3
|
/**
|
|
3
4
|
* Utility class for common validation operations using AJV
|
|
4
5
|
*/
|
|
5
6
|
export declare class ValidationUtils {
|
|
6
7
|
private static ajv;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
private static integerValidator;
|
|
9
|
+
private static stringValidator;
|
|
10
|
+
private static stringArrayValidator;
|
|
10
11
|
static validateInteger(value: number): void;
|
|
11
|
-
/**
|
|
12
|
-
* Validates that a value is a non-empty string. Throws ArgumentError on failure.
|
|
13
|
-
*/
|
|
14
12
|
static validateString(value: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Validates that a value is an array of non-empty strings. Throws ArgumentError on failure.
|
|
17
|
-
* Allows empty arrays - caller should handle early return.
|
|
18
|
-
*/
|
|
19
13
|
static validateStringArray(value: string[]): void;
|
|
14
|
+
static validateResource(resource: Resource): void;
|
|
20
15
|
/**
|
|
21
16
|
* Validates an attribute assignment object using a single AJV schema.
|
|
22
17
|
* Preserves legacy error messages for each field.
|
|
23
18
|
*/
|
|
24
|
-
static
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
attributeValue: any;
|
|
29
|
-
}, validTypes: readonly TType[], fieldNames: {
|
|
30
|
-
id: string;
|
|
31
|
-
type: string;
|
|
32
|
-
}): {
|
|
33
|
-
id: number;
|
|
34
|
-
type: TType;
|
|
35
|
-
attributeKey: string;
|
|
36
|
-
attributeValue: string;
|
|
37
|
-
};
|
|
19
|
+
static validatUpsertResourceAssignment(resource: ResourceAttributeAssignment): void;
|
|
20
|
+
static validatDeleteResourceAssignment(resource: ResourceAttributeDeleteAssignment): void;
|
|
21
|
+
static validatUpsertEntityAssignment(entity: EntityAttributeAssignment): void;
|
|
22
|
+
static validatDeleteEntityAssignment(entity: EntityAttributeDeleteAssignment): void;
|
|
38
23
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Throws ArgumentError with legacy-compatible messages.
|
|
24
|
+
* Formats AJV validation errors into a readable error message
|
|
41
25
|
*/
|
|
42
|
-
static
|
|
43
|
-
static validateArrayTypeOf<T>(attributesMessages: T[], messageClass: abstract new (...args: any[]) => T): void;
|
|
26
|
+
private static formatValidationErrors;
|
|
44
27
|
}
|
|
45
28
|
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,iCAAiC,EACjC,+BAA+B,EAChC,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAS5C;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,GAAG,CAAgC;IAElD,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAyE;IACxG,OAAO,CAAC,MAAM,CAAC,eAAe,CAAwE;IACtG,OAAO,CAAC,MAAM,CAAC,oBAAoB,CAGhC;WAEW,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;WAOpC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;WAOnC,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI;WAO1C,gBAAgB,CAAC,QAAQ,EAAE,QAAQ;IAQjD;;;OAGG;IACH,MAAM,CAAC,+BAA+B,CAAC,QAAQ,EAAE,2BAA2B,GAAG,IAAI;IAYnF,MAAM,CAAC,+BAA+B,CAAC,QAAQ,EAAE,iCAAiC,GAAG,IAAI;IAYzF,MAAM,CAAC,6BAA6B,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAU7E,MAAM,CAAC,6BAA6B,CAAC,MAAM,EAAE,+BAA+B,GAAG,IAAI;IASnF;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CActC"}
|
|
@@ -1,151 +1,94 @@
|
|
|
1
1
|
import Ajv from 'ajv';
|
|
2
2
|
import { ArgumentError } from '../errors/argument-error.mjs';
|
|
3
|
+
import { resourceUpsertAssignmentSchema, resourceDeleteAssignmentSchema, entityUpsertAssignmentSchema, entityDeleteAssignmentSchema } from './assignment-schema.mjs';
|
|
4
|
+
import { resourceSchema } from './resource-schema.mjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Utility class for common validation operations using AJV
|
|
6
8
|
*/
|
|
7
9
|
class ValidationUtils {
|
|
8
10
|
static ajv = new Ajv({ allErrors: true });
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
static integerValidator = this.ajv.compile({ type: 'number', multipleOf: 1 });
|
|
12
|
+
static stringValidator = this.ajv.compile({ type: 'string', minLength: 1 });
|
|
13
|
+
static stringArrayValidator = this.ajv.compile({
|
|
14
|
+
type: 'array',
|
|
15
|
+
items: { type: 'string' },
|
|
16
|
+
});
|
|
12
17
|
static validateInteger(value) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!isValid) {
|
|
17
|
-
throw new ArgumentError(`Value must be an integer, got: ${value}`);
|
|
18
|
+
const valid = this.integerValidator(value);
|
|
19
|
+
if (!valid) {
|
|
20
|
+
throw new ArgumentError('Invalid integer');
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
|
-
/**
|
|
21
|
-
* Validates that a value is a non-empty string. Throws ArgumentError on failure.
|
|
22
|
-
*/
|
|
23
23
|
static validateString(value) {
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
pattern: '\\S',
|
|
28
|
-
};
|
|
29
|
-
const validate = ValidationUtils.ajv.compile(non_empty_string_schema);
|
|
30
|
-
const isValid = validate(value);
|
|
31
|
-
if (!isValid) {
|
|
32
|
-
throw new ArgumentError(`Value must be a non-empty string, got: ${value}`);
|
|
24
|
+
const valid = this.stringValidator(value);
|
|
25
|
+
if (!valid) {
|
|
26
|
+
throw new ArgumentError('Invalid string');
|
|
33
27
|
}
|
|
34
28
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Validates that a value is an array of non-empty strings. Throws ArgumentError on failure.
|
|
37
|
-
* Allows empty arrays - caller should handle early return.
|
|
38
|
-
*/
|
|
39
29
|
static validateStringArray(value) {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
const validateStringArray = ValidationUtils.ajv.compile(string_array_schema);
|
|
49
|
-
const isValid = validateStringArray(value);
|
|
30
|
+
const valid = this.stringArrayValidator(value);
|
|
31
|
+
if (!valid) {
|
|
32
|
+
throw new ArgumentError('Invalid string array');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static validateResource(resource) {
|
|
36
|
+
const isValid = resourceSchema(resource);
|
|
50
37
|
if (!isValid) {
|
|
51
|
-
|
|
38
|
+
const errorMessage = this.formatValidationErrors(resourceSchema.errors);
|
|
39
|
+
throw new ArgumentError(errorMessage ? `Invalid resource: ${errorMessage}` : 'Invalid resource');
|
|
52
40
|
}
|
|
53
|
-
// Allow empty arrays to pass validation - caller should handle early return
|
|
54
|
-
// Non-empty arrays will be validated for string content above
|
|
55
41
|
}
|
|
56
42
|
/**
|
|
57
43
|
* Validates an attribute assignment object using a single AJV schema.
|
|
58
44
|
* Preserves legacy error messages for each field.
|
|
59
45
|
*/
|
|
60
|
-
static
|
|
61
|
-
const
|
|
62
|
-
type: 'object',
|
|
63
|
-
properties: {
|
|
64
|
-
id: { type: 'number', multipleOf: 1 },
|
|
65
|
-
type: { type: 'string', enum: validTypes },
|
|
66
|
-
attributeKey: { type: 'string', minLength: 1 },
|
|
67
|
-
attributeValue: { type: 'string', minLength: 1 },
|
|
68
|
-
},
|
|
69
|
-
required: ['id', 'type', 'attributeKey', 'attributeValue'],
|
|
70
|
-
additionalProperties: false,
|
|
71
|
-
};
|
|
72
|
-
const validate = this.ajv.compile(schema);
|
|
73
|
-
const valid = validate(data);
|
|
46
|
+
static validatUpsertResourceAssignment(resource) {
|
|
47
|
+
const valid = resourceUpsertAssignmentSchema(resource);
|
|
74
48
|
if (!valid) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
if (!isInteger) {
|
|
80
|
-
throw new ArgumentError(`${fieldNames.id} must be an integer, got: ${id}`);
|
|
81
|
-
}
|
|
82
|
-
// type must be within enum
|
|
83
|
-
if (typeof type !== 'string' || !validTypes.includes(type)) {
|
|
84
|
-
throw new ArgumentError(`${fieldNames.type} must be one of [${validTypes.join(', ')}], got: ${type}`);
|
|
85
|
-
}
|
|
86
|
-
// attributeKey
|
|
87
|
-
if (typeof attributeKey !== 'string') {
|
|
88
|
-
throw new ArgumentError(`attributeKey must be a string, got: ${typeof attributeKey}`);
|
|
89
|
-
}
|
|
90
|
-
if (!attributeKey) {
|
|
91
|
-
throw new ArgumentError('attributeKey must be a non-empty string');
|
|
92
|
-
}
|
|
93
|
-
// attributeValue
|
|
94
|
-
if (typeof attributeValue !== 'string') {
|
|
95
|
-
throw new ArgumentError(`attributeValue must be a string, got: ${typeof attributeValue}`);
|
|
96
|
-
}
|
|
97
|
-
if (!attributeValue) {
|
|
98
|
-
throw new ArgumentError('attributeValue must be a non-empty string');
|
|
99
|
-
}
|
|
100
|
-
// Fallback
|
|
101
|
-
throw new ArgumentError('Invalid attribute assignment');
|
|
49
|
+
const errorMessage = this.formatValidationErrors(resourceUpsertAssignmentSchema.errors);
|
|
50
|
+
throw new ArgumentError(errorMessage
|
|
51
|
+
? `Invalid resource attribute assignment: ${errorMessage}`
|
|
52
|
+
: 'Invalid resource attribute assignment');
|
|
102
53
|
}
|
|
103
|
-
return {
|
|
104
|
-
id: data.id,
|
|
105
|
-
type: data.type,
|
|
106
|
-
attributeKey: data.attributeKey,
|
|
107
|
-
attributeValue: data.attributeValue,
|
|
108
|
-
};
|
|
109
54
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
55
|
+
static validatDeleteResourceAssignment(resource) {
|
|
56
|
+
const valid = resourceDeleteAssignmentSchema(resource);
|
|
57
|
+
if (!valid) {
|
|
58
|
+
const errorMessage = this.formatValidationErrors(resourceDeleteAssignmentSchema.errors);
|
|
59
|
+
throw new ArgumentError(errorMessage
|
|
60
|
+
? `Invalid resource attribute assignment: ${errorMessage}`
|
|
61
|
+
: 'Invalid resource attribute assignment');
|
|
117
62
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
required: ['type', 'id'],
|
|
126
|
-
additionalProperties: false,
|
|
127
|
-
};
|
|
128
|
-
const validate = this.ajv.compile(schema);
|
|
129
|
-
const isValid = validate(resource);
|
|
130
|
-
if (!isValid) {
|
|
131
|
-
throw new ArgumentError('Invalid resource');
|
|
63
|
+
}
|
|
64
|
+
static validatUpsertEntityAssignment(entity) {
|
|
65
|
+
const valid = entityUpsertAssignmentSchema(entity);
|
|
66
|
+
if (!valid) {
|
|
67
|
+
const errorMessage = this.formatValidationErrors(entityUpsertAssignmentSchema.errors);
|
|
68
|
+
throw new ArgumentError(errorMessage ? `Invalid entity attribute assignment: ${errorMessage}` : 'Invalid entity attribute assignment');
|
|
132
69
|
}
|
|
133
70
|
}
|
|
134
|
-
static
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const isArrayValid = validateArray(attributesMessages);
|
|
140
|
-
if (!isArrayValid) {
|
|
141
|
-
throw new ArgumentError(`attributesMessages must be an array`);
|
|
71
|
+
static validatDeleteEntityAssignment(entity) {
|
|
72
|
+
const valid = entityDeleteAssignmentSchema(entity);
|
|
73
|
+
if (!valid) {
|
|
74
|
+
const errorMessage = this.formatValidationErrors(entityDeleteAssignmentSchema.errors);
|
|
75
|
+
throw new ArgumentError(errorMessage ? `Invalid entity attribute assignment: ${errorMessage}` : 'Invalid entity attribute assignment');
|
|
142
76
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Formats AJV validation errors into a readable error message
|
|
80
|
+
*/
|
|
81
|
+
static formatValidationErrors(errors) {
|
|
82
|
+
if (!errors || !errors.length) {
|
|
83
|
+
return '';
|
|
148
84
|
}
|
|
85
|
+
return errors
|
|
86
|
+
.map(err => {
|
|
87
|
+
const path = err.instancePath || (err.params && 'missingProperty' in err.params ? `/${err.params.missingProperty}` : '');
|
|
88
|
+
const message = err.message || 'validation failed';
|
|
89
|
+
return path ? `${path}: ${message}` : message;
|
|
90
|
+
})
|
|
91
|
+
.join('; ');
|
|
149
92
|
}
|
|
150
93
|
}
|
|
151
94
|
|
package/dist/index.d.ts
CHANGED
|
@@ -19,10 +19,16 @@ export declare function init(options?: InitOptions): Promise<void>;
|
|
|
19
19
|
export { authorizationCheckMiddleware, getAuthorizationMiddleware, skipAuthorizationMiddleware, } from './authorization-middleware';
|
|
20
20
|
export { AuthorizationService, AuthorizeResponse } from './authorization-service';
|
|
21
21
|
export { AuthorizationAttributesService } from './authorization-attributes-service';
|
|
22
|
+
export * from './resource-attributes-constants';
|
|
23
|
+
export * from './entity-attributes-constants';
|
|
24
|
+
export { ResourceAttributeAssignment } from './resource-attribute-assignment';
|
|
25
|
+
export { EntityAttributeAssignment } from './entity-attribute-assignment';
|
|
22
26
|
export { RolesService } from './roles-service';
|
|
23
27
|
export { MembershipsService } from './memberships';
|
|
24
28
|
export { AuthorizationObject, Resource, BaseRequest, ResourceGetter, ContextGetter } from './types/general';
|
|
25
29
|
export { Translation, ScopedAction, ScopedActionResponseObject, ScopedActionPermit, } from './types/scoped-actions-contracts';
|
|
26
30
|
export { CustomRole, BasicRole, RoleType, RoleCreateRequest, RoleUpdateRequest, RolesResponse } from './types/roles';
|
|
31
|
+
export { AttributeAssignment, AttributeOperation, ResourceAttributeDeleteAssignment, ResourceAttributeUpsertOperation, ResourceAttributeDeleteOperation, EntityAttributeDeleteAssignment, EntityAttributeUpsertOperation, EntityAttributeDeleteOperation, ResourceAttributeAssignment as ResourceAttributeAssignmentContract, EntityAttributeAssignment as EntityAttributeAssignmentContract, } from './types/authorization-attributes-contracts';
|
|
32
|
+
export { BaseAuthorizationAttributesService as IAuthorizationAttributesService } from './base-authorization-attributes-service';
|
|
27
33
|
export { TestKit };
|
|
28
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAGnE,OAAO,EAAqB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC,UAAU,kBAAkB;IAC1B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,CAAC,EAAE,GAAG,CAAC;IACjB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,WAAW,CAAC,EAAE,GAAG,CAAC;IAClB,sCAAsC,CAAC,EAAE,MAAM,CAAC;IAChD,OAAO,CAA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AEhI,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,15 @@ const metricsService = require('./metrics-service.js');
|
|
|
6
6
|
const testKit_index = require('./testKit/index.js');
|
|
7
7
|
const authorizationMiddleware = require('./authorization-middleware.js');
|
|
8
8
|
const authorizationAttributesService = require('./authorization-attributes-service.js');
|
|
9
|
+
const resourceAttributesConstants = require('./resource-attributes-constants.js');
|
|
10
|
+
const entityAttributesConstants = require('./entity-attributes-constants.js');
|
|
11
|
+
const resourceAttributeAssignment = require('./resource-attribute-assignment.js');
|
|
12
|
+
const entityAttributeAssignment = require('./entity-attribute-assignment.js');
|
|
9
13
|
const rolesService = require('./roles-service.js');
|
|
10
14
|
const memberships = require('./memberships.js');
|
|
11
15
|
const types_roles = require('./types/roles.js');
|
|
16
|
+
const types_authorizationAttributesContracts = require('./types/authorization-attributes-contracts.js');
|
|
17
|
+
const baseAuthorizationAttributesService = require('./base-authorization-attributes-service.js');
|
|
12
18
|
|
|
13
19
|
async function init(options = {}) {
|
|
14
20
|
if (options.prometheus) {
|
|
@@ -44,10 +50,28 @@ exports.authorizationCheckMiddleware = authorizationMiddleware.authorizationChec
|
|
|
44
50
|
exports.getAuthorizationMiddleware = authorizationMiddleware.getAuthorizationMiddleware;
|
|
45
51
|
exports.skipAuthorizationMiddleware = authorizationMiddleware.skipAuthorizationMiddleware;
|
|
46
52
|
exports.AuthorizationAttributesService = authorizationAttributesService.AuthorizationAttributesService;
|
|
53
|
+
exports.RESOURCE_ATTRIBUTES_CONSTANTS = resourceAttributesConstants.RESOURCE_ATTRIBUTES_CONSTANTS;
|
|
54
|
+
exports.RESOURCE_TYPES = resourceAttributesConstants.RESOURCE_TYPES;
|
|
55
|
+
Object.defineProperty(exports, 'ResourceType', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: () => resourceAttributesConstants.ResourceType
|
|
58
|
+
});
|
|
59
|
+
exports.ENTITY_TYPES = entityAttributesConstants.ENTITY_TYPES;
|
|
60
|
+
Object.defineProperty(exports, 'EntityType', {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: () => entityAttributesConstants.EntityType
|
|
63
|
+
});
|
|
64
|
+
exports.ResourceAttributeAssignment = resourceAttributeAssignment.ResourceAttributeAssignment;
|
|
65
|
+
exports.EntityAttributeAssignment = entityAttributeAssignment.EntityAttributeAssignment;
|
|
47
66
|
exports.RolesService = rolesService.RolesService;
|
|
48
67
|
exports.MembershipsService = memberships.MembershipsService;
|
|
49
68
|
Object.defineProperty(exports, 'RoleType', {
|
|
50
69
|
enumerable: true,
|
|
51
70
|
get: () => types_roles.RoleType
|
|
52
71
|
});
|
|
72
|
+
Object.defineProperty(exports, 'AttributeOperation', {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: () => types_authorizationAttributesContracts.AttributeOperation
|
|
75
|
+
});
|
|
76
|
+
exports.IAuthorizationAttributesService = baseAuthorizationAttributesService.BaseAuthorizationAttributesService;
|
|
53
77
|
exports.init = init;
|