@mondaydotcomorg/monday-authorization 3.6.0-feat-shaime-support-entity-attributes-1-f58d933 → 3.6.0-feat-shaime-support-entity-attributes-3-0d092e0

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 (96) hide show
  1. package/dist/authorization-attributes-ms-service.d.ts +68 -0
  2. package/dist/authorization-attributes-ms-service.d.ts.map +1 -0
  3. package/dist/authorization-attributes-ms-service.js +263 -0
  4. package/dist/authorization-attributes-service.d.ts +25 -47
  5. package/dist/authorization-attributes-service.d.ts.map +1 -1
  6. package/dist/authorization-attributes-service.js +32 -171
  7. package/dist/authorization-attributes-sns-service.d.ts +84 -0
  8. package/dist/authorization-attributes-sns-service.d.ts.map +1 -0
  9. package/dist/authorization-attributes-sns-service.js +196 -0
  10. package/dist/constants/sns.d.ts +12 -2
  11. package/dist/constants/sns.d.ts.map +1 -1
  12. package/dist/constants/sns.js +22 -2
  13. package/dist/entity-attribute-assignment.d.ts.map +1 -1
  14. package/dist/entity-attribute-assignment.js +0 -2
  15. package/dist/esm/authorization-attributes-ms-service.d.ts +68 -0
  16. package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -0
  17. package/dist/esm/authorization-attributes-ms-service.mjs +261 -0
  18. package/dist/esm/authorization-attributes-service.d.ts +25 -47
  19. package/dist/esm/authorization-attributes-service.d.ts.map +1 -1
  20. package/dist/esm/authorization-attributes-service.mjs +32 -167
  21. package/dist/esm/authorization-attributes-sns-service.d.ts +84 -0
  22. package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -0
  23. package/dist/esm/authorization-attributes-sns-service.mjs +190 -0
  24. package/dist/esm/constants/sns.d.ts +12 -2
  25. package/dist/esm/constants/sns.d.ts.map +1 -1
  26. package/dist/esm/constants/sns.mjs +17 -3
  27. package/dist/esm/entity-attribute-assignment.d.ts.map +1 -1
  28. package/dist/esm/entity-attribute-assignment.mjs +0 -2
  29. package/dist/esm/index.d.ts +6 -0
  30. package/dist/esm/index.d.ts.map +1 -1
  31. package/dist/esm/index.mjs +5 -0
  32. package/dist/esm/resource-attribute-assignment.d.ts.map +1 -1
  33. package/dist/esm/resource-attribute-assignment.mjs +0 -2
  34. package/dist/esm/resource-attributes-constants.d.ts +2 -1
  35. package/dist/esm/resource-attributes-constants.d.ts.map +1 -1
  36. package/dist/esm/resource-attributes-constants.mjs +1 -0
  37. package/dist/esm/types/authorization-attributes-contracts.d.ts +2 -17
  38. package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
  39. package/dist/esm/types/authorization-attributes-service.interface.d.ts +14 -25
  40. package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +1 -1
  41. package/dist/esm/types/general.d.ts +4 -3
  42. package/dist/esm/types/general.d.ts.map +1 -1
  43. package/dist/esm/utils/assignment-schema.d.ts +51 -0
  44. package/dist/esm/utils/assignment-schema.d.ts.map +1 -0
  45. package/dist/esm/utils/assignment-schema.mjs +49 -0
  46. package/dist/esm/utils/resource-schema.d.ts +9 -0
  47. package/dist/esm/utils/resource-schema.d.ts.map +1 -0
  48. package/dist/esm/utils/resource-schema.mjs +16 -0
  49. package/dist/esm/utils/validation.d.ts +11 -3
  50. package/dist/esm/utils/validation.d.ts.map +1 -1
  51. package/dist/esm/utils/validation.mjs +50 -13
  52. package/dist/index.d.ts +6 -0
  53. package/dist/index.d.ts.map +1 -1
  54. package/dist/index.js +22 -0
  55. package/dist/resource-attribute-assignment.d.ts.map +1 -1
  56. package/dist/resource-attribute-assignment.js +0 -2
  57. package/dist/resource-attributes-constants.d.ts +2 -1
  58. package/dist/resource-attributes-constants.d.ts.map +1 -1
  59. package/dist/resource-attributes-constants.js +1 -0
  60. package/dist/types/authorization-attributes-contracts.d.ts +2 -17
  61. package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
  62. package/dist/types/authorization-attributes-service.interface.d.ts +14 -25
  63. package/dist/types/authorization-attributes-service.interface.d.ts.map +1 -1
  64. package/dist/types/general.d.ts +4 -3
  65. package/dist/types/general.d.ts.map +1 -1
  66. package/dist/utils/assignment-schema.d.ts +51 -0
  67. package/dist/utils/assignment-schema.d.ts.map +1 -0
  68. package/dist/utils/assignment-schema.js +58 -0
  69. package/dist/utils/resource-schema.d.ts +9 -0
  70. package/dist/utils/resource-schema.d.ts.map +1 -0
  71. package/dist/utils/resource-schema.js +22 -0
  72. package/dist/utils/validation.d.ts +11 -3
  73. package/dist/utils/validation.d.ts.map +1 -1
  74. package/dist/utils/validation.js +50 -13
  75. package/package.json +1 -1
  76. package/src/authorization-attributes-ms-service.ts +397 -0
  77. package/src/authorization-attributes-service.ts +34 -222
  78. package/src/authorization-attributes-sns-service.ts +321 -0
  79. package/src/constants/sns.ts +19 -2
  80. package/src/entity-attribute-assignment.ts +0 -2
  81. package/src/index.ts +17 -0
  82. package/src/resource-attribute-assignment.ts +0 -2
  83. package/src/resource-attributes-constants.ts +1 -0
  84. package/src/types/authorization-attributes-contracts.ts +2 -24
  85. package/src/types/authorization-attributes-service.interface.ts +19 -31
  86. package/src/types/general.ts +4 -3
  87. package/src/utils/assignment-schema.ts +51 -0
  88. package/src/utils/resource-schema.ts +16 -0
  89. package/src/utils/validation.ts +76 -15
  90. package/dist/esm/utils/assigment-schema.d.ts +0 -29
  91. package/dist/esm/utils/assigment-schema.d.ts.map +0 -1
  92. package/dist/esm/utils/assigment-schema.mjs +0 -29
  93. package/dist/utils/assigment-schema.d.ts +0 -29
  94. package/dist/utils/assigment-schema.d.ts.map +0 -1
  95. package/dist/utils/assigment-schema.js +0 -36
  96. package/src/utils/assigment-schema.ts +0 -29
