{"version":3,"sources":["ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditor.utils.tsx","ui/pages/SourcesPage/SourcePage.utils.tsx","webpack:///./src/ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditor.module.less?c933","webpack:///./src/ui/pages/SourcesPage/partials/SourcesList/SourcesList.module.less?edd6","webpack:///./src/ui/pages/SourcesPage/partials/AddSourceDialog/AddSourceDialog.module.less?146e","webpack:///./src/ui/pages/SourcesPage/SourcesPage.less?a5b4","webpack:///./src/ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormStreamsLoadableForm.module.less?3604","webpack:///./src/ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorDocumentationDrawer.module.less?4dae","ui/pages/SourcesPage/partials/SourcesList/SourcesList.tsx","ui/pages/SourcesPage/partials/AddSourceDialog/AddSourceDialog.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditor.state.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormConfigurationStaticFields.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormConfigurationConfigurableLoadableFields.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormConfigurationConfigurableFields.tsx","ui/pages/SourcesPage/partials/SourceEditor/Common/OauthButton/OauthButton.tsx","ui/pages/SourcesPage/partials/SourceEditor/Common/SourceEditorOauthButtons/SourceEditorOauthButtons.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormConfiguration.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormStreamsConfigurableCollectionsField.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorPullData.ts","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormStreamsConfigurable.tsx","ui/pages/SourcesPage/utils/airbyte.ts","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormStreamsLoadableForm.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormStreamsLoadable.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormStreams.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormConnectionsView.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorFormConnections.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorDocumentationDrawer.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorViewControls.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorViewSteps.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorViewTabs.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditorView.tsx","ui/pages/SourcesPage/partials/SourceEditor/SourceEditor/SourceEditor.tsx","ui/pages/SourcesPage/SourcesPage.tsx"],"names":["STREAM_UID_DELIMITER","sourceEditorUtils","getSourceDataFromState","sourceEditorState","sourceCatalogData","initialSourceData","configuration","streams","connections","updatedSourceData","makeObjectFromFieldsValues","Object","values","config","selectedStreams","catalogSourceData","sourceType","sourcePageUtils","getSourceType","sourceProtoType","getSourcePrototype","selected_streams","reformatCatalogIntoSelectedStreams","sourceData","isNativeOrSDKSource","catalog","map","mapStreamDataToSelectedStreams","isAirbyteSource","getStreamUid","stream","isAirbyteStream","getAirbyteStreamUniqueId","isSingerStream","getSingerStreamUniqueId","getStreamSyncMode","data","airbyteData","sync_mode","streamData","name","namespace","cursor_field","tap_stream_id","docker_image","isSingerSource","getSelectedStreamUid","streamConfig","streamsAreEqual","streamA","streamB","createInitialSourceData","sourceId","getSourceId","id","sourcesStore","list","source","schedule","COLLECTIONS_SCHEDULES","value","connected","connectedErrorMessage","sourceConnector","protoType","snakeCase","sourcesIds","replace","isUniqueSourceId","find","getUniqueAutoIncId","getPromptMessage","tabs","some","tab","touched","undefined","testConnection","projectId","src","hideMessage","_options","options","ApplicationServices","get","backendApiClient","post","Marshal","toPureJson","response","actionNotification","loading","connectionTestMessagePrefix","POLLING_INTERVAL_MS","POLLING_TIMEOUT_MS","poll","Poll","end","fail","status","Error","start","wait","message","success","toLowerCase","connectedErrorType","connectedErrorPayload","prefixedMessage","skipHandleError","handleError","errorType","includes","_response","payload","applyOauthValuesToAntdForms","forms","oauthValues","oauthFieldsSuccessfullySet","oauthFieldsNotSet","entries","forEach","oauthFieldKey","oauthFieldValue","getAntdFormAndKeyByOauthFieldKey","formToApplyValue","fieldKeyToApplyValue","push","newValues","form","getFieldsValue","setFieldsValue","patchConfigOnFormValuesChange","length","messagePostfix","secretsNamesSeparator","key","toTitleCase","separator","join","warn","allFormsKeys","allFormsWithValues","reduce","result","formKey","formData","keys","_formKey","formKeyNameEnd","split","pop","parsedOauthFieldKey","SourcesListComponent","history","useHistory","project","useProject","disableEdit","permissions","allPermissions","ProjectPermission","MODIFY_CONFIG","useEffect","currentPageHeaderStore","setBreadcrumbs","styles","empty","projectRoute","sourcesPageRoutes","add","SourcesList","observer","displayName","isAirbyteSourceOnHeroku","features","environment","allAvailableSources","allSources","sort","a","b","expertMode","localeCompare","AddSourceDialogComponent","useState","filterParam","setFilterParam","services","useServices","showDeprecatedSources","setShowDeprecatedSources","handleClick","e","stopPropagation","preventDefault","analyticsService","track","app","appName","connector_id","confirm","title","icon","content","okText","cancelText","onOk","addExact","info","handleChange","debounce","useCallback","target","filteredSourcesList","useMemo","filter","document","body","classList","remove","dialog","filterInput","checked","deprecated","generatePath","activeProject","item","item__disabled","pic","airbyteLabel","expertLabel","star","cn","starIcon","strokeStar","fillStar","AddSourceDialog","memo","initialState","isLoadingConfig","isLoadingStreams","isTestingConnection","isLoadingOauthStatus","hasLoadedOauthFieldsStatus","isOauthFlowCompleted","hasConfigSealed","SourceEditorActionsTypes","actionsFactories","SET_STATUS","type","reducer","state","action","console","SourceEditorStateContext","React","createContext","SourceEditorDispatchContext","SourceEditorStateProvider","children","useReducer","dispatch","dispatcher","useSourceEditorState","useContext","useSourceEditorDispatcher","CONFIG_INTERNAL_STATE_KEY","CONFIG_FORM_KEY","SourceEditorFormConfigurationStaticFields","editorMode","disabled","initialValues","patchConfig","setValidator","setFormReference","useForm","dailyMode","setDailyMode","cronMode","setCronMode","subscription","currentSubscription","currentPlan","sourcesList","validateUniqueSourceId","_","Promise","reject","resolve","validateSourceIdNoSpaces","re","test","sourceIdValidationRules","required","validator","handleFormValuesChange","resetErrorsCount","validateGetErrorsCount","errorsCount","validateFields","errorFields","doNotSetStateChanged","editorStyles","field","span","v","option","available","quota","allowedSchedules","label","scheduleTime","DAILY_HOURS","cronExpression","Wrapped","SourceEditorFormConfigurationConfigurableLoadableFields","sourceDataFromCatalog","availableOauthBackendSecrets","_hideFields","hideFields","handleResetOauth","handleReloadStreams","dispatchAction","airbyteImageVersion","useRef","image_version","polledData","usePolling","configure","controlsDisableRequestId","imageVersion","current","availableImageVersions","onBeforePollingStart","pullAvailableAirbyteImageVersions","pollingCallback","pullAirbyteSpec","transformAirbyteSpecResponse","unshift","IMAGE_VERSION_FIELD_ID","singleSelectionType","defaultValue","onAfterPollingEnd","interval_ms","pullSdkSourceSpec","specEndpoint","transformSdkSourceSpecResponse","isLoadingParameters","isLoading","fp","loadingParametersError","error","reloadParameters","reload","fieldsParameters","oauthFieldsParametersNames","typeName","handleFormValuesChangeForm","changedValues","allValues","handleIfAirbyteVersionChanged","changedFormValues","newImageVersion","handleSetInitialFormValues","queryParams","project_id","requestUrl","withQueryParams","proxy","Array","isArray","versions","endpoint","mapAirbyteSpecToSourceConnectorConfig","parameter","mapSdkSourceSpecToSourceConnectorConfig","SourceEditorFormConfigurationConfigurableFields","configParameters","OauthButton","service","forceNotSupported","className","setAuthSecrets","onIsOauthSuppotedStatusChecked","setIsLoading","isOauthSupported","setIsOauthSupported","isOauthCompleted","setIsOauthCompleted","oauthService","getCredentialsInSeparateWindow","oauthResult","errorMessage","secrets","checkIfOauthSupported","then","supported","SourceEditorOauthButtons","isSignedIn","onIsOauthSupportedCheckSuccess","onFillAuthDataManuallyChange","setOauthSecretsToForms","fillAuthDataManually","setFillAuthDataManually","handleFillAuthDataManuallyToggle","newValue","handleOauthSupportCheckStatus","initialValidator","SourceEditorFormConfiguration","setSourceEditorState","setForms","isInitiallySignedIn","isOauthStatusReady","setIsOauthStatusReady","setIsOauthFlowCompleted","staticFieldsValidator","setStaticFieldsValidator","configurableFieldsValidator","setConfigurableFieldsValidator","configurableLoadableFieldsValidator","setConfigurableLoadableFieldsValidator","useUniqueKeyState","resetKey","resetFormUi","sourceConfigurationSchema","sdkSourceId","backendId","hideOauthFields","loadableFields","configurableFields","airbyteId","invisibleStaticFields","tapId","useLoaderAsObject","getAvailableBackendSecrets","availableBackendSecrets","isLoadingBackendSecrets","OAUTH_FIELDS_NAMES","handleOauthSupportedStatusChange","oauthSupported","handleFillAuthDataManuallyChange","fillManually","newState","stateChanged","validateConfigAndCountErrors","staticFieldsErrorsCount","configurableFieldsErrorsCount","configurableLoadableFieldsErrorsCount","isLoadingOauth","Boolean","SourceEditorFormStreamsCollectionsFieldComponent","collection","documentation","handleFormFieldsChange","formItemChild","maxOptions","validationRules","rules","rule","SourceEditorFormStreamsCollectionsField","PARSING_STREAMS_ERROR_NAME","pullAllAirbyteStreams","handleBringSourceData","assert","baseUrl","staticStreamsConfigEndpoint","previously_selected_streams","assertHasCatalog","rawAirbyteStreams","idx","assertIsAirbyteCatalogStream","streamMinimalConfig","previouslySelectedStream","previouslySelectedStreamConfig","supported_sync_modes","destination_sync_mode","json_schema","pullAllSDKSourceStreams","assertSDKSourceCatalog","assertIsSDKSourceCatalogStream","pullAllSingerStreams","tap","source_id","rawSingerStreams","assertIsSingerCatalogStream","assertIsObject","assertIsArrayOfTypes","assertIsString","errMsg","allowUndefined","supportedModes","key_properties","schema","metadata","metadataObject","breadcrumb","Panel","SELECTED_STREAMS_SOURCE_DATA_PATH","SourceEditorFormStreamsConfigurable","collectionTypes","selectedCollectionTypes","setSelectedCollectionTypes","addStreamVisible","setAddStreamVisible","addTemplateVisible","setAddTemplateVisible","setCollectionTypes","collectionParameters","setCollectionParameters","collectionModes","setCollectionModes","activePanel","setActivePanel","input","renderApplyTemplates","collectionTemplates","sourceEditorViewState","ct","cp","cm","params","param","tp","convertSdkType","applyOnlyTo","reloadStreamsList","handleValuesChange","useDebouncedCallback","setSelectedStreams","handleCollectionTypesFilter","getStream","index","collections","getFormErrors","fields","getFieldsError","errors","getCollectionParametersForType","getCollectionParameters","generateReportNameForType","formValues","blankName","reportNames","accumulator","addNewOfType","operation","newCollection","mode","parameters","_id","randomId","concat","keyToRemove","handleApplyTemplate","chosenTemplate","newActivePanel","template","col","copy","JSON","parse","stringify","handleTouchParameter","meta","templates","maxHeight","button","templateName","description","comment","s","prev","curr","isActive","color","delete","event","isError","m","sourceDataPath","getStreamFieldPaths","flattenStreamFields","path","traverseSchemaToField","naturalComparatorBy","cleanedName","flattenFields","fArr","arr","acc","f","jsonSchema","traverseJsonSchemaProperties","properties","flatMap","k","flat","t","SourceEditorFormStreamsLoadableForm","allStreams","initiallySelectedStreams","selectAllFieldsByDefault","hide","disableAllAnimations","disableToggelAllAnimations","streamsToDisplay","setStreamsToDisplay","allChecked","setAllChecked","handleAddStream","addStream","handleRemoveStream","removeStream","handleSetSelectedStreams","handleToggleStream","handleToggleAllStreams","requestAnimationFrame","handleSearch","query","handleSearchValueClear","setTimeout","disableAnimations","StreamsCollapsibleList","isAllStreamsChecked","aUid","bUid","uid","selected","aIsInitiallySelected","bIsInitiallySelected","Number","streamUid","StreamPanel","initialStreamData","forceChecked","rest","setChecked","setStreamData","toggle","handleChangeStreamConfig","updateStream","header","AirbyteStreamHeader","streamName","streamNamespace","AirbyteStreamParameters","cursorFieldPathDelimiter","initialSyncMode","needToDisplayData","source_defined_cursor","default_cursor_field","getAirbyteStreamCursorFields","setConfig","handleChangeSyncMode","newConfig","handleChangeCursorField","minWidth","cursor","stringifiedCursor","SingerStreamHeader","SingerStreamParameters","StreamParameter","oldStreams","newStreams","addToArrayIfNotDuplicate","removeFromArrayIfFound","substituteArrayValueIfFound","SourceEditorFormStreamsLoadable","previouslySelectedStreams","pullAllStreams","timeout_ms","allStreamsConfigs","unavailableStreams","previouslySelectedWithoutUnavailable","streamIsAvailable","forceReloadStreamsList","StreamsUnavailableWarning","SourceEditorFormStreams","typedStreams","SourceEditorFormConnectionsView","itemsList","handleItemChange","selectedItems","setSelectedItems","newItemsIds","findIndex","i","splice","CONNECTIONS_SOURCEDATA_PATH","SourceEditorFormConnectionsComponent","destinations","destinationsStore","destinationsList","dst","reference","destinationsReferenceMap","_type","_uid","syncFromSourcesStatus","ui","getDescription","preparedInitialValue","setConnections","SourceEditorFormConnections","connectionsIds","NameWithPicture","SourceEditorDocumentationDrawer","visible","setVisible","overview","connection","SourceEditorViewControls","mainButton","secondaryButton","dashedButton","dangerButton","controlsDisabled","SourceEditorViewSteps","steps","setInitialSourceData","handleLeaveEditor","currentStep","setCurrentStep","currentStepIsLoading","setCurrentStepIsLoading","proceedButtonTitle","handleCompleteStep","handleGoToNextStep","proceedAction","step","handleStepBack","render","disabledTabsKeys","Set","SourceEditorViewTabs","_handleSave","handleSave","handleValidateAndTestConnection","setShowDocumentationDrawer","currentTab","setCurrentTab","isSaving","setIsSaving","setIsTestingConnection","streamsTabKey","setStreamsTabKey","disabledTabs","handleTabChange","_key","handleConnectOrSaveError","handleTestConnection","ErrorDetailed","switchToStreamsTab","tabCard","tabKey","has","TabsExtra","logs","SourceEditorView","showDocumentationDrawer","handleValidateStreams","SourceEditor","SourceEditorContainer","allSourcesList","useParams","sourcesCatalog","viewState","dispatchSourceEditorAction","setState","showDocumentation","setShowDocumentation","validateCountErrors","configurationErrorsCount","streamsErrorsCount","validateAllForms","someFieldsErrored","getTestConnectionResponse","testResult","assertCanConnect","testConnectionResponse","ignoreErrors","methodConfig","testConnectionResults","sourceDataToSave","savedSourceData","flowResult","connectionsHelper","updateDestinationsConnectionsToSource","goToSourcesList","firstToLower","root","goBack","breadcrumbs","link","SourcesPageComponent","isSourcesLimitReached","sources","EntitiesStoreStatus","GLOBAL_ERROR","GLOBAL_LOADING","editExact","task","SourcesPage"],"mappings":";;;;;;;;;;;;;;;;AAEA;AAEA;AAkBA,GAAMA,qBAAoB,CAAG,IAA7B,CAEO,GAAMC,kBAAiB,CAAG,CAC/BC,sBAAsB,CAAE,gCACtBC,iBADsB,CAEtBC,iBAFsB,CAGtBC,iBAHsB,CAIP,oEACf,SAAgDF,iBAAhD,SAAgDA,iBAAhD,UAAgDA,iBAAhD,CAAqE,EAArE,CAAQG,aAAR,MAAQA,aAAR,CAAuBC,OAAvB,MAAuBA,OAAvB,CAAgCC,WAAhC,MAAgCA,WAAhC,CAEA,GAAIC,kBAA6B,CAAG,oDAClCC,kGAA0B,CAAC,kEAAM,EAAN,wNAAaC,MAAM,CAACC,MAAP,CAAcN,aAAa,CAACO,MAA5B,CAAb,GAAD,CADQ,CAElCH,kGAA0B,CAACH,OAAO,CAACO,eAAT,CAFQ,CAGlCJ,kGAA0B,CAACF,WAAW,CAACA,WAAb,CAHQ,CAApC,CAKA,GAAMO,kBAAqE,CAAG,CAC5EC,UAAU,CAAEC,6FAAe,CAACC,aAAhB,CAA8Bd,iBAA9B,CADgE,CAE5Ee,eAAe,CAAEF,6FAAe,CAACG,kBAAhB,CAAmChB,iBAAnC,CAF2D,CAA9E,CAKAK,iBAAiB,qmBAASJ,iBAAT,SAASA,iBAAT,UAASA,iBAAT,CAA8B,EAA9B,EAAsCU,iBAAtC,EAA4DN,iBAA5D,CAAjB,CACA;AACA,GAAI,sBAACA,iBAAD,8DAAC,mBAAmBI,MAApB,0CAAC,sBAA2BQ,gBAA5B,GAAgDhB,iBAAhD,SAAgDA,iBAAhD,kCAAgDA,iBAAiB,CAAEQ,MAAnE,0CAAgD,sBAA2BQ,gBAA/E,CAAiG,CAC/FZ,iBAAiB,CAAC,QAAD,CAAjB,CAA4B,kBAA5B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,2CAAY,CAACC,+CAAiB,CAAC8mB,IAAnB,CADvC,CAEE,mBAAmB,cACjB,uGAAwC3lB,QAAQ,CAAC8F,mBAAT,CAA6BC,WAA7B,CAAyC0B,KAAzC,CAA+Cwe,OAAvF,cAHJ,CAKE,eAAe,CAAED,qBALnB,uBAOE,2BAAC,eAAD,IAPF,EADF,EAzBF,cAoCE,2BAAC,6BAAD,wBACE,2BAAC,oCAAD,EAAc,OAAO,CAAC,GAAtB,EADF,EApCF,GADF,EADF,CA4CD,CA9DD,CAgEA,GAAMO,wBAAW,CAAGvnB,8BAAQ,CAAC+mB,gCAAD,CAA5B,CAEAQ,uBAAW,CAACtnB,WAAZ,CAA0B,aAA1B,CAEesnB,0HAAf,E","file":"static/js/93.166b55a5.chunk.js","sourcesContent":["// @Libs\nimport { merge } from \"lodash\"\n// @Utils\nimport { sourcePageUtils } from \"ui/pages/SourcesPage/SourcePage.utils\"\n// @Types\nimport { SourceEditorState } from \"./SourceEditor\"\nimport {\n booleanType,\n intType,\n isoUtcDateType,\n jsonType,\n ParameterType,\n passwordType,\n selectionType,\n singleSelectionType,\n SourceConnector,\n stringType,\n} from \"@jitsu/catalog\"\nimport { makeObjectFromFieldsValues } from \"utils/forms/marshalling\"\nimport { sourcesStore } from \"stores/sources\"\nimport { COLLECTIONS_SCHEDULES } from \"constants/schedule\"\n\nconst STREAM_UID_DELIMITER = \"__\"\n\nexport const sourceEditorUtils = {\n getSourceDataFromState: (\n sourceEditorState: SourceEditorState,\n sourceCatalogData: SourceConnector,\n initialSourceData: Partial\n ): SourceData => {\n const { configuration, streams, connections } = sourceEditorState ?? {}\n\n let updatedSourceData: SourceData = merge(\n makeObjectFromFieldsValues(merge({}, ...Object.values(configuration.config))),\n makeObjectFromFieldsValues(streams.selectedStreams),\n makeObjectFromFieldsValues(connections.connections)\n )\n const catalogSourceData: Pick = {\n sourceType: sourcePageUtils.getSourceType(sourceCatalogData),\n sourceProtoType: sourcePageUtils.getSourcePrototype(sourceCatalogData),\n }\n\n updatedSourceData = { ...(initialSourceData ?? {}), ...catalogSourceData, ...updatedSourceData }\n //backward compatibility: when catalog exists this code will take into account enabled streams from catalog\n if (!updatedSourceData?.config?.selected_streams && initialSourceData?.config?.selected_streams) {\n updatedSourceData[\"config\"][\"selected_streams\"] = initialSourceData.config.selected_streams\n }\n\n return updatedSourceData\n },\n\n /** Reformat old catalog (full schema JSON) into SelectedStreams and always remove old format*/\n reformatCatalogIntoSelectedStreams: (sourceData: SourceData): SourceData => {\n if (sourceEditorUtils.isNativeOrSDKSource(sourceData) || sourceData?.config?.selected_streams) return sourceData\n\n if (sourceData?.config?.catalog) {\n sourceData.config.selected_streams = sourceData.config.catalog[\"streams\"].map(\n sourceEditorUtils.mapStreamDataToSelectedStreams\n ) as AirbyteStreamConfig[] | SingerStreamConfig[]\n\n //remove massive deprecated catalog from config\n delete sourceData.config.catalog\n }\n\n if (!sourceEditorUtils.isAirbyteSource(sourceData)) return sourceData\n\n if (sourceData?.catalog) {\n sourceData.config.selected_streams = sourceData.catalog.streams.map(\n sourceEditorUtils.mapStreamDataToSelectedStreams\n )\n //remove massive deprecated catalog from config\n delete sourceData.catalog\n }\n\n return sourceData\n },\n\n getStreamUid: (stream: StreamData): string => {\n if (sourceEditorUtils.isAirbyteStream(stream)) {\n return sourceEditorUtils.getAirbyteStreamUniqueId(stream as AirbyteStreamData)\n } else if (sourceEditorUtils.isSingerStream(stream)) {\n return sourceEditorUtils.getSingerStreamUniqueId(stream as SingerStreamData)\n }\n },\n\n getStreamSyncMode: (data: StreamData): string => {\n if (sourceEditorUtils.isAirbyteStream(data)) {\n const airbyteData = data as AirbyteStreamData\n return airbyteData.sync_mode\n } else if (sourceEditorUtils.isSingerStream(data)) {\n return \"\"\n }\n },\n\n mapStreamDataToSelectedStreams: (\n streamData: T\n ): T extends AirbyteStreamData ? AirbyteStreamConfig : SingerStreamConfig => {\n if (sourceEditorUtils.isAirbyteStream(streamData)) {\n return {\n name: streamData.stream.name,\n namespace: streamData.stream.namespace,\n sync_mode: streamData.sync_mode,\n cursor_field: streamData.cursor_field,\n } as T extends AirbyteStreamData ? AirbyteStreamConfig : SingerStreamConfig\n } else if (sourceEditorUtils.isSingerStream(streamData)) {\n return {\n name: streamData.stream,\n namespace: streamData.tap_stream_id,\n } as T extends AirbyteStreamData ? AirbyteStreamConfig : SingerStreamConfig\n }\n },\n\n isNativeOrSDKSource: (data: SourceData): data is NativeSourceData => {\n return !!data?.[\"collections\"]\n },\n\n isAirbyteSource: (data: SourceData): data is AirbyteSourceData => {\n return !!data?.config.docker_image\n },\n\n isSingerSource: (data: SourceData): data is SingerSourceData => {\n return !data?.config.docker_image\n },\n\n isAirbyteStream: (stream: StreamData): stream is AirbyteStreamData => {\n return \"stream\" in stream && typeof stream.stream === \"object\"\n },\n\n isSingerStream: (stream: StreamData): stream is SingerStreamData => {\n return \"tap_stream_id\" in stream\n },\n\n getAirbyteStreamUniqueId: (data: AirbyteStreamData): string => {\n return `${data.stream?.name}${STREAM_UID_DELIMITER}${data.stream.namespace}`\n },\n\n getSingerStreamUniqueId: (data: SingerStreamData): string => {\n return `${data.stream}${STREAM_UID_DELIMITER}${data.tap_stream_id}`\n },\n\n getSelectedStreamUid: (streamConfig: StreamConfig): string => {\n return `${streamConfig.name}${STREAM_UID_DELIMITER}${streamConfig.namespace}`\n },\n\n streamsAreEqual: (\n streamA: Optional>,\n streamB: Optional>\n ) => {\n return streamA.name == streamB.name && streamA.namespace == streamB.namespace\n },\n}\n\nexport const createInitialSourceData = (sourceCatalogData: SourceConnector) =>\n ({\n sourceId: sourcePageUtils.getSourceId(\n sourceCatalogData.id,\n sourcesStore.list.map(source => source.sourceId)\n ),\n schedule: COLLECTIONS_SCHEDULES[0].value,\n connected: false,\n connectedErrorMessage: \"\",\n } as const)\n","// @Libs\nimport snakeCase from \"lodash/snakeCase\"\nimport { FormInstance } from \"antd\"\n// @Types\nimport { SourceConnector } from \"@jitsu/catalog\"\n// @Utils\nimport { getUniqueAutoIncId } from \"utils/numbers\"\nimport { handleError } from \"lib/components/components\"\nimport { toTitleCase } from \"utils/strings\"\n// @Services\nimport ApplicationServices from \"lib/services/ApplicationServices\"\nimport Marshal from \"lib/commons/marshalling\"\n// @Components\nimport { Tab } from \"ui/components/Tabs/TabsConfigurator\"\nimport { Poll } from \"utils/polling\"\nimport { actionNotification } from \"../../components/ActionNotification/ActionNotification\"\n\nexport type TestConnectionResponse = {\n connected: boolean\n connectedErrorType?: TestConnectionErrorType\n connectedErrorMessage?: string\n connectedErrorPayload?: any\n}\ntype TestConnectionErrorType = \"general\" | \"streams_changed\"\n\nconst sourcePageUtils = {\n getSourceType: (sourceConnector: SourceConnector) =>\n sourceConnector?.protoType ? sourceConnector?.protoType : snakeCase(sourceConnector?.id),\n getSourcePrototype: (sourceConnector: SourceConnector): string => snakeCase(sourceConnector?.id),\n getSourceId: (sourceProtoType: string, sourcesIds: string[]) => {\n sourceProtoType = sourceProtoType.replace(\"airbyte-source-\", \"\").replace(\"singer-tap-\", \"\")\n const isUniqueSourceId = !sourcesIds.find(id => id === sourceProtoType)\n\n if (isUniqueSourceId) {\n return sourceProtoType\n }\n\n return getUniqueAutoIncId(sourceProtoType, sourcesIds)\n },\n getPromptMessage: (tabs: Tab[]) => () =>\n tabs.some(tab => tab.touched) ? \"You have unsaved changes. Are you sure you want to leave the page?\" : undefined,\n\n testConnection: async (\n projectId: string,\n src: SourceData,\n hideMessage?: boolean,\n _options?: { skipHandleError?: boolean }\n ): Promise => {\n const options = _options ?? {}\n let connectionTestMessagePrefix: string | undefined\n try {\n const sourceData = { ...src, sourceId: projectId + \".\" + src.sourceId }\n const response = await ApplicationServices.get().backendApiClient.post(\n \"/sources/test\",\n Marshal.toPureJson(sourceData)\n )\n\n if (response[\"status\"] === \"pending\") {\n actionNotification.loading(\n \"Please, allow some time for the connector source installation to complete. Once the connector source is installed, we will test the connection and send a push notification with the result.\"\n )\n\n connectionTestMessagePrefix = `Source ${sourceData.sourceId} connection test result: `\n\n const POLLING_INTERVAL_MS = 2000\n const POLLING_TIMEOUT_MS = 60_000\n\n const poll = new Poll(\n (end, fail) => async () => {\n try {\n const response = await ApplicationServices.get().backendApiClient.post(\n \"/sources/test\",\n Marshal.toPureJson(sourceData)\n )\n const status = response[\"status\"]\n if (status !== \"pending\") end()\n else if (status !== \"ok\")\n fail(new Error(`Tap connection test returned an error. ${response[\"error\"] ?? \"Unknown error.\"}`))\n } catch (error) {\n fail(error)\n }\n },\n POLLING_INTERVAL_MS,\n POLLING_TIMEOUT_MS\n )\n\n poll.start()\n await poll.wait()\n }\n\n if (!hideMessage) {\n const message = \"Successfully connected\"\n actionNotification.success(\n connectionTestMessagePrefix ? `${connectionTestMessagePrefix}${message.toLowerCase()}` : message\n )\n }\n\n return {\n connected: true,\n connectedErrorType: undefined,\n connectedErrorMessage: undefined,\n connectedErrorPayload: undefined,\n }\n } catch (error) {\n if (!hideMessage) {\n const message = \"Connection test failed\"\n const prefixedMessage = connectionTestMessagePrefix\n ? `${connectionTestMessagePrefix}${message.toLowerCase()}`\n : message\n if (!options.skipHandleError) handleError(error, prefixedMessage)\n }\n\n const errorType: TestConnectionErrorType = `${error}`.includes(\"selected streams unavailable\")\n ? \"streams_changed\"\n : \"general\"\n\n return {\n connected: false,\n connectedErrorType: errorType,\n connectedErrorMessage: error.message ?? \"Failed to connect\",\n connectedErrorPayload: error._response?.payload,\n }\n }\n },\n applyOauthValuesToAntdForms: (\n forms: {\n [key: string]: {\n form: FormInstance\n patchConfigOnFormValuesChange?: (values: PlainObjectWithPrimitiveValues) => void\n }\n },\n oauthValues: PlainObjectWithPrimitiveValues\n ): boolean => {\n const oauthFieldsSuccessfullySet: string[] = []\n const oauthFieldsNotSet: string[] = []\n Object.entries(oauthValues).forEach(([oauthFieldKey, oauthFieldValue]) => {\n const [formToApplyValue, fieldKeyToApplyValue] = getAntdFormAndKeyByOauthFieldKey(forms, oauthFieldKey)\n\n if (!formToApplyValue || !fieldKeyToApplyValue) {\n oauthFieldsNotSet.push(oauthFieldKey)\n return\n }\n\n const newValues = { ...formToApplyValue.form.getFieldsValue() }\n newValues[fieldKeyToApplyValue] = oauthFieldValue\n formToApplyValue.form.setFieldsValue(newValues)\n formToApplyValue.patchConfigOnFormValuesChange?.(newValues)\n oauthFieldsSuccessfullySet.push(oauthFieldKey)\n })\n\n if (oauthFieldsSuccessfullySet.length > 0) {\n actionNotification.success(`Authorization Successful`)\n return true\n }\n\n /* handles the case when failed to set all fields */\n if (oauthFieldsNotSet.length > 0 && oauthFieldsSuccessfullySet.length === 0) {\n const messagePostfix =\n \"Did you forget to select OAuth authorization type in the form below? If you believe that this is an error, please, contact us at support@jitsu.com or file an issue to our github.\"\n const secretsNamesSeparator = oauthFieldsNotSet.length === 2 ? \" and \" : \", \"\n const message = `Failed to paste ${oauthFieldsNotSet\n .map(key => toTitleCase(key, { separator: \"_\" }))\n .join(secretsNamesSeparator)} secret${oauthFieldsNotSet.length > 1 ? \"s\" : \"\"}. ${messagePostfix}`\n actionNotification.warn(message)\n return false\n }\n },\n}\n\nconst getAntdFormAndKeyByOauthFieldKey = (\n forms: {\n [key: string]: {\n form: FormInstance\n patchConfigOnFormValuesChange?: (values: PlainObjectWithPrimitiveValues) => void\n }\n },\n oauthFieldKey: string\n): [\n {\n form: FormInstance\n patchConfigOnFormValuesChange?: (values: PlainObjectWithPrimitiveValues) => void\n } | null,\n string | null\n] => {\n let allFormsKeys: string[] = []\n const allFormsWithValues: {\n [key: string]: {\n form: {\n form: FormInstance\n patchConfigOnFormValuesChange?: (values: PlainObjectWithPrimitiveValues) => void\n }\n values: PlainObjectWithPrimitiveValues\n }\n } = Object.entries(forms).reduce((result, [formKey, formData]) => {\n const values = formData.form.getFieldsValue()\n allFormsKeys = [...allFormsKeys, ...Object.keys(values)]\n return {\n ...result,\n [formKey]: {\n form: formData,\n values,\n },\n }\n }, {})\n\n const formKey =\n allFormsKeys.find(_formKey => {\n const formKeyNameEnd = _formKey.split(\".\").pop() // gets access_token from config.config.access_token\n const formKey = formKeyNameEnd.replace(\"_\", \"\").toLowerCase() // viewid <- viewId, accesstoken <- access_token\n const parsedOauthFieldKey = oauthFieldKey.replace(\"_\", \"\").toLowerCase()\n return formKey === parsedOauthFieldKey\n }) ?? null\n\n const { form } = formKey ? Object.values(allFormsWithValues).find(({ values }) => formKey in values) : { form: null }\n\n return [form, formKey]\n}\n\nexport { sourcePageUtils }\n","// extracted by mini-css-extract-plugin\nmodule.exports = {\"box-shadow-base\":\"SourceEditor_box-shadow-base__Ynz38\",\"border-debug\":\"SourceEditor_border-debug__1j5JY\",\"font-heading\":\"SourceEditor_font-heading__2YVZL\",\"font-monospace\":\"SourceEditor_font-monospace__3k9Er\",\"ant-select-disabled\":\"SourceEditor_ant-select-disabled__S1Gu7\",\"ant-select\":\"SourceEditor_ant-select__1Z5X0\",\"ant-select-customize-input\":\"SourceEditor_ant-select-customize-input__YVvIS\",\"ant-select-selector\":\"SourceEditor_ant-select-selector__MZRkU\",\"ant-input-number-disabled\":\"SourceEditor_ant-input-number-disabled__3W024\",\"ant-select-item-option-selected\":\"SourceEditor_ant-select-item-option-selected__3e1Q6\",\"ant-select-item-option-active\":\"SourceEditor_ant-select-item-option-active__2KLAH\",\"ant-dropdown-menu-submenu-active\":\"SourceEditor_ant-dropdown-menu-submenu-active__1D7Y8\",\"ant-dropdown-menu-submenu-title\":\"SourceEditor_ant-dropdown-menu-submenu-title__2Y6Ml\",\"ant-collapse-content-box\":\"SourceEditor_ant-collapse-content-box__25Po8\",\"ant-card\":\"SourceEditor_ant-card__14qG_\",\"ant-modal-content\":\"SourceEditor_ant-modal-content__2BYx4\",\"ant-table-tbody\":\"SourceEditor_ant-table-tbody__2lIRJ\",\"ant-table-thead\":\"SourceEditor_ant-table-thead__D9VBk\",\"ant-checkbox-inner\":\"SourceEditor_ant-checkbox-inner__19Npx\",\"ant-modal-header\":\"SourceEditor_ant-modal-header__3OXd_\",\"ant-table\":\"SourceEditor_ant-table__2VWZ4\",\"ant-list-split\":\"SourceEditor_ant-list-split__s9zNi\",\"ant-list-header\":\"SourceEditor_ant-list-header__2kk20\",\"ant-tag\":\"SourceEditor_ant-tag__3b1bu\",\"ant-tooltip-inner\":\"SourceEditor_ant-tooltip-inner__1TpzB\",\"ant-badge-status-processing\":\"SourceEditor_ant-badge-status-processing__tMZvL\",\"ant-dropdown-menu-item-active\":\"SourceEditor_ant-dropdown-menu-item-active__F91MZ\",\"ant-dropdown\":\"SourceEditor_ant-dropdown__3GyHe\",\"ant-popover-inner\":\"SourceEditor_ant-popover-inner__bHaOa\",\"ant-popover-arrow\":\"SourceEditor_ant-popover-arrow__1Yk7Q\",\"ant-popover-placement-rightTop\":\"SourceEditor_ant-popover-placement-rightTop__3iLAZ\",\"ant-popover-content\":\"SourceEditor_ant-popover-content__1xOuC\",\"ant-popover-placement-leftBottom\":\"SourceEditor_ant-popover-placement-leftBottom__us5Wl\",\"ant-popover-placement-bottomRight\":\"SourceEditor_ant-popover-placement-bottomRight__1NSEW\",\"ant-popover-placement-top\":\"SourceEditor_ant-popover-placement-top__3F8W_\",\"icon-size-base\":\"SourceEditor_icon-size-base__1WzMW\",\"icon-size-lg\":\"SourceEditor_icon-size-lg__36ggP\",\"ant-tabs-card\":\"SourceEditor_ant-tabs-card__3xSux\",\"ant-tabs-tab-active\":\"SourceEditor_ant-tabs-tab-active__1Vdlk\",\"ant-skeleton\":\"SourceEditor_ant-skeleton__mJ7TZ\",\"ant-skeleton-paragraph\":\"SourceEditor_ant-skeleton-paragraph___iF0p\",\"collection\":\"SourceEditor_collection__3aMQb\",\"item\":\"SourceEditor_item__I8W9F\",\"delete\":\"SourceEditor_delete__2CuGF\",\"templates\":\"SourceEditor_templates__KkldR\",\"template\":\"SourceEditor_template__3H_DJ\",\"comment\":\"SourceEditor_comment__AR8bX\",\"button\":\"SourceEditor_button__1Wn_0\",\"tabCard\":\"SourceEditor_tabCard__3zk69\",\"documentation\":\"SourceEditor_documentation__2Z1gW\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"box-shadow-base\":\"SourcesList_box-shadow-base__4WrXl\",\"border-debug\":\"SourcesList_border-debug__PO3Lj\",\"font-heading\":\"SourcesList_font-heading__ySB_i\",\"font-monospace\":\"SourcesList_font-monospace__2h13s\",\"ant-select-disabled\":\"SourcesList_ant-select-disabled__2PPCI\",\"ant-select\":\"SourcesList_ant-select__2YLCQ\",\"ant-select-customize-input\":\"SourcesList_ant-select-customize-input__2GQX6\",\"ant-select-selector\":\"SourcesList_ant-select-selector__28wCb\",\"ant-input-number-disabled\":\"SourcesList_ant-input-number-disabled__1dmPP\",\"ant-select-item-option-selected\":\"SourcesList_ant-select-item-option-selected__8-7i9\",\"ant-select-item-option-active\":\"SourcesList_ant-select-item-option-active__ZQh7P\",\"ant-dropdown-menu-submenu-active\":\"SourcesList_ant-dropdown-menu-submenu-active__3Ru8r\",\"ant-dropdown-menu-submenu-title\":\"SourcesList_ant-dropdown-menu-submenu-title__1HvV8\",\"ant-collapse-content-box\":\"SourcesList_ant-collapse-content-box__14-Ey\",\"ant-card\":\"SourcesList_ant-card__2WzE8\",\"ant-modal-content\":\"SourcesList_ant-modal-content__8JrQn\",\"ant-table-tbody\":\"SourcesList_ant-table-tbody__19X5Z\",\"ant-table-thead\":\"SourcesList_ant-table-thead__caIVz\",\"ant-checkbox-inner\":\"SourcesList_ant-checkbox-inner__1KU15\",\"ant-modal-header\":\"SourcesList_ant-modal-header__s0HwD\",\"ant-table\":\"SourcesList_ant-table__uU-ps\",\"ant-list-split\":\"SourcesList_ant-list-split__1XZDt\",\"ant-list-header\":\"SourcesList_ant-list-header__1hnpG\",\"ant-tag\":\"SourcesList_ant-tag__hEJFE\",\"ant-tooltip-inner\":\"SourcesList_ant-tooltip-inner__2CD6U\",\"ant-badge-status-processing\":\"SourcesList_ant-badge-status-processing__3cvGd\",\"ant-dropdown-menu-item-active\":\"SourcesList_ant-dropdown-menu-item-active__2lAFT\",\"ant-dropdown\":\"SourcesList_ant-dropdown__zUC9C\",\"ant-popover-inner\":\"SourcesList_ant-popover-inner__2qMWm\",\"ant-popover-arrow\":\"SourcesList_ant-popover-arrow__n5SKh\",\"ant-popover-placement-rightTop\":\"SourcesList_ant-popover-placement-rightTop__2xy3L\",\"ant-popover-content\":\"SourcesList_ant-popover-content__1TVOE\",\"ant-popover-placement-leftBottom\":\"SourcesList_ant-popover-placement-leftBottom__22e7T\",\"ant-popover-placement-bottomRight\":\"SourcesList_ant-popover-placement-bottomRight__3XnUA\",\"ant-popover-placement-top\":\"SourcesList_ant-popover-placement-top__3RUpD\",\"icon-size-base\":\"SourcesList_icon-size-base__1RUN6\",\"icon-size-lg\":\"SourcesList_icon-size-lg__3v6YQ\",\"ant-tabs-card\":\"SourcesList_ant-tabs-card__2BEXC\",\"ant-tabs-tab-active\":\"SourcesList_ant-tabs-tab-active___oik6\",\"ant-skeleton\":\"SourcesList_ant-skeleton__27TOr\",\"ant-skeleton-paragraph\":\"SourcesList_ant-skeleton-paragraph__3ZNGU\",\"empty\":\"SourcesList_empty__38YqE\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"box-shadow-base\":\"AddSourceDialog_box-shadow-base__37iqT\",\"border-debug\":\"AddSourceDialog_border-debug__3L9v4\",\"font-heading\":\"AddSourceDialog_font-heading__Lnt_J\",\"font-monospace\":\"AddSourceDialog_font-monospace__2dw7L\",\"ant-select-disabled\":\"AddSourceDialog_ant-select-disabled__3NbVx\",\"ant-select\":\"AddSourceDialog_ant-select__3CAZi\",\"ant-select-customize-input\":\"AddSourceDialog_ant-select-customize-input__3zhDS\",\"ant-select-selector\":\"AddSourceDialog_ant-select-selector__1jo3M\",\"ant-input-number-disabled\":\"AddSourceDialog_ant-input-number-disabled__3-BmC\",\"ant-select-item-option-selected\":\"AddSourceDialog_ant-select-item-option-selected__wdmWw\",\"ant-select-item-option-active\":\"AddSourceDialog_ant-select-item-option-active__PWAvN\",\"ant-dropdown-menu-submenu-active\":\"AddSourceDialog_ant-dropdown-menu-submenu-active__1gyJW\",\"ant-dropdown-menu-submenu-title\":\"AddSourceDialog_ant-dropdown-menu-submenu-title__10ZHW\",\"ant-collapse-content-box\":\"AddSourceDialog_ant-collapse-content-box__2KBiX\",\"ant-card\":\"AddSourceDialog_ant-card__3BcaD\",\"ant-modal-content\":\"AddSourceDialog_ant-modal-content__2zpE9\",\"ant-table-tbody\":\"AddSourceDialog_ant-table-tbody__3pGvA\",\"ant-table-thead\":\"AddSourceDialog_ant-table-thead__3c6ve\",\"ant-checkbox-inner\":\"AddSourceDialog_ant-checkbox-inner__3QHon\",\"ant-modal-header\":\"AddSourceDialog_ant-modal-header__3FPsT\",\"ant-table\":\"AddSourceDialog_ant-table__TTYPz\",\"ant-list-split\":\"AddSourceDialog_ant-list-split__3UW8n\",\"ant-list-header\":\"AddSourceDialog_ant-list-header__1PiWJ\",\"ant-tag\":\"AddSourceDialog_ant-tag__oWJaL\",\"ant-tooltip-inner\":\"AddSourceDialog_ant-tooltip-inner__3AdX6\",\"ant-badge-status-processing\":\"AddSourceDialog_ant-badge-status-processing__2Mxr8\",\"ant-dropdown-menu-item-active\":\"AddSourceDialog_ant-dropdown-menu-item-active__WcvqA\",\"ant-dropdown\":\"AddSourceDialog_ant-dropdown__HV7Yb\",\"ant-popover-inner\":\"AddSourceDialog_ant-popover-inner__3mJCM\",\"ant-popover-arrow\":\"AddSourceDialog_ant-popover-arrow__2972l\",\"ant-popover-placement-rightTop\":\"AddSourceDialog_ant-popover-placement-rightTop__2ydJb\",\"ant-popover-content\":\"AddSourceDialog_ant-popover-content__3DwAn\",\"ant-popover-placement-leftBottom\":\"AddSourceDialog_ant-popover-placement-leftBottom__janul\",\"ant-popover-placement-bottomRight\":\"AddSourceDialog_ant-popover-placement-bottomRight__2kxxJ\",\"ant-popover-placement-top\":\"AddSourceDialog_ant-popover-placement-top__IQPCW\",\"icon-size-base\":\"AddSourceDialog_icon-size-base__23Vz9\",\"icon-size-lg\":\"AddSourceDialog_icon-size-lg__1wv5m\",\"ant-tabs-card\":\"AddSourceDialog_ant-tabs-card__2qi7J\",\"ant-tabs-tab-active\":\"AddSourceDialog_ant-tabs-tab-active__2k_KB\",\"ant-skeleton\":\"AddSourceDialog_ant-skeleton__3iv7s\",\"ant-skeleton-paragraph\":\"AddSourceDialog_ant-skeleton-paragraph__2Glah\",\"dialog\":\"AddSourceDialog_dialog__1VpmY\",\"filter\":\"AddSourceDialog_filter__1tc0K\",\"filterInput\":\"AddSourceDialog_filterInput__1tOi0\",\"list\":\"AddSourceDialog_list__1EuuY\",\"item\":\"AddSourceDialog_item__32WYt\",\"pic\":\"AddSourceDialog_pic__3JFC3\",\"title\":\"AddSourceDialog_title__FGAln\",\"airbyteLabel\":\"AddSourceDialog_airbyteLabel__yvMR6\",\"star\":\"AddSourceDialog_star__3Sa72\",\"starIcon\":\"AddSourceDialog_starIcon__O-IDx\",\"fillStar\":\"AddSourceDialog_fillStar__nITbb\",\"strokeStar\":\"AddSourceDialog_strokeStar__3qNwu\",\"item__disabled\":\"AddSourceDialog_item__disabled__1fg0s\"};","// extracted by mini-css-extract-plugin","// extracted by mini-css-extract-plugin\nmodule.exports = {\"disableAnimations\":\"SourceEditorFormStreamsLoadableForm_disableAnimations__22QBr\"};","// extracted by mini-css-extract-plugin\nmodule.exports = {\"documentation\":\"SourceEditorDocumentationDrawer_documentation__1P_SO\"};","// @Libs\nimport { useEffect } from \"react\"\nimport { useHistory } from \"react-router-dom\"\nimport { Button } from \"antd\"\nimport { observer } from \"mobx-react-lite\"\n// @Store\nimport { sourcesStore } from \"stores/sources\"\n// @Icons\nimport PlusOutlined from \"@ant-design/icons/lib/icons/PlusOutlined\"\n// @Styles\nimport styles from \"./SourcesList.module.less\"\n// @Routes\nimport { sourcesPageRoutes } from \"ui/pages/SourcesPage/SourcesPage.routes\"\n// @Utils\nimport { SourceCard } from \"../../../../components/SourceCard/SourceCard\"\nimport { currentPageHeaderStore } from \"../../../../../stores/currentPageHeader\"\nimport { projectRoute } from \"lib/components/ProjectLink/ProjectLink\"\nimport useProject from \"../../../../../hooks/useProject\"\nimport { allPermissions } from \"../../../../../lib/services/permissions\"\nimport { ProjectPermission } from \"../../../../../generated/conf-openapi\"\n\nconst SourcesListComponent = () => {\n const history = useHistory()\n const project = useProject()\n const disableEdit = !(project.permissions || allPermissions).includes(ProjectPermission.MODIFY_CONFIG)\n\n useEffect(() => {\n currentPageHeaderStore.setBreadcrumbs(\"Sources\")\n }, [])\n\n if (sourcesStore.list.length === 0) {\n return (\n
\n

Sources list is still empty

\n
\n }\n onClick={() => history.push(projectRoute(sourcesPageRoutes.add))}\n >\n Add source\n \n
\n
\n )\n }\n\n return (\n <>\n
\n }\n onClick={() => history.push(projectRoute(sourcesPageRoutes.add))}\n >\n Add source\n \n
\n\n
\n {sourcesStore.list.map((src: SourceData) => (\n \n ))}\n
\n \n )\n}\n\nconst SourcesList = observer(SourcesListComponent)\n\nSourcesList.displayName = \"SourcesList\"\n\nexport { SourcesList }\n","// @Libs\nimport React, { memo, useCallback, useEffect, useMemo, useState } from \"react\"\nimport { Link, generatePath, useHistory } from \"react-router-dom\"\nimport { Badge, Input, Modal, Switch } from \"antd\"\nimport cn from \"classnames\"\nimport debounce from \"lodash/debounce\"\n// @Catalog sources\nimport { allSources } from \"@jitsu/catalog\"\n// @Services\nimport ApplicationServices from \"lib/services/ApplicationServices\"\n// @Styles\nimport styles from \"./AddSourceDialog.module.less\"\n// @Types\nimport { SourceConnector } from \"@jitsu/catalog\"\n// @Icons\nimport { StarOutlined, StarFilled, ExclamationCircleOutlined } from \"@ant-design/icons\"\n// @Routes\nimport { sourcesPageRoutes } from \"ui/pages/SourcesPage/SourcesPage.routes\"\nimport { useServices } from \"hooks/useServices\"\nimport { projectRoute } from \"lib/components/ProjectLink/ProjectLink\"\n\n/**\n * All sources which are available for adding. Some filtering & sorting is applied\n * Sort:\n * 1. native connectors (protoType === undefined)\n * 2. not expert mode\n * 3. expert mode\n * 4. airbyte source on heroku (disabled)\n *\n * Airbyte connectors are disabled if the app is hosted using Heroku.\n */\n\nconst isAirbyteSourceOnHeroku = (source: SourceConnector): boolean => {\n return source.protoType === \"airbyte\" && ApplicationServices.get().features.environment === \"heroku\"\n}\n\nconst allAvailableSources = allSources.sort((a, b) => {\n if (a.protoType === undefined && b.protoType !== undefined) {\n return -1\n } else if (a.protoType !== undefined && b.protoType === undefined) {\n return 1\n } else if (isAirbyteSourceOnHeroku(a) && !isAirbyteSourceOnHeroku(b)) {\n return 1\n } else if (!isAirbyteSourceOnHeroku(a) && isAirbyteSourceOnHeroku(b)) {\n return -1\n } else if (a.expertMode && !b.expertMode) {\n return 1\n } else if (!a.expertMode && b.expertMode) {\n return -1\n }\n return a.displayName.localeCompare(b.displayName)\n})\n\nconst AddSourceDialogComponent = () => {\n const history = useHistory()\n\n const [filterParam, setFilterParam] = useState()\n const services = useServices()\n const [showDeprecatedSources, setShowDeprecatedSources] = useState(false)\n\n const handleClick = (src: SourceConnector) => (e: React.MouseEvent) => {\n if (src.expertMode) {\n e.stopPropagation()\n e.preventDefault()\n services.analyticsService.track(\"singer_connector_attempt\", {\n app: services.features.appName,\n connector_id: src.id,\n })\n\n Modal.confirm({\n title: (\n <>\n {src.displayName} - alpha version notice!\n \n ),\n icon: ,\n content: (\n <>\n {src.displayName} connector is available as alpha version only, it requires an understanding of{\" \"}\n \n Singer Protocol\n \n
\n
\n Do you want to continue?\n \n ),\n okText: \"Add\",\n cancelText: \"Cancel\",\n onOk: () => {\n services.analyticsService.track(\"singer_connector_added\", {\n app: services.features.appName,\n connector_id: src.id,\n })\n history.push(projectRoute(sourcesPageRoutes.addExact, { source: src.id }))\n },\n })\n }\n\n if (isAirbyteSourceOnHeroku(src)) {\n e.stopPropagation()\n e.preventDefault()\n\n Modal.info({\n title: (\n <>\n {src.displayName} connector is not available for Heroku-based applications.\n \n ),\n icon: ,\n content: (\n <>\n Currently, we do not support Airbyte sources for the applications deployed on Heroku due to its limited\n support for running docker containers inside docker container. To learn more, refer to{\" \"}\n \n Heroku documentation\n \n \n ),\n })\n }\n }\n\n const handleChange = debounce(\n useCallback((e: React.ChangeEvent) => {\n setFilterParam(e.target.value)\n }, []),\n 500\n )\n\n const filteredSourcesList = useMemo(\n () =>\n filterParam\n ? allAvailableSources.filter(\n (src: SourceConnector) =>\n src.displayName.toLowerCase().includes(filterParam.toLowerCase()) ||\n src.id.toLowerCase().includes(filterParam.toLowerCase())\n )\n : allAvailableSources,\n [filterParam]\n )\n\n useEffect(() => {\n document.body.classList.add(\"custom-scroll-body\")\n\n return () => document.body.classList.remove(\"custom-scroll-body\")\n }, [])\n\n return (\n
\n
\n
\n \n
\n
\n setShowDeprecatedSources(checked)} />\n
Show deprecated sources
\n
\n
\n\n
\n {filteredSourcesList\n .filter(src => showDeprecatedSources || !src.deprecated)\n .map((src: SourceConnector) => (\n \n {src.pic}\n {src.displayName}\n {src.protoType === \"airbyte\" && {\"powered by Airbyte\"}}\n {src.protoType === \"singer\" && {\"powered by Singer\"}}\n\n {src.expertMode ? (\n \n ) : src.protoType !== \"airbyte\" ? (\n \n \n \n \n ) : (\n <>\n )}\n \n ))}\n
\n
\n )\n}\n\nAddSourceDialogComponent.displayName = \"AddSourceDialog\"\n\nexport const AddSourceDialog = memo(AddSourceDialogComponent)\n","/**\n * This code organizes the state of the Source Editor using the useReducer and Context\n *\n * For now it is only used to manage the View State, e.g. loaders and disabled elements\n * TO DO: Move the source editor state from useState hook here\n *\n * Use it is as follows\n *\n * @example\n * const SourceEditor = () => {\n * return (\n * // wrap children in context provider so that they may consume state and dispatcher\n * \n * \n * )\n * }\n *\n * const SourceEditorChildComponent = () => {\n * const sourceEditorState = useSourceEditorState() // get source editor state from the context (warning: consuming state may result in a large amount of redundant re-renders)\n * const dispatchAction = useSourceEditorDispatcher() // get source editor dispatcher for updating the state\n *\n * useEffect(() => {\n * dispatchAction(SourceEditorActionsTypes.SET_STATUS, { // use dispathcer to update the state\n * loaders: {\n * isLoadingConfig: true,\n * isLoadingStreams: false,\n * },\n * })\n * }, [])\n *\n * return sourceEditorState.loaders.isLoadingConfig ? \"loading...\" : \"loaded!\"\n * }\n *\n */\n\nimport React, { useCallback, useContext, useEffect, useReducer } from \"react\"\n\ntype SourceEditorViewState = {\n status: {\n isLoadingConfig: boolean\n isLoadingStreams: boolean\n isTestingConnection: boolean\n isLoadingOauthStatus: boolean\n hasLoadedOauthFieldsStatus: boolean\n isOauthFlowCompleted: boolean\n hasConfigSealed: boolean\n }\n}\n\nconst initialState: SourceEditorViewState = {\n status: {\n isLoadingConfig: false,\n isLoadingStreams: false,\n isTestingConnection: false,\n isLoadingOauthStatus: false,\n hasLoadedOauthFieldsStatus: false,\n isOauthFlowCompleted: false,\n hasConfigSealed: false,\n },\n}\n\n/**\n * Available source editor actions types\n */\nexport enum SourceEditorActionsTypes {\n SET_STATUS,\n}\n\n/**\n * Map of factories of source editor actions\n */\nconst actionsFactories = {\n [SourceEditorActionsTypes.SET_STATUS](payload: Partial) {\n return { type: SourceEditorActionsTypes.SET_STATUS, payload } as const\n },\n} as const\n\n/** Holds a union of all possible Source Editor actions */\ntype SourceEditorActionsObjects = ReturnType\n\n/** Returns type of action payload by action type */\ntype SourceEditorActionPayload = ReturnType<\n typeof actionsFactories[ActionType]\n>[\"payload\"]\n\n/** Alias for reducer type */\ntype Reducer = (state: SourceEditorViewState, action: SourceEditorActionsObjects) => SourceEditorViewState\n\n/** Reducer that handles incoming actions by mapping them to a new state */\nconst reducer: Reducer = (state, action) => {\n switch (action.type) {\n case SourceEditorActionsTypes.SET_STATUS:\n return { ...state, status: { ...state.status, ...action.payload } }\n default:\n console.warn(\n `Reducer in Source Editor did not apply any state updates for action ${action.type}.\\nYou may have forgotten to specify an appropriate reducer case for this action.`\n )\n return state\n }\n}\n\n/** Helper for conviniently dispatching actions like `dispatchAction(type, payload) */\ntype Dispatcher = (type: T, payload: SourceEditorActionPayload) => void\n\n/**\n * Context that provides source editor state to children components\n */\nconst SourceEditorStateContext = React.createContext(initialState)\n\n/**\n * Context that provides source editor actions dispatcher to children components\n */\nconst SourceEditorDispatchContext = React.createContext(() => {\n throw new Error(\n `SourceEditorDispatchContext value that was not initialized. This may indicate a missuse when no value was provided to SourceEditorDispatchContext.Provider.`\n )\n})\n\n/**\n * Helper wrapper component that provides source editor state and dispatchers via context\n */\nexport const SourceEditorStateProvider: React.FC = ({ children }) => {\n const [state, dispatch] = useReducer(reducer, initialState)\n\n const dispatcher = useCallback((type, payload) => {\n dispatch(actionsFactories[type](payload as any))\n }, [])\n\n return (\n \n {children}\n \n )\n}\n\n/**\n * Hook for getting source editor state in children components\n *\n * @warning\n * This state will be changing a lot causing consumers to re-render on every change.\n * Therefore, this hook is designed for use in top-most components of the SourceEditor.\n */\nexport const useSourceEditorState = (): SourceEditorViewState => {\n const state = useContext(SourceEditorStateContext)\n if (!state) {\n throw new Error(`Attempted to get source editor state outside the SourceEditorStateContext.Provider.`)\n }\n return state\n}\n\n/**\n * Hook for getting source editor dispatcher in children components\n */\nexport const useSourceEditorDispatcher = (): Dispatcher => {\n const dispatcher = useContext(SourceEditorDispatchContext)\n if (!dispatcher) {\n throw new Error(`Attempted to get source editor dispatcher outside the SourceEditorDispatcherContext.Provider.`)\n }\n return dispatcher\n}\n","// @Libs\nimport React, { useEffect, useMemo, useState } from \"react\"\nimport { Form as AntdForm, Input, Row, Col, Select, FormProps } from \"antd\"\n// @Store\nimport { sourcesStore } from \"stores/sources\"\n// @Constants\nimport { COLLECTIONS_SCHEDULES, DAILY_HOURS } from \"constants/schedule\"\n// @Types\nimport { PatchConfig, SetFormReference, ValidateGetErrorsCount } from \"./SourceEditorFormConfiguration\"\nimport { Rule as AntdFormItemValidationRule } from \"antd/lib/form\"\n// @Services\nimport { useServices } from \"hooks/useServices\"\nimport { observer } from \"mobx-react-lite\"\n// @Styles\nimport editorStyles from \"ui/components/ConfigurableFieldsForm/ConfigurableFieldsForm.module.less\"\nimport { useSourceEditorState } from \"./SourceEditor.state\"\nimport { LabelWithTooltip } from \"../../../../../components/LabelWithTooltip/LabelWithTooltip\"\n\ntype FormFields = {\n sourceId: string\n schedule: string\n}\n\ntype Props = {\n editorMode: \"add\" | \"edit\"\n disabled?: boolean\n initialValues: Optional>\n patchConfig: PatchConfig\n setValidator: ReactSetState<(validator: ValidateGetErrorsCount) => void>\n setFormReference: SetFormReference\n}\n\nconst CONFIG_INTERNAL_STATE_KEY = \"staticParameters\"\nconst CONFIG_FORM_KEY = `${CONFIG_INTERNAL_STATE_KEY}Form`\n\nconst SourceEditorFormConfigurationStaticFields: React.FC = ({\n editorMode,\n disabled,\n initialValues,\n patchConfig,\n setValidator,\n setFormReference,\n}) => {\n const [form] = AntdForm.useForm()\n const [dailyMode, setDailyMode] = useState(initialValues?.schedule === \"@daily\")\n const [cronMode, setCronMode] = useState(initialValues?.schedule === \"@cron\")\n\n const services = useServices()\n const sourceEditorState = useSourceEditorState()\n const subscription = services.currentSubscription?.currentPlan\n const sourcesList = sourcesStore.list\n\n const validateUniqueSourceId = (_, value: string) =>\n editorMode === \"add\" && sourcesList?.find((source: SourceData) => source.sourceId === value)\n ? Promise.reject(\"SourceId must be unique!\")\n : Promise.resolve()\n\n const validateSourceIdNoSpaces = (_, value: string) => {\n const re = /^[A-Za-z0-9_-]*$/\n if (!re.test(value)) {\n return Promise.reject(\"SourceId must contain only letters, numbers, hyphens or the underscore character\")\n } else {\n return Promise.resolve()\n }\n }\n\n const sourceIdValidationRules = useMemo(\n () => [\n { required: true, message: \"SourceId is required field\" },\n { validator: validateUniqueSourceId },\n { validator: validateSourceIdNoSpaces },\n ],\n []\n )\n\n const handleFormValuesChange: FormProps[\"onValuesChange\"] = (_, values) => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, values, { resetErrorsCount: true })\n }\n\n /**\n * set initial state, validator and form reference on first render\n */\n useEffect(() => {\n const validateGetErrorsCount: ValidateGetErrorsCount = async () => {\n let errorsCount = 0\n try {\n await form.validateFields()\n } catch (error) {\n errorsCount = +error?.errorFields?.length\n }\n return errorsCount\n }\n\n patchConfig(CONFIG_INTERNAL_STATE_KEY, form.getFieldsValue(), { doNotSetStateChanged: true })\n setValidator(() => validateGetErrorsCount)\n setFormReference(CONFIG_FORM_KEY, form)\n }, [])\n\n return (\n \n \n \n SourceId}\n name=\"sourceId\"\n rules={sourceIdValidationRules}\n labelCol={{ span: 4 }}\n wrapperCol={{ span: 20 }}\n >\n \n \n \n \n\n \n \n Schedule}\n labelCol={{ span: 4 }}\n wrapperCol={{ span: 20 }}\n rules={[{ required: true, message: \"You have to choose schedule\" }]}\n >\n {\n setDailyMode(v === \"@daily\")\n setCronMode(v === \"@cron\")\n }}\n >\n {COLLECTIONS_SCHEDULES.map(option => {\n const available = subscription ? subscription.quota.allowedSchedules.includes(option.id) : true\n return (\n \n {option.label}\n {!available && \" - n/a, upgrade plan\"}\n \n )\n })}\n \n \n \n \n\n \n \n \n\n \n \n \n \n )\n}\n\nconst Wrapped = observer(SourceEditorFormConfigurationStaticFields)\n\nWrapped.displayName = \"SourceEditorFormConfigurationStaticFields\"\n\nexport { Wrapped as SourceEditorFormConfigurationStaticFields }\n","// @Libs\nimport { memo, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { Col, Row, Form, Select, FormProps } from \"antd\"\nimport { Parameter, singleSelectionType, SourceConnector } from \"@jitsu/catalog\"\n// @Services\nimport ApplicationServices from \"lib/services/ApplicationServices\"\n// @Components\nimport { ErrorCard } from \"lib/components/ErrorCard/ErrorCard\"\nimport { LoadableFieldsLoadingMessageCard } from \"lib/components/LoadingFormCard/LoadingFormCard\"\nimport {\n IMAGE_VERSION_FIELD_ID,\n ConfigurableFieldsForm,\n} from \"ui/components/ConfigurableFieldsForm/ConfigurableFieldsForm\"\n// @Types\nimport { PatchConfig, SetFormReference, ValidateGetErrorsCount } from \"./SourceEditorFormConfiguration\"\n// @Hooks\nimport { usePolling } from \"hooks/usePolling\"\n// @Utils\nimport { toTitleCase } from \"utils/strings\"\nimport { uniqueId } from \"lodash\"\nimport { withQueryParams } from \"utils/queryParams\"\nimport { mapAirbyteSpecToSourceConnectorConfig } from \"@jitsu/catalog\"\nimport { mapSdkSourceSpecToSourceConnectorConfig } from \"@jitsu/catalog\"\nimport { SourceEditorActionsTypes, useSourceEditorDispatcher } from \"./SourceEditor.state\"\n\ntype Props = {\n initialValues: Partial\n sourceDataFromCatalog: SourceConnector\n availableOauthBackendSecrets?: string[]\n disabled?: boolean\n hideFields?: string[]\n patchConfig: PatchConfig\n setValidator: React.Dispatch void>>\n setFormReference: SetFormReference\n handleResetOauth: VoidFunction\n handleReloadStreams: VoidFunction | AsyncVoidFunction\n}\n\nconst CONFIG_INTERNAL_STATE_KEY = \"loadableParameters\"\nconst CONFIG_FORM_KEY = `${CONFIG_INTERNAL_STATE_KEY}Form`\n\nexport const SourceEditorFormConfigurationConfigurableLoadableFields: React.FC = memo(\n ({\n disabled,\n initialValues,\n sourceDataFromCatalog,\n availableOauthBackendSecrets,\n hideFields: _hideFields,\n patchConfig,\n setValidator,\n setFormReference,\n handleResetOauth,\n handleReloadStreams,\n }) => {\n const [form] = Form.useForm()\n const dispatchAction = useSourceEditorDispatcher()\n const airbyteImageVersion = useRef(\n sourceDataFromCatalog.protoType === \"airbyte\"\n ? (initialValues as Partial).config?.image_version ?? \"\"\n : \"\"\n )\n\n let polledData\n switch (sourceDataFromCatalog.protoType) {\n case \"airbyte\":\n polledData = usePolling(\n {\n configure: () => {\n const controlsDisableRequestId = uniqueId(\"configurableLoadableFields-\")\n const imageVersion: string = airbyteImageVersion.current\n let availableImageVersions: string[] = []\n return {\n onBeforePollingStart: async () => {\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, { isLoadingConfig: true })\n availableImageVersions = (await pullAvailableAirbyteImageVersions(sourceDataFromCatalog.id)) || []\n },\n pollingCallback: (end, fail) => async () => {\n try {\n const response = await pullAirbyteSpec(\n sourceDataFromCatalog.id,\n imageVersion || availableImageVersions[0]\n )\n if (response?.message) throw new Error(response?.message)\n if (response?.status && response?.status !== \"pending\") {\n const result = transformAirbyteSpecResponse(response)\n result.unshift({\n id: IMAGE_VERSION_FIELD_ID,\n displayName: \"Airbyte Image Version\",\n type: singleSelectionType(availableImageVersions),\n defaultValue: imageVersion || availableImageVersions[0],\n required: true,\n })\n end(result)\n }\n } catch (error) {\n fail(error)\n }\n },\n onAfterPollingEnd: () => {\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, { isLoadingConfig: false })\n },\n }\n },\n },\n { interval_ms: 2000 }\n )\n break\n case \"sdk_source\":\n polledData = usePolling(\n {\n configure: () => {\n const controlsDisableRequestId = uniqueId(\"configurableLoadableFields-\")\n\n return {\n onBeforePollingStart: async () => {\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, { isLoadingConfig: true })\n },\n pollingCallback: (end, fail) => async () => {\n try {\n const response = await pullSdkSourceSpec(sourceDataFromCatalog.specEndpoint)\n if (response?.message) throw new Error(response?.message)\n if (response?.status && response?.status !== \"pending\") {\n const result = transformSdkSourceSpecResponse(response, availableOauthBackendSecrets)\n end(result)\n }\n } catch (error) {\n fail(error)\n }\n },\n onAfterPollingEnd: () => {\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, { isLoadingConfig: false })\n },\n }\n },\n },\n { interval_ms: 2000 },\n [availableOauthBackendSecrets]\n )\n }\n\n const {\n isLoading: isLoadingParameters,\n data: fp,\n error: loadingParametersError,\n reload: reloadParameters,\n } = polledData\n\n const fieldsParameters = fp as Parameter[]\n const hideFields = useMemo(() => {\n if (!fieldsParameters) return _hideFields\n const oauthFieldsParametersNames = fieldsParameters.reduce((result, current) => {\n if (current.type.typeName === \"oauthSecret\") result.push(current.id)\n return result\n }, [])\n return [..._hideFields, ...oauthFieldsParametersNames]\n }, [_hideFields, fieldsParameters])\n\n const handleFormValuesChange = useCallback(\n (values: PlainObjectWithPrimitiveValues): void => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, values, { resetErrorsCount: true })\n },\n [patchConfig]\n )\n\n const handleFormValuesChangeForm = useCallback[\"onValuesChange\"]>(\n (changedValues, allValues) => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, allValues, { resetErrorsCount: true })\n handleIfAirbyteVersionChanged(changedValues)\n },\n [patchConfig]\n )\n\n const handleIfAirbyteVersionChanged = async (changedFormValues: PlainObjectWithPrimitiveValues): Promise => {\n const newImageVersion = changedFormValues[IMAGE_VERSION_FIELD_ID]\n if (newImageVersion && typeof newImageVersion === \"string\") {\n airbyteImageVersion.current = newImageVersion\n handleResetOauth()\n await reloadParameters()\n handleReloadStreams()\n }\n }\n\n const handleSetInitialFormValues = useCallback(\n (values: PlainObjectWithPrimitiveValues): void => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, values, { doNotSetStateChanged: true })\n },\n [patchConfig]\n )\n\n /**\n * set validator and form reference to parent component after the first render\n */\n useEffect(() => {\n const validateGetErrorsCount: ValidateGetErrorsCount = async () => {\n let errorsCount = 0\n try {\n await form.validateFields()\n } catch (error) {\n errorsCount = +error?.errorFields?.length\n }\n return errorsCount\n }\n\n setValidator(() => validateGetErrorsCount)\n setFormReference(CONFIG_FORM_KEY, form, handleFormValuesChange)\n }, [])\n\n return loadingParametersError ? (\n \n \n \n \n \n \n ) : isLoadingParameters ? (\n \n \n \n \n \n \n ) : (\n
\n \n \n )\n }\n)\n\nconst pullAvailableAirbyteImageVersions = async (sourceId: string): Promise => {\n const services = ApplicationServices.get()\n const queryParams = { project_id: services.activeProject.id }\n const requestUrl = withQueryParams(`/airbyte/${sourceId.replace(\"airbyte-\", \"\")}/versions`, queryParams)\n\n const response = await services.backendApiClient.get(requestUrl, { proxy: true })\n if (!Array.isArray(response?.versions)) return []\n return response.versions\n}\n\nconst pullAirbyteSpec = async (sourceId: string, imageVersion?: string): Promise => {\n const services = ApplicationServices.get()\n const queryParams = { project_id: services.activeProject.id }\n if (imageVersion) queryParams[\"image_version\"] = imageVersion\n const requestUrl = withQueryParams(`/airbyte/${sourceId.replace(\"airbyte-\", \"\")}/spec`, queryParams)\n\n return await services.backendApiClient.get(requestUrl, { proxy: true })\n}\n\nconst pullSdkSourceSpec = async (endpoint: string): Promise => {\n const services = ApplicationServices.get()\n const queryParams = { project_id: services.activeProject.id }\n const requestUrl = withQueryParams(endpoint, queryParams)\n\n return await services.backendApiClient.get(requestUrl, { proxy: true })\n}\n\nconst transformAirbyteSpecResponse = (response: any) => {\n return mapAirbyteSpecToSourceConnectorConfig(\n response?.[\"spec\"]?.[\"spec\"]?.[\"connectionSpecification\"]\n ).map(parameter => ({\n ...parameter,\n displayName: toTitleCase(parameter.displayName || parameter.id.split(\".\").pop(), { separator: \"_\" }),\n }))\n}\n\nconst transformSdkSourceSpecResponse = (response: any, availableOauthBackendSecrets: string[]) => {\n return mapSdkSourceSpecToSourceConnectorConfig(response?.[\"spec\"], availableOauthBackendSecrets)\n}\n","// @Libs\nimport { memo, useCallback, useEffect } from \"react\"\nimport { Form, FormProps } from \"antd\"\n// @Types\nimport { Parameter } from \"@jitsu/catalog\"\nimport { ConfigurableFieldsForm } from \"ui/components/ConfigurableFieldsForm/ConfigurableFieldsForm\"\n// @Components\nimport { PatchConfig, SetFormReference, ValidateGetErrorsCount } from \"./SourceEditorFormConfiguration\"\n\ntype Props = {\n initialValues: Partial\n configParameters: Parameter[]\n disabled?: boolean\n availableOauthBackendSecrets?: string[]\n hideFields?: string[]\n patchConfig: PatchConfig\n setValidator: React.Dispatch void>>\n setFormReference: SetFormReference\n}\n\nconst CONFIG_INTERNAL_STATE_KEY = \"configurableParameters\"\nconst CONFIG_FORM_KEY = `${CONFIG_INTERNAL_STATE_KEY}Form`\n\nexport const SourceEditorFormConfigurationConfigurableFields: React.FC = memo(\n ({\n disabled,\n initialValues,\n configParameters,\n availableOauthBackendSecrets,\n hideFields,\n patchConfig,\n setValidator,\n setFormReference,\n }) => {\n const [form] = Form.useForm()\n\n // get form fields from source connector\n\n const handleFormValuesChange = useCallback<(values: PlainObjectWithPrimitiveValues) => void>(values => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, values, { resetErrorsCount: true })\n }, [])\n\n const handleFormValuesChangeForm: FormProps[\"onValuesChange\"] = (_, values) => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, values, { resetErrorsCount: true })\n }\n\n const handleSetInitialFormValues = useCallback<(values: PlainObjectWithPrimitiveValues) => void>(values => {\n patchConfig(CONFIG_INTERNAL_STATE_KEY, values, { doNotSetStateChanged: true })\n }, [])\n\n /**\n * set validator and form reference on first render\n */\n useEffect(() => {\n const validateGetErrorsCount: ValidateGetErrorsCount = async () => {\n let errorsCount = 0\n try {\n await form.validateFields()\n } catch (error) {\n errorsCount = +error?.errorFields?.length\n }\n return errorsCount\n }\n\n setValidator(() => validateGetErrorsCount)\n setFormReference(CONFIG_FORM_KEY, form, handleFormValuesChange)\n }, [])\n\n return (\n \n \n \n )\n }\n)\n","// @Libs\nimport { Button } from \"antd\"\nimport { useEffect, useState } from \"react\"\n// @Components\nimport { actionNotification } from \"ui/components/ActionNotification/ActionNotification\"\nimport { handleError } from \"lib/components/components\"\n// @Icons\nimport { KeyOutlined } from \"@ant-design/icons\"\nimport { useServices } from \"hooks/useServices\"\nimport { GoogleSignInButton } from \"lib/components/GoogleSignInButton/GoogleSignInButton\"\n\ntype Props = {\n service: string\n forceNotSupported?: boolean\n className?: string\n disabled?: boolean\n icon?: React.ReactNode\n isGoogle?: boolean\n setAuthSecrets: (data: any) => void\n onIsOauthSuppotedStatusChecked?: (isSupported: boolean) => void\n}\n\nexport const OauthButton: React.FC = ({\n service,\n forceNotSupported,\n className,\n disabled,\n icon,\n children,\n setAuthSecrets,\n onIsOauthSuppotedStatusChecked,\n}) => {\n const services = useServices()\n const [isLoading, setIsLoading] = useState(false)\n const [isOauthSupported, setIsOauthSupported] = useState(false)\n const [isOauthCompleted, setIsOauthCompleted] = useState(false)\n\n const handleClick = async (): Promise => {\n setIsLoading(true)\n try {\n const oauthResult = await services.oauthService.getCredentialsInSeparateWindow(service)\n if (oauthResult.status === \"error\") {\n actionNotification.error(\n oauthResult.message ??\n oauthResult.errorMessage ??\n \"OAuth failed due to internal error. Please, file an issue.\"\n )\n return\n }\n if (oauthResult.status === \"warning\") {\n actionNotification.warn(oauthResult.message)\n return\n }\n setAuthSecrets(oauthResult.secrets)\n setIsOauthCompleted(true)\n } catch (error) {\n handleError(new Error(error.message ?? \"OAuth failed due to internal error. Please, file an issue.\"))\n setIsOauthCompleted(false)\n } finally {\n setIsLoading(false)\n }\n }\n\n useEffect(() => {\n if (forceNotSupported) {\n onIsOauthSuppotedStatusChecked(false)\n return\n }\n services.oauthService.checkIfOauthSupported(service).then(supported => {\n supported && setIsOauthSupported(supported)\n onIsOauthSuppotedStatusChecked(supported)\n })\n }, [])\n\n return (\n
\n
\n }\n onClick={handleClick}\n >\n {children}\n \n
\n
\n )\n}\n","// @Libs\nimport { useCallback, useState } from \"react\"\nimport { Button, Col, FormInstance, Popconfirm, Row } from \"antd\"\n// @Types\nimport { SourceConnector as CatalogSourceConnector } from \"@jitsu/catalog\"\n// @Components\nimport { OauthButton } from \"../OauthButton/OauthButton\"\n\ntype Props = {\n sourceDataFromCatalog: CatalogSourceConnector\n disabled?: boolean\n isSignedIn?: boolean\n onIsOauthSupportedCheckSuccess?: (supported: boolean) => void\n onFillAuthDataManuallyChange?: (setManually: boolean) => void\n setOauthSecretsToForms?: (secrets: PlainObjectWithPrimitiveValues) => void\n}\n\nexport const SourceEditorOauthButtons: React.FC = ({\n sourceDataFromCatalog,\n disabled,\n isSignedIn,\n onIsOauthSupportedCheckSuccess,\n onFillAuthDataManuallyChange,\n setOauthSecretsToForms,\n}) => {\n const [fillAuthDataManually, setFillAuthDataManually] = useState(true)\n const [isOauthSupported, setIsOauthSupported] = useState(false)\n\n const handleFillAuthDataManuallyToggle = useCallback<() => void>(() => {\n setFillAuthDataManually(value => {\n const newValue = !value\n onFillAuthDataManuallyChange?.(value)\n return newValue\n })\n }, [])\n\n const handleOauthSupportCheckStatus = useCallback<(supported: boolean) => void>(\n supported => {\n onIsOauthSupportedCheckSuccess(supported)\n setIsOauthSupported(supported)\n },\n [onIsOauthSupportedCheckSuccess]\n )\n\n return (\n \n \n \n
\n {sourceDataFromCatalog.pic}}\n isGoogle={\n sourceDataFromCatalog.id.toLowerCase().includes(\"google\") ||\n sourceDataFromCatalog.id.toLowerCase().includes(\"firebase\")\n }\n setAuthSecrets={setOauthSecretsToForms}\n onIsOauthSuppotedStatusChecked={handleOauthSupportCheckStatus}\n >\n {`${\n isSignedIn ? \"Re-Sign In\" : `Grant Jitsu Access to ${sourceDataFromCatalog.displayName}`\n }`}\n \n
\n {isOauthSupported && (\n <>\n \n \n \n \n )}\n \n
\n )\n}\n","// @Libs\nimport { observer } from \"mobx-react-lite\"\nimport { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { cloneDeep } from \"lodash\"\nimport { FormInstance } from \"antd\"\n// @Types\nimport type { SourceConnector as CatalogSourceConnector } from \"@jitsu/catalog\"\nimport type { SetSourceEditorState, SourceEditorState } from \"./SourceEditor\"\n// @Components\nimport { SourceEditorFormConfigurationStaticFields } from \"./SourceEditorFormConfigurationStaticFields\"\nimport { SourceEditorFormConfigurationConfigurableLoadableFields } from \"./SourceEditorFormConfigurationConfigurableLoadableFields\"\nimport { SourceEditorFormConfigurationConfigurableFields } from \"./SourceEditorFormConfigurationConfigurableFields\"\n// @Utils\nimport { useServices } from \"hooks/useServices\"\nimport { useLoaderAsObject } from \"hooks/useLoader\"\nimport { OAUTH_FIELDS_NAMES } from \"constants/oauth\"\nimport { SourceEditorOauthButtons } from \"../Common/SourceEditorOauthButtons/SourceEditorOauthButtons\"\nimport { sourcePageUtils } from \"ui/pages/SourcesPage/SourcePage.utils\"\nimport { useUniqueKeyState } from \"hooks/useUniqueKeyState\"\nimport { FormSkeleton } from \"ui/components/FormSkeleton/FormSkeleton\"\nimport { SourceEditorActionsTypes, useSourceEditorDispatcher, useSourceEditorState } from \"./SourceEditor.state\"\n\nexport type SourceEditorFormConfigurationProps = {\n editorMode: \"add\" | \"edit\"\n initialSourceData: Optional>\n sourceDataFromCatalog: CatalogSourceConnector\n disabled?: boolean\n setSourceEditorState: SetSourceEditorState\n handleReloadStreams: VoidFunction | AsyncVoidFunction\n}\n\nexport type ValidateGetErrorsCount = () => Promise\nexport type PatchConfig = (\n key: string,\n allValues: PlainObjectWithPrimitiveValues,\n options?: {\n /**\n * Whether to tell the parent component to update the UI.\n * Needed to distinguish the state updates caused by the user and updates made internally.\n **/\n doNotSetStateChanged?: boolean\n /** Whether to reset configuration tab errors count. False by default */\n resetErrorsCount?: boolean\n }\n) => void\n\nexport type SetFormReference = (\n key: string,\n form: FormInstance,\n patchConfigOnFormValuesChange?: (values: PlainObjectWithPrimitiveValues) => void\n) => void\n\ntype Forms = {\n [key: string]: {\n form: FormInstance\n patchConfigOnFormValuesChange?: (values: PlainObjectWithPrimitiveValues) => void\n }\n}\n\nconst initialValidator: () => ValidateGetErrorsCount = () => async () => 0\n\nconst SourceEditorFormConfiguration: React.FC = ({\n editorMode,\n initialSourceData,\n sourceDataFromCatalog,\n disabled,\n setSourceEditorState,\n handleReloadStreams,\n}) => {\n const services = useServices()\n const dispatchAction = useSourceEditorDispatcher()\n const sourceEditorState = useSourceEditorState()\n\n const [forms, setForms] = useState({})\n\n const isInitiallySignedIn = editorMode === \"edit\"\n\n const [fillAuthDataManually, setFillAuthDataManually] = useState(true)\n const [isOauthStatusReady, setIsOauthStatusReady] = useState(false)\n const [isOauthFlowCompleted, setIsOauthFlowCompleted] = useState(isInitiallySignedIn)\n\n const [staticFieldsValidator, setStaticFieldsValidator] = useState(initialValidator)\n const [configurableFieldsValidator, setConfigurableFieldsValidator] =\n useState(initialValidator)\n const [configurableLoadableFieldsValidator, setConfigurableLoadableFieldsValidator] =\n useState(initialValidator)\n\n const [resetKey, resetFormUi] = useUniqueKeyState() // pass a key to a component, then re-mount component by calling `resetFormUi`\n\n const setFormReference = useCallback((key, form, patchConfigOnFormValuesChange) => {\n setForms(forms => ({ ...forms, [key]: { form, patchConfigOnFormValuesChange } }))\n }, [])\n\n const sourceConfigurationSchema = useMemo(() => {\n switch (sourceDataFromCatalog.protoType) {\n case \"sdk_source\":\n const sdkSourceId = sourceDataFromCatalog.id.replace(\"sdk-\", \"\")\n return {\n backendId: sdkSourceId,\n hideOauthFields: true,\n loadableFields: true,\n configurableFields: sourceDataFromCatalog.configParameters,\n protoType: sourceDataFromCatalog.protoType,\n }\n case \"airbyte\":\n const airbyteId = sourceDataFromCatalog.id.replace(\"airbyte-\", \"\")\n return {\n backendId: airbyteId,\n hideOauthFields: true,\n loadableFields: true,\n invisibleStaticFields: {\n \"config.docker_image\": sourceDataFromCatalog.id.replace(\"airbyte-\", \"\"),\n },\n protoType: sourceDataFromCatalog.protoType,\n }\n case \"singer\":\n const tapId = sourceDataFromCatalog.id.replace(\"singer-\", \"\")\n return {\n backendId: tapId,\n hideOauthFields: true,\n configurableFields: sourceDataFromCatalog.configParameters,\n invisibleStaticFields: {\n \"config.tap\": tapId,\n },\n protoType: sourceDataFromCatalog.protoType,\n }\n /** Native source */\n default:\n const id = sourceDataFromCatalog.id\n return {\n backendId: id,\n hideOauthFields: true,\n configurableFields: sourceDataFromCatalog.configParameters,\n }\n }\n }, [])\n\n const { data: availableBackendSecrets, isLoading: isLoadingBackendSecrets } = useLoaderAsObject<\n string[]\n >(async () => {\n const { backendId, hideOauthFields } = sourceConfigurationSchema\n if (!hideOauthFields) return []\n return await services.oauthService.getAvailableBackendSecrets(backendId, services.activeProject.id)\n }, [])\n\n const hideFields = useMemo(() => {\n const { hideOauthFields } = sourceConfigurationSchema\n return fillAuthDataManually || !hideOauthFields ? [] : [...OAUTH_FIELDS_NAMES, ...(availableBackendSecrets ?? [])]\n }, [fillAuthDataManually, availableBackendSecrets])\n\n const handleResetOauth = useCallback<() => void>(() => {\n setIsOauthFlowCompleted(false)\n }, [])\n\n const handleOauthSupportedStatusChange = useCallback((oauthSupported: boolean) => {\n setIsOauthStatusReady(true)\n setFillAuthDataManually(!oauthSupported)\n }, [])\n\n const handleFillAuthDataManuallyChange = (fillManually: boolean) => {\n setFillAuthDataManually(fillManually)\n if (!fillManually) {\n resetFormUi() // reset form if user switched from manual auth back to oauth\n setIsOauthFlowCompleted(false) // force user to push the 'Authorize' button one more time\n }\n }\n\n const setOauthSecretsToForms = useCallback<(secrets: PlainObjectWithPrimitiveValues) => void>(\n secrets => {\n const success = sourcePageUtils.applyOauthValuesToAntdForms(forms, secrets)\n success && setIsOauthFlowCompleted(true)\n },\n [forms]\n )\n\n const patchConfig = useCallback((key, allValues, options) => {\n setSourceEditorState(state => {\n const newState: SourceEditorState = {\n ...state,\n configuration: { ...state.configuration, config: { ...state.configuration.config, [key]: allValues } },\n }\n if (!options?.doNotSetStateChanged) newState.stateChanged = true\n if (options.resetErrorsCount) newState.configuration.errorsCount = 0\n\n return newState\n })\n }, [])\n\n useEffect(() => {\n const validateConfigAndCountErrors = async (): Promise => {\n const staticFieldsErrorsCount = await staticFieldsValidator()\n const configurableFieldsErrorsCount = await configurableFieldsValidator()\n const configurableLoadableFieldsErrorsCount = await configurableLoadableFieldsValidator()\n return staticFieldsErrorsCount + configurableLoadableFieldsErrorsCount + configurableFieldsErrorsCount\n }\n\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n newState.configuration.validateGetErrorsCount = validateConfigAndCountErrors\n return newState\n })\n }, [staticFieldsValidator, configurableFieldsValidator, configurableLoadableFieldsValidator])\n\n /**\n * Sets source type specific fields that are not configurable by user\n */\n useEffect(() => {\n const { invisibleStaticFields } = sourceConfigurationSchema\n if (invisibleStaticFields)\n patchConfig(\"invisibleStaticFields\", invisibleStaticFields, {\n doNotSetStateChanged: true,\n })\n }, [])\n\n useEffect(() => {\n const isLoadingOauth = !isOauthStatusReady || isLoadingBackendSecrets\n if (isLoadingOauth)\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, {\n isLoadingOauthStatus: true,\n hasLoadedOauthFieldsStatus: Boolean(availableBackendSecrets),\n })\n else if (fillAuthDataManually)\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, {\n isOauthFlowCompleted: true,\n isLoadingOauthStatus: false,\n hasLoadedOauthFieldsStatus: Boolean(availableBackendSecrets),\n })\n else if (!isOauthFlowCompleted) {\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, {\n isOauthFlowCompleted: false,\n isLoadingOauthStatus: false,\n hasLoadedOauthFieldsStatus: Boolean(availableBackendSecrets),\n })\n } else {\n dispatchAction(SourceEditorActionsTypes.SET_STATUS, {\n isOauthFlowCompleted: true,\n isLoadingOauthStatus: false,\n hasLoadedOauthFieldsStatus: Boolean(availableBackendSecrets),\n })\n }\n }, [isLoadingBackendSecrets, isOauthStatusReady, fillAuthDataManually, isOauthFlowCompleted])\n\n return (\n <>\n {!sourceEditorState.status.hasLoadedOauthFieldsStatus ? (\n
\n \n
\n ) : (\n
\n {!disabled && (\n \n )}\n
\n \n {sourceConfigurationSchema.configurableFields && (\n \n )}\n {sourceConfigurationSchema.loadableFields && (\n \n )}\n
\n
\n )}\n \n )\n}\n\nconst Wrapped = observer(SourceEditorFormConfiguration)\n\nWrapped.displayName = \"SourceEditorFormConfiguration\"\n\nexport { Wrapped as SourceEditorFormConfiguration }\n","// @Libs\nimport React, { memo, useMemo } from \"react\"\nimport { Col, Form, Input, Row, Select } from \"antd\"\n// @Components\nimport { LabelWithTooltip } from \"ui/components/LabelWithTooltip/LabelWithTooltip\"\n// @Types\nimport { Rule } from \"antd/lib/form\"\nimport { CollectionParameter } from \"@jitsu/catalog\"\nimport { FormListFieldData } from \"antd/es/form/FormList\"\n\nexport interface Props {\n collection: CollectionParameter\n field: FormListFieldData\n documentation?: React.ReactNode\n handleFormFieldsChange?: (...args: any) => void\n}\n\nconst SourceEditorFormStreamsCollectionsFieldComponent = ({\n collection,\n field,\n documentation,\n handleFormFieldsChange,\n}: Props) => {\n const formItemChild = useMemo(() => {\n switch (collection.type.typeName) {\n case \"selection\":\n return (\n 1 || !collection.type.data?.maxOptions ? \"multiple\" : undefined}\n onChange={handleFormFieldsChange}\n >\n {collection.type.data.options.map((option: { displayName: string; id: string }) => (\n \n {option.displayName}\n \n ))}\n \n )\n\n case \"string\":\n default:\n return \n }\n }, [collection])\n\n const validationRules = useMemo(() => {\n const rules = []\n\n if (collection.required) {\n rules.push({ required: collection.required, message: `${collection.displayName} is required` })\n }\n\n if (collection.type.data?.maxOptions > 1) {\n rules.push({\n validator: (rule: Rule, value: string[]) =>\n (value?.length ?? 0) <= collection.type.data.maxOptions\n ? Promise.resolve()\n : Promise.reject(`You can select maximum ${collection.type.data?.maxOptions} options`),\n })\n }\n\n return rules\n }, [collection])\n\n return (\n \n \n \n ) : (\n {collection.displayName}:\n )\n }\n key={collection.id}\n name={[field.name, \"parameters\", collection.id]}\n rules={validationRules}\n labelCol={{ span: 6 }}\n wrapperCol={{ span: 18 }}\n >\n {formItemChild}\n \n \n \n )\n}\n\nSourceEditorFormStreamsCollectionsFieldComponent.displayName = \"SourceEditorFormStreamsCollectionsField\"\n\nexport const SourceEditorFormStreamsCollectionsField = memo(SourceEditorFormStreamsCollectionsFieldComponent)\n","import { SourceConnector } from \"@jitsu/catalog\"\nimport ApplicationServices from \"lib/services/ApplicationServices\"\nimport { withQueryParams } from \"utils/queryParams\"\nimport { assert, assertIsArrayOfTypes, assertIsBoolean, assertIsObject, assertIsString } from \"utils/typeCheck\"\nimport { sourceEditorUtils } from \"./SourceEditor.utils\"\n\nexport type PullAllStreams = (\n sourceDataFromCatalog: SourceConnector,\n handleBringSourceData: () => SourceData\n) => Promise\n\nexport const PARSING_STREAMS_ERROR_NAME = \"PARSING_STREAMS_ERROR\"\n\nexport const pullAllAirbyteStreams = async (\n sourceDataFromCatalog: SourceConnector,\n handleBringSourceData: () => AirbyteSourceData\n): Promise => {\n assert(\n sourceDataFromCatalog.protoType === \"airbyte\",\n `Attempted to pull airbyte streams but SourceConnector type is of a different type (${sourceDataFromCatalog.protoType})`,\n PARSING_STREAMS_ERROR_NAME\n )\n\n const services = ApplicationServices.get()\n\n const sourceData = await handleBringSourceData()\n const config = sourceData.config.config\n const image_version = sourceData.config.image_version\n const baseUrl = sourceDataFromCatalog.staticStreamsConfigEndpoint\n const project_id = services.activeProject.id\n const previously_selected_streams = sourceData.config.selected_streams\n\n const response = await services.backendApiClient.post(\n withQueryParams(baseUrl, { project_id, image_version }),\n config,\n {\n proxy: true,\n }\n )\n\n if (response.message) throw new Error(response.message)\n\n if (response.status !== \"pending\") {\n assertHasCatalog(response, `Airbyte catalog parsing error`)\n const rawAirbyteStreams: UnknownObject[] = response.catalog?.streams || []\n const streams: AirbyteStreamData[] = rawAirbyteStreams.map((stream, idx) => {\n assertIsAirbyteCatalogStream(stream, `Failed to parse Airbyte stream ${stream} with index ${idx}`)\n const streamMinimalConfig = { name: stream.name, namespace: stream.namespace }\n const previouslySelectedStream = previously_selected_streams?.find(previouslySelectedStreamConfig =>\n sourceEditorUtils.streamsAreEqual(previouslySelectedStreamConfig, streamMinimalConfig)\n )\n return {\n sync_mode: previouslySelectedStream?.sync_mode ?? stream.supported_sync_modes[0],\n cursor_field: previouslySelectedStream?.cursor_field ?? undefined,\n destination_sync_mode: \"overwrite\",\n stream: {\n name: stream.name,\n namespace: stream.namespace,\n json_schema: stream.json_schema,\n supported_sync_modes: stream.supported_sync_modes,\n ...stream,\n },\n }\n })\n\n return streams\n }\n}\n\nexport const pullAllSDKSourceStreams = async (\n sourceDataFromCatalog: SourceConnector,\n handleBringSourceData: () => SourceData\n): Promise => {\n assert(\n sourceDataFromCatalog.protoType === \"sdk_source\",\n `Attempted to pull sdk_source streams but SourceConnector type is of a different type (${sourceDataFromCatalog.protoType})`,\n PARSING_STREAMS_ERROR_NAME\n )\n\n const services = ApplicationServices.get()\n\n const sourceData = await handleBringSourceData()\n const config = sourceData.config\n const baseUrl = sourceDataFromCatalog.staticStreamsConfigEndpoint\n const project_id = services.activeProject.id\n\n const response = await services.backendApiClient.post(withQueryParams(baseUrl, { project_id }), config, {\n proxy: true,\n })\n\n if (response.message) throw new Error(response.message)\n\n if (response.status !== \"pending\") {\n assertSDKSourceCatalog(response, `SDK Source catalog parsing error`)\n const streams: SDKSourceStreamData[] = response.catalog.map((stream, idx) => {\n assertIsSDKSourceCatalogStream(stream, `Failed to parse SDK Source stream ${stream} with index ${idx}`)\n return stream\n })\n return streams\n }\n}\n\nexport const pullAllSingerStreams = async (\n sourceDataFromCatalog?: SourceConnector,\n handleBringSourceData?: () => SingerSourceData\n): Promise => {\n assert(\n sourceDataFromCatalog.protoType === \"singer\",\n \"Attempted to pull singer streams but SourceConnector type is of a different type.\"\n )\n\n const services = ApplicationServices.get()\n const sourceData = await handleBringSourceData()\n const config = sourceData.config.config\n const project_id = services.activeProject.id\n const tap = sourceDataFromCatalog.id.replace(\"singer-\", \"\")\n const baseUrl = `/singer/${tap}/catalog`\n\n const response = await services.backendApiClient.post(\n withQueryParams(baseUrl, { project_id, source_id: project_id + \".\" + sourceData.sourceId }),\n config,\n {\n proxy: true,\n }\n )\n\n if (response.message) throw new Error(response.message)\n\n if (response.status !== \"pending\") {\n assertHasCatalog(response, `Singer catalog parsing error`)\n const rawSingerStreams: UnknownObject[] = response.catalog?.streams\n const streams: SingerStreamData[] = rawSingerStreams.map((stream, idx) => {\n assertIsSingerCatalogStream(stream, `Failed to parse Singer stream ${stream} with index ${idx}`)\n return stream\n })\n return streams\n }\n}\n\nfunction assertSDKSourceCatalog(response: unknown, errorMessage): asserts response is { catalog: UnknownObject[] } {\n assertIsObject(response, `${errorMessage}: Backend response is not an object`)\n assertIsObject(response.catalog, `${errorMessage}: Backend response.catalog is not an object`)\n assertIsArrayOfTypes(\n response.catalog,\n {},\n `${errorMessage}: Backend response.catalog is not an array of objects`,\n PARSING_STREAMS_ERROR_NAME\n )\n}\n\nfunction assertHasCatalog(\n response: unknown,\n errorMessage\n): asserts response is { catalog: { streams: UnknownObject[] } } {\n assertIsObject(response, `${errorMessage}: Backend response is not an object`)\n assertIsObject(response.catalog, `${errorMessage}: Backend response.catalog is not an object`)\n // assertIsArrayOfTypes(\n // response.catalog.streams,\n // {},\n // `${errorMessage}: Backend response.catalog.streams is not an array of objects`,\n // PARSING_STREAMS_ERROR_NAME\n // )\n}\n\nfunction assertIsAirbyteCatalogStream(\n stream: UnknownObject,\n errorMessage\n): asserts stream is AirbyteStreamData[\"stream\"] {\n assertIsString(\n stream.name,\n {\n errMsg: `${errorMessage}: stream.name is not a string`,\n },\n PARSING_STREAMS_ERROR_NAME\n )\n assertIsString(\n stream.namespace,\n {\n allowUndefined: true,\n errMsg: `${errorMessage}: stream.namespace is not a string or undefined`,\n },\n PARSING_STREAMS_ERROR_NAME\n )\n assertIsObject(stream.json_schema, `${errorMessage}: stream.json_schema is not an object`, PARSING_STREAMS_ERROR_NAME)\n if (stream.supported_sync_modes !== undefined) {\n assertIsArrayOfTypes(\n stream.supported_sync_modes,\n \"\",\n `${errorMessage}: stream.supported_sync_modes is not an array of strings or undefined`,\n PARSING_STREAMS_ERROR_NAME\n )\n }\n}\n\nfunction assertIsSDKSourceCatalogStream(\n collection: UnknownObject,\n errorMessage\n): asserts collection is SDKSourceStreamData {\n assertIsString(\n collection.type,\n {\n errMsg: `${errorMessage}: collection.type is not a string`,\n },\n PARSING_STREAMS_ERROR_NAME\n )\n if (collection.supportedModes !== undefined) {\n assertIsArrayOfTypes(\n collection.supportedModes,\n \"\",\n `${errorMessage}: collection.supportedModes is not an array of strings or undefined`,\n PARSING_STREAMS_ERROR_NAME\n )\n }\n}\n\nfunction assertIsSingerCatalogStream(stream: UnknownObject, errorMessage): asserts stream is SingerStreamData {\n assertIsString(\n stream.tap_stream_id,\n {\n errMsg: `${errorMessage}: stream.tap_stream_id is not a string`,\n },\n PARSING_STREAMS_ERROR_NAME\n )\n assertIsString(\n stream.stream,\n {\n errMsg: `${errorMessage}: stream.stream is not a string`,\n },\n PARSING_STREAMS_ERROR_NAME\n )\n assertIsArrayOfTypes(\n stream.key_properties || [],\n \"\",\n `${errorMessage}: stream.key_properties is not an array of strings`,\n PARSING_STREAMS_ERROR_NAME\n )\n assertIsObject(stream.schema, `${errorMessage}: stream.schema is not an object`, PARSING_STREAMS_ERROR_NAME)\n assertIsArrayOfTypes(\n stream.metadata,\n {},\n `${errorMessage}: stream.metadata is not an array of objects`,\n PARSING_STREAMS_ERROR_NAME\n )\n\n stream.metadata.forEach((metadataObject, idx) => {\n assertIsArrayOfTypes(\n metadataObject.breadcrumb,\n \"\",\n `${errorMessage}: in stream with name ${stream.name}: breadcrumb property of stream.metadata array member with index ${idx} is not an array of strings`\n )\n assertIsObject(\n metadataObject.metadata,\n \"\",\n `${errorMessage}: in stream with name ${stream.name}: metadata property of stream.metadata array member with index ${idx} is not an object`\n )\n })\n}\n","// @Libs\nimport React, { ChangeEvent, useCallback, useEffect, useMemo, useRef, useState } from \"react\"\nimport { Button, Col, Collapse, Form, Input, Popover, Row, Select } from \"antd\"\n// @Types\nimport {\n booleanType,\n CollectionParameter,\n CollectionTemplate,\n intType,\n isoUtcDateType,\n jsonType,\n ParameterType,\n passwordType,\n selectionType,\n singleSelectionType,\n SourceConnector,\n stringType,\n} from \"@jitsu/catalog\"\nimport { FormListFieldData, FormListOperation } from \"antd/es/form/FormList\"\nimport { SetSourceEditorState, SourceEditorState } from \"./SourceEditor\"\n// @Components\nimport { SourceEditorFormStreamsCollectionsField } from \"./SourceEditorFormStreamsConfigurableCollectionsField\"\n// @Icons\nimport { CaretRightOutlined, DeleteOutlined, PlusOutlined } from \"@ant-design/icons\"\n// @Utils\nimport { getUniqueAutoIncId, randomId } from \"utils/numbers\"\nimport { useDebouncedCallback } from \"hooks/useDebouncedCallback\"\n// @Styles\nimport styles from \"./SourceEditor.module.less\"\nimport { convertSdkType } from \"@jitsu/catalog\"\n\nimport {\n PARSING_STREAMS_ERROR_NAME,\n pullAllSDKSourceStreams,\n pullAllSingerStreams,\n PullAllStreams,\n} from \"./SourceEditorPullData\"\nimport { usePolling } from \"../../../../../../hooks/usePolling\"\nimport { SourceEditorActionsTypes, useSourceEditorDispatcher, useSourceEditorState } from \"./SourceEditor.state\"\nimport { LoadableFieldsLoadingMessageCard } from \"../../../../../../lib/components/LoadingFormCard/LoadingFormCard\"\nimport { ErrorCard } from \"../../../../../../lib/components/ErrorCard/ErrorCard\"\n// @Unsorted\n\nconst { Panel } = Collapse\n\nexport interface Props {\n initialSourceData: Partial\n sourceDataFromCatalog: SourceConnector\n setSourceEditorState: SetSourceEditorState\n handleBringSourceData: () => SourceData\n disabled?: boolean\n}\n\nconst SELECTED_STREAMS_SOURCE_DATA_PATH = \"collections\"\n\nconst SourceEditorFormStreamsConfigurable = ({\n initialSourceData,\n sourceDataFromCatalog,\n setSourceEditorState,\n handleBringSourceData,\n disabled,\n}: Props) => {\n const [selectedCollectionTypes, setSelectedCollectionTypes] = useState(sourceDataFromCatalog.collectionTypes)\n const [addStreamVisible, setAddStreamVisible] = useState(false)\n const [addTemplateVisible, setAddTemplateVisible] = useState(false)\n const [collectionTypes, setCollectionTypes] = useState(sourceDataFromCatalog.collectionTypes)\n const [collectionParameters, setCollectionParameters] = useState(sourceDataFromCatalog.collectionParameters)\n const [collectionModes, setCollectionModes] = useState({} as { string: StreamMode[] })\n\n const [activePanel, setActivePanel] = useState([])\n\n const input = useRef(null)\n const [form] = Form.useForm()\n\n const renderApplyTemplates = sourceDataFromCatalog.collectionTemplates\n\n const dispatch = useSourceEditorDispatcher()\n const sourceEditorViewState = useSourceEditorState()\n\n const {\n isLoading,\n data,\n error,\n reload: reloadStreamsList,\n } = usePolling({\n configure: () => ({\n pollingCallback: (end, fail) => async () => {\n try {\n if (sourceDataFromCatalog.protoType == \"sdk_source\") {\n const result = await pullAllSDKSourceStreams(sourceDataFromCatalog, handleBringSourceData)\n const streamData = result as SDKSourceStreamData[]\n let ct = []\n let cp = []\n let cm = {} as { string: StreamMode[] }\n for (const stream of streamData) {\n cm[stream.type] = stream.supportedModes\n ct.push(stream.type)\n for (const param of stream.params) {\n let tp = convertSdkType(param[\"type\"])\n cp.push({\n applyOnlyTo: stream.type,\n id: param.id,\n defaultValue: param.defaultValue,\n type: tp,\n displayName: param.displayName,\n required: param.required,\n documentation: param.documentation,\n })\n }\n }\n if (result !== undefined) {\n setCollectionParameters(cp)\n setCollectionTypes(ct)\n setSelectedCollectionTypes(ct)\n setCollectionModes(cm)\n end(result)\n }\n } else {\n end([] as StreamData[])\n }\n } catch (error) {\n fail(error)\n }\n },\n onBeforePollingStart: () => {\n dispatch(SourceEditorActionsTypes.SET_STATUS, { isLoadingStreams: true })\n },\n onAfterPollingEnd: () => {\n dispatch(SourceEditorActionsTypes.SET_STATUS, { isLoadingStreams: false })\n },\n }),\n })\n\n const handleValuesChange = useDebouncedCallback(\n (_, values: { [SELECTED_STREAMS_SOURCE_DATA_PATH]: UnknownObject[] }) => {\n setSelectedStreams(\n setSourceEditorState,\n SELECTED_STREAMS_SOURCE_DATA_PATH,\n values[SELECTED_STREAMS_SOURCE_DATA_PATH]\n )\n },\n 100\n )\n\n const handleCollectionTypesFilter = useCallback(\n e => {\n setSelectedCollectionTypes(collectionTypes.filter(v => v.toLowerCase().includes(e.target.value.toLowerCase())))\n },\n [collectionTypes]\n )\n\n const getStream = useCallback(\n (index: number) => {\n return form.getFieldsValue().collections?.[index] ?? initialSourceData.collections[index]\n },\n [initialSourceData.collections, form]\n )\n\n const getFormErrors = useCallback(\n (index: number) => {\n let fields = collectionParameters.map(v => [\"collections\", index, \"parameters\", v.id])\n fields.push([\"collections\", index, \"name\"])\n return form.getFieldsError(fields).filter(v => v.errors.length > 0)\n },\n [form, collectionParameters]\n )\n\n const getCollectionParametersForType = useCallback(\n (type: string) => {\n return collectionParameters?.filter(\n ({ applyOnlyTo }: CollectionParameter) => !applyOnlyTo || applyOnlyTo === type\n )\n },\n [collectionParameters]\n )\n\n const getCollectionParameters = useCallback(\n (index: number) => {\n return getCollectionParametersForType(getStream(index).type)\n },\n [getCollectionParametersForType, getStream]\n )\n\n const generateReportNameForType = useCallback(\n (type: string) => {\n const formValues = form.getFieldsValue()\n const collections = formValues?.collections ?? [{}]\n const blankName = type\n const reportNames =\n collections?.reduce((accumulator: string[], current: CollectionSource) => {\n if (current?.name?.includes(blankName)) {\n accumulator.push(current.name)\n }\n return accumulator\n }, []) || []\n return getUniqueAutoIncId(blankName, reportNames)\n },\n [form]\n )\n\n const addNewOfType = useCallback(\n (type: string, operation: FormListOperation) => {\n let newCollection = {\n name: generateReportNameForType(type),\n type: type,\n mode: collectionModes[type]?.length > 0 ? collectionModes[type]?.[0] : undefined,\n parameters: {},\n _id: randomId(),\n }\n for (const param of getCollectionParametersForType(type)) {\n if (param.defaultValue) {\n newCollection.parameters[param.id] = param.defaultValue\n }\n }\n operation.add(newCollection, 0)\n setActivePanel(activePanel.concat(newCollection._id))\n },\n [, sourceDataFromCatalog.collectionTemplates, activePanel, setActivePanel, collectionModes]\n )\n\n const remove = useCallback(\n (index: number, operation: FormListOperation) => {\n const stream = getStream(index)\n const keyToRemove = stream._id ?? stream.name\n operation.remove(index)\n setActivePanel(activePanel.filter(v => v !== keyToRemove))\n },\n [, activePanel, setActivePanel, getStream]\n )\n\n const handleApplyTemplate = useCallback(\n (chosenTemplate: number, operation: FormListOperation) => {\n if (chosenTemplate >= 0) {\n let newActivePanel = activePanel\n let template = sourceDataFromCatalog.collectionTemplates[chosenTemplate]\n for (const col of template.collections) {\n let copy = JSON.parse(JSON.stringify(col))\n if (copy.name) {\n copy.name = generateReportNameForType(copy.name)\n } else {\n copy.name = generateReportNameForType(copy.type)\n }\n copy._id = randomId()\n operation.add(copy, 0)\n newActivePanel = newActivePanel.concat(copy._id)\n }\n setActivePanel(newActivePanel)\n }\n },\n [sourceDataFromCatalog.collectionTemplates, activePanel, setActivePanel]\n )\n\n const handleTouchParameter = useCallback(\n (index: number, e: ChangeEvent) => {\n const formValues = form.getFieldsValue()\n const collections = formValues.collections\n const stream = collections[index]\n if (typeof stream._id === \"undefined\") {\n stream._id = input.current.state.value\n }\n form.setFieldsValue({ collections })\n },\n [form, , activePanel, setActivePanel, input]\n )\n\n /**\n * Pass form validator to the parent component\n */\n useEffect(() => {\n const validateConfigAndCountErrors = async (): Promise => {\n let errorsCount = 0\n try {\n await form.validateFields()\n } catch (error) {\n errorsCount = +error?.errorFields?.length\n }\n return errorsCount\n }\n\n setSourceEditorState(state => {\n const newState: SourceEditorState = { ...state, streams: { ...state.streams } }\n newState.streams.validateGetErrorsCount = validateConfigAndCountErrors\n return newState\n })\n }, [])\n\n return (\n \n \n {(fields: FormListFieldData[], operation: FormListOperation, meta) => (\n <>\n {isLoading ? (\n \n \n \n \n \n ) : error ? (\n \n \n \n \n \n ) : null}\n {!isLoading && (\n <>\n \n \n {!sourceEditorViewState.status.isLoadingStreams && collectionTypes.length <= 1 && (\n addNewOfType(collectionTypes[0] ?? \"default\", operation)}\n icon={}\n >\n Add new stream\n \n )}\n {!sourceEditorViewState.status.isLoadingStreams && collectionTypes.length > 1 && (\n \n {collectionTypes.length > 7 && (\n \n )}\n
\n {selectedCollectionTypes.map((type: string) => (\n
\n {\n addNewOfType(type, operation)\n setAddStreamVisible(false)\n }}\n >\n

{type}

\n
\n {\n addNewOfType(type, operation)\n setAddStreamVisible(false)\n }}\n >\n Add\n \n
\n ))}\n \n \n }\n trigger=\"click\"\n >\n \n \n )}\n {renderApplyTemplates && (\n <>\n \n {sourceDataFromCatalog.collectionTemplates.map((template: CollectionTemplate, index) => (\n
\n
\n

