wsp-ms-core 1.0.2 → 1.0.3

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.
Files changed (35) hide show
  1. package/package.json +5 -1
  2. package/jest.config.cjs +0 -9
  3. package/src/application/contracts/EventBus.ts +0 -7
  4. package/src/application/contracts/EventBusRepository.ts +0 -10
  5. package/src/domain/contracts/DomainEntity.ts +0 -58
  6. package/src/domain/contracts/DomainError.ts +0 -9
  7. package/src/domain/contracts/DomainEvent.ts +0 -22
  8. package/src/domain/contracts/ValueObject.ts +0 -26
  9. package/src/domain/errors/FatalError.ts +0 -9
  10. package/src/domain/errors/InternalError.ts +0 -9
  11. package/src/domain/errors/UsageError.ts +0 -12
  12. package/src/domain/value-objects/Currency.ts +0 -68
  13. package/src/domain/value-objects/DateTime.ts +0 -132
  14. package/src/domain/value-objects/Email.ts +0 -24
  15. package/src/domain/value-objects/Language.ts +0 -94
  16. package/src/domain/value-objects/Price.ts +0 -54
  17. package/src/domain/value-objects/UUID.ts +0 -23
  18. package/src/index.ts +0 -43
  19. package/src/infrastructure/contracts/DatabaseConnection.ts +0 -11
  20. package/src/infrastructure/contracts/DatabaseConnector.ts +0 -8
  21. package/src/infrastructure/contracts/Logger.ts +0 -9
  22. package/src/infrastructure/errors/ErrorManager.ts +0 -93
  23. package/src/infrastructure/mysql/MysqlConnection.ts +0 -45
  24. package/src/infrastructure/mysql/MysqlConnector.ts +0 -51
  25. package/src/utils/StringVars.ts +0 -14
  26. package/test/domain/value-objects/Currency.test.ts +0 -48
  27. package/test/domain/value-objects/DateTime.test.ts +0 -32
  28. package/test/domain/value-objects/Email.test.ts +0 -38
  29. package/test/domain/value-objects/Language.test.ts +0 -76
  30. package/test/domain/value-objects/Price.test.ts +0 -96
  31. package/test/domain/value-objects/UUID.test.ts +0 -18
  32. package/test/infrastructure/errors/ErrorManager.test.ts +0 -125
  33. package/test/infrastructure/mysql/MysqlConnection.test.ts +0 -45
  34. package/tsconfig.json +0 -14
  35. package/tsup.config.ts +0 -18
@@ -1,45 +0,0 @@
1
- import { MysqlConnection } from '@infrastructure/mysql/MysqlConnection';
2
- import { PoolConnection } from 'mysql2/promise';
3
-
4
- describe('MysqlConnection transaction()', () => {
5
- it('wraps begin → commit on success', async () => {
6
- const mockConn = {
7
- beginTransaction: jest.fn(),
8
- commit: jest.fn(),
9
- rollback: jest.fn(),
10
- query: jest.fn().mockResolvedValue([[]]),
11
- release: jest.fn(),
12
- } as unknown as PoolConnection;
13
-
14
- const db = new MysqlConnection(mockConn);
15
-
16
- await db.transaction(async (c) => {
17
- await c.query('SELECT 1');
18
- });
19
-
20
- expect(mockConn.beginTransaction).toHaveBeenCalled();
21
- expect(mockConn.commit).toHaveBeenCalled();
22
- expect(mockConn.rollback).not.toHaveBeenCalled();
23
- });
24
-
25
- it('wraps begin → rollback on error', async () => {
26
- const mockConn = {
27
- beginTransaction: jest.fn(),
28
- commit: jest.fn(),
29
- rollback: jest.fn(),
30
- query: jest.fn().mockResolvedValue([[]]),
31
- release: jest.fn(),
32
- } as unknown as PoolConnection;
33
-
34
- const db = new MysqlConnection(mockConn);
35
-
36
- await expect(
37
- db.transaction(async () => {
38
- throw new Error('fail');
39
- }),
40
- ).rejects.toThrow('fail');
41
-
42
- expect(mockConn.rollback).toHaveBeenCalled();
43
- expect(mockConn.commit).not.toHaveBeenCalled();
44
- });
45
- });
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2020",
4
- "module": "commonjs",
5
- "types": ["node", "jest"],
6
- "baseUrl": "src",
7
- "paths": {
8
- "@domain/*": ["domain/*"],
9
- "@application/*": ["application/*"],
10
- "@infrastructure/*":["infrastructure/*"],
11
- "@utils/*": ["utils/*"]
12
- },
13
- }
14
- }
package/tsup.config.ts DELETED
@@ -1,18 +0,0 @@
1
- import { defineConfig } from 'tsup';
2
- import alias from 'esbuild-plugin-alias';
3
- import path from 'path';
4
-
5
- export default defineConfig({
6
- entry: ['src/index.ts'],
7
- format: ['esm', 'cjs'],
8
- dts: true,
9
- sourcemap: true,
10
- esbuildPlugins: [
11
- alias({
12
- '@domain': path.resolve(__dirname, 'src/domain'),
13
- '@application': path.resolve(__dirname, 'src/application'),
14
- '@infrastructure':path.resolve(__dirname, 'src/infrastructure'),
15
- '@utils': path.resolve(__dirname, 'src/utils'),
16
- }),
17
- ],
18
- });