diff --git a/src/application/create-application.js b/src/application/create-application.js index 8f78a70..7634731 100644 --- a/src/application/create-application.js +++ b/src/application/create-application.js @@ -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, diff --git a/src/application/ports/clock-port.js b/src/application/ports/clock-port.js index 18f7b75..353d5a3 100644 --- a/src/application/ports/clock-port.js +++ b/src/application/ports/clock-port.js @@ -5,6 +5,7 @@ * }} ClockPort */ +/** @type {ClockPort} */ export const systemClock = Object.freeze({ now: () => Date.now(), sleep(milliseconds, signal) { diff --git a/src/application/ports/resource-ports.js b/src/application/ports/resource-ports.js index 1290758..6a07788 100644 --- a/src/application/ports/resource-ports.js +++ b/src/application/ports/resource-ports.js @@ -22,7 +22,7 @@ /** * @template Value * @typedef {{ ok: true, value: Value, meta?: Record } | - * { ok: false, error: import("../../contracts/errors.js").ApiFailure }} Result + * { ok: false, error: unknown }} Result */ export {};