Skip to content

Commit

Permalink
Add code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Feb 1, 2024
1 parent cd90d60 commit 7fe6871
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const getContentClientFactory =
};

return {
/**
* Client getter to interact with the registered content type.
*/
getForRequest,
};
};
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/content_management/server/core/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export interface CoreApi {
crud: <T = unknown>(contentType: string) => ContentCrud<T>;
/** Content management event bus */
eventBus: EventBus;
/** Client getters to interact with registered content types. */
contentClient: {
/** Client getter to interact with registered content types for the current HTTP request. */
getForRequest(deps: GetContentClientForRequestDependencies): {
for: <T = unknown>(contentTypeId: string, version?: Version) => IContentClient<T>;
msearch(args: MSearchIn): Promise<MSearchOut>;
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/content_management/server/core/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ export class ContentRegistry {
this.types.set(contentType.id, contentType);

const contentClient = getContentClientFactory({ contentRegistry: this })(contentType.id);
return { contentClient };

return {
/**
* Client getters to interact with the registered content type.
*/
contentClient,
};
}

getContentType(id: string): ContentType {
Expand Down

0 comments on commit 7fe6871

Please sign in to comment.