Skip to content

Commit

Permalink
Merge pull request #1466 from Tony133/chore/marked-apis-public
Browse files Browse the repository at this point in the history
chore(): marked apis public
  • Loading branch information
kamilmysliwiec authored Sep 18, 2023
2 parents e54ba02 + 12053da commit dadf916
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 0 deletions.
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

0 comments on commit dadf916

Please sign in to comment.