@snteam/amplify-angular-core 1.0.40 → 1.0.42

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
  */
@@ -1122,15 +1183,30 @@ declare class ListViewComponent implements OnInit {
1122
1183
  static ɵcmp: i0.ɵɵComponentDeclaration<ListViewComponent, "snteam-list-view", never, { "modelName": { "alias": "modelName"; "required": false; }; "customItemTemplate": { "alias": "customItemTemplate"; "required": false; }; "hideNewButton": { "alias": "hideNewButton"; "required": false; }; "title": { "alias": "title"; "required": false; }; "useRouter": { "alias": "useRouter"; "required": false; }; "showRowActions": { "alias": "showRowActions"; "required": false; }; "showDeleteAction": { "alias": "showDeleteAction"; "required": false; }; "customRowActions": { "alias": "customRowActions"; "required": false; }; }, { "itemClick": "itemClick"; "newClick": "newClick"; "itemsLoaded": "itemsLoaded"; "itemDeleted": "itemDeleted"; }, never, never, true, never>;
1123
1184
  }
1124
1185
 
1186
+ interface RelationshipSelectionConfigWithId extends RelationshipSelectionConfig {
1187
+ id: string;
1188
+ }
1125
1189
  declare class ConfigurationsComponent implements OnInit {
1126
1190
  amplifyOutputs?: any;
1127
1191
  private qcs;
1128
1192
  private ams;
1129
1193
  private snackBar;
1194
+ private fb;
1130
1195
  hasTableConfig: boolean;
1131
1196
  hasFormView: boolean;
1132
1197
  hasListView: boolean;
1133
1198
  hasFieldConfig: boolean;
1199
+ relationshipConfigs: RelationshipSelectionConfigWithId[];
1200
+ showAddRelationshipConfig: boolean;
1201
+ editingRelationshipConfig: RelationshipSelectionConfigWithId | null;
1202
+ relationshipConfigForm: FormGroup;
1203
+ availableModels: string[];
1204
+ availableFields: {
1205
+ name: string;
1206
+ label: string;
1207
+ type: string;
1208
+ }[];
1209
+ constructor();
1134
1210
  ngOnInit(): void;
1135
1211
  get outputs(): any;
1136
1212
  checkAvailableModels(): void;
@@ -1144,6 +1220,18 @@ declare class ConfigurationsComponent implements OnInit {
1144
1220
  private formatModelLabel;
1145
1221
  private formatFieldLabel;
1146
1222
  private mapFieldType;
1223
+ private loadAvailableModels;
1224
+ onRelationshipModelChange(event: any): void;
1225
+ private loadAvailableFields;
1226
+ private loadRelationshipConfigs;
1227
+ private saveRelationshipConfigsToStorage;
1228
+ saveRelationshipConfig(): void;
1229
+ editRelationshipConfig(config: RelationshipSelectionConfigWithId): void;
1230
+ deleteRelationshipConfig(config: RelationshipSelectionConfigWithId): void;
1231
+ private generateId;
1232
+ cancelRelationshipConfigEdit(): void;
1233
+ loadDefaultRelationshipConfigs(): void;
1234
+ clearAllRelationshipConfigs(): void;
1147
1235
  static ɵfac: i0.ɵɵFactoryDeclaration<ConfigurationsComponent, never>;
1148
1236
  static ɵcmp: i0.ɵɵComponentDeclaration<ConfigurationsComponent, "snteam-configurations", never, { "amplifyOutputs": { "alias": "amplifyOutputs"; "required": false; }; }, {}, never, never, true, never>;
1149
1237
  }
@@ -1328,4 +1416,4 @@ declare class ValToTitlePipe implements PipeTransform {
1328
1416
  }
1329
1417
 
1330
1418
  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 };
1419
+ 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.42",
4
4
  "description": "Angular 20 components for building dynamic forms and list views with AWS Amplify Data",
5
5
  "keywords": [
6
6
  "angular",