Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(): marked apis public #1466

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/config-host.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import {
} from './config.constants';
import { ConfigService } from './config.service';


/**
* @publicApi
*/
@Global()
@Module({
providers: [
Expand Down
3 changes: 3 additions & 0 deletions lib/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ import { createConfigProvider } from './utils/create-config-factory.util';
import { getRegistrationToken } from './utils/get-registration-token.util';
import { mergeConfigObject } from './utils/merge-configs.util';

/**
* @publicApi
*/
@Module({
imports: [ConfigHostModule],
providers: [
Expand Down
8 changes: 8 additions & 0 deletions lib/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ type ValidatedResult<
T,
> = WasValidated extends true ? T : T | undefined;


/**
* @publicApi
*/
export interface ConfigGetOptions {
/**
* If present, "get" method will try to automatically
Expand All @@ -31,6 +35,10 @@ export interface ConfigGetOptions {

type KeyOf<T> = keyof T extends never ? string : keyof T;


/**
* @publicApi
*/
@Injectable()
export class ConfigService<
K = Record<string, unknown>,
Expand Down
3 changes: 3 additions & 0 deletions lib/interfaces/config-module-options.interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { ConfigFactory } from './config-factory.interface';
import { DotenvExpandOptions } from 'dotenv-expand'

/**
* @publicApi
*/
export interface ConfigModuleOptions {
/**
* If "true", values from the process.env object will be cached in the memory.
Expand Down
3 changes: 3 additions & 0 deletions lib/types/config-object.type.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
/**
* @publicApi
*/
export type ConfigObject = Record<string, any>;
3 changes: 3 additions & 0 deletions lib/types/config.type.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export type ConfigType<T extends (...args: any) => any> = T extends (
...args: any
) => infer ReturnVal
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/create-config-factory.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { ConfigFactory } from '../interfaces';
import { getConfigToken } from './get-config-token.util';
import { ConfigFactoryKeyHost } from './register-as.util';

/**
* @publicApi
*/
export function createConfigProvider(
factory: ConfigFactory & ConfigFactoryKeyHost,
): FactoryProvider {
Expand Down
3 changes: 3 additions & 0 deletions lib/utils/get-config-token.util.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/**
* @publicApi
*/
export function getConfigToken(token: string) {
return `CONFIGURATION(${token})`;
}
3 changes: 3 additions & 0 deletions lib/utils/get-registration-token.util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { PARTIAL_CONFIGURATION_KEY } from '../config.constants';

/**
* @publicApi
*/
export function getRegistrationToken(config: Record<string, any>) {
return config[PARTIAL_CONFIGURATION_KEY];
}
3 changes: 3 additions & 0 deletions lib/utils/merge-configs.util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import set from 'lodash/set';

/**
* @publicApi
*/
export function mergeConfigObject(
host: Record<string, any>,
partial: Record<string, any>,
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/register-as.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { ConfigFactory } from '../interfaces';
import { ConfigObject } from '../types';
import { getConfigToken } from './get-config-token.util';

/**
* @publicApi
*/
export interface ConfigFactoryKeyHost<T = unknown> {
KEY: string;
asProvider(): {
Expand All @@ -18,6 +21,8 @@ export interface ConfigFactoryKeyHost<T = unknown> {
}

/**
* @publicApi
*
* Registers the configuration object behind a specified token.
*/
export function registerAs<
Expand Down