@nx-ddd/common 19.0.0-preview.8 → 19.1.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.
- package/domain/index.d.ts +117 -2
- package/fesm2022/nx-ddd-common-domain.mjs +262 -0
- package/fesm2022/nx-ddd-common-domain.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium-impl.mjs +89 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium-impl.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium-token.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium-token.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-chromium.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-cloud-storage.mjs +46 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-cloud-storage.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-browser.mjs +12 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-browser.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-server.mjs +13 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-server.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-token.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto-token.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-crypto.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin-impl.mjs +16 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin-impl.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin-token.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin-token.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin.mjs +13 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-openai-impl.mjs +37 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-openai-impl.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-openai-token.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-openai-token.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-openai.mjs +14 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-openai.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe-impl.mjs +33 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe-impl.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe-token.mjs +10 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe-token.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe.mjs +13 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-stripe.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs +15 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs +21 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-token.mjs +11 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket-token.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket.mjs +11 -0
- package/fesm2022/nx-ddd-common-infrastructure-externals-websocket.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-logging.mjs +129 -0
- package/fesm2022/nx-ddd-common-infrastructure-logging.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure-queries.mjs +54 -0
- package/fesm2022/nx-ddd-common-infrastructure-queries.mjs.map +1 -0
- package/fesm2022/nx-ddd-common-infrastructure.mjs +31 -0
- package/fesm2022/nx-ddd-common-infrastructure.mjs.map +1 -0
- package/fesm2022/nx-ddd-common.mjs +58 -0
- package/fesm2022/nx-ddd-common.mjs.map +1 -0
- package/index.d.ts +8 -1
- package/infrastructure/externals/chromium/impl/index.d.ts +21 -0
- package/infrastructure/externals/chromium/index.d.ts +6 -1
- package/infrastructure/externals/chromium/token/index.d.ts +5 -0
- package/infrastructure/externals/cloud-storage/index.d.ts +19 -1
- package/infrastructure/externals/crypto/impl/browser/index.d.ts +5 -0
- package/infrastructure/externals/crypto/impl/server/index.d.ts +5 -0
- package/infrastructure/externals/crypto/index.d.ts +6 -0
- package/infrastructure/externals/crypto/token/index.d.ts +6 -0
- package/infrastructure/externals/firebase-admin/impl/index.d.ts +10 -0
- package/infrastructure/externals/firebase-admin/index.d.ts +5 -1
- package/infrastructure/externals/firebase-admin/token/index.d.ts +12 -0
- package/infrastructure/externals/openai/impl/index.d.ts +18 -0
- package/infrastructure/externals/openai/index.d.ts +7 -2
- package/infrastructure/externals/openai/token/index.d.ts +5 -0
- package/infrastructure/externals/stripe/impl/index.d.ts +28 -0
- package/infrastructure/externals/stripe/index.d.ts +5 -2
- package/infrastructure/externals/stripe/token/index.d.ts +5 -0
- package/infrastructure/externals/websocket/impl/browser/index.d.ts +5 -0
- package/infrastructure/externals/websocket/impl/server/index.d.ts +5 -0
- package/infrastructure/externals/websocket/index.d.ts +13 -0
- package/infrastructure/externals/websocket/token/index.d.ts +13 -0
- package/infrastructure/index.d.ts +37 -3
- package/infrastructure/logging/index.d.ts +114 -0
- package/infrastructure/queries/index.d.ts +50 -1
- package/package.json +118 -27
- package/README.md +0 -40
- package/domain/index.js +0 -6
- package/domain/index.js.map +0 -1
- package/domain/models.d.ts +0 -70
- package/domain/models.js +0 -129
- package/domain/models.js.map +0 -1
- package/domain/repository.d.ts +0 -11
- package/domain/repository.js +0 -27
- package/domain/repository.js.map +0 -1
- package/domain/resolver.d.ts +0 -8
- package/domain/resolver.js +0 -25
- package/domain/resolver.js.map +0 -1
- package/index.js +0 -5
- package/index.js.map +0 -1
- package/infrastructure/converter.d.ts +0 -4
- package/infrastructure/converter.js +0 -7
- package/infrastructure/converter.js.map +0 -1
- package/infrastructure/externals/backup/backup.service.d.ts +0 -24
- package/infrastructure/externals/backup/backup.service.js +0 -67
- package/infrastructure/externals/backup/backup.service.js.map +0 -1
- package/infrastructure/externals/backup/index.d.ts +0 -1
- package/infrastructure/externals/backup/index.js +0 -5
- package/infrastructure/externals/backup/index.js.map +0 -1
- package/infrastructure/externals/chromium/chromium.service.impl.d.ts +0 -18
- package/infrastructure/externals/chromium/chromium.service.impl.js +0 -58
- package/infrastructure/externals/chromium/chromium.service.impl.js.map +0 -1
- package/infrastructure/externals/chromium/chromuim.service.d.ts +0 -9
- package/infrastructure/externals/chromium/chromuim.service.js +0 -6
- package/infrastructure/externals/chromium/chromuim.service.js.map +0 -1
- package/infrastructure/externals/chromium/index.js +0 -5
- package/infrastructure/externals/chromium/index.js.map +0 -1
- package/infrastructure/externals/cloud-storage/cloud-storage.service.d.ts +0 -13
- package/infrastructure/externals/cloud-storage/cloud-storage.service.js +0 -43
- package/infrastructure/externals/cloud-storage/cloud-storage.service.js.map +0 -1
- package/infrastructure/externals/cloud-storage/index.js +0 -5
- package/infrastructure/externals/cloud-storage/index.js.map +0 -1
- package/infrastructure/externals/firebase-admin/firebase-admin.service.d.ts +0 -9
- package/infrastructure/externals/firebase-admin/firebase-admin.service.impl.d.ts +0 -5
- package/infrastructure/externals/firebase-admin/firebase-admin.service.impl.js +0 -13
- package/infrastructure/externals/firebase-admin/firebase-admin.service.impl.js.map +0 -1
- package/infrastructure/externals/firebase-admin/firebase-admin.service.js +0 -11
- package/infrastructure/externals/firebase-admin/firebase-admin.service.js.map +0 -1
- package/infrastructure/externals/firebase-admin/index.js +0 -5
- package/infrastructure/externals/firebase-admin/index.js.map +0 -1
- package/infrastructure/externals/openai/index.js +0 -6
- package/infrastructure/externals/openai/index.js.map +0 -1
- package/infrastructure/externals/openai/open-ai.config.d.ts +0 -7
- package/infrastructure/externals/openai/open-ai.config.js +0 -19
- package/infrastructure/externals/openai/open-ai.config.js.map +0 -1
- package/infrastructure/externals/openai/open-ai.service.d.ts +0 -4
- package/infrastructure/externals/openai/open-ai.service.impl.d.ts +0 -4
- package/infrastructure/externals/openai/open-ai.service.impl.js +0 -18
- package/infrastructure/externals/openai/open-ai.service.impl.js.map +0 -1
- package/infrastructure/externals/openai/open-ai.service.js +0 -11
- package/infrastructure/externals/openai/open-ai.service.js.map +0 -1
- package/infrastructure/externals/stripe/index.js +0 -6
- package/infrastructure/externals/stripe/index.js.map +0 -1
- package/infrastructure/externals/stripe/stripe.config.d.ts +0 -17
- package/infrastructure/externals/stripe/stripe.config.js +0 -15
- package/infrastructure/externals/stripe/stripe.config.js.map +0 -1
- package/infrastructure/externals/stripe/stripe.service.d.ts +0 -4
- package/infrastructure/externals/stripe/stripe.service.impl.d.ts +0 -5
- package/infrastructure/externals/stripe/stripe.service.impl.js +0 -44
- package/infrastructure/externals/stripe/stripe.service.impl.js.map +0 -1
- package/infrastructure/externals/stripe/stripe.service.js +0 -11
- package/infrastructure/externals/stripe/stripe.service.js.map +0 -1
- package/infrastructure/index.js +0 -7
- package/infrastructure/index.js.map +0 -1
- package/infrastructure/queries/cached-query.d.ts +0 -45
- package/infrastructure/queries/cached-query.js +0 -47
- package/infrastructure/queries/cached-query.js.map +0 -1
- package/infrastructure/queries/index.js +0 -5
- package/infrastructure/queries/index.js.map +0 -1
- package/infrastructure/repo/excel/excel.converter.d.ts +0 -29
- package/infrastructure/repo/excel/excel.converter.js +0 -71
- package/infrastructure/repo/excel/excel.converter.js.map +0 -1
- package/infrastructure/repo/excel/excel.decorators.d.ts +0 -29
- package/infrastructure/repo/excel/excel.decorators.js +0 -55
- package/infrastructure/repo/excel/excel.decorators.js.map +0 -1
- package/infrastructure/repo/excel/excel.repository.d.ts +0 -14
- package/infrastructure/repo/excel/excel.repository.js +0 -32
- package/infrastructure/repo/excel/excel.repository.js.map +0 -1
- package/infrastructure/repo/excel/excel.service.impl.d.ts +0 -17
- package/infrastructure/repo/excel/excel.service.impl.js +0 -61
- package/infrastructure/repo/excel/excel.service.impl.js.map +0 -1
- package/infrastructure/repo/excel/index.d.ts +0 -3
- package/infrastructure/repo/excel/index.js +0 -7
- package/infrastructure/repo/excel/index.js.map +0 -1
- package/infrastructure/synchronizer.d.ts +0 -16
- package/infrastructure/synchronizer.js +0 -18
- package/infrastructure/synchronizer.js.map +0 -1
- package/utilities/generate-id.d.ts +0 -1
- package/utilities/generate-id.js +0 -23
- package/utilities/generate-id.js.map +0 -1
- package/utilities/index.d.ts +0 -2
- package/utilities/index.js +0 -6
- package/utilities/index.js.map +0 -1
- package/utilities/message.d.ts +0 -1
- package/utilities/message.js +0 -26
- package/utilities/message.js.map +0 -1
- package/utilities/to-object.d.ts +0 -1
- package/utilities/to-object.js +0 -14
- package/utilities/to-object.js.map +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
2
|
+
|
|
3
|
+
declare const WEBSOCKET: _nx_ddd_core.DiToken<{
|
|
4
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
5
|
+
prototype: WebSocket;
|
|
6
|
+
readonly CONNECTING: 0;
|
|
7
|
+
readonly OPEN: 1;
|
|
8
|
+
readonly CLOSING: 2;
|
|
9
|
+
readonly CLOSED: 3;
|
|
10
|
+
}>;
|
|
11
|
+
declare const WEBSOCKET_SERVER: _nx_ddd_core.DiToken<any>;
|
|
12
|
+
|
|
13
|
+
export { WEBSOCKET, WEBSOCKET_SERVER };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
2
|
+
|
|
3
|
+
declare const WEBSOCKET: _nx_ddd_core.DiToken<{
|
|
4
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
5
|
+
prototype: WebSocket;
|
|
6
|
+
readonly CONNECTING: 0;
|
|
7
|
+
readonly OPEN: 1;
|
|
8
|
+
readonly CLOSING: 2;
|
|
9
|
+
readonly CLOSED: 3;
|
|
10
|
+
}>;
|
|
11
|
+
declare const WEBSOCKET_SERVER: _nx_ddd_core.DiToken<any>;
|
|
12
|
+
|
|
13
|
+
export { WEBSOCKET, WEBSOCKET_SERVER };
|
|
@@ -1,3 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
4
|
+
import { webcrypto } from 'crypto';
|
|
5
|
+
|
|
6
|
+
declare abstract class Converter<E> {
|
|
7
|
+
abstract fromRecord(record: object): E;
|
|
8
|
+
abstract toRecord(entity: E): object;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface RepositorySynchronizerConfig<T> {
|
|
12
|
+
listChangesAfter: (updatedAt: dayjs.Dayjs) => Observable<T[]>;
|
|
13
|
+
lastUpdatedAtChanges: () => Observable<dayjs.Dayjs>;
|
|
14
|
+
saveMany: (entities: T[]) => void;
|
|
15
|
+
srcCount: () => Observable<number>;
|
|
16
|
+
destCount: () => Observable<number>;
|
|
17
|
+
}
|
|
18
|
+
declare class RepositorySynchronizer<T> {
|
|
19
|
+
private config;
|
|
20
|
+
constructor(config: RepositorySynchronizerConfig<T>);
|
|
21
|
+
readonly progress$: Observable<number>;
|
|
22
|
+
sync(): Observable<any[]>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
declare const CRYPTO: _nx_ddd_core.DiToken<webcrypto.Crypto>;
|
|
26
|
+
|
|
27
|
+
declare const WEBSOCKET: _nx_ddd_core.DiToken<{
|
|
28
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
29
|
+
prototype: WebSocket;
|
|
30
|
+
readonly CONNECTING: 0;
|
|
31
|
+
readonly OPEN: 1;
|
|
32
|
+
readonly CLOSING: 2;
|
|
33
|
+
readonly CLOSED: 3;
|
|
34
|
+
}>;
|
|
35
|
+
declare const WEBSOCKET_SERVER: _nx_ddd_core.DiToken<any>;
|
|
36
|
+
|
|
37
|
+
export { CRYPTO, Converter, RepositorySynchronizer, WEBSOCKET, WEBSOCKET_SERVER };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Provider, EnvironmentProviders } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* LoggingService interfaces
|
|
6
|
+
*
|
|
7
|
+
* Provides structured logging with different log levels and file output
|
|
8
|
+
*/
|
|
9
|
+
declare enum LogLevel {
|
|
10
|
+
DEBUG = 0,
|
|
11
|
+
INFO = 1,
|
|
12
|
+
WARN = 2,
|
|
13
|
+
ERROR = 3,
|
|
14
|
+
FATAL = 4
|
|
15
|
+
}
|
|
16
|
+
interface LogContext {
|
|
17
|
+
component?: string;
|
|
18
|
+
sessionId?: string;
|
|
19
|
+
clientId?: string;
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}
|
|
22
|
+
interface ILoggingService {
|
|
23
|
+
/**
|
|
24
|
+
* Log debug message (for development/troubleshooting)
|
|
25
|
+
*/
|
|
26
|
+
debug(message: string, context?: LogContext): void;
|
|
27
|
+
/**
|
|
28
|
+
* Log informational message
|
|
29
|
+
*/
|
|
30
|
+
info(message: string, context?: LogContext): void;
|
|
31
|
+
/**
|
|
32
|
+
* Log warning message
|
|
33
|
+
*/
|
|
34
|
+
warn(message: string, context?: LogContext): void;
|
|
35
|
+
/**
|
|
36
|
+
* Log error message
|
|
37
|
+
*/
|
|
38
|
+
error(message: string, error?: Error, context?: LogContext): void;
|
|
39
|
+
/**
|
|
40
|
+
* Log fatal error message (application cannot continue)
|
|
41
|
+
*/
|
|
42
|
+
fatal(message: string, error?: Error, context?: LogContext): void;
|
|
43
|
+
/**
|
|
44
|
+
* Set log level filter
|
|
45
|
+
*/
|
|
46
|
+
setLogLevel(level: LogLevel): void;
|
|
47
|
+
/**
|
|
48
|
+
* Set component name for this logger
|
|
49
|
+
*/
|
|
50
|
+
setComponent(component: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Close logger and flush buffers
|
|
53
|
+
*/
|
|
54
|
+
close(): void;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Base Logger class for multi-provider logging system
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
declare const LOGGER: InjectionToken<BaseLogger>;
|
|
62
|
+
declare abstract class BaseLogger {
|
|
63
|
+
/**
|
|
64
|
+
* Main log method that all loggers must implement
|
|
65
|
+
*/
|
|
66
|
+
abstract log(level: LogLevel, message: string, context?: LogContext, error?: Error): void;
|
|
67
|
+
/**
|
|
68
|
+
* Close logger and flush buffers
|
|
69
|
+
*/
|
|
70
|
+
abstract close(): void;
|
|
71
|
+
debug(message: string, context?: LogContext): void;
|
|
72
|
+
info(message: string, context?: LogContext): void;
|
|
73
|
+
warn(message: string, context?: LogContext): void;
|
|
74
|
+
error(message: string, error?: Error, context?: LogContext): void;
|
|
75
|
+
fatal(message: string, error?: Error, context?: LogContext): void;
|
|
76
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BaseLogger, never>;
|
|
77
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<BaseLogger>;
|
|
78
|
+
}
|
|
79
|
+
declare function provideLogger(useFactory: () => BaseLogger): Provider;
|
|
80
|
+
|
|
81
|
+
declare const LOGGING_SERVICE: InjectionToken<ILoggingService>;
|
|
82
|
+
interface Logger {
|
|
83
|
+
log: (...args: Parameters<typeof console['log']>) => void;
|
|
84
|
+
debug: (...args: Parameters<typeof console['debug']>) => void;
|
|
85
|
+
info: (...args: Parameters<typeof console['info']>) => void;
|
|
86
|
+
warn: (...args: Parameters<typeof console['warn']>) => void;
|
|
87
|
+
error: (...args: Parameters<typeof console['error']>) => void;
|
|
88
|
+
}
|
|
89
|
+
declare class LoggingService implements ILoggingService {
|
|
90
|
+
private loggers;
|
|
91
|
+
getLogger(name: string): Logger;
|
|
92
|
+
log(level: LogLevel, message: string, context?: LogContext, error?: Error): void;
|
|
93
|
+
close(): void;
|
|
94
|
+
debug(message: string, context?: LogContext): void;
|
|
95
|
+
info(message: string, context?: LogContext): void;
|
|
96
|
+
warn(message: string, context?: LogContext): void;
|
|
97
|
+
error(message: string, error?: Error, context?: LogContext): void;
|
|
98
|
+
fatal(message: string, error?: Error, context?: LogContext): void;
|
|
99
|
+
setLogLevel(level: LogLevel): void;
|
|
100
|
+
setComponent(component: string): void;
|
|
101
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoggingService, never>;
|
|
102
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LoggingService>;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
declare let globalLogging: LoggingService | null;
|
|
106
|
+
|
|
107
|
+
declare function setGlobalLogging(logging: LoggingService): void;
|
|
108
|
+
declare function getGlobalLogging(): LoggingService | null;
|
|
109
|
+
declare function createLogger(name: any): ILoggingService;
|
|
110
|
+
declare function getLogger(name: string): Logger;
|
|
111
|
+
declare function provideGlobalLogging(): EnvironmentProviders;
|
|
112
|
+
|
|
113
|
+
export { BaseLogger, LOGGER, LOGGING_SERVICE, LogLevel, LoggingService, createLogger, getGlobalLogging, getLogger, globalLogging as logging, provideGlobalLogging, provideLogger, setGlobalLogging };
|
|
114
|
+
export type { ILoggingService, LogContext, Logger };
|
|
@@ -1 +1,50 @@
|
|
|
1
|
-
|
|
1
|
+
import { RepositorySynchronizer } from '@nx-ddd/common/infrastructure';
|
|
2
|
+
import dayjs from 'dayjs';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
import * as i0 from '@angular/core';
|
|
5
|
+
|
|
6
|
+
declare function getLastUpdatedAt<T extends {
|
|
7
|
+
updatedAt: dayjs.Dayjs;
|
|
8
|
+
}>(items: T[]): dayjs.Dayjs;
|
|
9
|
+
interface SrcRepository<T extends {
|
|
10
|
+
updatedAt: dayjs.Dayjs;
|
|
11
|
+
}> {
|
|
12
|
+
count: () => Promise<number>;
|
|
13
|
+
query: {
|
|
14
|
+
listChangesAfter: (updatedAt: dayjs.Dayjs, { limit }: {
|
|
15
|
+
limit?: number;
|
|
16
|
+
}) => Observable<T[]>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface DestRepository<T extends {
|
|
20
|
+
updatedAt: dayjs.Dayjs;
|
|
21
|
+
}> {
|
|
22
|
+
listChanges: () => Observable<T[]>;
|
|
23
|
+
saveMany: (items: T[]) => void;
|
|
24
|
+
count: () => Observable<number>;
|
|
25
|
+
}
|
|
26
|
+
declare class CachedQuery<T extends {
|
|
27
|
+
updatedAt: dayjs.Dayjs;
|
|
28
|
+
}> {
|
|
29
|
+
protected repository: SrcRepository<T>;
|
|
30
|
+
protected indexedDb: DestRepository<T>;
|
|
31
|
+
protected options: {
|
|
32
|
+
debounceTime?: number;
|
|
33
|
+
chunkSize?: number;
|
|
34
|
+
};
|
|
35
|
+
constructor(repository: SrcRepository<T>, indexedDb: DestRepository<T>, options?: {
|
|
36
|
+
debounceTime?: number;
|
|
37
|
+
chunkSize?: number;
|
|
38
|
+
});
|
|
39
|
+
readonly synchronizer: RepositorySynchronizer<T>;
|
|
40
|
+
list(): Observable<T[]>;
|
|
41
|
+
}
|
|
42
|
+
declare class CachedQueryFactory {
|
|
43
|
+
create<T extends {
|
|
44
|
+
updatedAt: dayjs.Dayjs;
|
|
45
|
+
}>(repository: SrcRepository<T>, indexedDb: DestRepository<T>): CachedQuery<T>;
|
|
46
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CachedQueryFactory, never>;
|
|
47
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<CachedQueryFactory>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { CachedQuery, CachedQueryFactory, getLastUpdatedAt };
|
package/package.json
CHANGED
|
@@ -1,32 +1,123 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/common",
|
|
3
|
-
"version": "19.
|
|
4
|
-
"
|
|
5
|
-
"types": "./index.d.ts",
|
|
6
|
-
"homepage": "https://github.com/xx-machina/plaform/tree/main/packages/@nx-ddd/common",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/xx-machina/plaform.git"
|
|
10
|
-
},
|
|
3
|
+
"version": "19.1.0",
|
|
4
|
+
"license": "MIT",
|
|
11
5
|
"peerDependencies": {
|
|
12
|
-
"@
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
6
|
+
"@nx-ddd/core": "19.1.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"module": "fesm2022/nx-ddd-common.mjs",
|
|
12
|
+
"typings": "index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": {
|
|
15
|
+
"default": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./fesm2022/nx-ddd-common.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./domain": {
|
|
22
|
+
"types": "./domain/index.d.ts",
|
|
23
|
+
"default": "./fesm2022/nx-ddd-common-domain.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./infrastructure": {
|
|
26
|
+
"types": "./infrastructure/index.d.ts",
|
|
27
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./infrastructure/logging": {
|
|
30
|
+
"types": "./infrastructure/logging/index.d.ts",
|
|
31
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-logging.mjs"
|
|
32
|
+
},
|
|
33
|
+
"./infrastructure/queries": {
|
|
34
|
+
"types": "./infrastructure/queries/index.d.ts",
|
|
35
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-queries.mjs"
|
|
36
|
+
},
|
|
37
|
+
"./infrastructure/externals/chromium": {
|
|
38
|
+
"types": "./infrastructure/externals/chromium/index.d.ts",
|
|
39
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-chromium.mjs"
|
|
40
|
+
},
|
|
41
|
+
"./infrastructure/externals/cloud-storage": {
|
|
42
|
+
"types": "./infrastructure/externals/cloud-storage/index.d.ts",
|
|
43
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-cloud-storage.mjs"
|
|
44
|
+
},
|
|
45
|
+
"./infrastructure/externals/crypto": {
|
|
46
|
+
"types": "./infrastructure/externals/crypto/index.d.ts",
|
|
47
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-crypto.mjs"
|
|
48
|
+
},
|
|
49
|
+
"./infrastructure/externals/firebase-admin": {
|
|
50
|
+
"types": "./infrastructure/externals/firebase-admin/index.d.ts",
|
|
51
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin.mjs"
|
|
52
|
+
},
|
|
53
|
+
"./infrastructure/externals/openai": {
|
|
54
|
+
"types": "./infrastructure/externals/openai/index.d.ts",
|
|
55
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-openai.mjs"
|
|
56
|
+
},
|
|
57
|
+
"./infrastructure/externals/stripe": {
|
|
58
|
+
"types": "./infrastructure/externals/stripe/index.d.ts",
|
|
59
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-stripe.mjs"
|
|
60
|
+
},
|
|
61
|
+
"./infrastructure/externals/websocket": {
|
|
62
|
+
"types": "./infrastructure/externals/websocket/index.d.ts",
|
|
63
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-websocket.mjs"
|
|
64
|
+
},
|
|
65
|
+
"./infrastructure/externals/chromium/impl": {
|
|
66
|
+
"types": "./infrastructure/externals/chromium/impl/index.d.ts",
|
|
67
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-chromium-impl.mjs"
|
|
68
|
+
},
|
|
69
|
+
"./infrastructure/externals/chromium/token": {
|
|
70
|
+
"types": "./infrastructure/externals/chromium/token/index.d.ts",
|
|
71
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-chromium-token.mjs"
|
|
72
|
+
},
|
|
73
|
+
"./infrastructure/externals/crypto/token": {
|
|
74
|
+
"types": "./infrastructure/externals/crypto/token/index.d.ts",
|
|
75
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-crypto-token.mjs"
|
|
76
|
+
},
|
|
77
|
+
"./infrastructure/externals/firebase-admin/impl": {
|
|
78
|
+
"types": "./infrastructure/externals/firebase-admin/impl/index.d.ts",
|
|
79
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin-impl.mjs"
|
|
80
|
+
},
|
|
81
|
+
"./infrastructure/externals/firebase-admin/token": {
|
|
82
|
+
"types": "./infrastructure/externals/firebase-admin/token/index.d.ts",
|
|
83
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-firebase-admin-token.mjs"
|
|
84
|
+
},
|
|
85
|
+
"./infrastructure/externals/openai/impl": {
|
|
86
|
+
"types": "./infrastructure/externals/openai/impl/index.d.ts",
|
|
87
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-openai-impl.mjs"
|
|
88
|
+
},
|
|
89
|
+
"./infrastructure/externals/openai/token": {
|
|
90
|
+
"types": "./infrastructure/externals/openai/token/index.d.ts",
|
|
91
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-openai-token.mjs"
|
|
92
|
+
},
|
|
93
|
+
"./infrastructure/externals/stripe/impl": {
|
|
94
|
+
"types": "./infrastructure/externals/stripe/impl/index.d.ts",
|
|
95
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-stripe-impl.mjs"
|
|
96
|
+
},
|
|
97
|
+
"./infrastructure/externals/stripe/token": {
|
|
98
|
+
"types": "./infrastructure/externals/stripe/token/index.d.ts",
|
|
99
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-stripe-token.mjs"
|
|
100
|
+
},
|
|
101
|
+
"./infrastructure/externals/websocket/token": {
|
|
102
|
+
"types": "./infrastructure/externals/websocket/token/index.d.ts",
|
|
103
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-websocket-token.mjs"
|
|
104
|
+
},
|
|
105
|
+
"./infrastructure/externals/crypto/impl/browser": {
|
|
106
|
+
"types": "./infrastructure/externals/crypto/impl/browser/index.d.ts",
|
|
107
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-browser.mjs"
|
|
108
|
+
},
|
|
109
|
+
"./infrastructure/externals/crypto/impl/server": {
|
|
110
|
+
"types": "./infrastructure/externals/crypto/impl/server/index.d.ts",
|
|
111
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-crypto-impl-server.mjs"
|
|
112
|
+
},
|
|
113
|
+
"./infrastructure/externals/websocket/impl/browser": {
|
|
114
|
+
"types": "./infrastructure/externals/websocket/impl/browser/index.d.ts",
|
|
115
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-browser.mjs"
|
|
116
|
+
},
|
|
117
|
+
"./infrastructure/externals/websocket/impl/server": {
|
|
118
|
+
"types": "./infrastructure/externals/websocket/impl/server/index.d.ts",
|
|
119
|
+
"default": "./fesm2022/nx-ddd-common-infrastructure-externals-websocket-impl-server.mjs"
|
|
120
|
+
}
|
|
29
121
|
},
|
|
30
|
-
"
|
|
31
|
-
"type": "commonjs"
|
|
122
|
+
"sideEffects": false
|
|
32
123
|
}
|
package/README.md
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# NxDDD Common
|
|
2
|
-
`@nx-ddd/common` is a library used for domain model annotations and related functionalities.
|
|
3
|
-
|
|
4
|
-
## Install
|
|
5
|
-
```sh
|
|
6
|
-
$ npm i @nx-ddd/common
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
## Usage
|
|
10
|
-
|
|
11
|
-
```ts
|
|
12
|
-
import { Domain, getAnnotations, getLangMap, getModelName } from './models';
|
|
13
|
-
|
|
14
|
-
@Domain.Entity({name: 'Profile'})
|
|
15
|
-
class Profile {
|
|
16
|
-
@Domain.Lang('名前') name: string;
|
|
17
|
-
@Domain.Lang('メールアドレス') email: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Domain.Entity({name: 'ユーザー'})
|
|
21
|
-
class User {
|
|
22
|
-
@Domain.Lang('ID') id: string;
|
|
23
|
-
@Domain.Type() profile: Profile;
|
|
24
|
-
@Domain.Lang('作成日時') createdAt: Date;
|
|
25
|
-
@Domain.Lang('更新日時') updatedAt: Date;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getLangMap(User);
|
|
29
|
-
/**
|
|
30
|
-
-> {
|
|
31
|
-
id: 'ID',
|
|
32
|
-
'profile.name': '名前',
|
|
33
|
-
'profile.email': 'メールアドレス',
|
|
34
|
-
createdAt: '作成日時',
|
|
35
|
-
updatedAt: '更新日時',
|
|
36
|
-
}
|
|
37
|
-
* */
|
|
38
|
-
|
|
39
|
-
getModelName(User) // -> 'ユーザー'
|
|
40
|
-
```
|
package/domain/index.js
DELETED
package/domain/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/common/src/domain/index.ts"],"names":[],"mappings":";;;AAAA,mDAAyB;AACzB,qDAA2B"}
|
package/domain/models.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import 'reflect-metadata';
|
|
2
|
-
import { Dayjs } from 'dayjs';
|
|
3
|
-
export type Type<E> = {
|
|
4
|
-
new (): E;
|
|
5
|
-
};
|
|
6
|
-
export type DomainLangMap<Entity> = Partial<{
|
|
7
|
-
[K in keyof Entity]: string;
|
|
8
|
-
}>;
|
|
9
|
-
export interface Entity<Id = string> {
|
|
10
|
-
id: Id | null;
|
|
11
|
-
createdAt?: Dayjs | null;
|
|
12
|
-
updatedAt?: Dayjs | null;
|
|
13
|
-
}
|
|
14
|
-
export type OmitGetter<T> = {
|
|
15
|
-
[P in keyof T as string extends P ? never : number extends P ? never : P]: T[P];
|
|
16
|
-
};
|
|
17
|
-
export type DeepPartial<T> = {
|
|
18
|
-
[P in keyof T]?: DeepPartial<T[P]>;
|
|
19
|
-
};
|
|
20
|
-
interface BaseDomainAnnotation {
|
|
21
|
-
type: 'model:lang' | 'prop:lang' | 'prop:type';
|
|
22
|
-
}
|
|
23
|
-
export interface DomainModelLangAnnotation extends BaseDomainAnnotation {
|
|
24
|
-
type: 'model:lang';
|
|
25
|
-
modelName: string;
|
|
26
|
-
name: string;
|
|
27
|
-
typeFactory?: () => any;
|
|
28
|
-
}
|
|
29
|
-
export interface DomainPropLangAnnotation extends BaseDomainAnnotation {
|
|
30
|
-
type: 'prop:lang';
|
|
31
|
-
propName: string;
|
|
32
|
-
name: string;
|
|
33
|
-
}
|
|
34
|
-
export interface DomainPropTypeAnnotation extends BaseDomainAnnotation {
|
|
35
|
-
type: 'prop:type';
|
|
36
|
-
propName: string;
|
|
37
|
-
typeFactory: () => any;
|
|
38
|
-
}
|
|
39
|
-
export type DomainAnnotation = DomainModelLangAnnotation | DomainPropLangAnnotation | DomainPropTypeAnnotation;
|
|
40
|
-
interface Target {
|
|
41
|
-
constructor: {
|
|
42
|
-
[Domain.ANNOTATIONS]?: DomainAnnotation[];
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export declare class Domain {
|
|
46
|
-
static readonly ANNOTATIONS: unique symbol;
|
|
47
|
-
static Lang(name: string): (target: any, propName: string) => void;
|
|
48
|
-
static Type<T>(typeFactory?: () => T): (target: any, propName: string) => void;
|
|
49
|
-
static Entity(propsOrName: {
|
|
50
|
-
name: string;
|
|
51
|
-
} | string): (target: any) => void;
|
|
52
|
-
static registerAnnotation(constructor: Target['constructor'], annotation: DomainAnnotation): void;
|
|
53
|
-
}
|
|
54
|
-
export type LangMap<E> = Partial<Record<keyof E, string>>;
|
|
55
|
-
export declare function getLangMap<E>(domain: Type<E>, mergeObj?: object): LangMap<E>;
|
|
56
|
-
export declare function getAnnotations<E>(target: Type<E>): DomainAnnotation[];
|
|
57
|
-
/**
|
|
58
|
-
* @deprecated
|
|
59
|
-
* use getProps instead.
|
|
60
|
-
*/
|
|
61
|
-
export declare function getDomainProps<E>(target: Type<E>, deps?: number, path?: string): string[];
|
|
62
|
-
export declare function getProps<E>(target: Type<E>, deps?: number, path?: string): string[];
|
|
63
|
-
export declare function getModelName<E>(target: Type<E>): string;
|
|
64
|
-
export declare function getEntityName<E>(target: Type<E>): string;
|
|
65
|
-
export declare class Entity {
|
|
66
|
-
static fromObj<T extends Entity = Entity>(obj: object): T;
|
|
67
|
-
static toObj(entity: Entity): Entity;
|
|
68
|
-
}
|
|
69
|
-
export declare function TransformToDayjs(): PropertyDecorator;
|
|
70
|
-
export {};
|
package/domain/models.js
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Entity = exports.Domain = void 0;
|
|
4
|
-
exports.getLangMap = getLangMap;
|
|
5
|
-
exports.getAnnotations = getAnnotations;
|
|
6
|
-
exports.getDomainProps = getDomainProps;
|
|
7
|
-
exports.getProps = getProps;
|
|
8
|
-
exports.getModelName = getModelName;
|
|
9
|
-
exports.getEntityName = getEntityName;
|
|
10
|
-
exports.TransformToDayjs = TransformToDayjs;
|
|
11
|
-
const tslib_1 = require("tslib");
|
|
12
|
-
require("reflect-metadata");
|
|
13
|
-
const to_object_1 = require("../utilities/to-object");
|
|
14
|
-
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
15
|
-
const flat_1 = require("flat");
|
|
16
|
-
const class_transformer_1 = require("class-transformer");
|
|
17
|
-
const lodash_es_1 = require("lodash-es");
|
|
18
|
-
class Domain {
|
|
19
|
-
static Lang(name) {
|
|
20
|
-
return (target, propName) => {
|
|
21
|
-
this.registerAnnotation(target.constructor, { propName, type: 'prop:lang', name });
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
static Type(typeFactory) {
|
|
25
|
-
return (target, propName) => {
|
|
26
|
-
if (!typeFactory) {
|
|
27
|
-
const type = Reflect.getMetadata('design:type', target, propName);
|
|
28
|
-
typeFactory = () => type;
|
|
29
|
-
}
|
|
30
|
-
this.registerAnnotation(target.constructor, { propName, typeFactory, type: 'prop:type' });
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
// classをデコレートしてnameをアノテーションする
|
|
34
|
-
static Entity(propsOrName) {
|
|
35
|
-
const props = typeof propsOrName === 'string' ? { name: propsOrName } : propsOrName;
|
|
36
|
-
return (target) => {
|
|
37
|
-
this.registerAnnotation(target, { name: props.name, type: 'model:lang', modelName: target.name });
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
static registerAnnotation(constructor, annotation) {
|
|
41
|
-
var _a;
|
|
42
|
-
var _b;
|
|
43
|
-
(_a = constructor[_b = this.ANNOTATIONS]) !== null && _a !== void 0 ? _a : (constructor[_b] = []);
|
|
44
|
-
constructor[this.ANNOTATIONS].push(annotation);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
exports.Domain = Domain;
|
|
48
|
-
Domain.ANNOTATIONS = Symbol('annotations');
|
|
49
|
-
function getLangMap(domain, mergeObj = {}) {
|
|
50
|
-
return (0, flat_1.flatten)((0, lodash_es_1.merge)(_getLangMap(domain), mergeObj));
|
|
51
|
-
}
|
|
52
|
-
function _getLangMap(target) {
|
|
53
|
-
var _a;
|
|
54
|
-
return (0, flat_1.flatten)((_a = getAnnotations(target).reduce((acc, annotation) => {
|
|
55
|
-
var _a;
|
|
56
|
-
switch (annotation.type) {
|
|
57
|
-
case 'prop:lang': {
|
|
58
|
-
acc[annotation.propName] = annotation.name;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
case 'prop:type': {
|
|
62
|
-
const type = (_a = annotation.typeFactory) === null || _a === void 0 ? void 0 : _a.call(annotation);
|
|
63
|
-
acc[annotation.propName] = getLangMap(type);
|
|
64
|
-
break;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return acc;
|
|
68
|
-
}, {})) !== null && _a !== void 0 ? _a : {});
|
|
69
|
-
}
|
|
70
|
-
function getAnnotations(target) {
|
|
71
|
-
var _a;
|
|
72
|
-
return (_a = target === null || target === void 0 ? void 0 : target[Domain.ANNOTATIONS]) !== null && _a !== void 0 ? _a : [];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated
|
|
76
|
-
* use getProps instead.
|
|
77
|
-
*/
|
|
78
|
-
function getDomainProps(target, deps = 3, path = '') {
|
|
79
|
-
return getProps(target, deps, path);
|
|
80
|
-
}
|
|
81
|
-
function getProps(target, deps = 3, path = '') {
|
|
82
|
-
return getAnnotations(target).map((annotation) => {
|
|
83
|
-
var _a;
|
|
84
|
-
switch (annotation.type) {
|
|
85
|
-
case 'prop:lang': {
|
|
86
|
-
return `${path}${annotation.propName}`;
|
|
87
|
-
}
|
|
88
|
-
case 'prop:type': {
|
|
89
|
-
if (deps > 0) {
|
|
90
|
-
const type = (_a = annotation.typeFactory) === null || _a === void 0 ? void 0 : _a.call(annotation);
|
|
91
|
-
return getProps(type, deps - 1, `${path}${annotation.propName}.`);
|
|
92
|
-
}
|
|
93
|
-
return [];
|
|
94
|
-
}
|
|
95
|
-
default: return [];
|
|
96
|
-
}
|
|
97
|
-
}).flat();
|
|
98
|
-
}
|
|
99
|
-
function getModelName(target) {
|
|
100
|
-
var _a, _b;
|
|
101
|
-
return (_b = (_a = getAnnotations(target).find(annotation => {
|
|
102
|
-
return annotation.type === 'model:lang';
|
|
103
|
-
})) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : target.name;
|
|
104
|
-
}
|
|
105
|
-
function getEntityName(target) {
|
|
106
|
-
var _a, _b;
|
|
107
|
-
return (_b = (_a = getAnnotations(target).find(annotation => {
|
|
108
|
-
return annotation.type === 'model:lang';
|
|
109
|
-
})) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : target.name;
|
|
110
|
-
}
|
|
111
|
-
class Entity {
|
|
112
|
-
static fromObj(obj) {
|
|
113
|
-
return Object.assign(new this(), Object.assign({ id: null, createdAt: null, updatedAt: null }, obj));
|
|
114
|
-
}
|
|
115
|
-
static toObj(entity) {
|
|
116
|
-
return (0, to_object_1.toObject)(entity);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
exports.Entity = Entity;
|
|
120
|
-
function TransformToDayjs() {
|
|
121
|
-
return (0, class_transformer_1.Transform)(({ value }) => {
|
|
122
|
-
if (typeof value === 'undefined')
|
|
123
|
-
return undefined;
|
|
124
|
-
if ((0, dayjs_1.default)(value).isValid())
|
|
125
|
-
return (0, dayjs_1.default)(value);
|
|
126
|
-
return value;
|
|
127
|
-
}, {});
|
|
128
|
-
}
|
|
129
|
-
//# sourceMappingURL=models.js.map
|
package/domain/models.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/common/src/domain/models.ts"],"names":[],"mappings":";;;AA6FA,gCAEC;AAmBD,wCAEC;AAMD,wCAEC;AAED,4BAgBC;AAED,oCAIC;AAED,sCAIC;AAiBD,4CAMC;;AAjLD,4BAA0B;AAC1B,sDAAkD;AAClD,0DAAqC;AACrC,+BAA+B;AAC/B,yDAA8C;AA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AAC,IAAI,CAAC;AACxD,CAAC;AAED,MAAa,MAAM;IACjB,MAAM,CAAC,OAAO,CAA4B,GAAW;QACnD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE,kBAC7B,EAAE,EAAE,IAAI,EACR,SAAS,EAAE,IAAI,EACf,SAAS,EAAE,IAAI,IACZ,GAAG,EACQ,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAc;QACzB,OAAO,IAAA,oBAAQ,EAAC,MAAM,CAAW,CAAC;IACpC,CAAC;CACF;AAbD,wBAaC;AAED,SAAgB,gBAAgB;IAC9B,OAAO,IAAA,6BAAS,EAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAC7B,IAAI,OAAO,KAAK,KAAK,WAAW;YAAE,OAAO,SAAS,CAAC;QACnD,IAAI,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE;YAAE,OAAO,IAAA,eAAK,EAAC,KAAK,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
|
package/domain/repository.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Entity } from './models';
|
|
2
|
-
export type PartialWithId<E extends Entity> = Pick<E, 'id'> & Partial<E>;
|
|
3
|
-
export declare abstract class Repository<E extends {
|
|
4
|
-
id: string;
|
|
5
|
-
}> {
|
|
6
|
-
list(): Promise<E[]>;
|
|
7
|
-
get(entity: Pick<E, 'id'>): Promise<E>;
|
|
8
|
-
create(entity: E): Promise<E>;
|
|
9
|
-
update(entity: Pick<E, 'id'> & Partial<E>): Promise<void>;
|
|
10
|
-
delete(entity: Pick<E, 'id'>): Promise<void>;
|
|
11
|
-
}
|