@mondaydotcomorg/monday-authorization 3.5.0 → 3.5.1-feat-shaime-support-entity-attributes-in-authorization-sdk-d2be13e
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/attributions-service.d.ts.map +1 -1
- package/dist/attributions-service.js +1 -0
- package/dist/authorization-attributes-ms-service.d.ts +67 -0
- package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/authorization-attributes-ms-service.js +256 -0
- package/dist/authorization-attributes-sns-service.d.ts +85 -0
- package/dist/authorization-attributes-sns-service.d.ts.map +1 -0
- package/dist/authorization-attributes-sns-service.js +203 -0
- package/dist/base-attribute-assignment.d.ts +18 -0
- package/dist/base-attribute-assignment.d.ts.map +1 -0
- package/dist/base-attribute-assignment.js +43 -0
- package/dist/clients/graph-api.d.ts.map +1 -1
- package/dist/clients/graph-api.js +1 -0
- package/dist/constants/sns.d.ts +12 -2
- package/dist/constants/sns.d.ts.map +1 -1
- package/dist/constants/sns.js +22 -2
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/entity-attribute-assignment.d.ts +24 -0
- package/dist/entity-attribute-assignment.d.ts.map +1 -0
- package/dist/entity-attribute-assignment.js +36 -0
- package/dist/entity-attributes-constants.d.ts +7 -0
- package/dist/entity-attributes-constants.d.ts.map +1 -0
- package/dist/entity-attributes-constants.js +9 -0
- package/dist/errors/argument-error.d.ts +4 -0
- package/dist/errors/argument-error.d.ts.map +1 -0
- package/dist/errors/argument-error.js +11 -0
- package/dist/esm/attributions-service.d.ts.map +1 -1
- package/dist/esm/attributions-service.mjs +1 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts +67 -0
- package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
- package/dist/esm/authorization-attributes-ms-service.mjs +254 -0
- package/dist/esm/authorization-attributes-sns-service.d.ts +85 -0
- package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -0
- package/dist/esm/authorization-attributes-sns-service.mjs +197 -0
- package/dist/esm/base-attribute-assignment.d.ts +18 -0
- package/dist/esm/base-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/base-attribute-assignment.mjs +41 -0
- package/dist/esm/clients/graph-api.d.ts.map +1 -1
- package/dist/esm/clients/graph-api.mjs +2 -1
- package/dist/esm/constants/sns.d.ts +12 -2
- package/dist/esm/constants/sns.d.ts.map +1 -1
- package/dist/esm/constants/sns.mjs +17 -3
- package/dist/esm/constants.d.ts +3 -0
- package/dist/esm/constants.d.ts.map +1 -1
- package/dist/esm/constants.mjs +5 -1
- package/dist/esm/entity-attribute-assignment.d.ts +24 -0
- package/dist/esm/entity-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/entity-attribute-assignment.mjs +34 -0
- package/dist/esm/entity-attributes-constants.d.ts +7 -0
- package/dist/esm/entity-attributes-constants.d.ts.map +1 -0
- package/dist/esm/entity-attributes-constants.mjs +7 -0
- package/dist/esm/errors/argument-error.d.ts +4 -0
- package/dist/esm/errors/argument-error.d.ts.map +1 -0
- package/dist/esm/errors/argument-error.mjs +9 -0
- package/dist/esm/index.d.ts +9 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.mjs +7 -1
- package/dist/esm/resource-attribute-assignment.d.ts +24 -0
- package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/esm/resource-attribute-assignment.mjs +34 -0
- package/dist/esm/resource-attributes-constants.d.ts +25 -0
- package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
- package/dist/esm/resource-attributes-constants.mjs +25 -0
- package/dist/esm/roles-service.d.ts +1 -1
- package/dist/esm/roles-service.mjs +1 -1
- package/dist/esm/types/authorization-attributes-contracts.d.ts +36 -4
- package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/esm/types/authorization-attributes-contracts.mjs +6 -1
- package/dist/esm/utils/path-utils.d.ts +8 -0
- package/dist/esm/utils/path-utils.d.ts.map +1 -0
- package/dist/esm/utils/path-utils.mjs +15 -0
- package/dist/esm/utils/validation.d.ts +45 -0
- package/dist/esm/utils/validation.d.ts.map +1 -0
- package/dist/esm/utils/validation.mjs +75 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/dist/resource-attribute-assignment.d.ts +24 -0
- package/dist/resource-attribute-assignment.d.ts.map +1 -0
- package/dist/resource-attribute-assignment.js +36 -0
- package/dist/resource-attributes-constants.d.ts +25 -0
- package/dist/resource-attributes-constants.d.ts.map +1 -0
- package/dist/resource-attributes-constants.js +28 -0
- package/dist/roles-service.d.ts +1 -1
- package/dist/roles-service.js +1 -1
- package/dist/types/authorization-attributes-contracts.d.ts +36 -4
- package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/types/authorization-attributes-contracts.js +5 -0
- package/dist/utils/path-utils.d.ts +8 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +17 -0
- package/dist/utils/validation.d.ts +45 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +77 -0
- package/package.json +1 -1
- package/src/attributions-service.ts +4 -0
- package/src/authorization-attributes-ms-service.ts +400 -0
- package/src/authorization-attributes-sns-service.ts +290 -0
- package/src/base-attribute-assignment.ts +55 -0
- package/src/clients/graph-api.ts +2 -1
- package/src/constants/sns.ts +19 -2
- package/src/constants.ts +4 -0
- package/src/entity-attribute-assignment.ts +35 -0
- package/src/entity-attributes-constants.ts +7 -0
- package/src/errors/argument-error.ts +7 -0
- package/src/index.ts +18 -1
- package/src/resource-attribute-assignment.ts +43 -0
- package/src/resource-attributes-constants.ts +26 -0
- package/src/roles-service.ts +1 -1
- package/src/types/authorization-attributes-contracts.ts +56 -3
- package/src/utils/path-utils.ts +13 -0
- package/src/utils/validation.ts +77 -0
- package/dist/authorization-attributes-service.d.ts +0 -54
- package/dist/authorization-attributes-service.d.ts.map +0 -1
- package/dist/authorization-attributes-service.js +0 -186
- package/dist/esm/authorization-attributes-service.d.ts +0 -54
- package/dist/esm/authorization-attributes-service.d.ts.map +0 -1
- package/dist/esm/authorization-attributes-service.mjs +0 -180
- package/src/authorization-attributes-service.ts +0 -234
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAa,2BAA4B,SAAQ,uBAAuB,CAAC,MAAM,EAAE,YAAY,CAAC;IAC5F,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,YAAY,CAAC;gBAE/B,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAclG;;;OAGG;IACH,GAAG,IAAI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAS/E;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;CAGpD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { RESOURCE_TYPES } from './resource-attributes-constants.mjs';
|
|
2
|
+
import { BaseAttributeAssignment } from './base-attribute-assignment.mjs';
|
|
3
|
+
|
|
4
|
+
class ResourceAttributeAssignment extends BaseAttributeAssignment {
|
|
5
|
+
resourceId;
|
|
6
|
+
resourceType;
|
|
7
|
+
constructor(resourceId, resourceType, attributeKey, attributeValue) {
|
|
8
|
+
super(resourceId, resourceType, attributeKey, attributeValue, Object.values(RESOURCE_TYPES), 'resourceId', 'resourceType');
|
|
9
|
+
this.resourceId = resourceId;
|
|
10
|
+
this.resourceType = this.type;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Converts the assignment to hash format with camelCase keys
|
|
14
|
+
* @returns Object with camelCase keys: { resourceId, resourceType, key, value }
|
|
15
|
+
*/
|
|
16
|
+
toH() {
|
|
17
|
+
return {
|
|
18
|
+
resourceId: this.resourceId,
|
|
19
|
+
resourceType: this.resourceType,
|
|
20
|
+
key: this.attributeKey,
|
|
21
|
+
value: this.attributeValue,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Compares two assignments for equality
|
|
26
|
+
* @param other Another ResourceAttributeAssignment instance
|
|
27
|
+
* @returns true if all properties are equal
|
|
28
|
+
*/
|
|
29
|
+
equals(other) {
|
|
30
|
+
return super.equals(other);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { ResourceAttributeAssignment };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const RESOURCE_TYPES: {
|
|
2
|
+
readonly ACCOUNT: "account";
|
|
3
|
+
readonly ACCOUNT_PRODUCT: "account_product";
|
|
4
|
+
readonly WORKSPACE: "workspace";
|
|
5
|
+
readonly BOARD: "board";
|
|
6
|
+
readonly ITEM: "item";
|
|
7
|
+
readonly TEAM: "team";
|
|
8
|
+
readonly OVERVIEW: "overview";
|
|
9
|
+
readonly DOCUMENT: "document";
|
|
10
|
+
readonly CRM: "crm";
|
|
11
|
+
};
|
|
12
|
+
export declare const RESOURCE_ATTRIBUTES_CONSTANTS: {
|
|
13
|
+
readonly ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
14
|
+
readonly ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: "enable_members_invite_from_non_auth_domain";
|
|
15
|
+
};
|
|
16
|
+
readonly WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
17
|
+
readonly IS_DEFAULT_WORKSPACE: "is_default_workspace";
|
|
18
|
+
};
|
|
19
|
+
readonly BOARD_RESOURCE_ATTRIBUTES: {
|
|
20
|
+
readonly IS_SYNCABLE_CHILD_ENTITY: "is_syncable_child_entity";
|
|
21
|
+
readonly SYSTEM_ENTITY_TYPE: "system_entity_type";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type ResourceType = (typeof RESOURCE_TYPES)[keyof typeof RESOURCE_TYPES];
|
|
25
|
+
//# sourceMappingURL=resource-attributes-constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,eAAO,MAAM,6BAA6B;;;;;;;;;;;CAWhC,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const RESOURCE_TYPES = {
|
|
2
|
+
ACCOUNT: 'account',
|
|
3
|
+
ACCOUNT_PRODUCT: 'account_product',
|
|
4
|
+
WORKSPACE: 'workspace',
|
|
5
|
+
BOARD: 'board',
|
|
6
|
+
ITEM: 'item',
|
|
7
|
+
TEAM: 'team',
|
|
8
|
+
OVERVIEW: 'overview',
|
|
9
|
+
DOCUMENT: 'document',
|
|
10
|
+
CRM: 'crm',
|
|
11
|
+
};
|
|
12
|
+
const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
13
|
+
ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
14
|
+
ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
|
|
15
|
+
},
|
|
16
|
+
WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
17
|
+
IS_DEFAULT_WORKSPACE: 'is_default_workspace',
|
|
18
|
+
},
|
|
19
|
+
BOARD_RESOURCE_ATTRIBUTES: {
|
|
20
|
+
IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
|
|
21
|
+
SYSTEM_ENTITY_TYPE: 'system_entity_type',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { RESOURCE_ATTRIBUTES_CONSTANTS, RESOURCE_TYPES };
|
|
@@ -6,7 +6,7 @@ export declare class RolesService {
|
|
|
6
6
|
private fetchOptions;
|
|
7
7
|
private attributionHeaders;
|
|
8
8
|
/**
|
|
9
|
-
* Public constructor to create the
|
|
9
|
+
* Public constructor to create the RolesService instance.
|
|
10
10
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
11
11
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
12
12
|
*/
|
|
@@ -9,7 +9,7 @@ class RolesService {
|
|
|
9
9
|
fetchOptions;
|
|
10
10
|
attributionHeaders;
|
|
11
11
|
/**
|
|
12
|
-
* Public constructor to create the
|
|
12
|
+
* Public constructor to create the RolesService instance.
|
|
13
13
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
14
14
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
15
15
|
*/
|
|
@@ -1,28 +1,60 @@
|
|
|
1
1
|
import { Resource } from './general';
|
|
2
|
+
import type { EntityType } from '../entity-attributes-constants';
|
|
3
|
+
import type { ResourceType } from '../resource-attributes-constants';
|
|
4
|
+
export type { EntityType, ResourceType };
|
|
5
|
+
export type CommonAttributeKey = string;
|
|
6
|
+
export type ResourceAttributeKey = string;
|
|
7
|
+
export type EntityAttributeKey = string;
|
|
8
|
+
export type ResourceAttributeKeyType = CommonAttributeKey | ResourceAttributeKey;
|
|
9
|
+
export type EntityAttributeKeyType = CommonAttributeKey | EntityAttributeKey;
|
|
2
10
|
export interface ResourceAttributeAssignment {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
key:
|
|
11
|
+
resourceId: number;
|
|
12
|
+
resourceType: ResourceType;
|
|
13
|
+
key: ResourceAttributeKeyType;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EntityAttributeAssignment {
|
|
17
|
+
entityId: number;
|
|
18
|
+
entityType: EntityType;
|
|
19
|
+
key: EntityAttributeKeyType;
|
|
6
20
|
value: string;
|
|
7
21
|
}
|
|
8
22
|
export interface ResourceAttributeResponse {
|
|
9
23
|
attributes: ResourceAttributeAssignment[];
|
|
10
24
|
}
|
|
25
|
+
export interface EntityAttributeResponse {
|
|
26
|
+
attributes: EntityAttributeAssignment[];
|
|
27
|
+
}
|
|
11
28
|
export interface ResourceAttributeDelete {
|
|
12
29
|
resourceType: Resource['type'];
|
|
13
30
|
resourceId: Resource['id'];
|
|
14
31
|
key: string;
|
|
15
32
|
}
|
|
33
|
+
export interface EntityAttributeDelete {
|
|
34
|
+
entityType: EntityType;
|
|
35
|
+
entityId: number;
|
|
36
|
+
key: string;
|
|
37
|
+
}
|
|
16
38
|
export declare enum ResourceAttributeOperationEnum {
|
|
17
39
|
UPSERT = "upsert",
|
|
18
40
|
DELETE = "delete"
|
|
19
41
|
}
|
|
42
|
+
export declare enum EntityAttributeOperationEnum {
|
|
43
|
+
UPSERT = "upsert",
|
|
44
|
+
DELETE = "delete"
|
|
45
|
+
}
|
|
20
46
|
interface UpsertResourceAttributeOperation extends ResourceAttributeAssignment {
|
|
21
47
|
operationType: ResourceAttributeOperationEnum.UPSERT;
|
|
22
48
|
}
|
|
23
49
|
interface DeleteResourceAttributeOperation extends ResourceAttributeDelete {
|
|
24
50
|
operationType: ResourceAttributeOperationEnum.DELETE;
|
|
25
51
|
}
|
|
52
|
+
interface UpsertEntityAttributeOperation extends EntityAttributeAssignment {
|
|
53
|
+
operationType: EntityAttributeOperationEnum.UPSERT;
|
|
54
|
+
}
|
|
55
|
+
interface DeleteEntityAttributeOperation extends EntityAttributeDelete {
|
|
56
|
+
operationType: EntityAttributeOperationEnum.DELETE;
|
|
57
|
+
}
|
|
26
58
|
export type ResourceAttributesOperation = UpsertResourceAttributeOperation | DeleteResourceAttributeOperation;
|
|
27
|
-
export
|
|
59
|
+
export type EntityAttributesOperation = UpsertEntityAttributeOperation | DeleteEntityAttributeOperation;
|
|
28
60
|
//# 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,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AAGzC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAGxC,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAG1C,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAGxC,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AACjF,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAG7E,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,wBAAwB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,GAAG,EAAE,sBAAsB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,yBAAyB,EAAE,CAAC;CACzC;AAGD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,8BAA8B;IACxC,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,oBAAY,4BAA4B;IACtC,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,UAAU,gCAAiC,SAAQ,2BAA2B;IAC5E,aAAa,EAAE,8BAA8B,CAAC,MAAM,CAAC;CACtD;AAED,UAAU,gCAAiC,SAAQ,uBAAuB;IACxE,aAAa,EAAE,8BAA8B,CAAC,MAAM,CAAC;CACtD;AAED,UAAU,8BAA+B,SAAQ,yBAAyB;IACxE,aAAa,EAAE,4BAA4B,CAAC,MAAM,CAAC;CACpD;AAED,UAAU,8BAA+B,SAAQ,qBAAqB;IACpE,aAAa,EAAE,4BAA4B,CAAC,MAAM,CAAC;CACpD;AAED,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,GAAG,gCAAgC,CAAC;AAC9G,MAAM,MAAM,yBAAyB,GAAG,8BAA8B,GAAG,8BAA8B,CAAC"}
|
|
@@ -3,5 +3,10 @@ var ResourceAttributeOperationEnum;
|
|
|
3
3
|
ResourceAttributeOperationEnum["UPSERT"] = "upsert";
|
|
4
4
|
ResourceAttributeOperationEnum["DELETE"] = "delete";
|
|
5
5
|
})(ResourceAttributeOperationEnum || (ResourceAttributeOperationEnum = {}));
|
|
6
|
+
var EntityAttributeOperationEnum;
|
|
7
|
+
(function (EntityAttributeOperationEnum) {
|
|
8
|
+
EntityAttributeOperationEnum["UPSERT"] = "upsert";
|
|
9
|
+
EntityAttributeOperationEnum["DELETE"] = "delete";
|
|
10
|
+
})(EntityAttributeOperationEnum || (EntityAttributeOperationEnum = {}));
|
|
6
11
|
|
|
7
|
-
export { ResourceAttributeOperationEnum };
|
|
12
|
+
export { EntityAttributeOperationEnum, ResourceAttributeOperationEnum };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces path template parameters with actual values
|
|
3
|
+
* @param template Path template with placeholders like {accountId}
|
|
4
|
+
* @param params Object with parameter names and values
|
|
5
|
+
* @returns Path with all placeholders replaced
|
|
6
|
+
*/
|
|
7
|
+
export declare function replacePathParams(template: string, params: Record<string, string | number>): string;
|
|
8
|
+
//# sourceMappingURL=path-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-utils.d.ts","sourceRoot":"","sources":["../../../src/utils/path-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAMnG"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Replaces path template parameters with actual values
|
|
3
|
+
* @param template Path template with placeholders like {accountId}
|
|
4
|
+
* @param params Object with parameter names and values
|
|
5
|
+
* @returns Path with all placeholders replaced
|
|
6
|
+
*/
|
|
7
|
+
function replacePathParams(template, params) {
|
|
8
|
+
let path = template;
|
|
9
|
+
for (const [key, value] of Object.entries(params)) {
|
|
10
|
+
path = path.replace(`{${key}}`, String(value));
|
|
11
|
+
}
|
|
12
|
+
return path;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { replacePathParams };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility class for common validation operations
|
|
3
|
+
*/
|
|
4
|
+
export declare class ValidationUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Validates that a value is an integer
|
|
7
|
+
* @param value The value to validate
|
|
8
|
+
* @param fieldName The name of the field for error messages
|
|
9
|
+
* @throws ArgumentError if value is not an integer
|
|
10
|
+
*/
|
|
11
|
+
static validateInteger(value: any, fieldName: string): void;
|
|
12
|
+
/**
|
|
13
|
+
* Validates that a value is a string
|
|
14
|
+
* @param value The value to validate
|
|
15
|
+
* @param fieldName The name of the field for error messages
|
|
16
|
+
* @throws ArgumentError if value is not a string
|
|
17
|
+
*/
|
|
18
|
+
static validateString(value: any, fieldName: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Validates that a value is an array and optionally checks minimum length
|
|
21
|
+
* @param value The value to validate
|
|
22
|
+
* @param fieldName The name of the field for error messages
|
|
23
|
+
* @param minLength Minimum required length (default: 0)
|
|
24
|
+
* @returns The validated array
|
|
25
|
+
* @throws ArgumentError if value is not an array or doesn't meet minimum length
|
|
26
|
+
*/
|
|
27
|
+
static validateArray<T>(value: any, fieldName: string, minLength?: number): T[];
|
|
28
|
+
/**
|
|
29
|
+
* Validates that a value is one of the allowed enum values
|
|
30
|
+
* @param value The value to validate
|
|
31
|
+
* @param validValues Array of valid values
|
|
32
|
+
* @param fieldName The name of the field for error messages
|
|
33
|
+
* @returns The validated value as the enum type
|
|
34
|
+
* @throws ArgumentError if value is not in validValues
|
|
35
|
+
*/
|
|
36
|
+
static validateEnum<T extends string>(value: string, validValues: readonly T[], fieldName: string): T;
|
|
37
|
+
/**
|
|
38
|
+
* Validates that all items in an array are strings
|
|
39
|
+
* @param value Array to validate
|
|
40
|
+
* @param fieldName The name of the field for error messages
|
|
41
|
+
* @throws ArgumentError if any item is not a string
|
|
42
|
+
*/
|
|
43
|
+
static validateStringArray(value: any[], fieldName: string): void;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,qBAAa,eAAe;IAC1B;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAM3D;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAM1D;;;;;;;OAOG;IACH,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,SAAI,GAAG,CAAC,EAAE;IAU1E;;;;;;;OAOG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;IAOrG;;;;;OAKG;IACH,MAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;CAOlE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ArgumentError } from '../errors/argument-error.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Utility class for common validation operations
|
|
5
|
+
*/
|
|
6
|
+
class ValidationUtils {
|
|
7
|
+
/**
|
|
8
|
+
* Validates that a value is an integer
|
|
9
|
+
* @param value The value to validate
|
|
10
|
+
* @param fieldName The name of the field for error messages
|
|
11
|
+
* @throws ArgumentError if value is not an integer
|
|
12
|
+
*/
|
|
13
|
+
static validateInteger(value, fieldName) {
|
|
14
|
+
if (!Number.isInteger(value)) {
|
|
15
|
+
throw new ArgumentError(`${fieldName} must be an integer, got: ${value}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Validates that a value is a string
|
|
20
|
+
* @param value The value to validate
|
|
21
|
+
* @param fieldName The name of the field for error messages
|
|
22
|
+
* @throws ArgumentError if value is not a string
|
|
23
|
+
*/
|
|
24
|
+
static validateString(value, fieldName) {
|
|
25
|
+
if (typeof value !== 'string') {
|
|
26
|
+
throw new ArgumentError(`${fieldName} must be a string, got: ${typeof value}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Validates that a value is an array and optionally checks minimum length
|
|
31
|
+
* @param value The value to validate
|
|
32
|
+
* @param fieldName The name of the field for error messages
|
|
33
|
+
* @param minLength Minimum required length (default: 0)
|
|
34
|
+
* @returns The validated array
|
|
35
|
+
* @throws ArgumentError if value is not an array or doesn't meet minimum length
|
|
36
|
+
*/
|
|
37
|
+
static validateArray(value, fieldName, minLength = 0) {
|
|
38
|
+
if (!Array.isArray(value)) {
|
|
39
|
+
throw new ArgumentError(`${fieldName} must be an array`);
|
|
40
|
+
}
|
|
41
|
+
if (value.length < minLength) {
|
|
42
|
+
throw new ArgumentError(`${fieldName} must have at least ${minLength} items`);
|
|
43
|
+
}
|
|
44
|
+
return value;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Validates that a value is one of the allowed enum values
|
|
48
|
+
* @param value The value to validate
|
|
49
|
+
* @param validValues Array of valid values
|
|
50
|
+
* @param fieldName The name of the field for error messages
|
|
51
|
+
* @returns The validated value as the enum type
|
|
52
|
+
* @throws ArgumentError if value is not in validValues
|
|
53
|
+
*/
|
|
54
|
+
static validateEnum(value, validValues, fieldName) {
|
|
55
|
+
if (!validValues.includes(value)) {
|
|
56
|
+
throw new ArgumentError(`${fieldName} must be one of [${validValues.join(', ')}], got: ${value}`);
|
|
57
|
+
}
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Validates that all items in an array are strings
|
|
62
|
+
* @param value Array to validate
|
|
63
|
+
* @param fieldName The name of the field for error messages
|
|
64
|
+
* @throws ArgumentError if any item is not a string
|
|
65
|
+
*/
|
|
66
|
+
static validateStringArray(value, fieldName) {
|
|
67
|
+
for (let i = 0; i < value.length; i++) {
|
|
68
|
+
if (typeof value[i] !== 'string') {
|
|
69
|
+
throw new ArgumentError(`All ${fieldName} must be strings, but item at index ${i} is not`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { ValidationUtils };
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,15 @@ export interface InitOptions {
|
|
|
18
18
|
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
|
-
export {
|
|
21
|
+
export { AuthorizationAttributesSnsService } from './authorization-attributes-sns-service';
|
|
22
|
+
export { AuthorizationAttributesMsService } from './authorization-attributes-ms-service';
|
|
23
|
+
export { ResourceAttributeAssignment } from './resource-attribute-assignment';
|
|
24
|
+
export { RESOURCE_TYPES, RESOURCE_ATTRIBUTES_CONSTANTS } from './resource-attributes-constants';
|
|
25
|
+
export { EntityAttributeAssignment } from './entity-attribute-assignment';
|
|
26
|
+
export { ENTITY_TYPES } from './entity-attributes-constants';
|
|
27
|
+
export { ArgumentError } from './errors/argument-error';
|
|
28
|
+
export { ResourceAttributeResponse, EntityAttributeResponse, ResourceType, EntityAttributeKeyType, ResourceAttributeKeyType, CommonAttributeKey, ResourceAttributeKey, EntityAttributeKey, } from './types/authorization-attributes-contracts';
|
|
29
|
+
export type { EntityType } from './entity-attributes-constants';
|
|
22
30
|
export { RolesService } from './roles-service';
|
|
23
31
|
export { MembershipsService } from './memberships';
|
|
24
32
|
export { AuthorizationObject, Resource, BaseRequest, ResourceGetter, ContextGetter } from './types/general';
|
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,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,iBA6BnD;AAED,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,
|
|
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,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,wBAAsB,IAAI,CAAC,OAAO,GAAE,WAAgB,iBA6BnD;AAED,OAAO,EACL,4BAA4B,EAC5B,0BAA0B,EAC1B,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAClF,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AACzF,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAChG,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,YAAY,EACZ,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,4CAA4C,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EACL,WAAW,EACX,YAAY,EACZ,0BAA0B,EAC1B,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAErH,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,13 @@ const authorizationService = require('./authorization-service.js');
|
|
|
5
5
|
const metricsService = require('./metrics-service.js');
|
|
6
6
|
const testKit_index = require('./testKit/index.js');
|
|
7
7
|
const authorizationMiddleware = require('./authorization-middleware.js');
|
|
8
|
-
const
|
|
8
|
+
const authorizationAttributesSnsService = require('./authorization-attributes-sns-service.js');
|
|
9
|
+
const authorizationAttributesMsService = require('./authorization-attributes-ms-service.js');
|
|
10
|
+
const resourceAttributeAssignment = require('./resource-attribute-assignment.js');
|
|
11
|
+
const resourceAttributesConstants = require('./resource-attributes-constants.js');
|
|
12
|
+
const entityAttributeAssignment = require('./entity-attribute-assignment.js');
|
|
13
|
+
const entityAttributesConstants = require('./entity-attributes-constants.js');
|
|
14
|
+
const errors_argumentError = require('./errors/argument-error.js');
|
|
9
15
|
const rolesService = require('./roles-service.js');
|
|
10
16
|
const memberships = require('./memberships.js');
|
|
11
17
|
const types_roles = require('./types/roles.js');
|
|
@@ -43,7 +49,14 @@ exports.TestKit = testKit_index;
|
|
|
43
49
|
exports.authorizationCheckMiddleware = authorizationMiddleware.authorizationCheckMiddleware;
|
|
44
50
|
exports.getAuthorizationMiddleware = authorizationMiddleware.getAuthorizationMiddleware;
|
|
45
51
|
exports.skipAuthorizationMiddleware = authorizationMiddleware.skipAuthorizationMiddleware;
|
|
46
|
-
exports.
|
|
52
|
+
exports.AuthorizationAttributesSnsService = authorizationAttributesSnsService.AuthorizationAttributesSnsService;
|
|
53
|
+
exports.AuthorizationAttributesMsService = authorizationAttributesMsService.AuthorizationAttributesMsService;
|
|
54
|
+
exports.ResourceAttributeAssignment = resourceAttributeAssignment.ResourceAttributeAssignment;
|
|
55
|
+
exports.RESOURCE_ATTRIBUTES_CONSTANTS = resourceAttributesConstants.RESOURCE_ATTRIBUTES_CONSTANTS;
|
|
56
|
+
exports.RESOURCE_TYPES = resourceAttributesConstants.RESOURCE_TYPES;
|
|
57
|
+
exports.EntityAttributeAssignment = entityAttributeAssignment.EntityAttributeAssignment;
|
|
58
|
+
exports.ENTITY_TYPES = entityAttributesConstants.ENTITY_TYPES;
|
|
59
|
+
exports.ArgumentError = errors_argumentError.ArgumentError;
|
|
47
60
|
exports.RolesService = rolesService.RolesService;
|
|
48
61
|
exports.MembershipsService = memberships.MembershipsService;
|
|
49
62
|
Object.defineProperty(exports, 'RoleType', {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ResourceType } from './resource-attributes-constants';
|
|
2
|
+
import { BaseAttributeAssignment } from './base-attribute-assignment';
|
|
3
|
+
export declare class ResourceAttributeAssignment extends BaseAttributeAssignment<number, ResourceType> {
|
|
4
|
+
readonly resourceId: number;
|
|
5
|
+
readonly resourceType: ResourceType;
|
|
6
|
+
constructor(resourceId: number, resourceType: string, attributeKey: string, attributeValue: string);
|
|
7
|
+
/**
|
|
8
|
+
* Converts the assignment to hash format with camelCase keys
|
|
9
|
+
* @returns Object with camelCase keys: { resourceId, resourceType, key, value }
|
|
10
|
+
*/
|
|
11
|
+
toH(): {
|
|
12
|
+
resourceId: number;
|
|
13
|
+
resourceType: string;
|
|
14
|
+
key: string;
|
|
15
|
+
value: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Compares two assignments for equality
|
|
19
|
+
* @param other Another ResourceAttributeAssignment instance
|
|
20
|
+
* @returns true if all properties are equal
|
|
21
|
+
*/
|
|
22
|
+
equals(other: ResourceAttributeAssignment): boolean;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=resource-attribute-assignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,qBAAa,2BAA4B,SAAQ,uBAAuB,CAAC,MAAM,EAAE,YAAY,CAAC;IAC5F,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,YAAY,CAAC;gBAE/B,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAclG;;;OAGG;IACH,GAAG,IAAI;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAS/E;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;CAGpD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const resourceAttributesConstants = require('./resource-attributes-constants.js');
|
|
4
|
+
const baseAttributeAssignment = require('./base-attribute-assignment.js');
|
|
5
|
+
|
|
6
|
+
class ResourceAttributeAssignment extends baseAttributeAssignment.BaseAttributeAssignment {
|
|
7
|
+
resourceId;
|
|
8
|
+
resourceType;
|
|
9
|
+
constructor(resourceId, resourceType, attributeKey, attributeValue) {
|
|
10
|
+
super(resourceId, resourceType, attributeKey, attributeValue, Object.values(resourceAttributesConstants.RESOURCE_TYPES), 'resourceId', 'resourceType');
|
|
11
|
+
this.resourceId = resourceId;
|
|
12
|
+
this.resourceType = this.type;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Converts the assignment to hash format with camelCase keys
|
|
16
|
+
* @returns Object with camelCase keys: { resourceId, resourceType, key, value }
|
|
17
|
+
*/
|
|
18
|
+
toH() {
|
|
19
|
+
return {
|
|
20
|
+
resourceId: this.resourceId,
|
|
21
|
+
resourceType: this.resourceType,
|
|
22
|
+
key: this.attributeKey,
|
|
23
|
+
value: this.attributeValue,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Compares two assignments for equality
|
|
28
|
+
* @param other Another ResourceAttributeAssignment instance
|
|
29
|
+
* @returns true if all properties are equal
|
|
30
|
+
*/
|
|
31
|
+
equals(other) {
|
|
32
|
+
return super.equals(other);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.ResourceAttributeAssignment = ResourceAttributeAssignment;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const RESOURCE_TYPES: {
|
|
2
|
+
readonly ACCOUNT: "account";
|
|
3
|
+
readonly ACCOUNT_PRODUCT: "account_product";
|
|
4
|
+
readonly WORKSPACE: "workspace";
|
|
5
|
+
readonly BOARD: "board";
|
|
6
|
+
readonly ITEM: "item";
|
|
7
|
+
readonly TEAM: "team";
|
|
8
|
+
readonly OVERVIEW: "overview";
|
|
9
|
+
readonly DOCUMENT: "document";
|
|
10
|
+
readonly CRM: "crm";
|
|
11
|
+
};
|
|
12
|
+
export declare const RESOURCE_ATTRIBUTES_CONSTANTS: {
|
|
13
|
+
readonly ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
14
|
+
readonly ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: "enable_members_invite_from_non_auth_domain";
|
|
15
|
+
};
|
|
16
|
+
readonly WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
17
|
+
readonly IS_DEFAULT_WORKSPACE: "is_default_workspace";
|
|
18
|
+
};
|
|
19
|
+
readonly BOARD_RESOURCE_ATTRIBUTES: {
|
|
20
|
+
readonly IS_SYNCABLE_CHILD_ENTITY: "is_syncable_child_entity";
|
|
21
|
+
readonly SYSTEM_ENTITY_TYPE: "system_entity_type";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type ResourceType = (typeof RESOURCE_TYPES)[keyof typeof RESOURCE_TYPES];
|
|
25
|
+
//# sourceMappingURL=resource-attributes-constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;CAUjB,CAAC;AAEX,eAAO,MAAM,6BAA6B;;;;;;;;;;;CAWhC,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
const RESOURCE_TYPES = {
|
|
4
|
+
ACCOUNT: 'account',
|
|
5
|
+
ACCOUNT_PRODUCT: 'account_product',
|
|
6
|
+
WORKSPACE: 'workspace',
|
|
7
|
+
BOARD: 'board',
|
|
8
|
+
ITEM: 'item',
|
|
9
|
+
TEAM: 'team',
|
|
10
|
+
OVERVIEW: 'overview',
|
|
11
|
+
DOCUMENT: 'document',
|
|
12
|
+
CRM: 'crm',
|
|
13
|
+
};
|
|
14
|
+
const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
15
|
+
ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
16
|
+
ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
|
|
17
|
+
},
|
|
18
|
+
WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
19
|
+
IS_DEFAULT_WORKSPACE: 'is_default_workspace',
|
|
20
|
+
},
|
|
21
|
+
BOARD_RESOURCE_ATTRIBUTES: {
|
|
22
|
+
IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
|
|
23
|
+
SYSTEM_ENTITY_TYPE: 'system_entity_type',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.RESOURCE_ATTRIBUTES_CONSTANTS = RESOURCE_ATTRIBUTES_CONSTANTS;
|
|
28
|
+
exports.RESOURCE_TYPES = RESOURCE_TYPES;
|
package/dist/roles-service.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class RolesService {
|
|
|
6
6
|
private fetchOptions;
|
|
7
7
|
private attributionHeaders;
|
|
8
8
|
/**
|
|
9
|
-
* Public constructor to create the
|
|
9
|
+
* Public constructor to create the RolesService instance.
|
|
10
10
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
11
11
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
12
12
|
*/
|
package/dist/roles-service.js
CHANGED
|
@@ -11,7 +11,7 @@ class RolesService {
|
|
|
11
11
|
fetchOptions;
|
|
12
12
|
attributionHeaders;
|
|
13
13
|
/**
|
|
14
|
-
* Public constructor to create the
|
|
14
|
+
* Public constructor to create the RolesService instance.
|
|
15
15
|
* @param httpClient The HTTP client to use for API requests, if not provided, the default HTTP client from Api will be used.
|
|
16
16
|
* @param fetchOptions The fetch options to use for API requests, if not provided, the default fetch options will be used.
|
|
17
17
|
*/
|
|
@@ -1,28 +1,60 @@
|
|
|
1
1
|
import { Resource } from './general';
|
|
2
|
+
import type { EntityType } from '../entity-attributes-constants';
|
|
3
|
+
import type { ResourceType } from '../resource-attributes-constants';
|
|
4
|
+
export type { EntityType, ResourceType };
|
|
5
|
+
export type CommonAttributeKey = string;
|
|
6
|
+
export type ResourceAttributeKey = string;
|
|
7
|
+
export type EntityAttributeKey = string;
|
|
8
|
+
export type ResourceAttributeKeyType = CommonAttributeKey | ResourceAttributeKey;
|
|
9
|
+
export type EntityAttributeKeyType = CommonAttributeKey | EntityAttributeKey;
|
|
2
10
|
export interface ResourceAttributeAssignment {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
key:
|
|
11
|
+
resourceId: number;
|
|
12
|
+
resourceType: ResourceType;
|
|
13
|
+
key: ResourceAttributeKeyType;
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export interface EntityAttributeAssignment {
|
|
17
|
+
entityId: number;
|
|
18
|
+
entityType: EntityType;
|
|
19
|
+
key: EntityAttributeKeyType;
|
|
6
20
|
value: string;
|
|
7
21
|
}
|
|
8
22
|
export interface ResourceAttributeResponse {
|
|
9
23
|
attributes: ResourceAttributeAssignment[];
|
|
10
24
|
}
|
|
25
|
+
export interface EntityAttributeResponse {
|
|
26
|
+
attributes: EntityAttributeAssignment[];
|
|
27
|
+
}
|
|
11
28
|
export interface ResourceAttributeDelete {
|
|
12
29
|
resourceType: Resource['type'];
|
|
13
30
|
resourceId: Resource['id'];
|
|
14
31
|
key: string;
|
|
15
32
|
}
|
|
33
|
+
export interface EntityAttributeDelete {
|
|
34
|
+
entityType: EntityType;
|
|
35
|
+
entityId: number;
|
|
36
|
+
key: string;
|
|
37
|
+
}
|
|
16
38
|
export declare enum ResourceAttributeOperationEnum {
|
|
17
39
|
UPSERT = "upsert",
|
|
18
40
|
DELETE = "delete"
|
|
19
41
|
}
|
|
42
|
+
export declare enum EntityAttributeOperationEnum {
|
|
43
|
+
UPSERT = "upsert",
|
|
44
|
+
DELETE = "delete"
|
|
45
|
+
}
|
|
20
46
|
interface UpsertResourceAttributeOperation extends ResourceAttributeAssignment {
|
|
21
47
|
operationType: ResourceAttributeOperationEnum.UPSERT;
|
|
22
48
|
}
|
|
23
49
|
interface DeleteResourceAttributeOperation extends ResourceAttributeDelete {
|
|
24
50
|
operationType: ResourceAttributeOperationEnum.DELETE;
|
|
25
51
|
}
|
|
52
|
+
interface UpsertEntityAttributeOperation extends EntityAttributeAssignment {
|
|
53
|
+
operationType: EntityAttributeOperationEnum.UPSERT;
|
|
54
|
+
}
|
|
55
|
+
interface DeleteEntityAttributeOperation extends EntityAttributeDelete {
|
|
56
|
+
operationType: EntityAttributeOperationEnum.DELETE;
|
|
57
|
+
}
|
|
26
58
|
export type ResourceAttributesOperation = UpsertResourceAttributeOperation | DeleteResourceAttributeOperation;
|
|
27
|
-
export
|
|
59
|
+
export type EntityAttributesOperation = UpsertEntityAttributeOperation | DeleteEntityAttributeOperation;
|
|
28
60
|
//# 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,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"authorization-attributes-contracts.d.ts","sourceRoot":"","sources":["../../src/types/authorization-attributes-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AAGzC,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAGxC,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC;AAG1C,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAGxC,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AACjF,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAG7E,MAAM,WAAW,2BAA2B;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,wBAAwB,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;IACvB,GAAG,EAAE,sBAAsB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAGD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,yBAAyB,EAAE,CAAC;CACzC;AAGD,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,oBAAY,8BAA8B;IACxC,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,oBAAY,4BAA4B;IACtC,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,UAAU,gCAAiC,SAAQ,2BAA2B;IAC5E,aAAa,EAAE,8BAA8B,CAAC,MAAM,CAAC;CACtD;AAED,UAAU,gCAAiC,SAAQ,uBAAuB;IACxE,aAAa,EAAE,8BAA8B,CAAC,MAAM,CAAC;CACtD;AAED,UAAU,8BAA+B,SAAQ,yBAAyB;IACxE,aAAa,EAAE,4BAA4B,CAAC,MAAM,CAAC;CACpD;AAED,UAAU,8BAA+B,SAAQ,qBAAqB;IACpE,aAAa,EAAE,4BAA4B,CAAC,MAAM,CAAC;CACpD;AAED,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,GAAG,gCAAgC,CAAC;AAC9G,MAAM,MAAM,yBAAyB,GAAG,8BAA8B,GAAG,8BAA8B,CAAC"}
|