fix: make application port contracts checkJs-safe

This commit is contained in:
donghyeon-ka
2026-07-25 20:40:21 +09:00
parent 49b20bd557
commit d7480cbafd
3 changed files with 20 additions and 3 deletions
+18 -2
View File
@@ -12,10 +12,26 @@
* }} ports
*/
export function createApplication(ports) {
/**
* @param {unknown} query
* @param {import("./ports/resource-ports.js").RequestContext} [context]
*/
function queryResources(query, context) {
return ports.resources.query.execute(query, context);
}
/**
* @param {unknown} command
* @param {import("./ports/resource-ports.js").RequestContext} [context]
*/
function commandResources(command, context) {
return ports.resources.command.execute(command, context);
}
return Object.freeze({
resources: Object.freeze({
query: (query, context) => ports.resources.query.execute(query, context),
command: (command, context) => ports.resources.command.execute(command, context),
query: queryResources,
command: commandResources,
}),
cache: ports.cache,
storage: ports.storage,