Skip to content

Commit

Permalink
feat(core/transform): renames routes as route
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Oct 18, 2019
1 parent 9c684c4 commit 186d38e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/generate/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
CollectionTreeImplementation
} from '~/types';
import { typings } from './typings';
import { replace, ReplaceTransformData, normalize, routes } from '~/transform';
import { replace, ReplaceTransformData, normalize, route } from '~/transform';
import { isElementService, isServiceSubscription } from '~/inspect';

export interface ClientGenerateOptions {
Expand Down Expand Up @@ -69,7 +69,7 @@ export async function client<T extends CollectionTree>(
const [start, end] = [0, 1].map(() =>
(String(Math.random()) + String(Math.random())).replace(/\./g, '')
);
const { tree } = routes(normalize(source), {
const { tree } = route(normalize(source), {
children: true,
map(service): any {
let resolve = '';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/transform/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './replace';
export * from './normalize';
export * from './as';
export * from './routes';
export * from './route';
2 changes: 1 addition & 1 deletion packages/core/src/transform/normalize/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export function normalizeErrors(
return result;
}

export function checkServiceType(kind: string, type: Type) {
export function checkServiceType(kind: string, type: Type): void {
if (type.kind !== kind) {
throw Error(`Invalid inline type kind.`);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import {
import { normalize } from './normalize';
import { replace, ReplaceTransformData } from './replace';

export interface RoutesTransform<T extends CollectionTree> {
export interface RouteTransform<T extends CollectionTree> {
collection: GenericCollection<T>;
routes: ServicesRoutes<T>;
tree: ServicesTree<T>;
}

export interface RoutesTransformOptions<
export interface RouteTransformOptions<
T extends CollectionTree = CollectionTree
> {
/**
Expand All @@ -42,10 +42,10 @@ export interface RoutesTransformOptions<
/**
* Given a collection, it will return an object with *values* of all services, and *keys* of their full route.
*/
export function routes<T extends CollectionTree>(
export function route<T extends CollectionTree>(
collection: T,
options?: RoutesTransformOptions<T>
): RoutesTransform<T> {
options?: RouteTransformOptions<T>
): RouteTransform<T> {
const opts = Object.assign(
{
children: true,
Expand Down

0 comments on commit 186d38e

Please sign in to comment.