From 543cb7d46b5767121eab9a5102f525e68db84196 Mon Sep 17 00:00:00 2001 From: Jan Baykara Date: Tue, 12 Mar 2024 07:55:23 +0000 Subject: [PATCH] WIP import data from datasources for use in mapping --- hub/graphql/mutations.py | 10 +- hub/graphql/types.py | 12 +- hub/graphql/utils.py | 6 + ...xternaldatasource_geography_column_type.py | 2 +- ...0077_externaldatasource_fields_and_more.py | 28 ++ ...pping_externaldatasource_update_mapping.py | 18 ++ ...xternaldatasource_geography_column_type.py | 31 +++ ...0_dataset_external_data_source_and_more.py | 39 +++ hub/models.py | 243 +++++++++++++++--- hub/tests/test_sources.py | 2 +- nextjs/src/__generated__/gql.ts | 29 ++- nextjs/src/__generated__/graphql.ts | 88 ++++--- .../ExternalDataSourceUpdates.tsx | 2 +- .../configure/[externalDataSourceId]/page.tsx | 10 +- .../connect/[externalDataSourceType]/page.tsx | 12 +- .../review/[externalDataSourceId]/page.tsx | 2 +- .../InspectExternalDataSource.tsx | 12 +- nextjs/src/components/AutoUpdateCard.tsx | 2 +- nextjs/src/components/SelectSourceData.tsx | 7 +- ...eMappingForm.tsx => UpdateMappingForm.tsx} | 61 +++-- nextjs/src/graphql/mutations.ts | 2 +- nextjs/src/lib/data.ts | 4 +- utils/postcodesIO.py | 8 +- 23 files changed, 502 insertions(+), 128 deletions(-) create mode 100644 hub/graphql/utils.py create mode 100644 hub/migrations/0077_externaldatasource_fields_and_more.py create mode 100644 hub/migrations/0078_rename_auto_update_mapping_externaldatasource_update_mapping.py create mode 100644 hub/migrations/0079_alter_externaldatasource_geography_column_type.py create mode 100644 hub/migrations/0080_dataset_external_data_source_and_more.py rename nextjs/src/components/{AutoUpdateMappingForm.tsx => UpdateMappingForm.tsx} (69%) diff --git a/hub/graphql/mutations.py b/hub/graphql/mutations.py index bc112ff1e..f9e1e8ce2 100644 --- a/hub/graphql/mutations.py +++ b/hub/graphql/mutations.py @@ -8,13 +8,14 @@ from strawberry_django.permissions import IsAuthenticated from strawberry_django.auth.utils import get_current_user from strawberry.types.info import Info +from asgiref.sync import async_to_sync @strawberry.input class IDObject: id: str @strawberry.input -class AutoUpdateMappingItemInput: +class UpdateMappingItemInput: source: str source_path: str destination_column: str @@ -28,7 +29,7 @@ class ExternalDataSourceInput: geography_column: auto geography_column_type: auto auto_update_enabled: auto - auto_update_mapping: Optional[List[AutoUpdateMappingItemInput]] + update_mapping: Optional[List[UpdateMappingItemInput]] auto_import_enabled: auto @strawberry_django.input(models.AirtableSource, partial=True) @@ -66,7 +67,10 @@ def disable_auto_update (external_data_source_id: str) -> models.ExternalDataSou @strawberry.mutation(extensions=[IsAuthenticated()]) def trigger_update(external_data_source_id: str) -> models.ExternalDataSource: data_source = models.ExternalDataSource.objects.get(id=external_data_source_id) - job_id = data_source.schedule_refresh_all() + # TODO: Return this to the queue + print("Triggering update") + async_to_sync(data_source.refresh_all)() + # job_id = data_source.schedule_refresh_all() return data_source @strawberry.mutation(extensions=[IsAuthenticated()]) diff --git a/hub/graphql/types.py b/hub/graphql/types.py index 7105a3fd4..d2ec03c52 100644 --- a/hub/graphql/types.py +++ b/hub/graphql/types.py @@ -6,6 +6,7 @@ from hub import models from datetime import datetime import procrastinate.contrib.django.models +from .utils import key_resolver @strawberry_django.filters.filter(procrastinate.contrib.django.models.ProcrastinateJob, lookups=True) class QueueFilter: @@ -96,6 +97,12 @@ def get_queryset(cls, queryset, info, **kwargs): # ExternalDataSource +@strawberry.type +class FieldDefinition: + value: str = key_resolver('value') + label: Optional[str] = key_resolver('label') + description: Optional[str] = key_resolver('description') + @strawberry_django.type(models.ExternalDataSource) class ExternalDataSource: id: auto @@ -106,9 +113,12 @@ class ExternalDataSource: organisation: Organisation geography_column: auto geography_column_type: auto - auto_update_mapping: Optional[List['AutoUpdateConfig']] + update_mapping: Optional[List['AutoUpdateConfig']] auto_update_enabled: auto auto_import_enabled: auto + field_definitions: Optional[List[FieldDefinition]] = strawberry_django.field( + resolver=lambda self: self.field_definitions() + ) jobs: List[QueueJob] = strawberry_django.field( resolver=lambda self: procrastinate.contrib.django.models.ProcrastinateJob.objects.filter( diff --git a/hub/graphql/utils.py b/hub/graphql/utils.py new file mode 100644 index 000000000..a85a186cc --- /dev/null +++ b/hub/graphql/utils.py @@ -0,0 +1,6 @@ +import strawberry + +def key_resolver(key: str): + def resolver(self): + return self.get(key, None) + return strawberry.field(resolver=resolver) \ No newline at end of file diff --git a/hub/migrations/0075_alter_externaldatasource_geography_column_type.py b/hub/migrations/0075_alter_externaldatasource_geography_column_type.py index 643c66968..1a9452e6c 100644 --- a/hub/migrations/0075_alter_externaldatasource_geography_column_type.py +++ b/hub/migrations/0075_alter_externaldatasource_geography_column_type.py @@ -22,7 +22,7 @@ class Migration(migrations.Migration): ("council", "Council"), ("constituency", "Constituency"), ], - choices_enum=hub.models.ExternalDataSource.GeographyTypes, + choices_enum=hub.models.ExternalDataSource.PostcodesIOGeographyTypes, default="postcode", max_length=12, ), diff --git a/hub/migrations/0077_externaldatasource_fields_and_more.py b/hub/migrations/0077_externaldatasource_fields_and_more.py new file mode 100644 index 000000000..e45147928 --- /dev/null +++ b/hub/migrations/0077_externaldatasource_fields_and_more.py @@ -0,0 +1,28 @@ +# Generated by Django 4.2.10 on 2024-03-11 03:13 + +from django.db import migrations +import django_jsonform.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("hub", "0076_externaldatasource_autoimport_enabled_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="externaldatasource", + name="fields", + field=django_jsonform.models.fields.JSONField( + blank=True, default=[], null=True + ), + ), + migrations.AlterField( + model_name="externaldatasource", + name="auto_update_mapping", + field=django_jsonform.models.fields.JSONField( + blank=True, default=[], null=True + ), + ), + ] diff --git a/hub/migrations/0078_rename_auto_update_mapping_externaldatasource_update_mapping.py b/hub/migrations/0078_rename_auto_update_mapping_externaldatasource_update_mapping.py new file mode 100644 index 000000000..416b6fed8 --- /dev/null +++ b/hub/migrations/0078_rename_auto_update_mapping_externaldatasource_update_mapping.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.10 on 2024-03-11 03:15 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("hub", "0077_externaldatasource_fields_and_more"), + ] + + operations = [ + migrations.RenameField( + model_name="externaldatasource", + old_name="auto_update_mapping", + new_name="update_mapping", + ), + ] diff --git a/hub/migrations/0079_alter_externaldatasource_geography_column_type.py b/hub/migrations/0079_alter_externaldatasource_geography_column_type.py new file mode 100644 index 000000000..058b92ca8 --- /dev/null +++ b/hub/migrations/0079_alter_externaldatasource_geography_column_type.py @@ -0,0 +1,31 @@ +# Generated by Django 4.2.10 on 2024-03-11 03:45 + +from django.db import migrations +import django_choices_field.fields +import hub.models + + +class Migration(migrations.Migration): + + dependencies = [ + ("hub", "0078_rename_auto_update_mapping_externaldatasource_update_mapping"), + ] + + operations = [ + migrations.AlterField( + model_name="externaldatasource", + name="geography_column_type", + field=django_choices_field.fields.TextChoicesField( + choices=[ + ("postcode", "Postcode"), + ("ward", "Ward"), + ("council", "Council"), + ("constituency", "Constituency"), + ("constituency_2025", "Constituency (2024)"), + ], + choices_enum=hub.models.ExternalDataSource.PostcodesIOGeographyTypes, + default="postcode", + max_length=17, + ), + ), + ] diff --git a/hub/migrations/0080_dataset_external_data_source_and_more.py b/hub/migrations/0080_dataset_external_data_source_and_more.py new file mode 100644 index 000000000..8a8b76896 --- /dev/null +++ b/hub/migrations/0080_dataset_external_data_source_and_more.py @@ -0,0 +1,39 @@ +# Generated by Django 4.2.10 on 2024-03-11 09:56 + +from django.db import migrations, models +import django.db.models.deletion +import django_jsonform.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ("hub", "0079_alter_externaldatasource_geography_column_type"), + ] + + operations = [ + migrations.AddField( + model_name="dataset", + name="external_data_source", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="hub.externaldatasource", + ), + ), + migrations.AlterField( + model_name="externaldatasource", + name="fields", + field=django_jsonform.models.fields.JSONField( + blank=True, default=list, null=True + ), + ), + migrations.AlterField( + model_name="externaldatasource", + name="update_mapping", + field=django_jsonform.models.fields.JSONField( + blank=True, default=list, null=True + ), + ), + ] diff --git a/hub/models.py b/hub/models.py index 0ed6e2060..490896440 100644 --- a/hub/models.py +++ b/hub/models.py @@ -1,6 +1,6 @@ from datetime import datetime, timezone import uuid -from typing import Iterable, TypedDict, Union, Optional +from typing import Iterable, TypedDict, Union, Optional, List import asyncio from asgiref.sync import sync_to_async from psycopg.errors import UniqueViolation @@ -786,21 +786,28 @@ class ExternalDataSource(PolymorphicModel): created_at = models.DateTimeField(auto_now_add=True) last_update = models.DateTimeField(auto_now=True) automated_webhooks = False + introspect_fields = False # Geocoding data - class GeographyTypes(models.TextChoices): + class PostcodesIOGeographyTypes(models.TextChoices): POSTCODE = 'postcode', 'Postcode' WARD = 'ward', 'Ward' - COUNCIL = 'council', 'Council' - CONSTITUENCY = 'constituency', 'Constituency' - geography_column_type = TextChoicesField(choices_enum=GeographyTypes, default=GeographyTypes.POSTCODE) + COUNCIL = 'admin_district', 'Council' + CONSTITUENCY = 'parliamentary_constituency', 'Constituency' + CONSTITUENCY_2025 = 'parliamentary_constituency_2025', 'Constituency (2024)' + geography_column_type = TextChoicesField(choices_enum=PostcodesIOGeographyTypes, default=PostcodesIOGeographyTypes.POSTCODE) geography_column = models.CharField(max_length=250, blank=True, null=True) + class FieldDefinition(TypedDict): + value: str + label: Optional[str] + description: Optional[str] + fields = JSONField(blank=True, null=True, default=list) # Auto-updates - class AutoUpdateMapping(TypedDict): + class UpdateMapping(TypedDict): source: str # Can be a dot path, for use with benedict source_path: str destination_column: str - auto_update_mapping = JSONField(blank=True, null=True, default=[]) + update_mapping = JSONField(blank=True, null=True, default=list) auto_update_enabled = models.BooleanField(default=False, blank=True) # Auto-import auto_import_enabled = models.BooleanField(default=False, blank=True) @@ -811,8 +818,8 @@ def __str__(self): def event_log_queryset(self): return ProcrastinateJob.objects.filter(args__external_data_source_id=str(self.id)).order_by('-scheduled_at') - def get_auto_update_mapping(self) -> list[AutoUpdateMapping]: - return ensure_list(self.auto_update_mapping) + def get_update_mapping(self) -> list[UpdateMapping]: + return ensure_list(self.update_mapping) def delete(self, *args, **kwargs): self.disable_auto_update() @@ -826,6 +833,12 @@ def healthcheck(self): Check the connection to the API. ''' raise NotImplementedError('Healthcheck not implemented for this data source type.') + + def field_definitions(self) -> list[FieldDefinition]: + ''' + Get the fields for the data source. + ''' + return ensure_list(self.fields) def setup_webhooks(self): ''' @@ -941,17 +954,31 @@ def get_record_dict(self, record: any) -> dict: Get a record as a dictionary. ''' return record - + # Mapping mechanics async def fetch_many_loader(self, keys): results = await self.fetch_many(keys) # sort results by keys, including None return [next((result for result in results if self.get_record_id(result) == key), None) for key in keys] + + def filter(self, filter: dict) -> dict: + ''' + Look up a record by a value in a column. + ''' + raise NotImplementedError('Lookup not implemented for this data source type.') class Loaders(TypedDict): postcodesIO: DataLoader fetch_record: DataLoader + fetch_enrichment_data: DataLoader + + class EnrichmentLookup(TypedDict): + member_id: str + postcode_data: PostcodesIOResult + source_id: 'ExternalDataSource' + source_path: str + source_data: Optional[any] def get_import_data(self): return GenericData.objects.filter( @@ -959,13 +986,126 @@ def get_import_data(self): ) def get_import_dataframe(self): - return pd.DataFrame(list(self.get_cached_data())) - + return pd.DataFrame(list(self.get_import_data())) + def get_loaders (self) -> Loaders: - return { - "postcodesIO": DataLoader(load_fn=get_bulk_postcode_geo), - "fetch_record": DataLoader(load_fn=self.fetch_many_loader, cache=False) - } + async def fetch_enrichment_data(keys: List[self.EnrichmentLookup]) -> list[str]: + print("fetch_enrichment_data") + ''' + Each key is a member record with postcode data, and a source to join onto via geography_column/geography_column_type, and a path for the source field to select + For each row: + + SELECT members.member_id, source.source_path + FROM members + JOIN source ON source.geography_column = members.postcode_data.geography_column + + We can do this via python + Or we can do it via SQL, if we have GenericData for both the `members` and `source`. + For now we will convert both to pandas dataframes and join them in python + ''' + source_ids: list[str] = list(set([key['source_id'] for key in keys])) + updated_keys = keys.copy() + # pandas DF for the keys data + # Turn EnrichmentLookup into [member_id, ...postcode_data] + # keys_df = pd.DataFrame(keys) + keys_df = pd.DataFrame([ + { + **key, + **key['postcode_data'] + } for key in keys + ]) + + print(keys_df) + + # batch fetch the source data, joining on the geography_column + async for enrichment_layer in ExternalDataSource.objects.filter(id__in=source_ids): + print("enrichment_layer", enrichment_layer) + # pandas DF for the source data + enrichment_df = enrichment_layer.get_import_dataframe() + print("enrichment_df", enrichment_df) + # join and then return + # update_fields_df = pd.merge( + # keys_df, + # enrichment_df, + # left_on=enrichment_layer.geography_column_type, + # right_on=enrichment_layer.geography_column, + # how='left' + # ) + # print("update_fields_df", update_fields_df) + # For each row, get the source_path + for index, key in enumerate(keys): + if key['source_id'] == enrichment_layer.id: + # query enrichment_df by matching the postcode_data to the geography_column + enrichment_value = enrichment_df.loc[ + enrichment_layer.geography_column == key['postcode_data'][enrichment_layer.geography_column_type] + ] + updated_keys[index]['source_data'] = enrichment_value + + # k: self.EnrichmentLookup = key + # # Get the source_path + # source_path = k['source_path'] + # # Get the value + # value = enrichment_df.loc[ + # update_fields_df['member_id'] == key['member_id'], + # source_path + # ] + # updated_keys[index]['source_data'] = value or None + + return updated_keys + + # # TODO: query GenericData for imported stuff + # # A bunch of source / join_from / join_to / selects + # # Group by source + # # For each source, get the join_from and join_to + # # For each join_from, get the join_to + # # For each join_to, get the selects + # source_ids = list(set([key['source_id'] for key in keys])) + # update_df = pd.DataFrame([ + # key['postcode_data'] for key in keys + # ]) + # source_dataloaders = [] + # for source_id in source_ids: + # # pandas DF for the source data + # enrichment_df = self.get_import_dataframe() + # pandas DF for the keys data + # join and then return + + + # enrichment_layer: ExternalDataSource = ExternalDataSource.objects.get(id=source_id) + # def source_bulk_lookup_fn (keys: self.EnrichmentLookup) -> str: + # keys: member_lookup_values + # How to join the data? + # geography_lookup_values = set() + # for key in keys if key['source_id'] == source_id else []: + # postcode_data = key['postcode_data'] + # if enrichment_layer.geography_column_type == self.PostcodesIOGeographyTypes.POSTCODE: + # postcode_lookup_value = postcode_data['postcode'] + # elif enrichment_layer.geography_column_type == self.PostcodesIOGeographyTypes.WARD: + # postcode_lookup_value = postcode_data['ward'] + # elif enrichment_layer.geography_column_type == self.PostcodesIOGeographyTypes.COUNCIL: + # postcode_lookup_value = postcode_data['admin_district'] + # elif enrichment_layer.geography_column_type == self.PostcodesIOGeographyTypes.CONSTITUENCY: + # postcode_lookup_value = postcode_data['parliamentary_constituency'] + # elif enrichment_layer.geography_column_type == self.PostcodesIOGeographyTypes.CONSTITUENCY_2025: + # postcode_lookup_value = postcode_data['parliamentary_constituency_2025'] + # lookup_data = enrichment_layer.filter({ + # enrichment_layer.geography_column: postcode_lookup_value + # }) + # data = enrichment_layer.get_record_field(lookup_data, key['source_path']) + # source_dataloaders.append(DataLoader( + # load_fn=source_bulk_lookup_fn, + # cache=False + # )) + # return [0 for key in keys] + + def cache_key_fn (key: self.EnrichmentLookup) -> str: + return f"{key['member_id']}_{key['source_id']}" + + return self.Loaders( + postcodesIO=DataLoader(load_fn=get_bulk_postcode_geo), + fetch_record=DataLoader(load_fn=self.fetch_many_loader, cache=False), + fetch_enrichment_data=DataLoader(load_fn=fetch_enrichment_data, cache_key_fn=cache_key_fn) + ) async def map_one(self, member: Union[str, dict], loaders: Loaders) -> MappedMember: ''' @@ -976,33 +1116,48 @@ async def map_one(self, member: Union[str, dict], loaders: Loaders) -> MappedMem update_fields = {} try: postcode_data = None - if self.geography_column_type == self.GeographyTypes.POSTCODE: + if self.geography_column_type == self.PostcodesIOGeographyTypes.POSTCODE: # Get postcode from member postcode = self.get_record_field(member, self.geography_column) # Get relevant config data for that postcode - postcode_data = await loaders['postcodesIO'].load(postcode) + postcode_data: PostcodesIOResult = await loaders['postcodesIO'].load(postcode) # Map the fields - for mapping_dict in self.get_auto_update_mapping(): + for mapping_dict in self.get_update_mapping(): source = mapping_dict['source'] - path = mapping_dict['source_path'] - field = mapping_dict['destination_column'] + source_path = mapping_dict['source_path'] + destination_column = mapping_dict['destination_column'] if source == 'postcodes.io': if postcode_data is not None: - update_fields[field] = get(postcode_data, path) + update_fields[destination_column] = get(postcode_data, source_path) else: - # Room for other data sources - pass + update_value = await loaders['fetch_enrichment_data'].load( + self.EnrichmentLookup( + member_id=self.get_record_id(member), + postcode_data=postcode_data, + source_id=source, + source_path=source_path + ) + ) + print("Custom mapping", source, source_path, update_value) + update_fields[destination_column] = get(update_value['source_data'], source_path) + # enrichment_data = await enrichment_layer.lookup({ + # enrichment_layer.geography_column: + # postcode_lookup_value + # }) + # update_fields[field] = get(enrichment_data[0]['fields'], path) + # except: + # pass # Return the member and config data - return { - 'member': member, - 'update_fields': update_fields - } + return self.MappedMember( + member=member, + update_fields=update_fields + ) except TypeError: # Error fetching postcode data - return { - 'member': member, - 'update_fields': {} - } + return self.MappedMember( + member=member, + update_fields={} + ) async def map_many(self, members: list[Union[str, any]], loaders: Loaders) -> list[MappedMember]: ''' @@ -1018,21 +1173,21 @@ async def map_all(self, loaders: Loaders) -> list[MappedMember]: return await asyncio.gather(*[self.map_one(member, loaders) for member in members]) async def refresh_one(self, member_id: Union[str, any]): - if len(self.get_auto_update_mapping()) == 0: + if len(self.get_update_mapping()) == 0: return loaders = self.get_loaders() mapped_record = await self.map_one(member_id, loaders) await self.update_one(mapped_record=mapped_record) async def refresh_many(self, member_ids: list[Union[str, any]]): - if len(self.get_auto_update_mapping()) == 0: + if len(self.get_update_mapping()) == 0: return loaders = self.get_loaders() mapped_records = await self.map_many(member_ids, loaders) await self.update_many(mapped_records=mapped_records) async def refresh_all(self): - if len(self.get_auto_update_mapping()) == 0: + if len(self.get_update_mapping()) == 0: return loaders = self.get_loaders() mapped_records = await self.map_all(loaders) @@ -1155,6 +1310,7 @@ class AirtableSource(ExternalDataSource): base_id = models.CharField(max_length=250) table_id = models.CharField(max_length=250) automated_webhooks = True + introspect_fields = True class Meta: verbose_name = 'Airtable table' @@ -1178,6 +1334,16 @@ def healthcheck(self): return True return False + def field_definitions(self): + return [ + self.FieldDefinition( + label=field.name, + value=field.id, + description=field.description + ) + for field in self.table.schema().fields + ] + async def fetch_one(self, member_id): record = self.table.get(member_id) return record @@ -1193,6 +1359,13 @@ async def fetch_all(self): records = self.table.all() return records + def filter(self, d: dict): + formula = f'AND(' + formula += ",".join([f"{key}='{value}'" for key, value in d.items()]) + formula += ')' + records = self.table.all(formula=formula) + return records + def get_record_id(self, record): return record['id'] diff --git a/hub/tests/test_sources.py b/hub/tests/test_sources.py index ca97eac6f..e24a8ddfb 100644 --- a/hub/tests/test_sources.py +++ b/hub/tests/test_sources.py @@ -19,7 +19,7 @@ def setUp(self) -> None: api_key=settings.TEST_AIRTABLE_API_KEY, geography_column="Postcode", auto_update_enabled=True, - auto_update_mapping=[ + update_mapping=[ { "source": "postcodes.io", "source_path": "parliamentary_constituency_2025", diff --git a/nextjs/src/__generated__/gql.ts b/nextjs/src/__generated__/gql.ts index c71a7d5ff..ad5f55218 100644 --- a/nextjs/src/__generated__/gql.ts +++ b/nextjs/src/__generated__/gql.ts @@ -15,25 +15,26 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ const documents = { "\n query Example {\n organisations {\n id\n name\n }\n }\n": types.ExampleDocument, "\n mutation Verify($token: String!) {\n verifyAccount(token: $token) {\n errors\n success\n }\n }\n": types.VerifyDocument, - "\n query ListExternalDataSources {\n externalDataSources {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n jobs {\n lastEventAt\n status\n }\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n": types.ListExternalDataSourcesDocument, - "\n query GetSourceMapping($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n autoUpdateEnabled\n autoUpdateMapping {\n destinationColumn\n source\n sourcePath\n }\n geographyColumn\n geographyColumnType\n }\n }\n": types.GetSourceMappingDocument, + "\n query ListExternalDataSources {\n externalDataSources {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n jobs {\n lastEventAt\n status\n }\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n": types.ListExternalDataSourcesDocument, + "\n query GetSourceMapping($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n autoUpdateEnabled\n updateMapping {\n destinationColumn\n source\n sourcePath\n }\n geographyColumn\n geographyColumnType\n }\n }\n": types.GetSourceMappingDocument, "\n query TestAirtableSource(\n $apiKey: String!\n $baseId: String!\n $tableId: String!\n ) {\n testAirtableSource(apiKey: $apiKey, baseId: $baseId, tableId: $tableId)\n }\n": types.TestAirtableSourceDocument, "\n mutation CreateAirtableSource($AirtableSource: AirtableSourceInput!) {\n createAirtableSource(data: $AirtableSource) {\n id\n name\n healthcheck\n }\n }\n": types.CreateAirtableSourceDocument, "\n query AllExternalDataSources {\n externalDataSources {\n id\n name\n createdAt\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n }\n }\n autoUpdateEnabled\n }\n }\n": types.AllExternalDataSourcesDocument, - "\n query AutoUpdateCreationReview($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n }\n": types.AutoUpdateCreationReviewDocument, - "\n query ExternalDataSourceInspectPage($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n apiKey\n }\n }\n autoUpdateEnabled\n webhookHealthcheck\n geographyColumn\n geographyColumnType\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n": types.ExternalDataSourceInspectPageDocument, + "\n query AutoUpdateCreationReview($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n }\n": types.AutoUpdateCreationReviewDocument, + "\n query ExternalDataSourceInspectPage($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n apiKey\n }\n }\n autoUpdateEnabled\n webhookHealthcheck\n geographyColumn\n geographyColumnType\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n": types.ExternalDataSourceInspectPageDocument, "\n mutation DeleteUpdateConfig($id: String!) {\n deleteExternalDataSource(data: { id: $id }) {\n id\n }\n }\n": types.DeleteUpdateConfigDocument, "\n mutation Login($username: String!, $password: String!) {\n tokenAuth(username: $username, password: $password) {\n errors\n success\n token {\n token\n payload {\n exp\n }\n }\n }\n }\n": types.LoginDocument, "\n mutation Register($email: String!, $password1: String!, $password2: String!, $username: String!) {\n register(email: $email, password1: $password1, password2: $password2, username: $username) {\n errors\n success\n }\n }\n": types.RegisterDocument, "\n mutation AutoUpdateWebhookRefresh($ID: String!) {\n refreshWebhooks(externalDataSourceId: $ID) {\n id\n webhookHealthcheck\n }\n }\n": types.AutoUpdateWebhookRefreshDocument, - "\n fragment AutoUpdateCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n": types.AutoUpdateCardFieldsFragmentDoc, + "\n fragment AutoUpdateCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n": types.AutoUpdateCardFieldsFragmentDoc, "\n query ExternalDataSourceAutoUpdateCard($ID: ID!) {\n externalDataSource(pk: $ID) {\n ...AutoUpdateCardFields\n }\n }\n \n": types.ExternalDataSourceAutoUpdateCardDocument, "\n mutation EnableAutoUpdate($ID: String!) {\n enableAutoUpdate(externalDataSourceId: $ID) {\n id\n autoUpdateEnabled\n webhookHealthcheck\n name\n }\n }\n": types.EnableAutoUpdateDocument, "\n mutation DisableAutoUpdate($ID: String!) {\n disableAutoUpdate(externalDataSourceId: $ID) {\n id\n autoUpdateEnabled\n webhookHealthcheck\n name\n }\n }\n": types.DisableAutoUpdateDocument, "\n mutation TriggerFullUpdate($externalDataSourceId: String!) {\n triggerUpdate(externalDataSourceId: $externalDataSourceId) {\n id\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n id\n name\n connectionDetails {\n crmType: __typename\n }\n }\n }\n": types.TriggerFullUpdateDocument, "\n fragment ExternalDataSourceCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n }\n": types.ExternalDataSourceCardFieldsFragmentDoc, "\n query ExternalDataSourceCard($ID: ID!) {\n externalDataSource(pk: $ID) {\n ...ExternalDataSourceCardFields\n }\n }\n \n": types.ExternalDataSourceCardDocument, - "\n mutation UpdateExternalDataSource($input: ExternalDataSourceInput!) {\n updateExternalDataSource(data: $input) {\n id\n name\n geographyColumn\n geographyColumnType\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n": types.UpdateExternalDataSourceDocument, + "\n query EnrichmentLayers {\n externalDataSources {\n id\n name\n geographyColumn\n fieldDefinitions {\n label\n value\n description\n }\n }\n }\n": types.EnrichmentLayersDocument, + "\n mutation UpdateExternalDataSource($input: ExternalDataSourceInput!) {\n updateExternalDataSource(data: $input) {\n id\n name\n geographyColumn\n geographyColumnType\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n": types.UpdateExternalDataSourceDocument, "\n query PublicUser {\n publicUser {\n id\n username\n email\n }\n }\n": types.PublicUserDocument, }; @@ -62,11 +63,11 @@ export function gql(source: "\n mutation Verify($token: String!) {\n verifyA /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n query ListExternalDataSources {\n externalDataSources {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n jobs {\n lastEventAt\n status\n }\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"): (typeof documents)["\n query ListExternalDataSources {\n externalDataSources {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n jobs {\n lastEventAt\n status\n }\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"]; +export function gql(source: "\n query ListExternalDataSources {\n externalDataSources {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n jobs {\n lastEventAt\n status\n }\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"): (typeof documents)["\n query ListExternalDataSources {\n externalDataSources {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n jobs {\n lastEventAt\n status\n }\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n query GetSourceMapping($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n autoUpdateEnabled\n autoUpdateMapping {\n destinationColumn\n source\n sourcePath\n }\n geographyColumn\n geographyColumnType\n }\n }\n"): (typeof documents)["\n query GetSourceMapping($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n autoUpdateEnabled\n autoUpdateMapping {\n destinationColumn\n source\n sourcePath\n }\n geographyColumn\n geographyColumnType\n }\n }\n"]; +export function gql(source: "\n query GetSourceMapping($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n autoUpdateEnabled\n updateMapping {\n destinationColumn\n source\n sourcePath\n }\n geographyColumn\n geographyColumnType\n }\n }\n"): (typeof documents)["\n query GetSourceMapping($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n autoUpdateEnabled\n updateMapping {\n destinationColumn\n source\n sourcePath\n }\n geographyColumn\n geographyColumnType\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -82,11 +83,11 @@ export function gql(source: "\n query AllExternalDataSources {\n externalDat /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n query AutoUpdateCreationReview($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n }\n"): (typeof documents)["\n query AutoUpdateCreationReview($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n }\n"]; +export function gql(source: "\n query AutoUpdateCreationReview($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n }\n"): (typeof documents)["\n query AutoUpdateCreationReview($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n query ExternalDataSourceInspectPage($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n apiKey\n }\n }\n autoUpdateEnabled\n webhookHealthcheck\n geographyColumn\n geographyColumnType\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"): (typeof documents)["\n query ExternalDataSourceInspectPage($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n apiKey\n }\n }\n autoUpdateEnabled\n webhookHealthcheck\n geographyColumn\n geographyColumnType\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"]; +export function gql(source: "\n query ExternalDataSourceInspectPage($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n apiKey\n }\n }\n autoUpdateEnabled\n webhookHealthcheck\n geographyColumn\n geographyColumnType\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"): (typeof documents)["\n query ExternalDataSourceInspectPage($ID: ID!) {\n externalDataSource(pk: $ID) {\n id\n name\n connectionDetails {\n crmType: __typename\n ... on AirtableSource {\n baseId\n tableId\n apiKey\n }\n }\n autoUpdateEnabled\n webhookHealthcheck\n geographyColumn\n geographyColumnType\n jobs {\n status\n id\n taskName\n args\n lastEventAt\n }\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -106,7 +107,7 @@ export function gql(source: "\n mutation AutoUpdateWebhookRefresh($ID: String!) /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n fragment AutoUpdateCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n"): (typeof documents)["\n fragment AutoUpdateCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n"]; +export function gql(source: "\n fragment AutoUpdateCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n"): (typeof documents)["\n fragment AutoUpdateCardFields on ExternalDataSource {\n id\n name\n connectionDetails {\n crmType: __typename\n }\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n jobs {\n lastEventAt\n status\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -134,7 +135,11 @@ export function gql(source: "\n query ExternalDataSourceCard($ID: ID!) {\n e /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function gql(source: "\n mutation UpdateExternalDataSource($input: ExternalDataSourceInput!) {\n updateExternalDataSource(data: $input) {\n id\n name\n geographyColumn\n geographyColumnType\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"): (typeof documents)["\n mutation UpdateExternalDataSource($input: ExternalDataSourceInput!) {\n updateExternalDataSource(data: $input) {\n id\n name\n geographyColumn\n geographyColumnType\n autoUpdateEnabled\n autoUpdateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"]; +export function gql(source: "\n query EnrichmentLayers {\n externalDataSources {\n id\n name\n geographyColumn\n fieldDefinitions {\n label\n value\n description\n }\n }\n }\n"): (typeof documents)["\n query EnrichmentLayers {\n externalDataSources {\n id\n name\n geographyColumn\n fieldDefinitions {\n label\n value\n description\n }\n }\n }\n"]; +/** + * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function gql(source: "\n mutation UpdateExternalDataSource($input: ExternalDataSourceInput!) {\n updateExternalDataSource(data: $input) {\n id\n name\n geographyColumn\n geographyColumnType\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"): (typeof documents)["\n mutation UpdateExternalDataSource($input: ExternalDataSourceInput!) {\n updateExternalDataSource(data: $input) {\n id\n name\n geographyColumn\n geographyColumnType\n autoUpdateEnabled\n updateMapping {\n source\n sourcePath\n destinationColumn\n }\n }\n }\n"]; /** * The gql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/nextjs/src/__generated__/graphql.ts b/nextjs/src/__generated__/graphql.ts index f75730d9d..56fe5b23a 100644 --- a/nextjs/src/__generated__/graphql.ts +++ b/nextjs/src/__generated__/graphql.ts @@ -56,14 +56,14 @@ export type AirtableSource = { apiKey: Scalars['String']['output']; autoImportEnabled: Scalars['Boolean']['output']; autoUpdateEnabled: Scalars['Boolean']['output']; - autoUpdateMapping?: Maybe>; autoUpdateWebhookUrl: Scalars['String']['output']; baseId: Scalars['String']['output']; connectionDetails: AirtableSource; createdAt: Scalars['DateTime']['output']; description?: Maybe; + fieldDefinitions?: Maybe>; geographyColumn?: Maybe; - geographyColumnType: GeographyTypes; + geographyColumnType: PostcodesIoGeographyTypes; healthcheck: Scalars['Boolean']['output']; id: Scalars['UUID']['output']; jobs: Array; @@ -71,6 +71,7 @@ export type AirtableSource = { name: Scalars['String']['output']; organisation: Organisation; tableId: Scalars['String']['output']; + updateMapping?: Maybe>; webhookHealthcheck: Scalars['Boolean']['output']; }; @@ -80,15 +81,15 @@ export type AirtableSourceInput = { apiKey?: InputMaybe; autoImportEnabled?: InputMaybe; autoUpdateEnabled?: InputMaybe; - autoUpdateMapping?: InputMaybe>; baseId?: InputMaybe; description?: InputMaybe; geographyColumn?: InputMaybe; - geographyColumnType?: InputMaybe; + geographyColumnType?: InputMaybe; id?: InputMaybe; name?: InputMaybe; organisation?: InputMaybe; tableId?: InputMaybe; + updateMapping?: InputMaybe>; }; export type AutoUpdateConfig = { @@ -98,12 +99,6 @@ export type AutoUpdateConfig = { sourcePath: Scalars['String']['output']; }; -export type AutoUpdateMappingItemInput = { - destinationColumn: Scalars['String']['input']; - source: Scalars['String']['input']; - sourcePath: Scalars['String']['input']; -}; - export type CreateOrganisationInput = { description?: InputMaybe; name: Scalars['String']['input']; @@ -144,19 +139,20 @@ export type ExternalDataSource = { __typename?: 'ExternalDataSource'; autoImportEnabled: Scalars['Boolean']['output']; autoUpdateEnabled: Scalars['Boolean']['output']; - autoUpdateMapping?: Maybe>; autoUpdateWebhookUrl: Scalars['String']['output']; connectionDetails: AirtableSource; createdAt: Scalars['DateTime']['output']; description?: Maybe; + fieldDefinitions?: Maybe>; geographyColumn?: Maybe; - geographyColumnType: GeographyTypes; + geographyColumnType: PostcodesIoGeographyTypes; healthcheck: Scalars['Boolean']['output']; id: Scalars['UUID']['output']; jobs: Array; lastUpdate: Scalars['DateTime']['output']; name: Scalars['String']['output']; organisation: Organisation; + updateMapping?: Maybe>; webhookHealthcheck: Scalars['Boolean']['output']; }; @@ -168,21 +164,21 @@ export type ExternalDataSource = { export type ExternalDataSourceInput = { autoImportEnabled?: InputMaybe; autoUpdateEnabled?: InputMaybe; - autoUpdateMapping?: InputMaybe>; description?: InputMaybe; geographyColumn?: InputMaybe; - geographyColumnType?: InputMaybe; + geographyColumnType?: InputMaybe; id?: InputMaybe; name?: InputMaybe; organisation?: InputMaybe; + updateMapping?: InputMaybe>; }; -export enum GeographyTypes { - Constituency = 'CONSTITUENCY', - Council = 'COUNCIL', - Postcode = 'POSTCODE', - Ward = 'WARD' -} +export type FieldDefinition = { + __typename?: 'FieldDefinition'; + description?: Maybe; + label?: Maybe; + value: Scalars['String']['output']; +}; export type IdFilterLookup = { contains?: InputMaybe; @@ -245,6 +241,7 @@ export type Mutation = { deleteExternalDataSource: ExternalDataSource; disableAutoUpdate: ExternalDataSource; enableAutoUpdate: ExternalDataSource; + importAll: ExternalDataSource; refreshWebhooks: ExternalDataSource; /** * Register user with fields defined in the settings. If the email field of @@ -335,6 +332,11 @@ export type MutationEnableAutoUpdateArgs = { }; +export type MutationImportAllArgs = { + externalDataSourceId: Scalars['String']['input']; +}; + + export type MutationRefreshWebhooksArgs = { externalDataSourceId: Scalars['String']['input']; }; @@ -436,6 +438,14 @@ export type OutputInterface = { success: Scalars['Boolean']['output']; }; +export enum PostcodesIoGeographyTypes { + Constituency = 'CONSTITUENCY', + Constituency_2025 = 'CONSTITUENCY_2025', + Council = 'COUNCIL', + Postcode = 'POSTCODE', + Ward = 'WARD' +} + export type Query = { __typename?: 'Query'; airtableSource: AirtableSource; @@ -583,6 +593,12 @@ export type TokenType = { token: Scalars['String']['output']; }; +export type UpdateMappingItemInput = { + destinationColumn: Scalars['String']['input']; + source: Scalars['String']['input']; + sourcePath: Scalars['String']['input']; +}; + /** * Users within the Django authentication system are represented by this * model. @@ -652,14 +668,14 @@ export type VerifyMutation = { __typename?: 'Mutation', verifyAccount: { __typen export type ListExternalDataSourcesQueryVariables = Exact<{ [key: string]: never; }>; -export type ListExternalDataSourcesQuery = { __typename?: 'Query', externalDataSources: Array<{ __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, connectionDetails: { __typename?: 'AirtableSource', crmType: 'AirtableSource' }, jobs: Array<{ __typename?: 'QueueJob', lastEventAt: any, status: string }>, autoUpdateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null }> }; +export type ListExternalDataSourcesQuery = { __typename?: 'Query', externalDataSources: Array<{ __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, connectionDetails: { __typename?: 'AirtableSource', crmType: 'AirtableSource' }, jobs: Array<{ __typename?: 'QueueJob', lastEventAt: any, status: string }>, updateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null }> }; export type GetSourceMappingQueryVariables = Exact<{ ID: Scalars['ID']['input']; }>; -export type GetSourceMappingQuery = { __typename?: 'Query', externalDataSource: { __typename?: 'ExternalDataSource', id: any, autoUpdateEnabled: boolean, geographyColumn?: string | null, geographyColumnType: GeographyTypes, autoUpdateMapping?: Array<{ __typename?: 'AutoUpdateConfig', destinationColumn: string, source: string, sourcePath: string }> | null } }; +export type GetSourceMappingQuery = { __typename?: 'Query', externalDataSource: { __typename?: 'ExternalDataSource', id: any, autoUpdateEnabled: boolean, geographyColumn?: string | null, geographyColumnType: PostcodesIoGeographyTypes, updateMapping?: Array<{ __typename?: 'AutoUpdateConfig', destinationColumn: string, source: string, sourcePath: string }> | null } }; export type TestAirtableSourceQueryVariables = Exact<{ apiKey: Scalars['String']['input']; @@ -687,14 +703,14 @@ export type AutoUpdateCreationReviewQueryVariables = Exact<{ }>; -export type AutoUpdateCreationReviewQuery = { __typename?: 'Query', externalDataSource: { __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, connectionDetails: { __typename?: 'AirtableSource', crmType: 'AirtableSource' }, autoUpdateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null, jobs: Array<{ __typename?: 'QueueJob', lastEventAt: any, status: string }> } }; +export type AutoUpdateCreationReviewQuery = { __typename?: 'Query', externalDataSource: { __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, connectionDetails: { __typename?: 'AirtableSource', crmType: 'AirtableSource' }, updateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null, jobs: Array<{ __typename?: 'QueueJob', lastEventAt: any, status: string }> } }; export type ExternalDataSourceInspectPageQueryVariables = Exact<{ ID: Scalars['ID']['input']; }>; -export type ExternalDataSourceInspectPageQuery = { __typename?: 'Query', externalDataSource: { __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, webhookHealthcheck: boolean, geographyColumn?: string | null, geographyColumnType: GeographyTypes, connectionDetails: { __typename?: 'AirtableSource', baseId: string, tableId: string, apiKey: string, crmType: 'AirtableSource' }, jobs: Array<{ __typename?: 'QueueJob', status: string, id: string, taskName: string, args: any, lastEventAt: any }>, autoUpdateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null } }; +export type ExternalDataSourceInspectPageQuery = { __typename?: 'Query', externalDataSource: { __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, webhookHealthcheck: boolean, geographyColumn?: string | null, geographyColumnType: PostcodesIoGeographyTypes, connectionDetails: { __typename?: 'AirtableSource', baseId: string, tableId: string, apiKey: string, crmType: 'AirtableSource' }, jobs: Array<{ __typename?: 'QueueJob', status: string, id: string, taskName: string, args: any, lastEventAt: any }>, updateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null } }; export type DeleteUpdateConfigMutationVariables = Exact<{ id: Scalars['String']['input']; @@ -728,7 +744,7 @@ export type AutoUpdateWebhookRefreshMutationVariables = Exact<{ export type AutoUpdateWebhookRefreshMutation = { __typename?: 'Mutation', refreshWebhooks: { __typename?: 'ExternalDataSource', id: any, webhookHealthcheck: boolean } }; -export type AutoUpdateCardFieldsFragment = { __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, connectionDetails: { __typename?: 'AirtableSource', crmType: 'AirtableSource' }, autoUpdateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null, jobs: Array<{ __typename?: 'QueueJob', lastEventAt: any, status: string }> } & { ' $fragmentName'?: 'AutoUpdateCardFieldsFragment' }; +export type AutoUpdateCardFieldsFragment = { __typename?: 'ExternalDataSource', id: any, name: string, autoUpdateEnabled: boolean, connectionDetails: { __typename?: 'AirtableSource', crmType: 'AirtableSource' }, updateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null, jobs: Array<{ __typename?: 'QueueJob', lastEventAt: any, status: string }> } & { ' $fragmentName'?: 'AutoUpdateCardFieldsFragment' }; export type ExternalDataSourceAutoUpdateCardQueryVariables = Exact<{ ID: Scalars['ID']['input']; @@ -773,39 +789,45 @@ export type ExternalDataSourceCardQuery = { __typename?: 'Query', externalDataSo & { ' $fragmentRefs'?: { 'ExternalDataSourceCardFieldsFragment': ExternalDataSourceCardFieldsFragment } } ) }; +export type EnrichmentLayersQueryVariables = Exact<{ [key: string]: never; }>; + + +export type EnrichmentLayersQuery = { __typename?: 'Query', externalDataSources: Array<{ __typename?: 'ExternalDataSource', id: any, name: string, geographyColumn?: string | null, fieldDefinitions?: Array<{ __typename?: 'FieldDefinition', label?: string | null, value: string, description?: string | null }> | null }> }; + export type UpdateExternalDataSourceMutationVariables = Exact<{ input: ExternalDataSourceInput; }>; -export type UpdateExternalDataSourceMutation = { __typename?: 'Mutation', updateExternalDataSource: { __typename?: 'ExternalDataSource', id: any, name: string, geographyColumn?: string | null, geographyColumnType: GeographyTypes, autoUpdateEnabled: boolean, autoUpdateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null } }; +export type UpdateExternalDataSourceMutation = { __typename?: 'Mutation', updateExternalDataSource: { __typename?: 'ExternalDataSource', id: any, name: string, geographyColumn?: string | null, geographyColumnType: PostcodesIoGeographyTypes, autoUpdateEnabled: boolean, updateMapping?: Array<{ __typename?: 'AutoUpdateConfig', source: string, sourcePath: string, destinationColumn: string }> | null } }; export type PublicUserQueryVariables = Exact<{ [key: string]: never; }>; export type PublicUserQuery = { __typename?: 'Query', publicUser?: { __typename?: 'UserType', id: string, username: string, email: string } | null }; -export const AutoUpdateCardFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AutoUpdateCardFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; +export const AutoUpdateCardFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AutoUpdateCardFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; export const ExternalDataSourceCardFieldsFragmentDoc = {"kind":"Document","definitions":[{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ExternalDataSourceCardFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}}]}}]} as unknown as DocumentNode; export const ExampleDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"Example"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"organisations"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; export const VerifyDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Verify"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"token"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"verifyAccount"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"token"},"value":{"kind":"Variable","name":{"kind":"Name","value":"token"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errors"}},{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode; -export const ListExternalDataSourcesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListExternalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}}]}}]}}]} as unknown as DocumentNode; -export const GetSourceMappingDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSourceMapping"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}}]}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumnType"}}]}}]}}]} as unknown as DocumentNode; +export const ListExternalDataSourcesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ListExternalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}}]}}]}}]} as unknown as DocumentNode; +export const GetSourceMappingDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetSourceMapping"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}}]}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumnType"}}]}}]}}]} as unknown as DocumentNode; export const TestAirtableSourceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"TestAirtableSource"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"apiKey"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"baseId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"tableId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"testAirtableSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"apiKey"},"value":{"kind":"Variable","name":{"kind":"Name","value":"apiKey"}}},{"kind":"Argument","name":{"kind":"Name","value":"baseId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"baseId"}}},{"kind":"Argument","name":{"kind":"Name","value":"tableId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"tableId"}}}]}]}}]} as unknown as DocumentNode; export const CreateAirtableSourceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"CreateAirtableSource"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"AirtableSource"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"AirtableSourceInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"createAirtableSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"AirtableSource"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"healthcheck"}}]}}]}}]} as unknown as DocumentNode; export const AllExternalDataSourcesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AllExternalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AirtableSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseId"}},{"kind":"Field","name":{"kind":"Name","value":"tableId"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}}]}}]}}]} as unknown as DocumentNode; -export const AutoUpdateCreationReviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AutoUpdateCreationReview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]}}]} as unknown as DocumentNode; -export const ExternalDataSourceInspectPageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ExternalDataSourceInspectPage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AirtableSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseId"}},{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"apiKey"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"webhookHealthcheck"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumnType"}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"taskName"}},{"kind":"Field","name":{"kind":"Name","value":"args"}},{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}}]}}]}}]} as unknown as DocumentNode; +export const AutoUpdateCreationReviewDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"AutoUpdateCreationReview"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]}}]} as unknown as DocumentNode; +export const ExternalDataSourceInspectPageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ExternalDataSourceInspectPage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"AirtableSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseId"}},{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"apiKey"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"webhookHealthcheck"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumnType"}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"taskName"}},{"kind":"Field","name":{"kind":"Name","value":"args"}},{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}}]}}]}}]} as unknown as DocumentNode; export const DeleteUpdateConfigDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteUpdateConfig"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteExternalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}}]}}]}}]} as unknown as DocumentNode; export const LoginDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Login"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"username"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tokenAuth"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"username"},"value":{"kind":"Variable","name":{"kind":"Name","value":"username"}}},{"kind":"Argument","name":{"kind":"Name","value":"password"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errors"}},{"kind":"Field","name":{"kind":"Name","value":"success"}},{"kind":"Field","name":{"kind":"Name","value":"token"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"token"}},{"kind":"Field","name":{"kind":"Name","value":"payload"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"exp"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const RegisterDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"Register"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"email"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password1"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"password2"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"username"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"register"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"email"},"value":{"kind":"Variable","name":{"kind":"Name","value":"email"}}},{"kind":"Argument","name":{"kind":"Name","value":"password1"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password1"}}},{"kind":"Argument","name":{"kind":"Name","value":"password2"},"value":{"kind":"Variable","name":{"kind":"Name","value":"password2"}}},{"kind":"Argument","name":{"kind":"Name","value":"username"},"value":{"kind":"Variable","name":{"kind":"Name","value":"username"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"errors"}},{"kind":"Field","name":{"kind":"Name","value":"success"}}]}}]}}]} as unknown as DocumentNode; export const AutoUpdateWebhookRefreshDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"AutoUpdateWebhookRefresh"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"refreshWebhooks"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"externalDataSourceId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"webhookHealthcheck"}}]}}]}}]} as unknown as DocumentNode; -export const ExternalDataSourceAutoUpdateCardDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ExternalDataSourceAutoUpdateCard"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AutoUpdateCardFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AutoUpdateCardFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; +export const ExternalDataSourceAutoUpdateCardDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ExternalDataSourceAutoUpdateCard"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"AutoUpdateCardFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"AutoUpdateCardFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}},{"kind":"Field","name":{"kind":"Name","value":"status"}}]}}]}}]} as unknown as DocumentNode; export const EnableAutoUpdateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"EnableAutoUpdate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"enableAutoUpdate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"externalDataSourceId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"webhookHealthcheck"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; export const DisableAutoUpdateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DisableAutoUpdate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"disableAutoUpdate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"externalDataSourceId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"webhookHealthcheck"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}}]}}]} as unknown as DocumentNode; export const TriggerFullUpdateDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"TriggerFullUpdate"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"externalDataSourceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"triggerUpdate"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"externalDataSourceId"},"value":{"kind":"Variable","name":{"kind":"Name","value":"externalDataSourceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"jobs"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"taskName"}},{"kind":"Field","name":{"kind":"Name","value":"args"}},{"kind":"Field","name":{"kind":"Name","value":"lastEventAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}}]}}]}}]} as unknown as DocumentNode; export const ExternalDataSourceCardDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"ExternalDataSourceCard"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"ID"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"pk"},"value":{"kind":"Variable","name":{"kind":"Name","value":"ID"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"ExternalDataSourceCardFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"ExternalDataSourceCardFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSource"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"connectionDetails"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmType"},"name":{"kind":"Name","value":"__typename"}}]}}]}}]} as unknown as DocumentNode; -export const UpdateExternalDataSourceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateExternalDataSource"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSourceInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateExternalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumnType"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}}]}}]}}]} as unknown as DocumentNode; +export const EnrichmentLayersDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"EnrichmentLayers"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"externalDataSources"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"fieldDefinitions"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"label"}},{"kind":"Field","name":{"kind":"Name","value":"value"}},{"kind":"Field","name":{"kind":"Name","value":"description"}}]}}]}}]}}]} as unknown as DocumentNode; +export const UpdateExternalDataSourceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"UpdateExternalDataSource"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ExternalDataSourceInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"updateExternalDataSource"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"data"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumn"}},{"kind":"Field","name":{"kind":"Name","value":"geographyColumnType"}},{"kind":"Field","name":{"kind":"Name","value":"autoUpdateEnabled"}},{"kind":"Field","name":{"kind":"Name","value":"updateMapping"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"sourcePath"}},{"kind":"Field","name":{"kind":"Name","value":"destinationColumn"}}]}}]}}]}}]} as unknown as DocumentNode; export const PublicUserDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PublicUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"publicUser"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"username"}},{"kind":"Field","name":{"kind":"Name","value":"email"}}]}}]}}]} as unknown as DocumentNode; export interface PossibleTypesResultData { diff --git a/nextjs/src/app/data-sources/ExternalDataSourceUpdates.tsx b/nextjs/src/app/data-sources/ExternalDataSourceUpdates.tsx index 2718d7235..8a68a93a7 100644 --- a/nextjs/src/app/data-sources/ExternalDataSourceUpdates.tsx +++ b/nextjs/src/app/data-sources/ExternalDataSourceUpdates.tsx @@ -22,7 +22,7 @@ const LIST_UPDATE_CONFIGS = gql` lastEventAt status } - autoUpdateMapping { + updateMapping { source sourcePath destinationColumn diff --git a/nextjs/src/app/data-sources/create-auto-update/configure/[externalDataSourceId]/page.tsx b/nextjs/src/app/data-sources/create-auto-update/configure/[externalDataSourceId]/page.tsx index b8f70bfe8..426e2d2f3 100644 --- a/nextjs/src/app/data-sources/create-auto-update/configure/[externalDataSourceId]/page.tsx +++ b/nextjs/src/app/data-sources/create-auto-update/configure/[externalDataSourceId]/page.tsx @@ -14,7 +14,7 @@ import { UpdateExternalDataSourceMutationVariables, } from "@/__generated__/graphql"; import { toast } from "sonner"; -import { AutoUpdateMappingForm } from "@/components/AutoUpdateMappingForm"; +import { UpdateMappingForm } from "@/components/UpdateMappingForm"; import { LoadingIcon } from "@/components/ui/loadingIcon"; import {UDPATE_EXTERNAL_DATA_SOURCE} from '@/graphql/mutations'; @@ -23,7 +23,7 @@ const GET_UPDATE_CONFIG = gql` externalDataSource(pk: $ID) { id autoUpdateEnabled - autoUpdateMapping { + updateMapping { destinationColumn source sourcePath @@ -88,12 +88,12 @@ export default function Page({ {externalDataSource.loading ? ( ) : externalDataSource.data ? ( - ({ + updateMapping: externalDataSource.data?.externalDataSource.updateMapping?.map((m) => ({ source: m.source, sourcePath: m.sourcePath, destinationColumn: m.destinationColumn, @@ -111,7 +111,7 @@ export default function Page({ > Back - + ) : null} ); diff --git a/nextjs/src/app/data-sources/create-auto-update/connect/[externalDataSourceType]/page.tsx b/nextjs/src/app/data-sources/create-auto-update/connect/[externalDataSourceType]/page.tsx index 9b319d24b..01b314b1d 100644 --- a/nextjs/src/app/data-sources/create-auto-update/connect/[externalDataSourceType]/page.tsx +++ b/nextjs/src/app/data-sources/create-auto-update/connect/[externalDataSourceType]/page.tsx @@ -30,7 +30,7 @@ import { LoadingIcon } from "@/components/ui/loadingIcon"; import { CreateAirtableSourceMutation, CreateAirtableSourceMutationVariables, - GeographyTypes, + PostcodesIoGeographyTypes, TestAirtableSourceQuery, TestAirtableSourceQueryVariables, } from "@/__generated__/graphql"; @@ -74,7 +74,7 @@ export default function Page({ const form = useForm({ defaultValues: { airtable: { - geographyColumnType: GeographyTypes.Postcode, + geographyColumnType: PostcodesIoGeographyTypes.Postcode, }, }, }); @@ -323,10 +323,10 @@ export default function Page({ Geography column type - Postcode - Ward - Council - Constituency + Postcode + Ward + Council + Constituency diff --git a/nextjs/src/app/data-sources/create-auto-update/review/[externalDataSourceId]/page.tsx b/nextjs/src/app/data-sources/create-auto-update/review/[externalDataSourceId]/page.tsx index 9bc3dc9ba..1f7efafeb 100644 --- a/nextjs/src/app/data-sources/create-auto-update/review/[externalDataSourceId]/page.tsx +++ b/nextjs/src/app/data-sources/create-auto-update/review/[externalDataSourceId]/page.tsx @@ -21,7 +21,7 @@ const GET_UPDATE_CONFIG = gql` crmType: __typename } autoUpdateEnabled - autoUpdateMapping { + updateMapping { source sourcePath destinationColumn diff --git a/nextjs/src/app/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx b/nextjs/src/app/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx index 13e8e1004..2b05e9553 100644 --- a/nextjs/src/app/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx +++ b/nextjs/src/app/data-sources/inspect/[externalDataSourceId]/InspectExternalDataSource.tsx @@ -56,7 +56,7 @@ import { AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; -import { AutoUpdateMappingForm } from "@/components/AutoUpdateMappingForm"; +import { UpdateMappingForm } from "@/components/UpdateMappingForm"; import { UDPATE_EXTERNAL_DATA_SOURCE } from "@/graphql/mutations"; import { AlertCircle } from "lucide-react" import { @@ -89,7 +89,7 @@ const GET_UPDATE_CONFIG = gql` args lastEventAt } - autoUpdateMapping { + updateMapping { source sourcePath destinationColumn @@ -183,15 +183,17 @@ export default function InspectExternalDataSource({

