mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 09:56:44 +00:00 
			
		
		
		
	fix: refactor object notation type in entity-service sort
This commit is contained in:
		
							parent
							
								
									1107713a66
								
							
						
					
					
						commit
						16a54daf6a
					
				| @ -75,16 +75,24 @@ export type ArrayNotation<TSchemaUID extends Common.UID.Schema> = Any<TSchemaUID | |||||||
|  * type F = 'title'; // ❌
 |  * type F = 'title'; // ❌
 | ||||||
|  */ |  */ | ||||||
| export type ObjectNotation<TSchemaUID extends Common.UID.Schema> = { | export type ObjectNotation<TSchemaUID extends Common.UID.Schema> = { | ||||||
|   // First level sort
 |   [key in ObjectNotationKeys<TSchemaUID>]?: key extends SingleAttribute<TSchemaUID> | ||||||
|   [key in SingleAttribute<TSchemaUID>]?: OrderKind.Any; |     ? // First level sort (scalar attributes, id, ...)
 | ||||||
| } & { |       OrderKind.Any | ||||||
|   // Deep sort, only add populatable keys that have a
 |     : // Deep sort (relations with a target, components, media, ...)
 | ||||||
|   // target (remove dynamic zones and other polymorphic links)
 |       ObjectNotation<Attribute.GetTarget<TSchemaUID, key>>; | ||||||
|   [key in Attribute.GetKeysWithTarget<TSchemaUID>]?: ObjectNotation< |  | ||||||
|     Attribute.GetTarget<TSchemaUID, key> |  | ||||||
|   >; |  | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | /** | ||||||
|  |  * Represents the keys of an object notation for a sort | ||||||
|  |  * - SingleAttribute<TSchemaUID> represents a union of every non-populatable attribute based on the passed schema UID | ||||||
|  |  * - Attribute.GetKeysWithTarget<TSchemaUID> provides keys with a target from the passed schema UID. | ||||||
|  |  * | ||||||
|  |  * This means that every member of ObjectNotationKeys can represent either a single non-populatable attribute or an attribute with a target. | ||||||
|  |  */ | ||||||
|  | type ObjectNotationKeys<TSchemaUID extends Common.UID.Schema> = | ||||||
|  |   | SingleAttribute<TSchemaUID> | ||||||
|  |   | Attribute.GetKeysWithTarget<TSchemaUID>; | ||||||
|  | 
 | ||||||
| /** | /** | ||||||
|  * Represents any notation for a sort (string, array, object) |  * Represents any notation for a sort (string, array, object) | ||||||
|  * |  * | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Convly
						Convly