@mondaydotcomorg/monday-authorization 3.4.0-feature-bashanye-add-membership-create-delete-api-234505c → 3.5.0-feat-shaime-support-entity-attributes-in-authorization-sdk-397ce54

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 (48) hide show
  1. package/dist/authorization-attributes-ms-service.d.ts +37 -0
  2. package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
  3. package/dist/authorization-attributes-ms-service.js +232 -0
  4. package/dist/authorization-attributes-service.d.ts +45 -1
  5. package/dist/authorization-attributes-service.d.ts.map +1 -1
  6. package/dist/authorization-attributes-service.js +262 -0
  7. package/dist/errors/argument-error.d.ts +4 -0
  8. package/dist/errors/argument-error.d.ts.map +1 -0
  9. package/dist/errors/argument-error.js +11 -0
  10. package/dist/esm/authorization-attributes-ms-service.d.ts +37 -0
  11. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
  12. package/dist/esm/authorization-attributes-ms-service.mjs +230 -0
  13. package/dist/esm/authorization-attributes-service.d.ts +45 -1
  14. package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
  15. package/dist/esm/authorization-attributes-service.mjs +263 -1
  16. package/dist/esm/errors/argument-error.d.ts +4 -0
  17. package/dist/esm/errors/argument-error.d.ts.map +1 -0
  18. package/dist/esm/errors/argument-error.mjs +9 -0
  19. package/dist/esm/index.d.ts +5 -0
  20. package/dist/esm/index.d.ts.map +1 -1
  21. package/dist/esm/index.mjs +4 -0
  22. package/dist/esm/resource-attribute-assignment.d.ts +25 -0
  23. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -0
  24. package/dist/esm/resource-attribute-assignment.mjs +60 -0
  25. package/dist/esm/resource-attributes-constants.d.ts +25 -0
  26. package/dist/esm/resource-attributes-constants.d.ts.map +1 -0
  27. package/dist/esm/resource-attributes-constants.mjs +25 -0
  28. package/dist/esm/types/authorization-attributes-contracts.d.ts +19 -3
  29. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  30. package/dist/index.d.ts +5 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +9 -0
  33. package/dist/resource-attribute-assignment.d.ts +25 -0
  34. package/dist/resource-attribute-assignment.d.ts.map +1 -0
  35. package/dist/resource-attribute-assignment.js +62 -0
  36. package/dist/resource-attributes-constants.d.ts +25 -0
  37. package/dist/resource-attributes-constants.d.ts.map +1 -0
  38. package/dist/resource-attributes-constants.js +28 -0
  39. package/dist/types/authorization-attributes-contracts.d.ts +19 -3
  40. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  41. package/package.json +1 -1
  42. package/src/authorization-attributes-ms-service.ts +327 -0
  43. package/src/authorization-attributes-service.ts +325 -0
  44. package/src/errors/argument-error.ts +8 -0
  45. package/src/index.ts +16 -0
  46. package/src/resource-attribute-assignment.ts +70 -0
  47. package/src/resource-attributes-constants.ts +27 -0
  48. package/src/types/authorization-attributes-contracts.ts +49 -3
