<commit_before>import { Provider, provide, ExceptionHandler, PipeTransform } from '@angular/core';
import { UpgradeAdapter } from '@angular/upgrade';

import * as angular from 'angular';

import { IsEmptyPipe } from './filters/isEmpty/isEmpty';
import { TruncatePipe } from './filters/truncate/truncate';

import { ARRAY_PROVIDER, arrayToken } from './services/array/array.service';
import { BOOLEAN_PROVIDER, booleanToken } from './services/boolean/boolean.service';
import { RESOURCE_BUILDER_PROVIDER, resourceBuilderToken } from './services/dataContracts/resourceBuilder/resourceBuilder.service';
import { DATE_PROVIDER, dateToken } from './services/date/date.service';
import { ERROR_HANDLER_PROVIDER, DEFAULT_ERROR_PROVIDERS, DEFAULT_LOGIN_URL_PROVIDERS, errorHandlerToken } from './services/errorHandler/errorHandler.service';
import { GENERIC_SEARCH_FILTER_PROVIDER, genericSearchFilterToken } from './services/genericSearchFilter/genericSearchFilter.service';
import { GUID_PROVIDER, guidToken } from './services/guid/guid.service';
import { LOGGER_PROVIDER, loggerToken } from './services/logger/logger.service';
import { NOTIFICATION_PROVIDER, notificationServiceToken } from './services/notification/notification.service';
import { NUMBER_PROVIDER, numberUtilityToken } from './services/number/number.service';
import { OBJECT_PROVIDER, objectUtility, objectToken } from './services/object/object.service';
import { observableToken, ObservableService, IObservableService } from './services/observable/observable.service';
import { REDIRECT_PROVIDER, redirectToken } from './services/redirect/redirect.service';
import { STRING_PROVIDER, stringToken } from './services/string/string.service';
import { SYNCHRONIZED_REQUESTS_PROVIDER, synchronizedRequestsToken } from './services/synchronizedRequests/synchronizedRequests.service';
import { TIME_PROVIDER, timeToken } from './services/time/time.service';
import { TIMEZONE_PROVIDER, timezoneToken } from './services/timezone/timezone.service';
import { VALIDATION_PROVIDER, validationToken } from './services/validation/validation.service';
import { WINDOW_PROVIDER, windowToken } from './services/window/window.provider';

export const isEmptyFilterName: string = 'isEmpty';
export const truncateFilterName: string = 'truncate';

export const arrayServiceName: string = 'rlArrayService';
export const booleanServiceName: string = 'rlBooleanService';
export const resourceBuilderServiceName: string = 'rlResourceBuilderService';
export const dateServiceName: string = 'rlDateService';
export const errorHandlerServiceName: string = 'rlErrorHandlerService';
export const genericSearchFilterServiceName: string = 'rlGenericSearchFilterService';
export const guidServiceName: string = 'rlGuidService';
export const httpServiceName: string = 'rlHttpService';
export const notificationServiceName: string = 'rlNotificationService';
export const numberServiceName: string = 'rlNumberService';
export const objectServiceName: string = 'rlObjectService';
export const observableServiceName: string = 'rlObservableService';
export const stringServiceName: string = 'rlStringService';
export const synchronizedRequestsServiceName: string = 'rlSynchronizedRequestsService';
export const timeServiceName: string = 'rlTimeService';
export const timezoneServiceName: string = 'rlTimezoneService';
export const validationServiceName: string = 'rlValidationService';

export const moduleName: string = 'rl.utilities';

const utilitiesModule = angular.module(moduleName, []);

export interface IObservableFactory {
	getInstance(): IObservableService;
}

export function PipeDowngrader(pipe: PipeTransform) {
	return (value: any, ...args: any[]): any => {
		return pipe.transform(value, ...args);
	};
}