@@ -21,6 +21,7 @@ export enum ResourceType {
21
21
  Overview = 'overview',
22
22
  Document = 'document',
23
23
  Crm = 'crm',
24
+ Feature = 'feature',
24
25
  }
25
26
 
26
27
  // Define the array of strings and use 'as const' to make its contents literal types
@@ -1,4 +1,3 @@
1
- import { Resource } from './general';
2
1
  import type { EntityType } from '../entity-attributes-constants';
3
2
  import type { ResourceType } from '../resource-attributes-constants';
4
3
 
@@ -12,6 +11,7 @@ export interface ResourceAttributeAssignment extends AttributeAssignment {
12
11
  resourceId: number;
13
12
  resourceType: ResourceType;
14
13
  }
14
+ export type ResourceAttributeDeleteAssignment = Omit<ResourceAttributeAssignment, 'value'>;
15
15
 
16
16
  // Entity Attribute Assignment - matching API contract
17
17
  // Note: For validation, use the EntityAttributeAssignment class from '../entity-attribute-assignment'
@@ -19,34 +19,12 @@ export interface EntityAttributeAssignment extends AttributeAssignment {
19
19
  entityId: number;
20
20
  entityType: EntityType;
21
21
  }
22
-
23
- // Legacy types for backward compatibility
24
- export interface ResourceAttributeDelete {
25
- resourceType: Resource['type'];
26
- resourceId: Resource['id'];
27
- key: string;
28
- }
29
-
30
- export interface EntityAttributeDelete {
31
- entityType: EntityType;
32
- entityId: number;
33
- key: string;
34
- }
22
+ export type EntityAttributeDeleteAssignment = Omit<EntityAttributeAssignment, 'value'>;
35
23
 
36
24
  export enum AttributeOperation {
37
25
  UPSERT = 'upsert',
38
26
  DELETE = 'delete',
39
27
  }
40
-
41
- // Response types
42
- export interface ResourceAttributeResponse {
43
- attributes: ResourceAttributeAssignment[];
44
- }
45
-
46
- export interface EntityAttributeResponse {
47
- attributes: EntityAttributeAssignment[];
48
- }
49
-
50
28
  export interface ResourceAttributeUpsertOperation extends ResourceAttributeAssignment {
51
29
  operationType: AttributeOperation;
52
30
  }