{template.templateName}

\n {template.description &&

{template.description}

}\n

\n Streams:{\" \"}\n \n {template.collections\n .map(s => <>{s.name ?? s.type})\n .reduce((prev, curr) => [prev, \", \", curr])}\n \n

\n
\n {\n handleApplyTemplate(index, operation)\n setAddTemplateVisible(false)\n }}\n >\n Apply\n \n
\n ))}\n \n }\n trigger=\"click\"\n >\n \n \n \n )}\n \n
\n setActivePanel(v as string[])}\n expandIcon={({ isActive }) => }\n >\n {fields.map((field: FormListFieldData) => {\n return (\n \n \n Name:  {getStream(field.name).name}\n \n \n Type:  {getStream(field.name).type}\n \n
\n Table Name:  \n \n {`${initialSourceData.sourceId}_${getStream(field.name).name ?? \"[Name]\"}`}\n \n
\n
\n {getFormErrors(field.name).length > 0 && (\n {getFormErrors(field.name).length} errors\n )}\n
\n \n }\n extra={\n {\n remove(field.name, operation)\n event.stopPropagation()\n }}\n />\n }\n >\n
\n <>\n \n \n Name:}\n name={[field.name, \"name\"]}\n rules={[\n {\n required: true,\n message: \"Field is required. You can remove this collection.\",\n },\n {\n validator: (rule: any, value: string) => {\n const formValues = form.getFieldsValue()\n const isError = formValues.collections\n .map((collection, index) => index !== field.name && collection.name)\n .includes(value)\n\n return isError\n ? Promise.reject(\"Name must be unique under the current collection\")\n : Promise.resolve()\n },\n },\n ]}\n labelCol={{ span: 6 }}\n wrapperCol={{ span: 18 }}\n >\n handleTouchParameter(field.name, e)}\n />\n \n \n \n {collectionModes[getStream(field.name).type]?.length > 0 ? (\n \n \n Sync Mode:}\n name={[field.name, \"mode\"]}\n rules={[\n {\n required: true,\n message: \"Field is required. You can remove this collection.\",\n },\n ]}\n labelCol={{ span: 6 }}\n wrapperCol={{ span: 18 }}\n >\n \n {collectionModes[getStream(field.name).type]?.map(m => (\n \n {m}\n \n ))}\n \n \n \n \n ) : (\n <>\n )}\n {getCollectionParameters(field.name).map((collection: CollectionParameter) => (\n \n ))}\n \n
\n \n )\n })}\n \n \n )}\n \n )}\n
\n \n )\n}\nSourceEditorFormStreamsConfigurable.displayName = \"SourceEditorFormStreamsConfigurable\"\n\nexport { SourceEditorFormStreamsConfigurable }\n\n/**\n * Helper function that passes the values to the parent\n */\n\nconst setSelectedStreams = (\n setSourceEditorState: SetSourceEditorState,\n sourceDataPath: string,\n streams: any,\n options?: {\n doNotSetStateChanged?: boolean\n }\n) => {\n setSourceEditorState(state => {\n const newState: SourceEditorState = {\n ...state,\n streams: { ...state.streams, selectedStreams: { ...state.streams.selectedStreams } },\n }\n newState.streams.selectedStreams[sourceDataPath] = streams\n newState.streams.errorsCount = 0\n if (!options?.doNotSetStateChanged) newState.stateChanged = true\n return newState\n })\n}\n","import { naturalComparatorBy } from \"utils/object\"\n\n/**\n *\n * Funtions to flatten Airbyte stream json schema\n *\n */\n\n/**\n * Field extracted from a JSON schema of a stream\n */\ntype SyncSchemaField = {\n cleanedName: string\n type: string\n key: string\n path: string[]\n fields?: SyncSchemaField[]\n}\n\nexport const getStreamFieldPaths = (stream: AirbyteStreamData): string[][] => {\n return flattenStreamFields(stream.stream).map(field => field.path)\n}\n\nconst flattenStreamFields = (stream: AirbyteStreamData[\"stream\"]): SyncSchemaField[] => {\n const fields = traverseSchemaToField(stream.json_schema, stream.name).sort(\n naturalComparatorBy(field => field.cleanedName)\n )\n return flattenFields(fields)\n}\n\nconst flattenFields = (fArr: SyncSchemaField[], arr: SyncSchemaField[] = []): SyncSchemaField[] =>\n fArr.reduce((acc, f) => {\n acc.push(f)\n\n if (f.fields?.length) {\n return flattenFields(f.fields, acc)\n }\n return acc\n }, arr)\n\nconst traverseSchemaToField = (jsonSchema: any, key: string): SyncSchemaField[] => {\n // For the top level we should not insert an extra object\n return traverseJsonSchemaProperties(jsonSchema, key)[0].fields ?? []\n}\n\nconst traverseJsonSchemaProperties = (jsonSchema: any, key: string, path: string[] = []): SyncSchemaField[] => {\n if (typeof jsonSchema === \"boolean\") {\n return []\n }\n\n let fields: SyncSchemaField[] | undefined\n if (jsonSchema.properties) {\n fields = Object.entries(jsonSchema.properties)\n .flatMap(([k, schema]) => traverseJsonSchemaProperties(schema, k, [...path, k]))\n .flat(2)\n }\n\n return [\n {\n cleanedName: key,\n path,\n key,\n fields,\n type:\n (Array.isArray(jsonSchema.type)\n ? jsonSchema.type.find(t => t !== \"null\") ?? jsonSchema.type[0]\n : jsonSchema.type) ?? \"null\",\n },\n ]\n}\n","// @Libs\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { Collapse, Empty, Input, Select, Switch } from \"antd\"\nimport { cloneDeep } from \"lodash\"\n// @Components\nimport { Code } from \"lib/components/Code/Code\"\n// @Icons\nimport { CaretRightOutlined } from \"@ant-design/icons\"\n// @Types\nimport { SetSourceEditorState } from \"./SourceEditor\"\n// @Utils\nimport { isArray } from \"utils/typeCheck\"\nimport { addToArrayIfNotDuplicate, removeFromArrayIfFound, substituteArrayValueIfFound } from \"utils/arrays\"\n// @Styles\nimport styles from \"./SourceEditorFormStreamsLoadableForm.module.less\"\nimport { sourceEditorUtils } from \"./SourceEditor.utils\"\nimport { getStreamFieldPaths } from \"ui/pages/SourcesPage/utils/airbyte\"\n\ntype Props = {\n allStreams: StreamData[]\n disabled?: boolean\n initiallySelectedStreams: Array | null\n selectAllFieldsByDefault?: boolean\n hide?: boolean\n setSourceEditorState: SetSourceEditorState\n}\n\nconst SELECTED_STREAMS_SOURCE_DATA_PATH = \"config.selected_streams\"\n\nconst SourceEditorFormStreamsLoadableForm = ({\n allStreams,\n initiallySelectedStreams,\n selectAllFieldsByDefault,\n hide,\n disabled,\n setSourceEditorState,\n}: Props) => {\n const disableAllAnimations: boolean = allStreams.length > 30\n const disableToggelAllAnimations: boolean = allStreams.length > 10\n\n const [streamsToDisplay, setStreamsToDisplay] = useState(allStreams)\n\n const [allChecked, setAllChecked] = useState(selectAllFieldsByDefault || undefined)\n\n const handleAddStream = (stream: StreamData) => {\n addStream(setSourceEditorState, SELECTED_STREAMS_SOURCE_DATA_PATH, stream)\n }\n\n const handleRemoveStream = (stream: StreamData) => {\n removeStream(setSourceEditorState, SELECTED_STREAMS_SOURCE_DATA_PATH, stream)\n }\n\n const handleSetSelectedStreams = (\n selectedStreams: Array,\n options?: {\n doNotSetStateChanged?: boolean\n }\n ) => {\n setSelectedStreams(setSourceEditorState, SELECTED_STREAMS_SOURCE_DATA_PATH, selectedStreams, options)\n }\n\n const handleToggleStream = useCallback((checked: boolean, stream: StreamData): void => {\n checked ? handleAddStream(stream) : handleRemoveStream(stream)\n }, [])\n\n const handleToggleAllStreams = async (checked: boolean) => {\n requestAnimationFrame(() => {\n setAllChecked(checked)\n checked\n ? handleSetSelectedStreams(allStreams.map(sourceEditorUtils.mapStreamDataToSelectedStreams))\n : handleSetSelectedStreams([])\n })\n }\n\n const handleSearch = (query: string) => {\n setStreamsToDisplay(streams =>\n streams.filter(streamData => sourceEditorUtils.getStreamUid(streamData).includes(query))\n )\n }\n\n const handleSearchValueClear = (event: React.ChangeEvent) => {\n if (event.target.value === \"\") setTimeout(() => setStreamsToDisplay(allStreams), 0)\n }\n\n useEffect(() => {\n handleSetSelectedStreams(initiallySelectedStreams, { doNotSetStateChanged: true })\n }, [])\n\n return (\n \n
\n \n {}}\n onAnimationIterationCapture={() => {}}\n >\n \n \n
\n \n
\n {streamsToDisplay?.length ? (\n \n ) : (\n \n )}\n
\n \n )\n}\nSourceEditorFormStreamsLoadableForm.displayName = \"SourceEditorFormStreamsLoadableForm\"\n\nexport { SourceEditorFormStreamsLoadableForm }\n\n// @Components\n\ntype StreamsCollapsibleListProps = {\n streamsToDisplay: StreamData[]\n disabled?: boolean\n initiallySelectedStreams: StreamConfig[]\n isAllStreamsChecked?: boolean\n setSourceEditorState: SetSourceEditorState\n handleToggleStream: (checked: boolean, stream: StreamData) => void\n}\n\nconst StreamsCollapsibleList: React.FC = React.memo(\n ({\n streamsToDisplay,\n initiallySelectedStreams,\n isAllStreamsChecked,\n handleToggleStream,\n setSourceEditorState,\n disabled,\n }) => {\n return (\n }\n >\n {streamsToDisplay\n /* moves initially selected streams to the top of the list */\n .sort((a, b) => {\n const [aUid, bUid] = [a, b].map(sourceEditorUtils.getStreamUid)\n const [aIsInitiallySelected, bIsInitiallySelected] = [aUid, bUid].map(uid =>\n initiallySelectedStreams.some(selected => sourceEditorUtils.getSelectedStreamUid(selected) === uid)\n )\n return Number(bIsInitiallySelected) - Number(aIsInitiallySelected)\n })\n .map(streamData => {\n const streamUid = sourceEditorUtils.getStreamUid(streamData)\n return (\n \n )\n })}\n \n )\n }\n)\n\ntype StreamPanelProps = {\n streamUid: string\n streamData: StreamData\n initiallySelectedStreams: StreamConfig[]\n forceChecked?: boolean\n handleToggleStream: (checked: boolean, stream: StreamData) => void\n setSourceEditorState: SetSourceEditorState\n} & { [key: string]: any }\n\nconst StreamPanel: React.FC = ({\n streamUid,\n streamData: initialStreamData,\n initiallySelectedStreams,\n forceChecked,\n handleToggleStream,\n setSourceEditorState,\n children,\n ...rest\n}) => {\n const [checked, setChecked] = useState(\n forceChecked ||\n initiallySelectedStreams.some(selected => sourceEditorUtils.getSelectedStreamUid(selected) === streamUid)\n )\n\n const [streamData, setStreamData] = useState(initialStreamData)\n\n const toggle = (checked: boolean, event: React.MouseEvent) => {\n event.stopPropagation() // hack to prevent collapse triggers\n setChecked(checked)\n handleToggleStream(checked, streamData)\n }\n\n /**\n * Creates source type specific methods and components\n */\n const { header, content } = useMemo<{ header: JSX.Element; content: JSX.Element }>(() => {\n if (sourceEditorUtils.isAirbyteStream(streamData)) {\n const handleChangeStreamConfig = (stream: AirbyteStreamData): void => {\n setStreamData(stream)\n updateStream(setSourceEditorState, SELECTED_STREAMS_SOURCE_DATA_PATH, { ...stream })\n }\n return {\n header: (\n \n ),\n content: (\n \n ),\n }\n } else if (sourceEditorUtils.isSingerStream(streamData)) {\n return {\n header: ,\n content: ,\n }\n }\n }, [streamData, checked])\n\n /** Used to force check all streams by the parent component */\n useEffect(() => {\n if (forceChecked !== undefined) setChecked(forceChecked)\n }, [forceChecked])\n\n return (\n }\n >\n {content}\n \n )\n}\n\ntype AirbyteStreamHeaderProps = {\n streamName: string\n streamNamespace: string\n}\n\nconst AirbyteStreamHeader: React.FC = ({ streamName, streamNamespace }) => {\n return (\n
\n
\n {streamNamespace && Name:  }\n {streamName}\n
\n {streamNamespace && (\n
\n Namespace:  \n {streamNamespace}\n
\n )}\n
\n )\n}\n\ntype AirbyteStreamParametersProps = {\n streamData: AirbyteStreamData\n checked?: boolean\n handleChangeStreamConfig: (stream: AirbyteStreamData) => void\n}\n\nconst AirbyteStreamParameters: React.FC = ({\n streamData,\n checked,\n handleChangeStreamConfig,\n}) => {\n const cursorFieldPathDelimiter = \" -> \"\n const initialSyncMode = streamData.sync_mode ?? streamData.stream.supported_sync_modes?.[0]\n const needToDisplayData: boolean = !!initialSyncMode && !!streamData.stream.json_schema?.properties\n const [config, setConfig] = useState>({\n sync_mode: initialSyncMode,\n cursor_field: streamData.stream.source_defined_cursor\n ? streamData.stream.default_cursor_field\n : streamData.cursor_field ?? getAirbyteStreamCursorFields(streamData)[0],\n })\n\n const handleChangeSyncMode = (value: string): void => {\n setConfig(config => {\n let newConfig = config\n if (value === \"full_refresh\") newConfig = { ...config, sync_mode: value }\n if (value === \"incremental\")\n newConfig = {\n sync_mode: value,\n cursor_field: config.cursor_field,\n }\n handleChangeStreamConfig({ ...streamData, ...newConfig })\n return newConfig\n })\n }\n\n const handleChangeCursorField = (value: string): void => {\n setConfig(config => {\n const newConfig = { ...config, cursor_field: value.split(cursorFieldPathDelimiter) }\n handleChangeStreamConfig({ ...streamData, ...newConfig })\n return newConfig\n })\n }\n\n return (\n needToDisplayData && (\n
\n {/* Sync mode */}\n {streamData.stream.supported_sync_modes?.length ? (\n \n \n {streamData.stream.supported_sync_modes.map(mode => (\n \n {mode}\n \n ))}\n \n \n ) : initialSyncMode ? (\n {initialSyncMode}\n ) : null}\n\n {/* Cursor field */}\n {config.sync_mode === \"incremental\" && (\n \n \n {getAirbyteStreamCursorFields(streamData).map(cursor => {\n const stringifiedCursor = cursor.join(cursorFieldPathDelimiter)\n return (\n \n {stringifiedCursor}\n \n )\n })}\n \n \n )}\n\n {/* JSON Schema */}\n {streamData.stream.json_schema.properties && (\n \n
\n \n {JSON.stringify(streamData.stream.json_schema.properties ?? {}, null, 2)}\n \n
\n
\n )}\n
\n )\n )\n}\n\ntype SingerStreamHeaderProps = {\n streamUid: string\n streamName: string\n}\n\nconst SingerStreamHeader: React.FC = ({ streamUid, streamName }) => {\n return (\n
\n
\n {streamName}\n
\n
\n )\n}\n\ntype SingerStreamParametersProps = {\n streamData: SingerStreamData\n}\n\nconst SingerStreamParameters: React.FC = ({ streamData }) => {\n return (\n
\n {/* {streamDestinationSyncMode} */}\n\n {streamData.schema && (\n \n
\n \n {JSON.stringify(streamData.schema ?? {}, null, 2)}\n \n
\n
\n )}\n
\n )\n}\n\ntype StreamParameterProps = {\n title: string\n}\n\nconst StreamParameter: React.FC = ({ title, children }) => {\n return (\n
\n \n {\":\"}\n {children}\n
\n )\n}\n\n// @Streams Utils (temporary)\n\nexport const addStream = (setSourceEditorState: SetSourceEditorState, sourceDataPath: string, stream: StreamData) => {\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n const oldStreams = newState.streams.selectedStreams[sourceDataPath]\n const streamConfig = sourceEditorUtils.mapStreamDataToSelectedStreams(stream)\n\n let newStreams = oldStreams\n if (isArray(oldStreams)) {\n newStreams = addToArrayIfNotDuplicate(oldStreams, streamConfig, sourceEditorUtils.streamsAreEqual)\n }\n\n newState.streams.selectedStreams[sourceDataPath] = newStreams\n newState.stateChanged = true\n\n return newState\n })\n}\n\nexport const removeStream = (\n setSourceEditorState: SetSourceEditorState,\n sourceDataPath: string,\n stream: StreamData\n) => {\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n const oldStreams = newState.streams.selectedStreams[sourceDataPath]\n const streamConfig = sourceEditorUtils.mapStreamDataToSelectedStreams(stream)\n\n let newStreams = oldStreams\n if (isArray(oldStreams)) {\n newStreams = removeFromArrayIfFound(oldStreams, streamConfig, sourceEditorUtils.streamsAreEqual)\n }\n\n delete newStreams[sourceEditorUtils.getStreamUid(stream)]\n\n newState.streams.selectedStreams[sourceDataPath] = newStreams\n newState.stateChanged = true\n\n return newState\n })\n}\n\nexport const updateStream = (\n setSourceEditorState: SetSourceEditorState,\n sourceDataPath: string,\n stream: StreamData\n) => {\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n const oldStreams = newState.streams.selectedStreams[sourceDataPath]\n\n const streamConfig = sourceEditorUtils.mapStreamDataToSelectedStreams(stream)\n\n let newStreams = oldStreams\n if (isArray(oldStreams)) {\n newStreams = substituteArrayValueIfFound(oldStreams, streamConfig, sourceEditorUtils.streamsAreEqual)\n }\n\n newState.streams.selectedStreams[sourceDataPath] = newStreams\n newState.stateChanged = true\n\n return newState\n })\n}\n\nexport const setSelectedStreams = (\n setSourceEditorState: SetSourceEditorState,\n sourceDataPath: string,\n selectedStreams: Array,\n options?: {\n doNotSetStateChanged?: boolean\n }\n) => {\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n newState.streams.selectedStreams[sourceDataPath] = selectedStreams\n if (!options?.doNotSetStateChanged) newState.stateChanged = true\n return newState\n })\n}\n\nconst getAirbyteStreamCursorFields = (stream: AirbyteStreamData): string[][] => {\n return getStreamFieldPaths(stream)\n}\n","// @Libs\nimport { useEffect, useMemo } from \"react\"\nimport { Col, Row } from \"antd\"\nimport { cloneDeep, uniqueId } from \"lodash\"\n// @Components\nimport { ErrorCard } from \"lib/components/ErrorCard/ErrorCard\"\nimport { SourceEditorFormStreamsLoadableForm } from \"./SourceEditorFormStreamsLoadableForm\"\nimport { LoadableFieldsLoadingMessageCard } from \"lib/components/LoadingFormCard/LoadingFormCard\"\n// @Hooks\nimport { usePolling } from \"hooks/usePolling\"\n// @Types\nimport { SourceConnector } from \"@jitsu/catalog\"\nimport { SetSourceEditorState } from \"./SourceEditor\"\n// @Utils\nimport {\n PARSING_STREAMS_ERROR_NAME,\n pullAllAirbyteStreams,\n pullAllSingerStreams,\n PullAllStreams,\n} from \"./SourceEditorPullData\"\nimport { sourceEditorUtils } from \"./SourceEditor.utils\"\nimport { SourceEditorActionsTypes, useSourceEditorDispatcher } from \"./SourceEditor.state\"\n\ntype Props = {\n editorMode: \"add\" | \"edit\"\n disabled?: boolean\n initialSourceData: Optional>\n sourceDataFromCatalog: SourceConnector\n setSourceEditorState: SetSourceEditorState\n handleBringSourceData: () => SourceData\n}\n\nexport const SourceEditorFormStreamsLoadable: React.FC = ({\n editorMode,\n disabled,\n initialSourceData,\n sourceDataFromCatalog,\n setSourceEditorState,\n handleBringSourceData,\n}) => {\n const dispatch = useSourceEditorDispatcher()\n\n const previouslySelectedStreams = useMemo>(\n () => initialSourceData?.config?.selected_streams ?? [],\n [initialSourceData]\n )\n\n const pullAllStreams = useMemo(() => {\n switch (sourceDataFromCatalog.protoType) {\n case \"airbyte\":\n return pullAllAirbyteStreams\n case \"singer\":\n return pullAllSingerStreams\n default:\n throw new Error(\n `Can not display streams list. Expected source of type 'airbyte' or 'singer' but received '${sourceDataFromCatalog.protoType}'`\n )\n }\n }, [])\n\n const {\n isLoading,\n data,\n error,\n reload: reloadStreamsList,\n } = usePolling(\n {\n configure: () => ({\n pollingCallback: (end, fail) => async () => {\n try {\n const result = await pullAllStreams(sourceDataFromCatalog, handleBringSourceData)\n if (result !== undefined) end(result)\n } catch (error) {\n fail(error)\n }\n },\n onBeforePollingStart: () => {\n dispatch(SourceEditorActionsTypes.SET_STATUS, { isLoadingStreams: true })\n },\n onAfterPollingEnd: () => {\n dispatch(SourceEditorActionsTypes.SET_STATUS, { isLoadingStreams: false })\n },\n }),\n },\n { timeout_ms: 30 * 60 * 1000 }\n )\n\n const selectAllFieldsByDefault: boolean = editorMode === \"add\"\n\n const [initiallySelectedStreams, unavailableStreams] = useMemo<[StreamConfig[], StreamConfig[]]>(() => {\n const allStreamsConfigs = data?.map(sourceEditorUtils.mapStreamDataToSelectedStreams) ?? []\n if (selectAllFieldsByDefault) return [allStreamsConfigs, []]\n if (allStreamsConfigs.length === 0) {\n return [previouslySelectedStreams, []]\n } else {\n const unavailableStreams: StreamConfig[] = []\n const previouslySelectedWithoutUnavailable = previouslySelectedStreams.filter(previouslySelectedStream => {\n const streamIsAvailable = allStreamsConfigs.some(streamConfig =>\n sourceEditorUtils.streamsAreEqual(streamConfig, previouslySelectedStream)\n )\n if (!streamIsAvailable) unavailableStreams.push(previouslySelectedStream)\n return streamIsAvailable\n })\n return [previouslySelectedWithoutUnavailable, unavailableStreams]\n }\n }, [selectAllFieldsByDefault, previouslySelectedStreams, data])\n\n /** Set global errors counter */\n useEffect(() => {\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n newState.streams.errorsCount = error ? 1 : 0\n return newState\n })\n }, [error])\n\n useEffect(() => {\n const forceReloadStreamsList = reloadStreamsList\n setSourceEditorState(state => {\n const newState = { ...state, streams: { ...state.streams, forceReloadStreamsList } }\n return newState\n })\n }, [])\n\n return (\n <>\n {data && !error && !isLoading && (\n <>\n {!!unavailableStreams.length && }\n \n \n )}\n {isLoading ? (\n \n \n \n \n \n ) : error ? (\n \n \n \n \n \n ) : !data ? (\n \n \n \n \n \n ) : null}\n \n )\n}\n\nconst StreamsUnavailableWarning: React.FC<{ unavailableStreams: StreamConfig[] }> = ({ unavailableStreams }) => {\n return (\n
\n {`Due to changes in the source configuration, some of the previously selected streams are no longer available.\\nPlease, review your streams selection before saving the source`}\n
\n {`The list of unavalilable streams:`}\n {unavailableStreams.map(({ name, namespace }) => (\n \n {`• name: `}\n {name}\n {namespace ? (\n <>\n {`, namespace: `}\n {namespace}\n \n ) : (\n \"\"\n )}\n \n ))}\n
\n
\n )\n}\n","// @Libs\n\n// @Components\nimport { SourceEditorFormStreamsConfigurable } from \"./SourceEditorFormStreamsConfigurable\"\nimport { SourceEditorFormStreamsLoadable } from \"./SourceEditorFormStreamsLoadable\"\n// @Types\nimport { SourceConnector } from \"@jitsu/catalog\"\nimport { SetSourceEditorState } from \"./SourceEditor\"\n\ntype Props = {\n editorMode: \"add\" | \"edit\"\n disabled?: boolean\n initialSourceData: Optional>\n sourceDataFromCatalog: SourceConnector\n setSourceEditorState: SetSourceEditorState\n handleBringSourceData: () => SourceData\n}\n\nexport const SourceEditorFormStreams: React.FC = ({\n editorMode,\n disabled,\n initialSourceData,\n sourceDataFromCatalog,\n setSourceEditorState,\n handleBringSourceData,\n}) => {\n const typedStreams: boolean =\n !sourceDataFromCatalog.protoType ||\n sourceDataFromCatalog.protoType == \"sdk_source\" ||\n sourceDataFromCatalog.protoType == \"native\"\n return typedStreams ? (\n \n ) : (\n \n )\n}\n","// @Libs\nimport { useCallback, useState } from \"react\"\nimport { Switch } from \"antd\"\nimport useProject from \"../../../../../../hooks/useProject\"\nimport { allPermissions } from \"../../../../../../lib/services/permissions\"\nimport { ProjectPermission } from \"../../../../../../generated/conf-openapi\"\n\ntype Props = {\n itemsList: ConnectedItem[]\n initialValues?: string[]\n handleItemChange?: (selectedItems: string[]) => void\n}\n\nexport interface ConnectedItem {\n id: string\n disabled?: boolean\n title: React.ReactNode\n description?: React.ReactNode\n}\n\nexport const SourceEditorFormConnectionsView: React.FC = ({ itemsList, initialValues, handleItemChange }) => {\n const [selectedItems, setSelectedItems] = useState(initialValues ?? [])\n const project = useProject()\n const disableEdit = !(project.permissions || allPermissions).includes(ProjectPermission.MODIFY_CONFIG)\n\n const handleChange = useCallback(\n (id: string) => (checked: boolean) => {\n const newItemsIds = [...selectedItems]\n\n if (checked) {\n newItemsIds.push(id)\n } else {\n const index = newItemsIds.findIndex(i => i === id)\n newItemsIds.splice(index, 1)\n }\n\n setSelectedItems(newItemsIds)\n handleItemChange(newItemsIds)\n },\n [selectedItems, handleItemChange]\n )\n\n return (\n <>\n {itemsList?.length > 0 && (\n
    \n {itemsList.sort().map(({ id, title, description, disabled }: ConnectedItem) => (\n
    \n
    \n \n
    \n
    \n
    {title}
    \n
    \n {description}\n
    \n
    \n
    \n ))}\n
\n )}\n \n )\n}\n","// @Libs\nimport { useCallback, useEffect, useMemo } from \"react\"\nimport { observer } from \"mobx-react-lite\"\n// @Store\nimport { destinationsStore } from \"stores/destinations\"\n// @Catalog\nimport { destinationsReferenceMap } from \"@jitsu/catalog\"\n// @Components\nimport { SourceEditorFormConnectionsView } from \"./SourceEditorFormConnectionsView\"\n// @Types\nimport { Destination } from \"@jitsu/catalog\"\nimport { SetSourceEditorState } from \"./SourceEditor\"\n// @Utils\nimport { cloneDeep } from \"lodash\"\n\ntype Props = {\n initialSourceData: Optional>\n setSourceEditorState: SetSourceEditorState\n}\n\nexport interface ConnectedItem {\n id: string\n disabled?: boolean\n title: React.ReactNode\n description?: React.ReactNode\n}\n\nconst CONNECTIONS_SOURCEDATA_PATH = \"destinations\"\n\nconst SourceEditorFormConnectionsComponent: React.FC = ({ initialSourceData, setSourceEditorState }) => {\n const destinations = destinationsStore.list\n\n const destinationsList = useMemo(\n () =>\n destinations?.map((dst: DestinationData) => {\n const reference = destinationsReferenceMap[dst._type]\n return {\n id: dst._uid,\n disabled: reference?.syncFromSourcesStatus !== \"supported\",\n title: (\n \n {reference?.displayName}: {dst.displayName || dst._id}\n \n ),\n description: {getDescription(reference)},\n }\n }) ?? [],\n [destinations]\n )\n\n const preparedInitialValue = useMemo(() => initialSourceData?.destinations ?? [], [initialSourceData])\n\n const handleChange = useCallback(\n (connections: string[]) => {\n setConnections(setSourceEditorState, CONNECTIONS_SOURCEDATA_PATH, connections)\n },\n [setConnections]\n )\n\n useEffect(() => {\n setConnections(setSourceEditorState, CONNECTIONS_SOURCEDATA_PATH, preparedInitialValue, {\n doNotSetStateChanged: true,\n })\n }, [])\n\n return (\n \n )\n}\n\nconst SourceEditorFormConnections = observer(SourceEditorFormConnectionsComponent)\n\nSourceEditorFormConnections.displayName = \"SourceEditorFormConnections\"\n\nexport { SourceEditorFormConnections }\n\n/** */\n\n/**\n * Helpers\n */\n\n/** */\n\nconst setConnections = (\n setSourceEditorState: SetSourceEditorState,\n sourceDataPath: string,\n connectionsIds: string[],\n options?: {\n doNotSetStateChanged?: boolean\n }\n): void => {\n setSourceEditorState(state => {\n const newState = cloneDeep(state)\n newState.connections.connections[sourceDataPath] = connectionsIds\n if (!options?.doNotSetStateChanged) newState.stateChanged = true\n return newState\n })\n}\n\nfunction getDescription(reference: Destination) {\n if (reference?.syncFromSourcesStatus === \"supported\") {\n return null\n } else if (reference?.syncFromSourcesStatus === \"coming_soon\") {\n return `${reference?.displayName} synchronization is coming soon! At the moment, it's not available`\n } else {\n return `${reference?.displayName} synchronization is not supported`\n }\n}\n\nconst NameWithPicture: React.FC<{\n icon: React.ReactNode\n children: React.ReactNode\n}> = ({ icon, children }) => {\n return (\n \n \n {icon}\n \n {children}\n \n )\n}\n","// @Components\nimport { Collapse, Drawer } from \"antd\"\n// @Types\nimport { SourceConnector } from \"@jitsu/catalog\"\n// @Styles\nimport styles from \"./SourceEditorDocumentationDrawer.module.less\"\n\ntype Props = {\n sourceDataFromCatalog: SourceConnector\n visible: boolean\n setVisible: (value: boolean) => void\n}\n\nexport const SourceEditorDocumentationDrawer: React.FC = ({ sourceDataFromCatalog, visible, setVisible }) => {\n return (\n {sourceDataFromCatalog.displayName} documentation}\n placement=\"right\"\n closable={true}\n onClose={() => setVisible(false)}\n width=\"70%\"\n visible={visible}\n >\n
\n \n {sourceDataFromCatalog.displayName} overview
}\n key=\"overview\"\n >\n {sourceDataFromCatalog.documentation.overview}\n \n How to connect} key=\"connection\">\n {sourceDataFromCatalog.documentation.connection}\n \n \n \n \n )\n}\n","// @Libs\nimport { Button, Tooltip } from \"antd\"\n// @Icons\nimport { useMemo, useState } from \"react\"\nimport { useSourceEditorState } from \"./SourceEditor.state\"\n\ninterface ButtonProps {\n title?: string\n hide?: boolean\n loading?: boolean\n handleClick: UnknownFunction | AsyncUnknownFunction\n}\n\n/**\n * Enables granular control of which buttons are disabled.\n * If string is passed, the disabled button will show a tooltip.\n */\ntype ControlsDisabled = {\n mainButton?: boolean | string\n secondaryButton?: boolean | string\n dashedButton?: boolean | string\n dangerButton?: boolean | string\n}\n\nexport interface Props {\n mainButton?: ButtonProps\n secondaryButton?: ButtonProps\n dashedButton?: ButtonProps\n dangerButton?: ButtonProps\n}\n\nconst SourceEditorViewControls: React.FC = ({ mainButton, secondaryButton, dashedButton, dangerButton }) => {\n const sourceEditorViewState = useSourceEditorState()\n\n /** @see {@link ControlsDisabled} type description */\n const controlsDisabled = useMemo(() => {\n const result: ControlsDisabled = {\n mainButton: false,\n secondaryButton: false,\n dashedButton: false,\n dangerButton: false,\n }\n if (sourceEditorViewState.status.isLoadingOauthStatus) {\n result.mainButton = result.secondaryButton = result.dashedButton = true\n }\n if (sourceEditorViewState.status.isTestingConnection) {\n result.mainButton = result.secondaryButton = result.dashedButton = \"Validating source configuration\"\n }\n if (!sourceEditorViewState.status.isOauthFlowCompleted) {\n result.mainButton =\n result.secondaryButton =\n result.dashedButton =\n \"Please, either grant Jitsu access or fill auth credentials manually\"\n }\n if (sourceEditorViewState.status.isLoadingConfig) {\n result.mainButton = result.secondaryButton = result.dashedButton = \"Loading source configuration\"\n }\n if (sourceEditorViewState.status.isLoadingStreams) {\n result.mainButton = result.secondaryButton = result.dashedButton = \"Loading the list of streams\"\n }\n return result\n }, [sourceEditorViewState.status])\n\n return (\n <>\n {mainButton && (\n \n \n {mainButton.title ?? \"Save\"}\n \n \n )}\n\n {secondaryButton && !secondaryButton.hide && (\n \n \n Back\n \n \n )}\n\n {dashedButton && !dashedButton.hide && (\n \n \n {dashedButton.title}\n \n \n )}\n\n {dangerButton && (\n \n \n Cancel\n \n \n )}\n \n )\n}\n\nSourceEditorViewControls.displayName = \"SourceEditorViewControls\"\n\nexport { SourceEditorViewControls }\n","import cn from \"classnames\"\nimport { useState } from \"react\"\nimport { Steps } from \"antd\"\nimport { SourceEditorViewControls } from \"./SourceEditorViewControls\"\nimport { LoadingOutlined } from \"@ant-design/icons\"\nimport { actionNotification } from \"ui/components/ActionNotification/ActionNotification\"\nimport { SetSourceEditorInitialSourceData } from \"./SourceEditor\"\n\ntype Step = {\n key: string\n title: string\n description: string\n render: React.ReactNode\n proceedButtonTitle?: string\n proceedAction?: AsyncUnknownFunction\n}\n\ntype SourceEditorTabsViewProps = {\n steps: Step[]\n handleBringSourceData: () => SourceData\n setInitialSourceData: SetSourceEditorInitialSourceData\n handleLeaveEditor: VoidFunction\n}\n\nexport const SourceEditorViewSteps: React.FC = ({\n steps,\n handleBringSourceData,\n setInitialSourceData,\n handleLeaveEditor,\n}) => {\n const [currentStep, setCurrentStep] = useState(0)\n const [currentStepIsLoading, setCurrentStepIsLoading] = useState(false)\n\n const proceedButtonTitle = steps[currentStep].proceedButtonTitle ?? \"Next\"\n\n const handleCompleteStep = () => {\n setInitialSourceData(handleBringSourceData())\n }\n\n const handleGoToNextStep: AsyncUnknownFunction = async () => {\n handleCompleteStep()\n setCurrentStepIsLoading(true)\n try {\n await steps[currentStep].proceedAction?.()\n setCurrentStep(step => step + 1)\n } catch (error) {\n actionNotification.error(`${error}`)\n } finally {\n setCurrentStepIsLoading(false)\n }\n }\n\n const handleStepBack: AsyncUnknownFunction = async () => {\n handleCompleteStep()\n setCurrentStep(step => step - 1)\n }\n\n return (\n <>\n
\n
\n \n {steps.map(({ key, title, description }, idx) => (\n : undefined}\n />\n ))}\n \n
\n\n
\n
{steps[currentStep]?.render}
\n
\n\n
\n \n
\n
\n \n )\n}\n","import cn from \"classnames\"\nimport React, { useCallback, useMemo, useState } from \"react\"\nimport { Tabs } from \"antd\"\nimport { SourceEditorViewControls } from \"./SourceEditorViewControls\"\nimport styles from \"./SourceEditor.module.less\"\nimport { NavLink } from \"react-router-dom\"\nimport { SourceConnector } from \"@jitsu/catalog\"\nimport { actionNotification } from \"ui/components/ActionNotification/ActionNotification\"\nimport { TabName } from \"ui/components/Tabs/TabName\"\nimport { HandleSaveSource, HandleValidateTestConnection } from \"./SourceEditor\"\nimport { ErrorDetailed } from \"lib/commons/errors\"\nimport { uniqueId } from \"lodash\"\nimport { projectRoute } from \"../../../../../../lib/components/ProjectLink/ProjectLink\"\nimport { sourcesPageRoutes } from \"ui/pages/SourcesPage/SourcesPage.routes\"\nimport { useSourceEditorState } from \"./SourceEditor.state\"\nimport useProject from \"../../../../../../hooks/useProject\"\nimport { allPermissions } from \"../../../../../../lib/services/permissions\"\nimport { ProjectPermission } from \"../../../../../../generated/conf-openapi\"\n\ntype Tab = {\n key: string\n title: string\n description: string\n errorsCount?: number\n render: React.ReactNode\n proceedButtonTitle?: string\n proceedAction?: AsyncUnknownFunction\n}\n\ntype SourceEditorViewTabsProps = {\n sourceId: string\n tabs: Tab[]\n sourceDataFromCatalog: SourceConnector\n handleSave: HandleSaveSource\n handleValidateAndTestConnection: HandleValidateTestConnection\n handleLeaveEditor: VoidFunction\n setShowDocumentationDrawer: (value: boolean) => void\n}\n\nconst disabledTabsKeys = new Set()\n\nexport const SourceEditorViewTabs: React.FC = ({\n sourceId,\n tabs,\n sourceDataFromCatalog,\n handleSave: _handleSave,\n handleValidateAndTestConnection,\n handleLeaveEditor,\n setShowDocumentationDrawer,\n}) => {\n const sourceEditorViewState = useSourceEditorState()\n const project = useProject()\n const disableEdit = !(project.permissions || allPermissions).includes(ProjectPermission.MODIFY_CONFIG)\n\n const [currentTab, setCurrentTab] = useState(\"configuration\")\n const [isSaving, setIsSaving] = useState(false)\n const [isTestingConnection, setIsTestingConnection] = useState(false)\n\n const [streamsTabKey, setStreamsTabKey] = useState(\"streams\")\n\n const disabledTabs = useMemo>(() => {\n const { isLoadingConfig, isLoadingOauthStatus, isOauthFlowCompleted } = sourceEditorViewState.status\n\n /** Streams tab handling */\n isLoadingConfig || isLoadingOauthStatus || !isOauthFlowCompleted\n ? disabledTabsKeys.add(streamsTabKey)\n : disabledTabsKeys.delete(streamsTabKey)\n\n return disabledTabsKeys\n }, [sourceEditorViewState.status, streamsTabKey])\n\n const handleTabChange = useCallback((_key: string) => {\n // Commented Out: This code reseted all unsaved user changes on tab switch\n // let key = _key\n // // reset streams tab key to re-mount the component to reload the list of streams\n // if (key.includes(\"streams\")) {\n // key = uniqueId(\"streams-\")\n // setStreamsTabKey(key)\n // }\n setCurrentTab(_key)\n }, [])\n\n const handleSave = useCallback(async () => {\n setIsSaving(true)\n try {\n await _handleSave()\n } catch (error) {\n handleConnectOrSaveError(error)\n } finally {\n setIsSaving(false)\n }\n }, [_handleSave])\n\n const handleTestConnection = useCallback(async () => {\n setIsTestingConnection(true)\n try {\n await handleValidateAndTestConnection()\n actionNotification.success(\"Successfully connected\")\n } catch (error) {\n handleConnectOrSaveError(error)\n } finally {\n setIsTestingConnection(false)\n }\n }, [handleValidateAndTestConnection])\n\n const handleConnectOrSaveError = (error: unknown) => {\n if (!(error instanceof ErrorDetailed)) {\n actionNotification.error(`${error}`)\n return\n }\n\n switch (error.name) {\n case \"streams_changed\": {\n actionNotification.warn(\n `Some of the previously selected streams are not available. Please, review your streams selection before saving.`\n )\n switchToStreamsTab()\n return\n }\n default: {\n actionNotification.error(error.message)\n return\n }\n }\n }\n\n const switchToStreamsTab = () => {\n setCurrentTab(streamsTabKey)\n }\n\n return (\n
\n \n }\n onChange={handleTabChange}\n >\n {tabs.map((tab: Tab) => {\n const tabKey = tab.key === \"streams\" ? streamsTabKey : tab.key\n return (\n }\n disabled={disabledTabs.has(tabKey)}\n >\n {tab.render}\n \n )\n })}\n \n\n
\n \n
\n
\n )\n}\n\nconst TabsExtra: React.FC<{\n sourceId: string\n sourceDataFromCatalog: SourceConnector\n setShowDocumentationDrawer: (value: boolean) => void\n}> = ({ sourceId, sourceDataFromCatalog, setShowDocumentationDrawer }) => {\n return (\n \n \n View Logs\n \n\n {sourceDataFromCatalog?.documentation && (\n <>\n {\" \"}\n {\" \"}\n setShowDocumentationDrawer(true)}>Documentation\n \n )}\n \n )\n}\n","import { Prompt } from \"react-router\"\n// @Components\nimport { SourceEditorFormConfiguration } from \"./SourceEditorFormConfiguration\"\nimport { SourceEditorFormStreams } from \"./SourceEditorFormStreams\"\nimport { SourceEditorFormConnections } from \"./SourceEditorFormConnections\"\nimport { SourceEditorDocumentationDrawer } from \"./SourceEditorDocumentationDrawer\"\n// @Types\nimport type { SourceConnector as CatalogSourceConnector } from \"@jitsu/catalog\"\nimport type {\n HandleSaveSource,\n HandleValidateTestConnection,\n SetSourceEditorInitialSourceData,\n SetSourceEditorState,\n SourceEditorState,\n} from \"./SourceEditor\"\nimport { SourceEditorViewSteps } from \"./SourceEditorViewSteps\"\nimport { SourceEditorViewTabs } from \"./SourceEditorViewTabs\"\nimport useProject from \"../../../../../../hooks/useProject\"\nimport { allPermissions } from \"../../../../../../lib/services/permissions\"\nimport { ProjectPermission } from \"../../../../../../generated/conf-openapi\"\n\ntype SourceEditorViewProps = {\n state: SourceEditorState\n editorMode: \"add\" | \"edit\"\n showDocumentationDrawer: boolean\n initialSourceData: Optional>\n sourceDataFromCatalog: CatalogSourceConnector\n setSourceEditorState: SetSourceEditorState\n setShowDocumentationDrawer: (value: boolean) => void\n handleBringSourceData: () => SourceData\n handleSave: HandleSaveSource\n setInitialSourceData: SetSourceEditorInitialSourceData\n handleLeaveEditor: VoidFunction\n handleValidateAndTestConnection: HandleValidateTestConnection\n handleValidateStreams: AsyncUnknownFunction\n handleReloadStreams: VoidFunction | AsyncVoidFunction\n}\n\nexport const SourceEditorView: React.FC = ({\n state,\n editorMode,\n showDocumentationDrawer,\n initialSourceData,\n sourceDataFromCatalog,\n setSourceEditorState,\n setShowDocumentationDrawer,\n handleBringSourceData,\n handleSave,\n setInitialSourceData,\n handleLeaveEditor,\n handleValidateAndTestConnection,\n handleValidateStreams,\n handleReloadStreams,\n}) => {\n const project = useProject()\n const disableEdit = !(project.permissions || allPermissions).includes(ProjectPermission.MODIFY_CONFIG)\n\n const forms = [\n {\n key: \"configuration\",\n title: \"Configuration\",\n description: \"Specify essential parameters\",\n errorsCount: state.configuration.errorsCount,\n render: (\n \n ),\n proceedAction: handleValidateAndTestConnection,\n },\n {\n key: \"streams\",\n title: \"Streams\",\n description: \"Select data pipelines\",\n errorsCount: state.streams.errorsCount,\n render: (\n \n ),\n proceedAction: handleValidateStreams,\n },\n {\n key: \"connections\",\n title: \"Connections\",\n description: \"Choose destinations to send data to\",\n render: (\n \n ),\n proceedButtonTitle: \"Save\",\n proceedAction: handleSave,\n },\n ]\n\n return (\n <>\n {editorMode === \"add\" ? (\n \n ) : (\n \n )}\n\n \n\n {sourceDataFromCatalog?.documentation && (\n \n )}\n \n )\n}\n","// @Libs\nimport React, { useCallback, useEffect, useMemo, useState } from \"react\"\nimport { observer } from \"mobx-react-lite\"\nimport { useHistory, useParams } from \"react-router\"\nimport { cloneDeep, snakeCase, uniqueId } from \"lodash\"\n// @Types\nimport { CommonSourcePageProps } from \"ui/pages/SourcesPage/SourcesPage\"\nimport { SourceConnector as CatalogSourceConnector } from \"@jitsu/catalog\"\n// @Store\nimport { sourcesStore } from \"stores/sources\"\n// @Catalog\nimport { allSources as sourcesCatalog } from \"@jitsu/catalog\"\n// @Components\nimport { sourcesPageRoutes } from \"ui/pages/SourcesPage/SourcesPage.routes\"\nimport { createInitialSourceData, sourceEditorUtils } from \"./SourceEditor.utils\"\nimport { sourcePageUtils, TestConnectionResponse } from \"ui/pages/SourcesPage/SourcePage.utils\"\nimport { firstToLower } from \"lib/commons/utils\"\nimport { actionNotification } from \"ui/components/ActionNotification/ActionNotification\"\nimport { SourceEditorView } from \"./SourceEditorView\"\nimport { ErrorDetailed } from \"lib/commons/errors\"\nimport { connectionsHelper } from \"stores/helpers\"\nimport { projectRoute } from \"lib/components/ProjectLink/ProjectLink\"\nimport { flowResult } from \"mobx\"\nimport { useServices } from \"../../../../../../hooks/useServices\"\nimport {\n SourceEditorActionsTypes,\n SourceEditorStateProvider,\n useSourceEditorDispatcher,\n useSourceEditorState,\n} from \"./SourceEditor.state\"\nimport { destinationPageRoutes } from \"../../../../DestinationsPage/DestinationsPage.routes\"\nimport { PageHeader } from \"../../../../../components/PageHeader/PageHeader\"\nimport { DestinationsUtils } from \"../../../../../../utils/destinations.utils\"\nimport { currentPageHeaderStore } from \"../../../../../../stores/currentPageHeader\"\n// @Utils\n\n/** Accumulated state of all forms that is transformed and sent to backend on source save */\nexport type SourceEditorState = {\n /**\n * Source configuration step/tab\n */\n configuration: ConfigurationState\n /**\n * Source streams step/tab\n */\n streams: StreamsState\n /**\n * Source connected destinations step/tab\n */\n connections: ConnectionsState\n /**\n * Whether user made any changes\n */\n stateChanged: boolean\n}\nexport type SetSourceEditorState = React.Dispatch>\n\n/** Initial source data used to render the forms */\nexport type SourceEditorInitialSourceData = Optional>\nexport type SetSourceEditorInitialSourceData = React.Dispatch>\n\n/** Set of source editor disabled tabs */\nexport type SetSourceEditorDisabledTabs = (tabKeys: string[], action: \"enable\" | \"disable\") => void\n\n/** Method for saving the configured source */\nexport type HandleSaveSource = (config?: HandleSaveSourceConfig) => Promise\ntype HandleSaveSourceConfig = {\n /** Errors names to skip when saving the source */\n ignoreErrors?: string[]\n}\n\n/** Method for validating and testing connection of the configured source */\nexport type HandleValidateTestConnection = (config?: HandleValidateTestConnectionConfig) => Promise\ntype HandleValidateTestConnectionConfig = {\n /** Errors names to skip when testing the source connection */\n ignoreErrors?: string[]\n}\n\ntype ConfigurationState = {\n config: SourceConfigurationData\n validateGetErrorsCount: () => Promise\n errorsCount: number\n}\n\ntype StreamsState = {\n /** @deprecated use `selectedStreams` instead */\n streams?: SourceStreamsData\n selectedStreams: SourceSelectedStreams\n validateGetErrorsCount: () => Promise\n forceReloadStreamsList: VoidFunction | AsyncVoidFunction\n errorsCount: number\n}\n\ntype ConnectionsState = {\n connections: SourceConnectionsData\n errorsCount: number\n}\n\nexport type SourceConfigurationData = {\n [key: string]: PlainObjectWithPrimitiveValues\n}\nexport type SourceStreamsData = {\n [pathToStreamsInSourceData: string]: StreamData[]\n}\nexport type SourceSelectedStreams = {\n [pathToSelectedStreamsInSourceData: string]: StreamConfig[]\n}\nexport type SourceConnectionsData = {\n [pathToConnectionsInSourceData: string]: string[]\n}\n\nexport type UpdateConfigurationFields = (newFileds: Partial) => void\n\nconst initialState: SourceEditorState = {\n configuration: {\n config: {},\n validateGetErrorsCount: async () => 0,\n errorsCount: 0,\n },\n streams: {\n streams: {},\n selectedStreams: {},\n validateGetErrorsCount: async () => 0,\n forceReloadStreamsList: () => {},\n errorsCount: 0,\n },\n connections: {\n connections: {},\n errorsCount: 0,\n },\n stateChanged: false,\n}\n\nexport const SourceEditor: React.FC = ({ editorMode }) => {\n return (\n \n \n \n )\n}\n\nconst SourceEditorContainer: React.FC = ({ editorMode }) => {\n const history = useHistory()\n const services = useServices()\n const allSourcesList = sourcesStore.list\n const { source, sourceId } = useParams<{ source?: string; sourceId?: string }>()\n\n const sourceDataFromCatalog = useMemo(() => {\n let sourceType = source\n ? source\n : sourceId\n ? sourcesStore.list.find(src => src.sourceId === sourceId)?.sourceProtoType\n : undefined\n\n return sourceType\n ? sourcesCatalog.find((source: CatalogSourceConnector) => snakeCase(source.id) === snakeCase(sourceType))\n : undefined\n }, [sourceId, allSourcesList])\n\n const [initialSourceData, setInitialSourceData] = useState(\n () =>\n sourceEditorUtils.reformatCatalogIntoSelectedStreams(allSourcesList.find(src => src.sourceId === sourceId)) ??\n createInitialSourceData(sourceDataFromCatalog)\n )\n\n /**\n * The new state management tools defined in SourceEditor.state.tsx\n * For now, used for controlling view props such as loaders and buttons hence the naming\n */\n const viewState = useSourceEditorState()\n const dispatchSourceEditorAction = useSourceEditorDispatcher()\n\n /**\n * @obsolete state storage\n * TO DO: move state management completely to the SourceEditor.state.tsx\n **/\n const [state, setState] = useState(initialState)\n\n const [showDocumentation, setShowDocumentation] = useState(false)\n\n const handleBringSourceData = () => {\n let sourceEditorState = state\n setState(state => {\n sourceEditorState = state\n return state\n })\n return sourceEditorUtils.getSourceDataFromState(sourceEditorState, sourceDataFromCatalog, initialSourceData)\n }\n\n const validateCountErrors = async (): Promise => {\n const configurationErrorsCount = await state.configuration.validateGetErrorsCount()\n const streamsErrorsCount = await state.streams.validateGetErrorsCount()\n\n setState(state => {\n const newState = cloneDeep(state)\n newState.configuration.errorsCount = configurationErrorsCount\n newState.streams.errorsCount = streamsErrorsCount\n return newState\n })\n\n return configurationErrorsCount + streamsErrorsCount\n }\n\n const validateAllForms = async () => {\n const someFieldsErrored = !!(await validateCountErrors())\n if (someFieldsErrored) throw new Error(\"some values are invalid\")\n }\n\n const getTestConnectionResponse = async (): Promise => {\n const sourceData = handleBringSourceData()\n const testResult = await sourcePageUtils.testConnection(services.activeProject.id, sourceData, true)\n return testResult\n }\n\n const assertCanConnect = async (config?: {\n testConnectionResponse?: TestConnectionResponse\n ignoreErrors?: string[]\n }): Promise => {\n const response = config?.testConnectionResponse ?? (await getTestConnectionResponse())\n if (!response.connected && !config?.ignoreErrors?.includes(response.connectedErrorType))\n throw new ErrorDetailed({\n message: response.connectedErrorMessage,\n name: response.connectedErrorType,\n payload: response.connectedErrorPayload,\n })\n }\n\n const handleValidateAndTestConnection: HandleValidateTestConnection = async (methodConfig): Promise => {\n await validateAllForms()\n dispatchSourceEditorAction(SourceEditorActionsTypes.SET_STATUS, {\n isTestingConnection: true,\n hasConfigSealed: true,\n })\n try {\n await assertCanConnect({ ignoreErrors: methodConfig?.ignoreErrors })\n } finally {\n dispatchSourceEditorAction(SourceEditorActionsTypes.SET_STATUS, { isTestingConnection: false })\n }\n }\n\n const handleSave = useCallback(\n async methodConfig => {\n let sourceEditorState = null\n setState(state => {\n sourceEditorState = state // hack for getting the most recent state in the async function\n return { ...state, stateChanged: false }\n })\n\n if (editorMode === \"edit\") await validateAllForms()\n\n const sourceData = handleBringSourceData()\n const testConnectionResults = await sourcePageUtils.testConnection(services.activeProject.id, sourceData, true)\n\n await assertCanConnect({\n testConnectionResponse: testConnectionResults,\n ignoreErrors: methodConfig?.ignoreErrors,\n })\n\n let sourceDataToSave: SourceData = {\n ...sourceData,\n ...testConnectionResults,\n }\n\n let savedSourceData: SourceData = sourceDataToSave\n if (editorMode === \"add\") {\n savedSourceData = await flowResult(sourcesStore.add(sourceDataToSave))\n }\n if (editorMode === \"edit\") {\n await flowResult(sourcesStore.replace(sourceDataToSave))\n }\n await connectionsHelper.updateDestinationsConnectionsToSource(\n savedSourceData.sourceId,\n savedSourceData.destinations\n )\n\n handleLeaveEditor({ goToSourcesList: true })\n\n if (savedSourceData.connected) {\n actionNotification.success(editorMode === \"add\" ? \"New source has been added!\" : \"Source has been saved\")\n } else {\n actionNotification.warn(\n `Source has been saved, but test has failed with '${firstToLower(\n savedSourceData.connectedErrorMessage\n )}'. Data from this source will not be available`\n )\n }\n },\n [editorMode, state]\n )\n\n const handleLeaveEditor = useCallback<(options?: { goToSourcesList?: boolean }) => void>(options => {\n options.goToSourcesList ? history.push(projectRoute(sourcesPageRoutes.root)) : history.goBack()\n }, [])\n\n const handleValidateStreams = async (): Promise => {\n const streamsErrorsCount = await state.streams.validateGetErrorsCount()\n if (streamsErrorsCount) throw new Error(\"some streams settings are invalid\")\n }\n\n useEffect(() => {\n let breadcrumbs = []\n breadcrumbs.push({\n title: \"Sources\",\n link: projectRoute(sourcesPageRoutes.root),\n })\n\n breadcrumbs.push({\n title: (\n \n ),\n })\n setTimeout(() => {\n currentPageHeaderStore.setBreadcrumbs(...breadcrumbs)\n }, 100)\n }, [initialSourceData, sourceDataFromCatalog])\n\n return (\n \n )\n}\n\nconst Wrapped = observer(SourceEditorContainer)\n\nWrapped.displayName = \"SourceEditorContainer\"\n","// @Libs\nimport { useCallback } from \"react\"\nimport { Route, Switch, useParams } from \"react-router-dom\"\nimport { observer } from \"mobx-react-lite\"\n// @Routes\nimport { sourcesPageRoutes } from \"./SourcesPage.routes\"\n// @Services\nimport { useServices } from \"hooks/useServices\"\n// @Components\nimport { SourcesList } from \"./partials/SourcesList/SourcesList\"\nimport { AddSourceDialog } from \"./partials/AddSourceDialog/AddSourceDialog\"\nimport { CenteredSpin } from \"lib/components/components\"\nimport { BillingCheckRedirect } from \"lib/components/BillingCheckRedirect/BillingCheckRedirect\"\n// @Store\nimport { sourcesStore } from \"stores/sources\"\n// @Styles\nimport \"./SourcesPage.less\"\n// @Types\nimport { ErrorBoundary } from \"lib/components/ErrorBoundary/ErrorBoundary\"\nimport { SourceEditor } from \"./partials/SourceEditor/SourceEditor/SourceEditor\"\nimport { CurrentSubscription } from \"lib/services/billing\"\nimport { EntitiesStoreStatus } from \"stores/entitiesStore\"\nimport { projectRoute } from \"lib/components/ProjectLink/ProjectLink\"\nimport { TaskLogsPage } from \"../TaskLogs/TaskLogsPage\"\nimport { TaskLogViewer } from \"../TaskLogs/TaskLogViewer\"\nimport { PageNotFound } from \"ui/components/PageNotFound/PageNotFound\"\n\nexport interface CollectionSourceData {\n sources: SourceData[]\n _lastUpdated?: string\n}\n\nexport interface CommonSourcePageProps {\n editorMode?: \"edit\" | \"add\"\n}\n\nconst SourcesPageComponent: React.FC = () => {\n const params = useParams()\n const services = useServices()\n\n const isSourcesLimitReached = useCallback<(subscription?: CurrentSubscription) => boolean>(\n subscription => sourcesStore.list.length >= (subscription?.currentPlan.quota.sources ?? 999),\n [sourcesStore.list.length]\n )\n\n if (sourcesStore.status === EntitiesStoreStatus.GLOBAL_ERROR) {\n throw new Error(\n sourcesStore.errorMessage ??\n `Internal error occured in sources management tool. Please, contact support or file an issue.`\n )\n } else if (sourcesStore.status === EntitiesStoreStatus.GLOBAL_LOADING) {\n return \n }\n\n return (\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n You current plan allows to have only {services.currentSubscription.currentPlan.quota.sources} sources\n }\n isQuotaExceeded={isSourcesLimitReached}\n >\n \n \n \n \n You current plan allows to have only {services.currentSubscription.currentPlan.quota.sources} sources\n }\n isQuotaExceeded={isSourcesLimitReached}\n >\n \n \n \n \n \n \n \n \n )\n}\n\nconst SourcesPage = observer(SourcesPageComponent)\n\nSourcesPage.displayName = \"SourcesPage\"\n\nexport default SourcesPage\n"],"sourceRoot":""}