@@ -0,0 +1,70 @@
1
+ import { RESOURCE_TYPES, ResourceType } from './resource-attributes-constants';
2
+ import { ArgumentError } from './errors/argument-error';
3
+
4
+ export class ResourceAttributeAssignment {
5
+ public readonly resourceId: number;
6
+ public readonly resourceType: ResourceType;
7
+ public readonly attributeKey: string;
8
+ public readonly attributeValue: string;
9
+
10
+ constructor(resourceId: number, resourceType: string, attributeKey: string, attributeValue: string) {
11
+ // Validate resourceId
12
+ if (!Number.isInteger(resourceId)) {
13
+ throw new ArgumentError(`resourceId must be an integer, got: ${resourceId}`);
14
+ }
15
+
16
+ // Validate resourceType
17
+ const validResourceTypes = Object.values(RESOURCE_TYPES);
18
+ if (!validResourceTypes.includes(resourceType as ResourceType)) {
19
+ throw new ArgumentError(
20
+ `resourceType must be one of [${validResourceTypes.join(', ')}], got: ${resourceType}`
21
+ );
22
+ }
23
+
24
+ // Validate attributeKey
25
+ if (typeof attributeKey !== 'string') {
26
+ throw new ArgumentError(`attributeKey must be a string, got: ${typeof attributeKey}`);
27
+ }
28
+
29
+ // Validate attributeValue
30
+ if (typeof attributeValue !== 'string') {
31
+ throw new ArgumentError(`attributeValue must be a string, got: ${typeof attributeValue}`);
32
+ }
33
+
34
+ this.resourceId = resourceId;
35
+ this.resourceType = resourceType as ResourceType;
36
+ this.attributeKey = attributeKey;
37
+ this.attributeValue = attributeValue;
38
+ }
39
+
40
+ /**
41
+ * Converts the assignment to hash format with camelCase keys
42
+ * @returns Object with camelCase keys: { resourceId, resourceType, key, value }
43
+ */
44
+ toH(): { resourceId: number; resourceType: string; key: string; value: string } {
45
+ return {
46
+ resourceId: this.resourceId,
47
+ resourceType: this.resourceType,
48
+ key: this.attributeKey,
49
+ value: this.attributeValue,
50
+ };
51
+ }
52
+
53
+ /**
54
+ * Compares two assignments for equality
55
+ * @param other Another ResourceAttributeAssignment instance
56
+ * @returns true if all properties are equal
57
+ */
58
+ equals(other: ResourceAttributeAssignment): boolean {
59
+ if (!(other instanceof ResourceAttributeAssignment)) {
60
+ return false;
61
+ }
62
+ return (
63
+ this.resourceId === other.resourceId &&
64
+ this.resourceType === other.resourceType &&
65
+ this.attributeKey === other.attributeKey &&
66
+ this.attributeValue === other.attributeValue
67
+ );
68
+ }
69
+ }
70
+
@@ -0,0 +1,27 @@
1
+ export 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
+ } as const;
12
+
13
+ export const RESOURCE_ATTRIBUTES_CONSTANTS = {
14
+ ACCOUNT_RESOURCE_ATTRIBUTES: {
15
+ ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
16
+ },
17
+ WORKSPACE_RESOURCE_ATTRIBUTES: {
18
+ IS_DEFAULT_WORKSPACE: 'is_default_workspace',
19
+ },
20
+ BOARD_RESOURCE_ATTRIBUTES: {
21
+ IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
22
+ SYSTEM_ENTITY_TYPE: 'system_entity_type',
23
+ },
24
+ } as const;
25
+
26
+ export type ResourceType = typeof RESOURCE_TYPES[keyof typeof RESOURCE_TYPES];
27
+
@@ -1,16 +1,62 @@
1
1
  import { Resource } from './general';
2
2
 
3
+ // Resource Types - matching the API
4
+ export type ResourceType =
5
+ | 'account'
6
+ | 'account_product'
7
+ | 'workspace'
8
+ | 'board'
9
+ | 'item'
10
+ | 'team'
11
+ | 'overview'
12
+ | 'document'
13
+ | 'crm';
14
+
15
+ // Entity Types - matching the API
16
+ export type EntityType =
17
+ | 'user'
18
+ | 'team'
19
+ | 'account';
20
+
21
+ // Common attribute keys that can be used for both resources and entities
22
+ export type CommonAttributeKey = string;
23
+
24
+ // Resource-specific attribute keys
25
+ export type ResourceAttributeKey = string;
26
+
27
+ // Entity-specific attribute keys
28
+ export type EntityAttributeKey = string;
29
+
30
+ // Combined types for attribute keys
31
+ export type ResourceAttributeKeyType = CommonAttributeKey | ResourceAttributeKey;
32
+ export type EntityAttributeKeyType = CommonAttributeKey | EntityAttributeKey;
33
+
34
+ // Resource Attribute Assignment - matching API contract
3
35
  export interface ResourceAttributeAssignment {
4
- resourceType: Resource['type'];
5
- resourceId: Resource['id'];
6
- key: string;
36
+ resourceId: number;
37
+ resourceType: ResourceType;
38
+ key: ResourceAttributeKeyType;
7
39
  value: string;
8
40
  }
9
41
 
42
+ // Entity Attribute Assignment - matching API contract
43
+ export interface EntityAttributeAssignment {
44
+ entityId: number;
45
+ entityType: EntityType;
46
+ key: EntityAttributeKeyType;
47
+ value: string;
48
+ }
49
+
50
+ // Response types
10
51
  export interface ResourceAttributeResponse {
11
52
  attributes: ResourceAttributeAssignment[];
12
53
  }
13
54
 
55
+ export interface EntityAttributeResponse {
56
+ attributes: EntityAttributeAssignment[];
57
+ }
58
+
59
+ // Legacy types for backward compatibility
14
60
  export interface ResourceAttributeDelete {
15
61
  resourceType: Resource['type'];
16
62
  resourceId: Resource['id'];