export function downgradeUtilitiesToAngular1(upgradeAdapter: UpgradeAdapter) {
	const observableFactoryProvider: Provider = new Provider(observableToken, {
		useValue: {
			deps: [ExceptionHandler],
			getInstance: (exceptionHandler: ExceptionHandler): IObservableService => new ObservableService(exceptionHandler),
		},
	})

	upgradeAdapter.addProvider(ARRAY_PROVIDER);
	upgradeAdapter.addProvider(BOOLEAN_PROVIDER);
	upgradeAdapter.addProvider(RESOURCE_BUILDER_PROVIDER);
	upgradeAdapter.addProvider(DATE_PROVIDER);
	upgradeAdapter.addProvider(ERROR_HANDLER_PROVIDER);
	upgradeAdapter.addProvider(DEFAULT_ERROR_PROVIDERS);
	upgradeAdapter.addProvider(DEFAULT_LOGIN_URL_PROVIDERS);
	upgradeAdapter.addProvider(GENERIC_SEARCH_FILTER_PROVIDER);
	upgradeAdapter.addProvider(GUID_PROVIDER);
	upgradeAdapter.addProvider(LOGGER_PROVIDER);
	upgradeAdapter.addProvider(NOTIFICATION_PROVIDER);
	upgradeAdapter.addProvider(NUMBER_PROVIDER);<commit_msg>Fixed the PipeDowngrader. Since we call it, we need to return a filter 'factory' for angualr to use to build a filter. This is breaking because angular things 'value' is something to inject.<commit_after>import { Provider, provide, ExceptionHandler, PipeTransform } from '@angular/core';
import { UpgradeAdapter } from '@angular/upgrade';

import * as angular from 'angular';

import { IsEmptyPipe } from './filters/isEmpty/isEmpty';
import { TruncatePipe } from './filters/truncate/truncate';

import { ARRAY_PROVIDER, arrayToken } from './services/array/array.service';
import { BOOLEAN_PROVIDER, booleanToken } from './services/boolean/boolean.service';
import { RESOURCE_BUILDER_PROVIDER, resourceBuilderToken } from './services/dataContracts/resourceBuilder/resourceBuilder.service';
import { DATE_PROVIDER, dateToken } from './services/date/date.service';
import { ERROR_HANDLER_PROVIDER, DEFAULT_ERROR_PROVIDERS, DEFAULT_LOGIN_URL_PROVIDERS, errorHandlerToken } from './services/errorHandler/errorHandler.service';
import { GENERIC_SEARCH_FILTER_PROVIDER, genericSearchFilterToken } from './services/genericSearchFilter/genericSearchFilter.service';
import { GUID_PROVIDER, guidToken } from './services/guid/guid.service';
import { LOGGER_PROVIDER, loggerToken } from './services/logger/logger.service';
import { NOTIFICATION_PROVIDER, notificationServiceToken } from './services/notification/notification.service';
import { NUMBER_PROVIDER, numberUtilityToken } from './services/number/number.service';
import { OBJECT_PROVIDER, objectUtility, objectToken } from './services/object/object.service';
import { observableToken, ObservableService, IObservableService } from './services/observable/observable.service';
import { REDIRECT_PROVIDER, redirectToken } from './services/redirect/redirect.service';
import { STRING_PROVIDER, stringToken } from './services/string/string.service';
import { SYNCHRONIZED_REQUESTS_PROVIDER, synchronizedRequestsToken } from './services/synchronizedRequests/synchronizedRequests.service';
import { TIME_PROVIDER, timeToken } from './services/time/time.service';
import { TIMEZONE_PROVIDER, timezoneToken } from './services/timezone/timezone.service';
import { VALIDATION_PROVIDER, validationToken } from './services/validation/validation.service';
import { WINDOW_PROVIDER, windowToken } from './services/window/window.provider';

export const isEmptyFilterName: string = 'isEmpty';
export const truncateFilterName: string = 'truncate';

export const arrayServiceName: string = 'rlArrayService';
export const booleanServiceName: string = 'rlBooleanService';
export const resourceBuilderServiceName: string = 'rlResourceBuilderService';
export const dateServiceName: string = 'rlDateService';
export const errorHandlerServiceName: string = 'rlErrorHandlerService';
export const genericSearchFilterServiceName: string = 'rlGenericSearchFilterService';
export const guidServiceName: string = 'rlGuidService';
export const httpServiceName: string = 'rlHttpService';
export const notificationServiceName: string = 'rlNotificationService';
export const numberServiceName: string = 'rlNumberService';
export const objectServiceName: string = 'rlObjectService';
export const observableServiceName: string = 'rlObservableService';
export const stringServiceName: string = 'rlStringService';
export const synchronizedRequestsServiceName: string = 'rlSynchronizedRequestsService';
export const timeServiceName: string = 'rlTimeService';
export const timezoneServiceName: string = 'rlTimezoneService';
export const validationServiceName: string = 'rlValidationService';

export const moduleName: string = 'rl.utilities';

const utilitiesModule = angular.module(moduleName, []);

export interface IObservableFactory {
	getInstance(): IObservableService;
}

export function PipeDowngrader(pipe: PipeTransform) {
	// factory that returns a filter
	return () => (value: any, ...args: any[]): any => {
		return pipe.transform(value, ...args);
	};
}

export function downgradeUtilitiesToAngular1(upgradeAdapter: UpgradeAdapter) {
	const observableFactoryProvider: Provider = new Provider(observableToken, {
		useValue: {
			deps: [ExceptionHandler],
			getInstance: (exceptionHandler: ExceptionHandler): IObservableService => new ObservableService(exceptionHandler),
		},
	})

	upgradeAdapter.addProvider(ARRAY_PROVIDER);
	upgradeAdapter.addProvider(BOOLEAN_PROVIDER);
	upgradeAdapter.addProvider(RESOURCE_BUILDER_PROVIDER);
	upgradeAdapter.addProvider(DATE_PROVIDER);
	upgradeAdapter.addProvider(ERROR_HANDLER_PROVIDER);
	upgradeAdapter.addProvider(DEFAULT_ERROR_PROVIDERS);
	upgradeAdapter.addProvider(DEFAULT_LOGIN_URL_PROVIDERS);
	upgradeAdapter.addProvider(GENERIC_SEARCH_FILTER_PROVIDER);
	upgradeAdapter.addProvider(GUID_PROVIDER);
	upgradeAdapter.addProvider(LOGGER_PROVIDER);
	upgradeAdapter.addProvider(NOTIFICATION_PROVIDER);
	upgradeAdapter.addProvider(NUMBER_PROVIDER);
{'fraction_non_alphanumeric': 0.10090691128948191, 'fraction_numerical': 0.00020848535390388824, 'mean_word_length': 7.777676120768527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4865122', 'n_tokens_mistral': 2646, 'n_tokens_neox': 2599, 'n_words': 584}