@ddd-ts-kit/di 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,9 @@ import type { Resolve } from '../wiring/resolve.js';
4
4
  * The unit of work is resolved at each command, not when the bus is built: the application
5
5
  * resolves the bus at creation to attach the handlers, and that must not open a database. The
6
6
  * error reporting comes first, outside of it, so a commit that fails is reported too. What
7
- * observes the use cases comes after the guard: a refused command never started.
7
+ * observes the use cases comes after the guard: a refused command never started. The file a
8
+ * command carries is staged last before the unit of work, out of any transaction; the staging is
9
+ * resolved only for such a command.
8
10
  */
9
11
  export declare function transactionalCommandBus(resolve: Resolve, observed?: BusMiddleware): InMemoryCommandBus;
10
12
  //# sourceMappingURL=transactional-command-bus.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactional-command-bus.d.ts","sourceRoot":"","sources":["../../src/kernel/transactional-command-bus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAoC,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAE9G,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,kBAAkB,CAQtG"}
1
+ {"version":3,"file":"transactional-command-bus.d.ts","sourceRoot":"","sources":["../../src/kernel/transactional-command-bus.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,EAIlB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,aAAa,GAAG,kBAAkB,CAUtG"}
@@ -1,17 +1,21 @@
1
- import { InMemoryCommandBus, UnitOfWork, unitOfWorkMiddleware } from '@ddd-ts-kit/kernel';
1
+ import { FileKeys, FileStaging, InMemoryCommandBus, UnitOfWork, fileUploadsMiddleware, unitOfWorkMiddleware, } from '@ddd-ts-kit/kernel';
2
2
  import { useCaseGuardMiddleware } from '../authorization/use-case-guard-middleware.js';
3
3
  import { reportedFailures } from './reported-failures.js';
4
4
  /**
5
5
  * The unit of work is resolved at each command, not when the bus is built: the application
6
6
  * resolves the bus at creation to attach the handlers, and that must not open a database. The
7
7
  * error reporting comes first, outside of it, so a commit that fails is reported too. What
8
- * observes the use cases comes after the guard: a refused command never started.
8
+ * observes the use cases comes after the guard: a refused command never started. The file a
9
+ * command carries is staged last before the unit of work, out of any transaction; the staging is
10
+ * resolved only for such a command.
9
11
  */
10
12
  export function transactionalCommandBus(resolve, observed) {
11
13
  const bus = new InMemoryCommandBus().use(reportedFailures(resolve)).use(useCaseGuardMiddleware(resolve));
12
14
  if (observed !== undefined) {
13
15
  bus.use(observed);
14
16
  }
15
- return bus.use(unitOfWorkMiddleware({ run: (work) => resolve(UnitOfWork).run(work) }));
17
+ return bus
18
+ .use(fileUploadsMiddleware(() => ({ keys: resolve(FileKeys), staging: resolve(FileStaging) })))
19
+ .use(unitOfWorkMiddleware({ run: (work) => resolve(UnitOfWork).run(work) }));
16
20
  }
17
21
  //# sourceMappingURL=transactional-command-bus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transactional-command-bus.js","sourceRoot":"","sources":["../../src/kernel/transactional-command-bus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,oBAAoB,EAAsB,MAAM,oBAAoB,CAAC;AAC9G,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAgB,EAAE,QAAwB;IAChF,MAAM,GAAG,GAAG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,CAAC,CAAC;SAC9F,GAAG,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACjF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ddd-ts-kit/di",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Port classes and context modules on top of tsyringe, for projects without a heavy framework.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,8 +30,8 @@
30
30
  "dist"
31
31
  ],
32
32
  "dependencies": {
33
- "@ddd-ts-kit/kernel": "0.8.0",
34
- "@ddd-ts-kit/scheduling": "0.8.0"
33
+ "@ddd-ts-kit/kernel": "0.9.0",
34
+ "@ddd-ts-kit/scheduling": "0.9.0"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "tsyringe": "^4.10.0",