@@ -7,69 +7,57 @@ import {
7
7
  } from './authorization-attributes-contracts';
8
8
  import { Resource } from './general';
9
9
 
10
- /**
11
- * Resource type compatible with both MS and SNS services
12
- */
13
- export interface CompatibleResource {
14
- resourceType?: string;
15
- resourceId?: number;
16
- type?: string;
17
- id?: number;
18
- }
19
-
20
10
  /**
21
11
  * Interface for authorization attributes operations.
22
12
  * Both MS (direct) and SNS (async) services implement this interface.
23
13
  */
24
14
  export interface AuthorizationAttributesService {
25
15
  /**
26
- * Deletes resource attributes.
27
- * For MS service: returns Promise<void>
28
- * For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
16
+ * Deletes a resource attribute.
17
+ * Returns Promise<ResourceAttributeDeleteOperation>
29
18
  */
30
19
  deleteResourceAttributes(
31
20
  accountId: number,
32
- resource: CompatibleResource | Resource,
33
- attributeKeys: string[],
21
+ resource: Resource,
22
+ attributeKey: string,
34
23
  appName?: string,
35
24
  callerActionIdentifier?: string
36
- ): Promise<void | ResourceAttributeDeleteOperation[]>;
25
+ ): Promise<ResourceAttributeDeleteOperation>;
37
26
 
38
27
  /**
39
- * Deletes entity attributes.
40
- * For MS service: returns Promise<void>
41
- * For SNS service: requires appName and callerActionIdentifier, returns Promise<EntityAttributesOperation[]>
28
+ * Deletes an entity attribute.
29
+ * Returns Promise<EntityAttributeDeleteOperation>
42
30
  */
43
31
  deleteEntityAttributes(
44
32
  accountId: number,
45
33
  entityType: EntityType | string,
46
34
  entityId: number,
47
- attributeKeys: string[],
35
+ attributeKey: string,
48
36
  appName?: string,
49
37
  callerActionIdentifier?: string
50
- ): Promise<void | EntityAttributeDeleteOperation[]>;
38
+ ): Promise<EntityAttributeDeleteOperation>;
51
39
 
52
40
  /**
53
- * Updates resource attributes (batch operations).
54
- * For MS service: may throw error or delegate to upsert/delete
55
- * For SNS service: returns Promise<ResourceAttributesOperation[]>
41
+ * Updates a resource attribute (single operation - upsert only).
42
+ * For MS service: performs upsert operation
43
+ * For SNS service: returns Promise<ResourceAttributeUpsertOperation>
56
44
  */
57
45
  updateResourceAttributes(
58
46
  accountId: number,
59
47
  appName: string,
60
48
  callerActionIdentifier: string,
61
- resourceAttributeOperations: ResourceAttributeUpsertOperation[]
62
- ): Promise<ResourceAttributeUpsertOperation[]>;
49
+ resourceAttributeOperation: ResourceAttributeUpsertOperation
50
+ ): Promise<ResourceAttributeUpsertOperation>;
63
51
 
64
52
  /**
65
- * Updates entity attributes (batch operations).
66
- * For MS service: may throw error or delegate to upsert/delete
67
- * For SNS service: returns Promise<EntityAttributesOperation[]>
53
+ * Updates an entity attribute (single operation - upsert only).
54
+ * For MS service: performs upsert operation
55
+ * For SNS service: returns Promise<EntityAttributeUpsertOperation>
68
56
  */
69
57
  updateEntityAttributes(
70
58
  accountId: number,
71
59
  appName: string,
72
60
  callerActionIdentifier: string,
73
- entityAttributeOperations: EntityAttributeUpsertOperation[]
74
- ): Promise<EntityAttributeUpsertOperation[]>;
61
+ entityAttributeOperation: EntityAttributeUpsertOperation
62
+ ): Promise<EntityAttributeUpsertOperation>;
75
63
  }
@@ -1,8 +1,9 @@
1
1
  import type { Request, Response } from 'express';
2
+ import type { ResourceType } from '../resource-attributes-constants';
2
3
 
3
4
  export interface Resource {
4
- id?: number;
5
- type: string;
5
+ id: number;
6
+ type: ResourceType;
6
7
  wrapperData?: object;
7
8
  }
8
9
  export type Action = string;
