@mondaydotcomorg/monday-authorization 3.5.2-feat-shaime-support-entity-attributes-4-ddec1d3 → 3.5.2-feat-shaime-support-entity-attributes-3-00b45ac
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/authorization-attributes-ms-service.d.ts +1 -17
- package/dist/authorization-attributes-ms-service.d.ts.map +1 -1
- package/dist/authorization-attributes-ms-service.js +47 -58
- package/dist/authorization-attributes-sns-service.d.ts +2 -23
- package/dist/authorization-attributes-sns-service.d.ts.map +1 -1
- package/dist/authorization-attributes-sns-service.js +11 -49
- 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/entity-attribute-assignment.d.ts +4 -8
- package/dist/entity-attribute-assignment.d.ts.map +1 -1
- package/dist/entity-attribute-assignment.js +4 -3
- package/dist/errors/argument-error.d.ts.map +1 -1
- package/dist/errors/argument-error.js +0 -1
- package/dist/esm/authorization-attributes-ms-service.d.ts +1 -17
- package/dist/esm/authorization-attributes-ms-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-ms-service.mjs +47 -58
- package/dist/esm/authorization-attributes-sns-service.d.ts +2 -23
- package/dist/esm/authorization-attributes-sns-service.d.ts.map +1 -1
- package/dist/esm/authorization-attributes-sns-service.mjs +11 -49
- 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/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 +4 -3
- package/dist/esm/errors/argument-error.d.ts.map +1 -1
- package/dist/esm/errors/argument-error.mjs +0 -1
- 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 +3 -2
- package/dist/esm/resource-attributes-constants.d.ts +9 -9
- package/dist/esm/resource-attributes-constants.d.ts.map +1 -1
- package/dist/esm/resource-attributes-constants.mjs +2 -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 +1 -2
- package/dist/esm/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/esm/types/authorization-attributes-service.interface.d.ts +2 -16
- package/dist/esm/types/authorization-attributes-service.interface.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +1 -1
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/utils/assigment-schema.d.ts +23 -0
- package/dist/esm/utils/assigment-schema.d.ts.map +1 -0
- package/dist/esm/utils/assigment-schema.mjs +29 -0
- package/dist/esm/utils/resource-schema.d.ts +17 -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 +9 -28
- package/dist/esm/utils/validation.d.ts.map +1 -1
- package/dist/esm/utils/validation.mjs +47 -120
- 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 +3 -2
- package/dist/resource-attributes-constants.d.ts +9 -9
- package/dist/resource-attributes-constants.d.ts.map +1 -1
- package/dist/resource-attributes-constants.js +2 -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 +1 -2
- package/dist/types/authorization-attributes-contracts.d.ts.map +1 -1
- package/dist/types/authorization-attributes-service.interface.d.ts +2 -16
- package/dist/types/authorization-attributes-service.interface.d.ts.map +1 -1
- package/dist/types/general.d.ts +1 -1
- package/dist/types/general.d.ts.map +1 -1
- package/dist/utils/assigment-schema.d.ts +23 -0
- package/dist/utils/assigment-schema.d.ts.map +1 -0
- package/dist/utils/assigment-schema.js +36 -0
- package/dist/utils/resource-schema.d.ts +17 -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 +9 -28
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +47 -120
- package/package.json +2 -3
- package/src/authorization-attributes-ms-service.ts +93 -117
- package/src/authorization-attributes-sns-service.ts +14 -69
- package/src/base-attribute-assignment.ts +10 -26
- package/src/entity-attribute-assignment.ts +9 -6
- package/src/errors/argument-error.ts +0 -1
- package/src/resource-attribute-assignment.ts +10 -12
- package/src/resource-attributes-constants.ts +2 -2
- package/src/testKit/index.ts +5 -5
- package/src/types/authorization-attributes-contracts.ts +1 -1
- package/src/types/authorization-attributes-service.interface.ts +2 -33
- package/src/types/general.ts +1 -1
- package/src/utils/assigment-schema.ts +29 -0
- package/src/utils/resource-schema.ts +21 -0
- package/src/utils/validation.ts +60 -138
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ResourceAttributeAssignment as ResourceAttributeAssignmentContract, EntityAttributeAssignment as EntityAttributeAssignmentContract, ResourceAttributeOperation, EntityAttributeOperation } from './authorization-attributes-contracts';
|
|
2
|
-
import { ResourceAttributeAssignment } from '../resource-attribute-assignment';
|
|
3
|
-
import { EntityAttributeAssignment } from '../entity-attribute-assignment';
|
|
4
|
-
import { Resource } from './general';
|
|
5
1
|
import { EntityType } from '../entity-attributes-constants';
|
|
2
|
+
import { ResourceAttributeOperation, EntityAttributeOperation } from './authorization-attributes-contracts';
|
|
3
|
+
import { Resource } from './general';
|
|
6
4
|
/**
|
|
7
5
|
* Resource type compatible with both MS and SNS services
|
|
8
6
|
*/
|
|
@@ -17,24 +15,12 @@ export interface CompatibleResource {
|
|
|
17
15
|
* Both MS (direct) and SNS (async) services implement this interface.
|
|
18
16
|
*/
|
|
19
17
|
export interface AuthorizationAttributesService {
|
|
20
|
-
/**authorization-attributes-service.ts
|
|
21
|
-
* Upserts resource attributes.
|
|
22
|
-
* For MS service: returns Promise<void>
|
|
23
|
-
* For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
|
|
24
|
-
*/
|
|
25
|
-
upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[] | ResourceAttributeAssignmentContract[], appName?: string, callerActionIdentifier?: string): Promise<void | ResourceAttributeOperation[]>;
|
|
26
18
|
/**
|
|
27
19
|
* Deletes resource attributes.
|
|
28
20
|
* For MS service: returns Promise<void>
|
|
29
21
|
* For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
|
|
30
22
|
*/
|
|
31
23
|
deleteResourceAttributes(accountId: number, resource: CompatibleResource | Resource, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<void | ResourceAttributeOperation[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Upserts entity attributes.
|
|
34
|
-
* For MS service: returns Promise<void>
|
|
35
|
-
* For SNS service: requires appName and callerActionIdentifier, returns Promise<EntityAttributesOperation[]>
|
|
36
|
-
*/
|
|
37
|
-
upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[] | EntityAttributeAssignmentContract[], appName?: string, callerActionIdentifier?: string): Promise<void | EntityAttributeOperation[]>;
|
|
38
24
|
/**
|
|
39
25
|
* Deletes entity attributes.
|
|
40
26
|
* For MS service: returns Promise<void>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-attributes-service.interface.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"authorization-attributes-service.interface.d.ts","sourceRoot":"","sources":["../../../src/types/authorization-attributes-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC5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AAQ,CAAC,gBAAgB,CAAC,CAAC;AACtD,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,QAAQ,EAAE,CAAC;AAClE,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const entityAssignmentSchema: import("ajv").ValidateFunction<{
|
|
2
|
+
entityId: any;
|
|
3
|
+
entityType: any;
|
|
4
|
+
key: any;
|
|
5
|
+
} & {
|
|
6
|
+
entityId: any;
|
|
7
|
+
} & {
|
|
8
|
+
entityType: any;
|
|
9
|
+
} & {
|
|
10
|
+
key: any;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const resourceAssignmentSchema: import("ajv").ValidateFunction<{
|
|
13
|
+
id: any;
|
|
14
|
+
type: any;
|
|
15
|
+
key: any;
|
|
16
|
+
} & {
|
|
17
|
+
id: any;
|
|
18
|
+
} & {
|
|
19
|
+
type: any;
|
|
20
|
+
} & {
|
|
21
|
+
key: any;
|
|
22
|
+
}>;
|
|
23
|
+
//# sourceMappingURL=assigment-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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' },
|
|
13
|
+
},
|
|
14
|
+
required: ['entityId', 'entityType', 'key'],
|
|
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' },
|
|
24
|
+
},
|
|
25
|
+
required: ['id', 'type', 'key'],
|
|
26
|
+
additionalProperties: false,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { entityAssignmentSchema, resourceAssignmentSchema };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Resource {
|
|
2
|
+
id?: number;
|
|
3
|
+
type: string;
|
|
4
|
+
wrapperData?: object;
|
|
5
|
+
}
|
|
6
|
+
export declare const resourceSchema: import("ajv").ValidateFunction<{
|
|
7
|
+
id: any;
|
|
8
|
+
type: any;
|
|
9
|
+
wrapperData: any;
|
|
10
|
+
} & {
|
|
11
|
+
id: any;
|
|
12
|
+
} & {
|
|
13
|
+
type: any;
|
|
14
|
+
} & {
|
|
15
|
+
wrapperData: any;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=resource-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-schema.d.ts","sourceRoot":"","sources":["../../../src/utils/resource-schema.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,eAAO,MAAM,cAAc;;;;;;;;;;EASzB,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: 'string', minLength: 1 },
|
|
11
|
+
},
|
|
12
|
+
required: ['id', 'type', 'wrapperData'],
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export { resourceSchema };
|
|
@@ -1,45 +1,26 @@
|
|
|
1
|
+
import { ResourceAttributeAssignment, EntityAttributeAssignment } 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
|
-
type: string;
|
|
27
|
-
attributeKey: any;
|
|
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 validateResourceAssignment(resource: ResourceAttributeAssignment): void;
|
|
20
|
+
static validateEntityAssignment(entity: EntityAttributeAssignment): void;
|
|
38
21
|
/**
|
|
39
|
-
*
|
|
40
|
-
* Throws ArgumentError with legacy-compatible messages.
|
|
22
|
+
* Formats AJV validation errors into a readable error message
|
|
41
23
|
*/
|
|
42
|
-
static
|
|
43
|
-
static validateArrayTypeOf<T>(attributesMessages: T[], messageClass: abstract new (...args: any[]) => T): void;
|
|
24
|
+
private static formatValidationErrors;
|
|
44
25
|
}
|
|
45
26
|
//# 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,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACrH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C;;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,0BAA0B,CAAC,QAAQ,EAAE,2BAA2B,GAAG,IAAI;IAY9E,MAAM,CAAC,wBAAwB,CAAC,MAAM,EAAE,yBAAyB,GAAG,IAAI;IAUxE;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,sBAAsB;CActC"}
|
|
@@ -1,151 +1,78 @@
|
|
|
1
1
|
import Ajv from 'ajv';
|
|
2
2
|
import { ArgumentError } from '../errors/argument-error.mjs';
|
|
3
|
+
import { resourceAssignmentSchema, entityAssignmentSchema } from './assigment-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 validateResourceAssignment(resource) {
|
|
47
|
+
const valid = resourceAssignmentSchema(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(resourceAssignmentSchema.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
|
-
if (!resource || typeof resource !== 'object') {
|
|
116
|
-
throw new ArgumentError('resource must be an object');
|
|
117
|
-
}
|
|
118
|
-
const schema = {
|
|
119
|
-
type: 'object',
|
|
120
|
-
properties: {
|
|
121
|
-
id: { type: 'number', multipleOf: 1 },
|
|
122
|
-
type: { type: 'string', minLength: 1 },
|
|
123
|
-
wrapperData: { type: 'string' },
|
|
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');
|
|
55
|
+
static validateEntityAssignment(entity) {
|
|
56
|
+
const valid = entityAssignmentSchema(entity);
|
|
57
|
+
if (!valid) {
|
|
58
|
+
const errorMessage = this.formatValidationErrors(entityAssignmentSchema.errors);
|
|
59
|
+
throw new ArgumentError(errorMessage ? `Invalid entity attribute assignment: ${errorMessage}` : 'Invalid entity attribute assignment');
|
|
132
60
|
}
|
|
133
61
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (!isArrayValid) {
|
|
141
|
-
throw new ArgumentError(`attributesMessages must be an array`);
|
|
142
|
-
}
|
|
143
|
-
for (let i = 0; i < attributesMessages.length; i++) {
|
|
144
|
-
const item = attributesMessages[i];
|
|
145
|
-
if (!(item instanceof messageClass)) {
|
|
146
|
-
throw new ArgumentError(`attributesMessages[${i}] must be an instance of ${messageClass.name}, got: ${item?.constructor?.name || typeof item}`);
|
|
147
|
-
}
|
|
62
|
+
/**
|
|
63
|
+
* Formats AJV validation errors into a readable error message
|
|
64
|
+
*/
|
|
65
|
+
static formatValidationErrors(errors) {
|
|
66
|
+
if (!errors || errors.length === 0) {
|
|
67
|
+
return '';
|
|
148
68
|
}
|
|
69
|
+
return errors
|
|
70
|
+
.map(err => {
|
|
71
|
+
const path = err.instancePath || (err.params && 'missingProperty' in err.params ? `/${err.params.missingProperty}` : '');
|
|
72
|
+
const message = err.message || 'validation failed';
|
|
73
|
+
return path ? `${path}: ${message}` : message;
|
|
74
|
+
})
|
|
75
|
+
.join('; ');
|
|
149
76
|
}
|
|
150
77
|
}
|
|
151
78
|
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { ResourceType } from './resource-attributes-constants';
|
|
2
2
|
import { BaseAttributeAssignment } from './base-attribute-assignment';
|
|
3
|
-
|
|
3
|
+
import { ResourceAttributeAssignment as ResourceAttributeAssignmentContract } from './types/authorization-attributes-contracts';
|
|
4
|
+
export declare class ResourceAttributeAssignment extends BaseAttributeAssignment<ResourceType, ResourceAttributeAssignmentContract> {
|
|
4
5
|
readonly resourceId: number;
|
|
5
6
|
readonly resourceType: ResourceType;
|
|
6
7
|
constructor(resourceId: number, resourceType: ResourceType, attributeKey: string, attributeValue: string);
|
|
7
|
-
toDataTransferObject():
|
|
8
|
-
resourceId: number;
|
|
9
|
-
resourceType: ResourceType;
|
|
10
|
-
key: string;
|
|
11
|
-
value: string;
|
|
12
|
-
};
|
|
8
|
+
toDataTransferObject(): ResourceAttributeAssignmentContract;
|
|
13
9
|
/**
|
|
14
10
|
* Compares two assignments for equality
|
|
15
11
|
* @param other Another ResourceAttributeAssignment instance
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"resource-attribute-assignment.d.ts","sourceRoot":"","sources":["../src/resource-attribute-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,2BAA2B,IAAI,mCAAmC,EAAE,MAAM,4CAA4C,CAAC;AAGhI,qBAAa,2BAA4B,SAAQ,uBAAuB,CACtE,YAAY,EACZ,mCAAmC,CACpC;IACC,SAAgB,UAAU,EAAE,MAAM,CAAC;IACnC,SAAgB,YAAY,EAAE,YAAY,CAAC;gBAE/B,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAOxG,oBAAoB,IAAI,mCAAmC;IAQ3D;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO;CAGpD"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const resourceAttributesConstants = require('./resource-attributes-constants.js');
|
|
4
3
|
const baseAttributeAssignment = require('./base-attribute-assignment.js');
|
|
4
|
+
const utils_validation = require('./utils/validation.js');
|
|
5
5
|
|
|
6
6
|
class ResourceAttributeAssignment extends baseAttributeAssignment.BaseAttributeAssignment {
|
|
7
7
|
resourceId;
|
|
8
8
|
resourceType;
|
|
9
9
|
constructor(resourceId, resourceType, attributeKey, attributeValue) {
|
|
10
|
-
|
|
10
|
+
utils_validation.ValidationUtils.validateResourceAssignment({ resourceId, resourceType, key: attributeKey, value: attributeValue });
|
|
11
|
+
super(resourceId, resourceType, attributeKey, attributeValue);
|
|
11
12
|
this.resourceId = resourceId;
|
|
12
13
|
this.resourceType = this.type;
|
|
13
14
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export declare const RESOURCE_ATTRIBUTES_CONSTANTS: {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export declare const RESOURCE_ATTRIBUTES_CONSTANTS: Readonly<{
|
|
2
|
+
ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
3
|
+
ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: string;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
WORKSPACE_RESOURCE_ATTRIBUTES: {
|
|
6
|
+
IS_DEFAULT_WORKSPACE: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
BOARD_RESOURCE_ATTRIBUTES: {
|
|
9
|
+
IS_SYNCABLE_CHILD_ENTITY: string;
|
|
10
|
+
SYSTEM_ENTITY_TYPE: string;
|
|
11
11
|
};
|
|
12
|
-
}
|
|
12
|
+
}>;
|
|
13
13
|
export declare enum ResourceType {
|
|
14
14
|
Account = "account",
|
|
15
15
|
AccountProduct = "account_product",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"resource-attributes-constants.d.ts","sourceRoot":"","sources":["../src/resource-attributes-constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B;;;;;;;;;;;EAWxC,CAAC;AAEH,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,cAAc,oBAAoB;IAClC,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,GAAG,QAAQ;CACZ;AAGD,eAAO,MAAM,cAAc,yBAA6C,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
3
|
+
const RESOURCE_ATTRIBUTES_CONSTANTS = Object.freeze({
|
|
4
4
|
ACCOUNT_RESOURCE_ATTRIBUTES: {
|
|
5
5
|
ENABLE_MEMBERS_INVITE_FROM_NON_AUTH_DOMAIN: 'enable_members_invite_from_non_auth_domain',
|
|
6
6
|
},
|
|
@@ -11,7 +11,7 @@ const RESOURCE_ATTRIBUTES_CONSTANTS = {
|
|
|
11
11
|
IS_SYNCABLE_CHILD_ENTITY: 'is_syncable_child_entity',
|
|
12
12
|
SYSTEM_ENTITY_TYPE: 'system_entity_type',
|
|
13
13
|
},
|
|
14
|
-
};
|
|
14
|
+
});
|
|
15
15
|
exports.ResourceType = void 0;
|
|
16
16
|
(function (ResourceType) {
|
|
17
17
|
ResourceType["Account"] = "account";
|
package/dist/testKit/index.d.ts
CHANGED
|
@@ -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,7 @@
|
|
|
1
1
|
import { Resource } from './general';
|
|
2
2
|
import type { EntityType } from '../entity-attributes-constants';
|
|
3
3
|
import type { ResourceType } from '../resource-attributes-constants';
|
|
4
|
-
interface AttributeAssignment {
|
|
4
|
+
export interface AttributeAssignment {
|
|
5
5
|
key: string;
|
|
6
6
|
value: string;
|
|
7
7
|
}
|
|
@@ -39,5 +39,4 @@ export interface ResourceAttributeOperation extends ResourceAttributeAssignment
|
|
|
39
39
|
export interface EntityAttributeOperation extends EntityAttributeAssignment {
|
|
40
40
|
operationType: AttributeOperation;
|
|
41
41
|
}
|
|
42
|
-
export {};
|
|
43
42
|
//# 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;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAErE,
|
|
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,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;AAID,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,UAAU,CAAC;CACxB;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,kBAAkB;IAC5B,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAGD,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,2BAA2B,EAAE,CAAC;CAC3C;AAED,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,yBAAyB,EAAE,CAAC;CACzC;AAED,MAAM,WAAW,0BAA2B,SAAQ,2BAA2B;IAC7E,aAAa,EAAE,kBAAkB,CAAC;CACnC;AAED,MAAM,WAAW,wBAAyB,SAAQ,yBAAyB;IACzE,aAAa,EAAE,kBAAkB,CAAC;CACnC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { ResourceAttributeAssignment as ResourceAttributeAssignmentContract, EntityAttributeAssignment as EntityAttributeAssignmentContract, ResourceAttributeOperation, EntityAttributeOperation } from './authorization-attributes-contracts';
|
|
2
|
-
import { ResourceAttributeAssignment } from '../resource-attribute-assignment';
|
|
3
|
-
import { EntityAttributeAssignment } from '../entity-attribute-assignment';
|
|
4
|
-
import { Resource } from './general';
|
|
5
1
|
import { EntityType } from '../entity-attributes-constants';
|
|
2
|
+
import { ResourceAttributeOperation, EntityAttributeOperation } from './authorization-attributes-contracts';
|
|
3
|
+
import { Resource } from './general';
|
|
6
4
|
/**
|
|
7
5
|
* Resource type compatible with both MS and SNS services
|
|
8
6
|
*/
|
|
@@ -17,24 +15,12 @@ export interface CompatibleResource {
|
|
|
17
15
|
* Both MS (direct) and SNS (async) services implement this interface.
|
|
18
16
|
*/
|
|
19
17
|
export interface AuthorizationAttributesService {
|
|
20
|
-
/**authorization-attributes-service.ts
|
|
21
|
-
* Upserts resource attributes.
|
|
22
|
-
* For MS service: returns Promise<void>
|
|
23
|
-
* For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
|
|
24
|
-
*/
|
|
25
|
-
upsertResourceAttributes(accountId: number, resourceAttributeAssignments: ResourceAttributeAssignment[] | ResourceAttributeAssignmentContract[], appName?: string, callerActionIdentifier?: string): Promise<void | ResourceAttributeOperation[]>;
|
|
26
18
|
/**
|
|
27
19
|
* Deletes resource attributes.
|
|
28
20
|
* For MS service: returns Promise<void>
|
|
29
21
|
* For SNS service: requires appName and callerActionIdentifier, returns Promise<ResourceAttributesOperation[]>
|
|
30
22
|
*/
|
|
31
23
|
deleteResourceAttributes(accountId: number, resource: CompatibleResource | Resource, attributeKeys: string[], appName?: string, callerActionIdentifier?: string): Promise<void | ResourceAttributeOperation[]>;
|
|
32
|
-
/**
|
|
33
|
-
* Upserts entity attributes.
|
|
34
|
-
* For MS service: returns Promise<void>
|
|
35
|
-
* For SNS service: requires appName and callerActionIdentifier, returns Promise<EntityAttributesOperation[]>
|
|
36
|
-
*/
|
|
37
|
-
upsertEntityAttributes(accountId: number, entityAttributeAssignments: EntityAttributeAssignment[] | EntityAttributeAssignmentContract[], appName?: string, callerActionIdentifier?: string): Promise<void | EntityAttributeOperation[]>;
|
|
38
24
|
/**
|
|
39
25
|
* Deletes entity attributes.
|
|
40
26
|
* For MS service: returns Promise<void>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-attributes-service.interface.d.ts","sourceRoot":"","sources":["../../src/types/authorization-attributes-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"authorization-attributes-service.interface.d.ts","sourceRoot":"","sources":["../../src/types/authorization-attributes-service.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAC5G,O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