@fluojs/mongoose 1.0.1 → 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.
package/README.ko.md CHANGED
@@ -50,7 +50,7 @@ const connection = mongoose.createConnection('mongodb://localhost:27017/test');
50
50
  class AppModule {}
51
51
  ```
52
52
 
53
- `MongooseModule.forRootAsync(...)`는 주입된 의존성과 동기 또는 비동기로 옵션을 반환하는 `useFactory`를 지원합니다. provider를 전역으로 노출해야 할 때는 최상위 async 등록 옵션에 `global`을 전달하세요. 해석된 옵션은 모듈 인스턴스 안에서 재사용되므로 연결 설정과 dispose hook이 모든 provider에서 일관되게 유지됩니다.
53
+ `MongooseModule.forRootAsync(...)`는 주입된 의존성과 동기 또는 비동기로 옵션을 반환하는 `useFactory`를 지원합니다. 여러 모듈에서 async 등록 helper를 공유할 때는 export된 `MongooseAsyncModuleOptions<TConnection>` 타입을 사용하세요. provider를 전역으로 노출해야 할 때는 최상위 async 등록 옵션에 `global`을 전달하세요. 해석된 옵션은 모듈 인스턴스 안에서 재사용되므로 연결 설정과 dispose hook이 모든 provider에서 일관되게 유지됩니다.
54
54
 
55
55
  ## 라이프사이클과 종료
56
56
 
@@ -122,15 +122,17 @@ HTTP interceptor 밖에서 같은 request-aware transaction boundary가 필요
122
122
  - `MongooseConnection`
123
123
  - `MongooseTransactionInterceptor`
124
124
  - `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
125
- - `createMongooseProviders(options)`
125
+ - `createMongooseProviders(options)` — 호환성/수동 composition helper입니다. 애플리케이션-facing 등록에서는 module export와 provider visibility가 문서화된 namespace facade와 맞도록 `MongooseModule.forRoot(...)` 또는 `MongooseModule.forRootAsync(...)`를 우선 사용하세요.
126
126
  - `createMongoosePlatformStatusSnapshot(...)`
127
127
 
128
128
  ### 관련 export 타입
129
129
 
130
130
  - `MongooseModuleOptions<TConnection>`
131
+ - `MongooseAsyncModuleOptions<TConnection>`
131
132
  - `MongooseConnectionLike`
132
133
  - `MongooseSessionLike`
133
134
  - `MongooseHandleProvider`
135
+ - `MongoosePlatformStatusSnapshotInput`
134
136
 
135
137
  ## 관련 패키지
136
138
 
package/README.md CHANGED
@@ -48,7 +48,7 @@ const connection = mongoose.createConnection('mongodb://localhost:27017/test');
48
48
  class AppModule {}
