@snteam/amplify-angular-core 1.0.40 → 1.0.41

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/index.d.ts CHANGED
@@ -858,11 +858,75 @@ declare class FormGroupQuestion<T> extends QuestionBase<T> {
858
858
  constructor(options?: any);
859
859
  }
860
860
 
861
+ /**
862
+ * Configuration interface for relationship selection sets
863
+ * This allows users to define exactly what fields should be selected for each relationship
864
+ */
865
+ interface RelationshipSelectionConfig {
866
+ /**
867
+ * The relationship model name (e.g., "ListView", "FormViewField")
868
+ */
869
+ relationshipModel: string;
870
+ /**
871
+ * The field name in the relationship (e.g., "table", "formView")
872
+ */
873
+ fieldName: string;
874
+ /**
875
+ * The selection set to use for this relationship
876
+ * This is the exact GraphQL selection set that will be used
877
+ */
878
+ selectionSet: string[];
879
+ /**
880
+ * Optional description for documentation
881
+ */
882
+ description?: string;
883
+ }
884
+ /**
885
+ * Configuration for all relationship selection sets in the application
886
+ */
887
+ interface RelationshipSelectionSetConfig {
888
+ /**
889
+ * Array of relationship configurations
890
+ */
891
+ relationships: RelationshipSelectionConfig[];
892
+ /**
893
+ * Default selection set to use when no specific configuration is found
894
+ */
895
+ defaultSelectionSet?: string[];
896
+ /**
897
+ * Whether to use fallback selection sets when configured ones fail
898
+ */
899
+ enableFallback?: boolean;
900
+ }
901
+ /**
902
+ * Service configuration that includes relationship selection sets
903
+ */
904
+ interface AmplifyModelServiceConfig {
905
+ /**
906
+ * Relationship selection set configurations
907
+ */
908
+ relationshipSelectionSets?: RelationshipSelectionSetConfig;
909
+ /**
910
+ * Other service configurations can be added here
911
+ */
912
+ [key: string]: any;
913
+ }
914
+
861
915
  declare class AmplifyModelService {
862
916
  private selectionSetGenerator;
863
917
  private errorHandler;
864
918
  private client;
919
+ private relationshipConfig;
865
920
  constructor(selectionSetGenerator: SelectionSetGeneratorService, errorHandler: ErrorHandlerService);
921
+ /**
922
+ * Configure the service with relationship selection sets
923
+ * This should be called by the consuming application to define how relationships should be queried
924
+ */
925
+ configure(config: AmplifyModelServiceConfig): void;
926
+ /**
927
+ * Set relationship selection set configuration directly
928
+ */
929
+ setRelationshipConfig(config: RelationshipSelectionSetConfig): void;
866
930
  /**
867
931
  * Initialize the service with the Amplify client
868
932
  * This should be called by the consuming application after Amplify.configure()
@@ -889,14 +953,21 @@ declare class AmplifyModelService {
889
953
  createRelationship(relModel: string, relItem: any): Promise<any> | null;
890
954
  getRelationshipFilter(config: any, baseId?: string, removeIds?: string[]): any;
891
955
  /**
892
- * Generate dynamic selection set for relationship queries
893
- * Replaces hardcoded selection set logic with dynamic generation
894
- * Enhanced with comprehensive error handling and logging
956
+ * Get selection set for relationship queries using configuration
957
+ * This replaces the complex dynamic generation with simple configuration lookup
895
958
  * @param config Relationship configuration object
896
959
  * @param baseId Base record ID (for compatibility, not used in generation)
897
960
  * @returns Array of GraphQL field selectors
898
961
  */
899
962
  getAmplifySelectionSet(config: RelationshipConfiguration, baseId: string): string[];
963
+ /**
964
+ * Get configured selection set for a specific relationship
965
+ */
966
+ private getConfiguredSelectionSet;
967
+ /**
968
+ * Generate a simple, predictable fallback selection set
969
+ */
970
+ private generateSimpleFallbackSelectionSet;
900
971
  setRelatedSub(config: any, baseId: string): Observable<any> | null;
901
972
  /**
902
973
  * Get related items with enhanced error handling and retry logic
@@ -922,19 +993,9 @@ declare class AmplifyModelService {
922
993
  private shouldRetryOnError;
923
994
  /**
924
995
  * Validate that relationship field data is populated in query results
925
- * Enhanced with comprehensive error logging and very flexible validation
996
+ * Simplified validation that's more predictable and easier to debug
926
997
  */
927
998
  private validateRelationshipFieldPopulation;
928
- /**
929
- * Check if a record has nested relationship data based on field patterns
930
- * This helps validate cases where selection sets use nested field access like "table.id", "table.name"
931
- */
932
- private hasNestedRelationshipData;
933
- /**
934
- * Check if a record has any field that might be related to the relationship field
935
- * This is a very permissive check for debugging purposes
936
- */
937
- private hasAnyRelatedField;
938
999
  /**
939
1000
  * Log query attempt details
940
1001
  */
@@ -1328,4 +1389,4 @@ declare class ValToTitlePipe implements PipeTransform {
1328
1389
  }
1329
1390
 
1330
1391
  export { AddRelationshipDialogComponent, AmplifyAngularCore, AmplifyFormBuilderService, AmplifyModelService, AsyncDropdownQuestion, ConfigurationAnalyzerService, ConfigurationsComponent, DatePickerQuestion, DateTimePickerQuestion, DropdownQuestion, DynamicFormComponent, DynamicFormGroupComponent, DynamicFormQuestionComponent, DynamicNestedFormQuestionComponent, DynamicRelationshipBuilderComponent, EmailQuestion, FieldClassification, FormGroupQuestion, ListViewComponent, MyErrorStateMatcher, NumberQuestion, PhoneQuestion, QuestionBase, QuestionControlService, RecordRelationshipsComponent, SchemaIntrospectorService, SelectionSetErrorType, SelectionSetGeneratorService, SelectionSetPattern, SliderQuestion, TextboxQuestion, TimePickerQuestion, ValToTitlePipe, phoneNumberValidator };
1331
- export type { AnalysisResult, CacheKey, CachedSelectionSet, ComplexityLimits, ComplexityValidationResult, ConfigurationAnalyzer, DialogData, DisplayOptimizationConfig, FieldAnalysis, ModelField, RelationshipConfiguration, RowAction, SchemaIntrospector, SelectionSetConfig, SelectionSetError, SelectionSetGenerator, SelectionSetResult };
1392
+ export type { AmplifyModelServiceConfig, AnalysisResult, CacheKey, CachedSelectionSet, ComplexityLimits, ComplexityValidationResult, ConfigurationAnalyzer, DialogData, DisplayOptimizationConfig, FieldAnalysis, ModelField, RelationshipConfiguration, RelationshipSelectionConfig, RelationshipSelectionSetConfig, RowAction, SchemaIntrospector, SelectionSetConfig, SelectionSetError, SelectionSetGenerator, SelectionSetResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snteam/amplify-angular-core",
3
- "version": "1.0.40",
3
+ "version": "1.0.41",
4
4
  "description": "Angular 20 components for building dynamic forms and list views with AWS Amplify Data",
5
5
  "keywords": [
6
6
  "angular",