feat: define clean architecture layers and ports
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Application facade factory. Concrete dependencies are supplied by bootstrap.
|
||||
*
|
||||
* @param {{
|
||||
* resources: {
|
||||
* query: import("./ports/resource-ports.js").ResourceQueryPort<unknown, unknown>,
|
||||
* command: import("./ports/resource-ports.js").ResourceCommandPort<unknown, unknown>
|
||||
* },
|
||||
* cache: import("./ports/query-cache-port.js").QueryCachePort,
|
||||
* storage: import("./ports/storage-port.js").StoragePort,
|
||||
* telemetry: import("./ports/telemetry-port.js").TelemetryPort
|
||||
* }} ports
|
||||
*/
|
||||
export function createApplication(ports) {
|
||||
return Object.freeze({
|
||||
resources: Object.freeze({
|
||||
query: (query, context) => ports.resources.query.execute(query, context),
|
||||
command: (command, context) => ports.resources.command.execute(command, context),
|
||||
}),
|
||||
cache: ports.cache,
|
||||
storage: ports.storage,
|
||||
telemetry: ports.telemetry,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user