Skip to content

Commit

Permalink
refactor: return generic Provider type for providers
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlj95 committed Nov 20, 2024
1 parent 6f6961a commit bf346cd
Show file tree
Hide file tree
Showing 14 changed files with 64 additions and 65 deletions.
70 changes: 35 additions & 35 deletions projects/ngx-meta/api-extractor/ngx-meta.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const _injectMetadataManagers: () => readonly NgxMetaMetadataManager[];
export const _isDefined: <T>(value: T | null | undefined) => value is T;

// @public
export const JSON_LD_METADATA_PROVIDER: FactoryProvider;
export const JSON_LD_METADATA_PROVIDER: Provider;

// @public
export interface JsonLdMetadata {
Expand Down Expand Up @@ -296,16 +296,16 @@ export class NgxMetaTwitterCardModule {
}

// @public
export const OPEN_GRAPH_DESCRIPTION_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_DESCRIPTION_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_IMAGE_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_IMAGE_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_LOCALE_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_LOCALE_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_PROFILE_FIRST_NAME_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_PROFILE_FIRST_NAME_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_PROFILE_GENDER_FEMALE = "female";
Expand All @@ -314,19 +314,19 @@ export const OPEN_GRAPH_PROFILE_GENDER_FEMALE = "female";
export const OPEN_GRAPH_PROFILE_GENDER_MALE = "male";

// @public
export const OPEN_GRAPH_PROFILE_GENDER_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_PROFILE_GENDER_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_PROFILE_LAST_NAME_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_PROFILE_LAST_NAME_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_PROFILE_USERNAME_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_PROFILE_USERNAME_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_SITE_NAME_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_SITE_NAME_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_TITLE_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_TITLE_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_TYPE_ARTICLE = "article";
Expand All @@ -335,7 +335,7 @@ export const OPEN_GRAPH_TYPE_ARTICLE = "article";
export const OPEN_GRAPH_TYPE_BOOK = "book";

// @public
export const OPEN_GRAPH_TYPE_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_TYPE_METADATA_PROVIDER: Provider;

// @public
export const OPEN_GRAPH_TYPE_MUSIC_ALBUM = "music.album";
Expand Down Expand Up @@ -368,7 +368,7 @@ export const OPEN_GRAPH_TYPE_VIDEO_TV_SHOW = "video.tv_show";
export const OPEN_GRAPH_TYPE_WEBSITE = "website";

// @public
export const OPEN_GRAPH_URL_METADATA_PROVIDER: FactoryProvider;
export const OPEN_GRAPH_URL_METADATA_PROVIDER: Provider;

// @public
export interface OpenGraph {
Expand Down Expand Up @@ -415,12 +415,12 @@ export type OpenGraphType = typeof OPEN_GRAPH_TYPE_MUSIC_SONG | typeof OPEN_GRAP
export const provideNgxMetaCore: (...features: CoreFeatures) => EnvironmentProviders;

// @public
export const provideNgxMetaJsonLd: () => Provider[];
export const provideNgxMetaJsonLd: () => Provider;

// Warning: (ae-incompatible-release-tags) The symbol "provideNgxMetaManager" is marked as @public, but its signature references "_ProvideNgxMetaManagerOptions" which is marked as @internal
//
// @public
export const provideNgxMetaManager: <T>(jsonPath: string, setterFactory: MetadataSetterFactory<T>, options?: _ProvideNgxMetaManagerOptions) => FactoryProvider;
export const provideNgxMetaManager: <T>(jsonPath: string, setterFactory: MetadataSetterFactory<T>, options?: _ProvideNgxMetaManagerOptions) => Provider;

// @internal (undocumented)
export type _ProvideNgxMetaManagerOptions = Partial<{
Expand All @@ -431,12 +431,12 @@ export type _ProvideNgxMetaManagerOptions = Partial<{
}>;

// @public
export const provideNgxMetaMetadataLoader: () => Provider[];
export const provideNgxMetaMetadataLoader: () => Provider;

// Warning: (ae-forgotten-export) The symbol "StringKeyOf" needs to be exported by the entry point all-entry-points.d.ts
//
// @internal (undocumented)
export const _provideNgxMetaModuleManager: <Type extends object, Key extends StringKeyOf<Type>>(key: Key, scope: readonly string[], options: _ProvideNgxMetaModuleManagerOptions<Type[Key]>) => FactoryProvider;
export const _provideNgxMetaModuleManager: <Type extends object, Key extends StringKeyOf<Type>>(key: Key, scope: readonly string[], options: _ProvideNgxMetaModuleManagerOptions<Type[Key]>) => Provider;

// @internal (undocumented)
export type _ProvideNgxMetaModuleManagerOptions<T> = Partial<{
Expand All @@ -446,19 +446,19 @@ export type _ProvideNgxMetaModuleManagerOptions<T> = Partial<{
}> & _ProvideNgxMetaManagerOptions;

// @public
export const provideNgxMetaOpenGraph: () => Provider[];
export const provideNgxMetaOpenGraph: () => Provider;

// @public
export const provideNgxMetaOpenGraphProfile: () => Provider[];
export const provideNgxMetaOpenGraphProfile: () => Provider;

// @public
export const provideNgxMetaRouting: () => EnvironmentProviders;

// @public
export const provideNgxMetaStandard: () => Provider[];
export const provideNgxMetaStandard: () => Provider;

// @public
export const provideNgxMetaTwitterCard: () => Provider[];
export const provideNgxMetaTwitterCard: () => Provider;

// @internal (undocumented)
export type _RouteMetadataStrategy = () => MetadataValues | undefined;
Expand All @@ -480,31 +480,31 @@ export interface Standard {
}

// @public
export const STANDARD_APPLICATION_NAME_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_APPLICATION_NAME_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_AUTHOR_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_AUTHOR_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_CANONICAL_URL_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_CANONICAL_URL_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_DESCRIPTION_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_DESCRIPTION_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_GENERATOR_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_GENERATOR_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_KEYWORDS_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_KEYWORDS_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_LOCALE_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_LOCALE_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_THEME_COLOR_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_THEME_COLOR_METADATA_PROVIDER: Provider;

// @public
export const STANDARD_TITLE_METADATA_PROVIDER: FactoryProvider;
export const STANDARD_TITLE_METADATA_PROVIDER: Provider;

// @public
export interface StandardMetadata {
Expand All @@ -524,22 +524,22 @@ export interface StandardThemeColorMetadataObject {
type StringKeyOf<T = object> = Extract<keyof T, string>;

// @public
export const TWITTER_CARD_CARD_METADATA_PROVIDER: FactoryProvider;
export const TWITTER_CARD_CARD_METADATA_PROVIDER: Provider;

// @public
export const TWITTER_CARD_CREATOR_METADATA_PROVIDER: FactoryProvider;
export const TWITTER_CARD_CREATOR_METADATA_PROVIDER: Provider;

// @public
export const TWITTER_CARD_DESCRIPTION_METADATA_PROVIDER: FactoryProvider;
export const TWITTER_CARD_DESCRIPTION_METADATA_PROVIDER: Provider;

// @public
export const TWITTER_CARD_IMAGE_METADATA_PROVIDER: FactoryProvider;
export const TWITTER_CARD_IMAGE_METADATA_PROVIDER: Provider;

// @public
export const TWITTER_CARD_SITE_METADATA_PROVIDER: FactoryProvider;
export const TWITTER_CARD_SITE_METADATA_PROVIDER: Provider;

// @public
export const TWITTER_CARD_TITLE_METADATA_PROVIDER: FactoryProvider;
export const TWITTER_CARD_TITLE_METADATA_PROVIDER: Provider;

// @public
export const TWITTER_CARD_TYPE_APP = "app";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ import { provideNgxMetaMetadataLoader } from './provide-ngx-meta-metadata-loader
* @public
*/
@NgModule({
providers: provideNgxMetaMetadataLoader(),
providers: [provideNgxMetaMetadataLoader()],
})
export class NgxMetaMetadataLoaderModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
*
* @public
*/
export const provideNgxMetaMetadataLoader = (): Provider[] => [
export const provideNgxMetaMetadataLoader = (): Provider => [
provideMetadataRegistry(),
{
provide: ENVIRONMENT_INITIALIZER,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FactoryProvider } from '@angular/core'
import { FactoryProvider, Provider } from '@angular/core'
import {
MetadataResolverOptions,
NgxMetaMetadataManager,
Expand Down Expand Up @@ -64,21 +64,22 @@ export const provideNgxMetaManager = <T>(
setterFactory: MetadataSetterFactory<T>,
/* istanbul ignore next - quite simple */
options: _ProvideNgxMetaManagerOptions = {},
): FactoryProvider => ({
provide: NgxMetaMetadataManager,
multi: true,
useFactory: (...deps: readonly unknown[]) =>
({
id: jsonPath,
set: setterFactory(...deps),
resolverOptions: {
jsonPath: jsonPath.split('.'),
global: options.g,
objectMerge: options.o,
},
}) satisfies NgxMetaMetadataManager<T>,
deps: options.d,
})
): Provider =>
({
provide: NgxMetaMetadataManager,
multi: true,
useFactory: (...deps: readonly unknown[]) =>
({
id: jsonPath,
set: setterFactory(...deps),
resolverOptions: {
jsonPath: jsonPath.split('.'),
global: options.g,
objectMerge: options.o,
},
}) satisfies NgxMetaMetadataManager<T>,
deps: options.d,
}) satisfies FactoryProvider

/**
* @internal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { provideNgxMetaJsonLd } from './provide-ngx-meta-json-ld'
* @public
*/
@NgModule({
providers: provideNgxMetaJsonLd(),
providers: [provideNgxMetaJsonLd()],
})
export class NgxMetaJsonLdModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ import { JSON_LD_METADATA_PROVIDER } from '../managers'
*
* @public
*/
export const provideNgxMetaJsonLd = (): Provider[] => [
JSON_LD_METADATA_PROVIDER,
]
export const provideNgxMetaJsonLd = (): Provider => [JSON_LD_METADATA_PROVIDER]
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { provideNgxMetaOpenGraph } from './provide-ngx-meta-open-graph'
* @public
*/
@NgModule({
providers: provideNgxMetaOpenGraph(),
providers: [provideNgxMetaOpenGraph()],
})
export class NgxMetaOpenGraphModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
*
* @public
*/
export const provideNgxMetaOpenGraph = (): Provider[] => [
export const provideNgxMetaOpenGraph = (): Provider => [
OPEN_GRAPH_TITLE_METADATA_PROVIDER,
OPEN_GRAPH_TYPE_METADATA_PROVIDER,
OPEN_GRAPH_IMAGE_METADATA_PROVIDER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { provideNgxMetaOpenGraphProfile } from './provide-ngx-meta-open-graph-pr
* @public
*/
@NgModule({
providers: provideNgxMetaOpenGraphProfile(),
providers: [provideNgxMetaOpenGraphProfile()],
})
export class NgxMetaOpenGraphProfileModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
*
* @public
*/
export const provideNgxMetaOpenGraphProfile = (): Provider[] => [
export const provideNgxMetaOpenGraphProfile = (): Provider => [
OPEN_GRAPH_PROFILE_FIRST_NAME_METADATA_PROVIDER,
OPEN_GRAPH_PROFILE_LAST_NAME_METADATA_PROVIDER,
OPEN_GRAPH_PROFILE_USERNAME_METADATA_PROVIDER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { provideNgxMetaStandard } from './provide-ngx-meta-standard'
* @public
*/
@NgModule({
providers: provideNgxMetaStandard(),
providers: [provideNgxMetaStandard()],
})
export class NgxMetaStandardModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
*
* @public
*/
export const provideNgxMetaStandard = (): Provider[] => [
export const provideNgxMetaStandard = (): Provider => [
STANDARD_TITLE_METADATA_PROVIDER,
STANDARD_DESCRIPTION_METADATA_PROVIDER,
STANDARD_AUTHOR_METADATA_PROVIDER,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import { provideNgxMetaTwitterCard } from './provide-ngx-meta-twitter-card'
* @public
*/
@NgModule({
providers: provideNgxMetaTwitterCard(),
providers: [provideNgxMetaTwitterCard()],
})
export class NgxMetaTwitterCardModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
*
* @public
*/
export const provideNgxMetaTwitterCard = (): Provider[] => [
export const provideNgxMetaTwitterCard = (): Provider => [
TWITTER_CARD_CARD_METADATA_PROVIDER,
TWITTER_CARD_SITE_METADATA_PROVIDER,
TWITTER_CARD_CREATOR_METADATA_PROVIDER,
Expand Down

0 comments on commit bf346cd

Please sign in to comment.