@@ -12,7 +13,7 @@ export interface Context {
12
13
  }
13
14
  export interface AuthorizationObject {
14
15
  resource_id?: Resource['id'];
15
- resource_type: Resource['type'];
16
+ resource_type: string;
16
17
  wrapper_data?: Resource['wrapperData'];
17
18
  action: Action;
18
19
  }
@@ -0,0 +1,51 @@
1
+ import Ajv from 'ajv';
2
+ import { EntityType } from '../entity-attributes-constants';
3
+ import { ResourceType } from '../resource-attributes-constants';
4
+
5
+ const ajv = new Ajv({ allErrors: true });
6
+
7
+ export 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
+ },
15
+ required: ['entityId', 'entityType', 'key', 'value'],
16
+ additionalProperties: false,
17
+ });
18
+
19
+ export 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
+ },
26
+ required: ['entityId', 'entityType', 'key'],
27
+ additionalProperties: false,
28
+ });
29
+
30
+ export 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
+ },
37
+ required: ['id', 'type', 'key'],
38
+ additionalProperties: false,
39
+ });
40
+
41
+ export 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
+ },
49
+ required: ['resourceId', 'resourceType', 'key', 'value'],
50
+ additionalProperties: false,
51
+ });
@@ -0,0 +1,16 @@
1
+ import Ajv from 'ajv';
2
+ import { RESOURCE_TYPES } from '../resource-attributes-constants';
3
+
4
+ const ajv = new Ajv({ allErrors: true });
5
+
6
+ export const resourceSchema = ajv.compile({
7
+ type: 'object',
8
+ properties: {
9
+ id: { type: 'number', multipleOf: 1 },
10
+ type: { type: 'string', enum: RESOURCE_TYPES },
11
+ wrapperData: { type: 'object' },
12
+ },
13
+
14
+ required: ['id', 'type'],
15
+ additionalProperties: false,
16
+ });
@@ -1,7 +1,19 @@
1
- import Ajv, { ValidateFunction } from 'ajv';
1
+ import Ajv, { ValidateFunction, ErrorObject } from 'ajv';
2
2
  import { ArgumentError } from '../errors/argument-error';
3
- import { ResourceAttributeAssignment, EntityAttributeAssignment } from '../types/authorization-attributes-contracts';
4
- import { entityAssignmentSchema, resourceAssignmentSchema } from './assigment-schema';
3
+ import {
4
+ ResourceAttributeAssignment,
5
+ EntityAttributeAssignment,
6
+ ResourceAttributeDeleteAssignment,
7
+ EntityAttributeDeleteAssignment,
8
+ } from '../types/authorization-attributes-contracts';
9
+ import { Resource } from '../types/general';
10
+ import {
11
+ entityUpsertAssignmentSchema,
12
+ resourceUpsertAssignmentSchema,
13
+ entityDeleteAssignmentSchema,
14
+ resourceDeleteAssignmentSchema,
15
+ } from './assignment-schema';
16
+ import { resourceSchema } from './resource-schema';
5
17
 
6
18
  /**
7
19
  * Utility class for common validation operations using AJV
@@ -37,27 +49,76 @@ export class ValidationUtils {
37
49
  }
38
50
  }
39
51
 
52
+ public static validateResource(resource: Resource) {
53
+ const isValid = resourceSchema(resource);
54
+ if (!isValid) {
55
+ const errorMessage = this.formatValidationErrors(resourceSchema.errors);
56
+ throw new ArgumentError(errorMessage ? `Invalid resource: ${errorMessage}` : 'Invalid resource');
57
+ }
58
+ }
59
+
40
60
  /**
41
61
  * Validates an attribute assignment object using a single AJV schema.
42
62
  * Preserves legacy error messages for each field.
43
63
  */