Data mapping

- + {!!source.updateMapping?.length && ( + + )}
- ({ + updateMapping: source?.updateMapping?.map((m) => ({ source: m.source, sourcePath: m.sourcePath, destinationColumn: m.destinationColumn, diff --git a/nextjs/src/components/AutoUpdateCard.tsx b/nextjs/src/components/AutoUpdateCard.tsx index 8f91ca033..77fa7b8a1 100644 --- a/nextjs/src/components/AutoUpdateCard.tsx +++ b/nextjs/src/components/AutoUpdateCard.tsx @@ -214,7 +214,7 @@ export const UPDATE_CONFIG_CARD_FRAGMENT = gql` crmType: __typename } autoUpdateEnabled - autoUpdateMapping { + updateMapping { source sourcePath destinationColumn diff --git a/nextjs/src/components/SelectSourceData.tsx b/nextjs/src/components/SelectSourceData.tsx index 0d99a5d8e..7f2a012b5 100644 --- a/nextjs/src/components/SelectSourceData.tsx +++ b/nextjs/src/components/SelectSourceData.tsx @@ -36,7 +36,7 @@ export function SourcePathSelector({
setOpen(true)} className="w-full text-ellipsis overflow-hidden text-nowrap text-sm"> {value && value.source && value.sourcePath - ? `${labelForSourcePath(value.source, value.sourcePath)} (${value.source})` + ? `${labelForSourcePath(value.source, value.sourcePath)} (${sourceName(value.source)})` : "Click to select data"}
setOpen(false)}> @@ -73,6 +73,11 @@ export function SourcePathSelector({
); + + function sourceName(source: string) { + const sourceDict = sources.find((s) => s.slug === source); + return sourceDict ? sourceDict.name : source; + } } function label(d: SourcePath) { diff --git a/nextjs/src/components/AutoUpdateMappingForm.tsx b/nextjs/src/components/UpdateMappingForm.tsx similarity index 69% rename from nextjs/src/components/AutoUpdateMappingForm.tsx rename to nextjs/src/components/UpdateMappingForm.tsx index 0c04ca210..ce0febc35 100644 --- a/nextjs/src/components/AutoUpdateMappingForm.tsx +++ b/nextjs/src/components/UpdateMappingForm.tsx @@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button"; import { enrichmentDataSources } from "@/lib/data"; import { FormProvider, useFieldArray, useForm } from "react-hook-form"; -import { ExternalDataSourceInput, GeographyTypes } from "@/__generated__/graphql"; +import { EnrichmentLayersQuery, ExternalDataSourceInput, PostcodesIoGeographyTypes } from "@/__generated__/graphql"; import { Input } from "@/components/ui/input"; import { SourcePathSelector } from "@/components/SelectSourceData"; import { ArrowRight, X, XCircle } from "lucide-react"; @@ -25,8 +25,24 @@ import { SelectTrigger, SelectValue, } from "@/components/ui/select" +import { gql, useQuery } from "@apollo/client"; -export function AutoUpdateMappingForm({ +const ENRICHMENT_LAYERS = gql` + query EnrichmentLayers { + externalDataSources { + id + name + geographyColumn + fieldDefinitions { + label + value + description + } + } + } +`; + +export function UpdateMappingForm({ onSubmit, initialData, children, @@ -47,10 +63,12 @@ export function AutoUpdateMappingForm({ const { fields, append, prepend, remove, swap, move, insert } = useFieldArray( { control: form.control, - name: "autoUpdateMapping", + name: "updateMapping", }, ); + const customEnrichmentLayers = useQuery(ENRICHMENT_LAYERS) + return (
@@ -87,10 +105,10 @@ export function AutoUpdateMappingForm({ Geography column type - Postcode - Ward - Council - Constituency + Postcode + Ward + Council + Constituency @@ -116,16 +134,29 @@ export function AutoUpdateMappingForm({ !!source.geographyColumn) + .map((source) => ({ + slug: source.id, + name: source.name, + author: "", + description: "", + descriptionURL: "", + colour: "", + builtIn: false, + sourcePaths: source.fieldDefinitions || [] + })) || [] + )} value={{ - source: form.watch(`autoUpdateMapping.${index}.source`), - sourcePath: form.watch(`autoUpdateMapping.${index}.sourcePath`), + source: form.watch(`updateMapping.${index}.source`), + sourcePath: form.watch(`updateMapping.${index}.sourcePath`), }} setValue={(source, sourcePath) => { - form.setValue(`autoUpdateMapping.${index}.source`, source); + form.setValue(`updateMapping.${index}.source`, source); form.setValue( - `autoUpdateMapping.${index}.sourcePath`, + `updateMapping.${index}.sourcePath`, sourcePath, ); }} @@ -137,7 +168,7 @@ export function AutoUpdateMappingForm({ className="flex-shrink-0 flex-grow" placeholder="Destination column" key={field.id} // important to include key with field's id - {...form.register(`autoUpdateMapping.${index}.destinationColumn`)} + {...form.register(`updateMapping.${index}.destinationColumn`)} /> @@ -146,7 +177,7 @@ export function AutoUpdateMappingForm({