49
49
  ```
50
50
 
51
- `MongooseModule.forRootAsync(...)` accepts injected dependencies and a `useFactory` that may return options synchronously or asynchronously. Pass `global` on the top-level async registration when the providers should be visible globally. The resolved options are reused for the module instance, so connection setup and disposal hooks stay consistent across all providers.
51
+ `MongooseModule.forRootAsync(...)` accepts injected dependencies and a `useFactory` that may return options synchronously or asynchronously. Use the exported `MongooseAsyncModuleOptions<TConnection>` type when sharing async registration helpers across modules. Pass `global` on the top-level async registration when the providers should be visible globally. The resolved options are reused for the module instance, so connection setup and disposal hooks stay consistent across all providers.
52
52
 
53
53
  ## Lifecycle and Shutdown
54
54
 
@@ -113,15 +113,17 @@ Use `MongooseConnection.requestTransaction(...)` directly when you need the same
113
113
  - `MongooseConnection`
114
114
  - `MongooseTransactionInterceptor`
115
115
  - `MONGOOSE_CONNECTION`, `MONGOOSE_DISPOSE`, `MONGOOSE_OPTIONS`
116
- - `createMongooseProviders(options)`
116
+ - `createMongooseProviders(options)` — compatibility/manual composition helper; prefer `MongooseModule.forRoot(...)` or `MongooseModule.forRootAsync(...)` for application-facing registration so module exports and provider visibility stay aligned.
117
117
  - `createMongoosePlatformStatusSnapshot(...)`
118
118
 
119
119
  ### Related exported types
120
120
 
121
121
  - `MongooseModuleOptions<TConnection>`
122
+ - `MongooseAsyncModuleOptions<TConnection>`
122
123
  - `MongooseConnectionLike`
123
124
  - `MongooseSessionLike`
124
125
  - `MongooseHandleProvider`
126
+ - `MongoosePlatformStatusSnapshotInput`
125
127
 
126
128
  ## Related Packages
127
129
 
package/dist/module.d.ts CHANGED
@@ -2,9 +2,21 @@ import type { AsyncModuleOptions } from '@fluojs/core';
2
2
  import type { Provider } from '@fluojs/di';
3
3
  import { type ModuleType } from '@fluojs/runtime';
4
4
  import type { MongooseConnectionLike, MongooseModuleOptions } from './types.js';
5
- type MongooseAsyncModuleOptions<TConnection extends MongooseConnectionLike> = AsyncModuleOptions<Omit<MongooseModuleOptions<TConnection>, 'global'>> & Pick<MongooseModuleOptions<TConnection>, 'global'>;
6
5
  /**
7
- * Creates Mongoose providers for manual module composition.
6
+ * Async registration options accepted by `MongooseModule.forRootAsync(...)`.
7
+ *
8
+ * The factory resolves the same connection, disposal, and strict transaction
9
+ * options accepted by `MongooseModule.forRoot(...)`; `global` remains on the
10
+ * top-level async registration so callers can opt into global provider export.
11
+ */
12
+ export type MongooseAsyncModuleOptions<TConnection extends MongooseConnectionLike> = AsyncModuleOptions<Omit<MongooseModuleOptions<TConnection>, 'global'>> & Pick<MongooseModuleOptions<TConnection>, 'global'>;
13
+ /**
14
+ * Creates Mongoose providers for compatibility-oriented manual module composition.
15
+ *
16
+ * Prefer `MongooseModule.forRoot(...)` for application registration so module
17
+ * exports and provider visibility stay aligned with the documented namespace
18
+ * facade. Use this helper only when hand-assembling providers in advanced
19
+ * compatibility scenarios.
8
20
  *
9
21
  * @param options Mongoose module options with a connection handle, optional dispose hook, and strict transaction policy.
10
22
  * @returns Provider definitions equivalent to `MongooseModule.forRoot(...)`.
@@ -19,5 +31,4 @@ export declare class MongooseModule {
19
31
  /** Creates a module definition from DI-aware async Mongoose options. */
20
32
  static forRootAsync<TConnection extends MongooseConnectionLike>(options: MongooseAsyncModuleOptions<TConnection>): ModuleType;
21
33
  }
22
- export {};
23
34
  //# sourceMappingURL=module.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,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,WAAW,CAAC,EAAE,QAAQ,CAAC,CAAC;AAiFvD;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,WAAW,SAAS,sBAAsB,EAChF,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAC1C,QAAQ,EAAE,CAOZ;AA0BD;;GAEG;AACH,qBAAa,cAAc;IACzB,gEAAgE;IAChE,MAAM,CAAC,OAAO,CAAC,WAAW,SAAS,sBAAsB,EAAE,OAAO,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAAG,UAAU;IAInH,wEAAwE;IACxE,MAAM,CAAC,YAAY,CAAC,WAAW,SAAS,sBAAsB,EAC5D,OAAO,EAAE,0BAA0B,CAAC,WAAW,CAAC,GAC/C,UAAU;CAGd"}
package/dist/module.js CHANGED
@@ -2,6 +2,15 @@ import { defineModule } from '@fluojs/runtime';
2
2
  import { MongooseConnection } from './connection.js';
3
3
  import { MONGOOSE_CONNECTION, MONGOOSE_DISPOSE, MONGOOSE_OPTIONS } from './tokens.js';
4
4
  import { MongooseTransactionInterceptor } from './transaction.js';
5
+
6
+ /**
7
+ * Async registration options accepted by `MongooseModule.forRootAsync(...)`.
8
+ *
9
+ * The factory resolves the same connection, disposal, and strict transaction
10
+ * options accepted by `MongooseModule.forRoot(...)`; `global` remains on the
11
+ * top-level async registration so callers can opt into global provider export.
12
+ */
13
+
5
14
  const MONGOOSE_NORMALIZED_OPTIONS = Symbol('fluo.mongoose.normalized-options');
6
15
  const MONGOOSE_MODULE_EXPORTS = [MongooseConnection, MongooseTransactionInterceptor];
7
16
  function normalizeMongooseModuleOptions(options) {
@@ -54,7 +63,12 @@ function createMongooseProvidersAsync(options) {
54
63
  }
55
64
 
56
65
  /**
57
- * Creates Mongoose providers for manual module composition.
66
+ * Creates Mongoose providers for compatibility-oriented manual module composition.
67
+ *
68
+ * Prefer `MongooseModule.forRoot(...)` for application registration so module
69
+ * exports and provider visibility stay aligned with the documented namespace
70
+ * facade. Use this helper only when hand-assembling providers in advanced
71
+ * compatibility scenarios.
58
72
  *
59
73
  * @param options Mongoose module options with a connection handle, optional dispose hook, and strict transaction policy.
60
74
  * @returns Provider definitions equivalent to `MongooseModule.forRoot(...)`.
package/dist/status.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { PersistencePlatformStatusSnapshot } from '@fluojs/runtime';
2
2
  type MongoosePlatformLifecycleState = 'ready' | 'shutting-down' | 'stopped';
3
- type MongoosePlatformStatusSnapshotInput = {
3
+ /**
4
+ * Input values used to create a Mongoose persistence platform status snapshot.
5
+ */
6
+ export type MongoosePlatformStatusSnapshotInput = {
4
7
  activeRequestTransactions: number;
5
8
  activeSessions: number;
6
9
  hasActiveSession: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EAGlC,MAAM,iBAAiB,CAAC;AAEzB,KAAK,8BAA8B,GAAG,OAAO,GAAG,eAAe,GAAG,SAAS,CAAC;AAE5E,KAAK,mCAAmC,GAAG;IACzC,yBAAyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,8BAA8B,CAAC;IAC/C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6BAA6B,EAAE,OAAO,CAAC;IACvC,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAqDF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,mCAAmC,GACzC,iCAAiC,CAoBnC"}
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iCAAiC,EAGlC,MAAM,iBAAiB,CAAC;AAEzB,KAAK,8BAA8B,GAAG,OAAO,GAAG,eAAe,GAAG,SAAS,CAAC;AAE5E;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,yBAAyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,8BAA8B,CAAC;IAC/C,kBAAkB,EAAE,OAAO,CAAC;IAC5B,6BAA6B,EAAE,OAAO,CAAC;IACvC,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC;AAqDF;;;;;GAKG;AACH,wBAAgB,oCAAoC,CAClD,KAAK,EAAE,mCAAmC,GACzC,iCAAiC,CAoBnC"}
package/dist/status.js CHANGED
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Input values used to create a Mongoose persistence platform status snapshot.
3
+ */
4
+
1
5
  function createReadiness(input) {
2
6
  if (input.lifecycleState === 'shutting-down') {
3
7
  return {
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "transaction",
10
10
  "odm"
11
11
  ],
12
- "version": "1.0.1",
12
+ "version": "1.0.3",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -36,10 +36,10 @@
36
36
  "dist"
37
37
  ],
38
38
  "dependencies": {
39
- "@fluojs/core": "^1.0.1",
39
+ "@fluojs/core": "^1.0.2",
40
40
  "@fluojs/http": "^1.0.0",
41
- "@fluojs/di": "^1.0.1",
42
- "@fluojs/runtime": "^1.0.1"
41
+ "@fluojs/di": "^1.0.2",
42
+ "@fluojs/runtime": "^1.1.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "mongoose": ">=7.0.0"