44
- static validateResourceAssignment(resource: ResourceAttributeAssignment): void {
45
- const valid = resourceAssignmentSchema(resource);
64
+ static validatUpsertResourceAssignment(resource: ResourceAttributeAssignment): void {
65
+ const valid = resourceUpsertAssignmentSchema(resource);
66
+ if (!valid) {
67
+ const errorMessage = this.formatValidationErrors(resourceUpsertAssignmentSchema.errors);
68
+ throw new ArgumentError(
69
+ errorMessage
70
+ ? `Invalid resource attribute assignment: ${errorMessage}`
71
+ : 'Invalid resource attribute assignment'
72
+ );
73
+ }
74
+ }
75
+
76
+ static validatDeleteResourceAssignment(resource: ResourceAttributeDeleteAssignment): void {
77
+ const valid = resourceDeleteAssignmentSchema(resource);
78
+ if (!valid) {
79
+ const errorMessage = this.formatValidationErrors(resourceUpsertAssignmentSchema.errors);
80
+ throw new ArgumentError(
81
+ errorMessage
82
+ ? `Invalid resource attribute assignment: ${errorMessage}`
83
+ : 'Invalid resource attribute assignment'
84
+ );
85
+ }
86
+ }
87
+
88
+ static validatUpsertEntityAssignment(entity: EntityAttributeAssignment): void {
89
+ const valid = entityUpsertAssignmentSchema(entity);
46
90
  if (!valid) {
47
- const errorMessages = (resourceAssignmentSchema.errors || [])
48
- .map(err => err.message || 'validation failed')
49
- .join(', ');
50
- throw new ArgumentError(`Invalid resource attribute assignment: ${errorMessages}`);
91
+ const errorMessage = this.formatValidationErrors(entityUpsertAssignmentSchema.errors);
92
+ throw new ArgumentError(
93
+ errorMessage ? `Invalid entity attribute assignment: ${errorMessage}` : 'Invalid entity attribute assignment'
94
+ );
51
95
  }
52
96
  }
53
97
 
54
- static validateEntityAssignment(entity: EntityAttributeAssignment): void {
55
- const valid = entityAssignmentSchema(entity);
98
+ static validatDeleteEntityAssignment(entity: EntityAttributeDeleteAssignment): void {
99
+ const valid = entityDeleteAssignmentSchema(entity);
56
100
  if (!valid) {
57
- const errorMessages = (entityAssignmentSchema.errors || [])
58
- .map(err => err.message || 'validation failed')
59
- .join(', ');
60
- throw new ArgumentError(`Invalid entity attribute assignment: ${errorMessages}`);
101
+ const errorMessage = this.formatValidationErrors(entityDeleteAssignmentSchema.errors);
102
+ throw new ArgumentError(
103
+ errorMessage ? `Invalid entity attribute assignment: ${errorMessage}` : 'Invalid entity attribute assignment'
104
+ );
105
+ }
106
+ }
107
+ /**
108
+ * Formats AJV validation errors into a readable error message
109
+ */
110
+ private static formatValidationErrors(errors: ErrorObject[] | null | undefined): string {
111
+ if (!errors || errors.length === 0) {
112
+ return '';
61
113
  }
114
+
115
+ return errors
116
+ .map(err => {
117
+ const path =
118
+ err.instancePath || (err.params && 'missingProperty' in err.params ? `/${err.params.missingProperty}` : '');
119
+ const message = err.message || 'validation failed';
120
+ return path ? `${path}: ${message}` : message;
121
+ })
122
+ .join('; ');
62
123
  }
63
124
  }
@@ -1,29 +0,0 @@
1
- export declare const entityAssignmentSchema: import("ajv").ValidateFunction<{
2
- entityId: any;
3
- entityType: any;
4
- attributeKey: any;
5
- attributeValue: any;
6
- } & {
7
- entityId: any;
8
- } & {
9
- entityType: any;
10
- } & {
11
- attributeKey: any;
12
- } & {
13
- attributeValue: any;
14
- }>;
15
- export declare const resourceAssignmentSchema: import("ajv").ValidateFunction<{
16
- id: any;
17
- type: any;
18
- attributeKey: any;
19
- attributeValue: any;
20
- } & {
21
- id: any;
22
- } & {
23
- type: any;
24
- } & {
25
- attributeKey: any;
26
- } & {
27
- attributeValue: any;
28
- }>;
29
- //# sourceMappingURL=assigment-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assigment-schema.d.ts","sourceRoot":"","sources":["../../../src/utils/assigment-schema.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;EAUjC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;EAUnC,CAAC"}
@@ -1,29 +0,0 @@
1
- import Ajv from 'ajv';
2
- import { EntityType } from '../entity-attributes-constants.mjs';
3
- import { ResourceType } from '../resource-attributes-constants.mjs';
4
-
5
- const ajv = new Ajv({ allErrors: true });
6
- const entityAssignmentSchema = ajv.compile({
7
- type: 'object',
8
- properties: {
9
- entityId: { type: 'number', multipleOf: 1 },
10
- entityType: { type: 'string', enum: Object.values(EntityType) },
11
- key: { type: 'string', minLength: 1 },
12
- value: { type: 'string', minLength: 1 },
13
- },
14
- required: ['entityId', 'entityType', 'attributeKey', 'attributeValue'],
15
- additionalProperties: false,
16
- });
17
- const resourceAssignmentSchema = ajv.compile({
18
- type: 'object',
19
- properties: {
20
- id: { type: 'number', multipleOf: 1 },
21
- type: { type: 'string', enum: Object.values(ResourceType) },
22
- key: { type: 'string', minLength: 1 },
23
- value: { type: 'string', minLength: 1 },
24
- },
25
- required: ['id', 'type', 'attributeKey', 'attributeValue'],
26
- additionalProperties: false,
27
- });
28
-
29
- export { entityAssignmentSchema, resourceAssignmentSchema };
@@ -1,29 +0,0 @@
1
- export declare const entityAssignmentSchema: import("ajv").ValidateFunction<{
2
- entityId: any;
3
- entityType: any;
4
- attributeKey: any;
5
- attributeValue: any;
6
- } & {
7
- entityId: any;
8
- } & {
9
- entityType: any;
10
- } & {
11
- attributeKey: any;
12
- } & {
13
- attributeValue: any;
14
- }>;
15
- export declare const resourceAssignmentSchema: import("ajv").ValidateFunction<{
16
- id: any;
17
- type: any;
18
- attributeKey: any;
19
- attributeValue: any;
20
- } & {
21
- id: any;
22
- } & {
23
- type: any;
24
- } & {
25
- attributeKey: any;
26
- } & {
27
- attributeValue: any;
28
- }>;
29
- //# sourceMappingURL=assigment-schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"assigment-schema.d.ts","sourceRoot":"","sources":["../../src/utils/assigment-schema.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;EAUjC,CAAC;AAEH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;EAUnC,CAAC"}
@@ -1,36 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- const Ajv = require('ajv');
4
- const entityAttributesConstants = require('../entity-attributes-constants.js');
5
- const resourceAttributesConstants = require('../resource-attributes-constants.js');
6
-
7
- const _interopDefault = e => e && e.__esModule ? e : { default: e };
8
-
9
- const Ajv__default = /*#__PURE__*/_interopDefault(Ajv);
10
-
11
- const ajv = new Ajv__default.default({ allErrors: true });
12
- const entityAssignmentSchema = ajv.compile({
13
- type: 'object',
14
- properties: {
15
- entityId: { type: 'number', multipleOf: 1 },
16
- entityType: { type: 'string', enum: Object.values(entityAttributesConstants.EntityType) },
17
- key: { type: 'string', minLength: 1 },
18
- value: { type: 'string', minLength: 1 },
19
- },
20
- required: ['entityId', 'entityType', 'attributeKey', 'attributeValue'],
21
- additionalProperties: false,
22
- });
23
- const resourceAssignmentSchema = ajv.compile({
24
- type: 'object',
25
- properties: {
26
- id: { type: 'number', multipleOf: 1 },
27
- type: { type: 'string', enum: Object.values(resourceAttributesConstants.ResourceType) },
28
- key: { type: 'string', minLength: 1 },
29
- value: { type: 'string', minLength: 1 },
30
- },
31
- required: ['id', 'type', 'attributeKey', 'attributeValue'],
32
- additionalProperties: false,
33
- });
34
-
35
- exports.entityAssignmentSchema = entityAssignmentSchema;
36
- exports.resourceAssignmentSchema = resourceAssignmentSchema;
@@ -1,29 +0,0 @@
1
- import Ajv from 'ajv';
2
- import { EntityType } from '../entity-attributes-constants';
3
- import { ResourceType } from '../resource-attributes-constants';
4
-
5
- const ajv = new Ajv({ allErrors: true });
6
-
7
- export const entityAssignmentSchema = 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
- },
15
- required: ['entityId', 'entityType', 'attributeKey', 'attributeValue'],
16
- additionalProperties: false,
17
- });
18
-
19
- export const resourceAssignmentSchema = ajv.compile({
20
- type: 'object',
21
- properties: {
22
- id: { type: 'number', multipleOf: 1 },
23
- type: { type: 'string', enum: Object.values(ResourceType) },
24
- key: { type: 'string', minLength: 1 },
25
- value: { type: 'string', minLength: 1 },
26
- },
27
- required: ['id', 'type', 'attributeKey', 'attributeValue'],
28
- additionalProperties: false,
29
- });