@plyaz/core 1.22.5 → 1.22.6

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.
@@ -28,7 +28,7 @@ import * as path from 'path';
28
28
  import { dirname, join } from 'path';
29
29
  import * as fs from 'fs';
30
30
  import { readFileSync } from 'fs';
31
- import { Get, Param, Post, HttpCode, HttpStatus, Body, Patch, Delete, Controller, Inject, Module, Req, Res, Query, Put, Global, Injectable, Headers as Headers$1, SetMetadata } from '@nestjs/common';
31
+ import { Get, Param, Post, HttpCode, HttpStatus, Body, Patch, Delete, Controller, Inject, Module, Req, Res, Global, Query, Put, Injectable, Headers as Headers$1, SetMetadata } from '@nestjs/common';
32
32
  import { promisify } from 'util';
33
33
  import * as yaml from 'yaml';
34
34
  import { tap, of } from 'rxjs';
@@ -19220,6 +19220,102 @@ StreamingController = __decorateClass([
19220
19220
 
19221
19221
  // src/init/nestjs/CoreModule.ts
19222
19222
  var CORE_OPTIONS = Symbol("CORE_OPTIONS");
19223
+ var DB_SERVICE = Symbol("DB_SERVICE");
19224
+ var CoreModule = class {
19225
+ /**
19226
+ * Register CoreModule with static configuration
19227
+ */
19228
+ static forRoot(options = {}) {
19229
+ const streamingEnabled = options.streaming?.enabled === true;
19230
+ const controllers = streamingEnabled ? [StreamingController] : [];
19231
+ const moduleExports = [DB_SERVICE, CORE_OPTIONS];
19232
+ const providers = [
19233
+ {
19234
+ provide: CORE_OPTIONS,
19235
+ useValue: options
19236
+ },
19237
+ {
19238
+ provide: DbService,
19239
+ useFactory: /* @__PURE__ */ __name(async () => {
19240
+ await Core.initialize(options);
19241
+ return Core.db;
19242
+ }, "useFactory")
19243
+ },
19244
+ {
19245
+ provide: DB_SERVICE,
19246
+ useFactory: /* @__PURE__ */ __name(async () => {
19247
+ await Core.initialize(options);
19248
+ return Core.db;
19249
+ }, "useFactory")
19250
+ }
19251
+ ];
19252
+ if (streamingEnabled) {
19253
+ providers.push({
19254
+ provide: STREAM_SERVER,
19255
+ useFactory: /* @__PURE__ */ __name(async () => {
19256
+ await Core.initialize(options);
19257
+ return Core.streamServer;
19258
+ }, "useFactory")
19259
+ });
19260
+ moduleExports.push(STREAM_SERVER);
19261
+ }
19262
+ return {
19263
+ module: CoreModule,
19264
+ global: true,
19265
+ controllers,
19266
+ providers,
19267
+ exports: moduleExports
19268
+ };
19269
+ }
19270
+ /**
19271
+ * Register CoreModule with async configuration
19272
+ */
19273
+ static forRootAsync(options) {
19274
+ const providers = [
19275
+ {
19276
+ provide: CORE_OPTIONS,
19277
+ useFactory: options.useFactory,
19278
+ inject: options.inject ?? []
19279
+ },
19280
+ {
19281
+ provide: DbService,
19282
+ useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
19283
+ await Core.initialize(coreOptions);
19284
+ return Core.db;
19285
+ }, "useFactory"),
19286
+ inject: [CORE_OPTIONS]
19287
+ },
19288
+ {
19289
+ provide: DB_SERVICE,
19290
+ useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
19291
+ await Core.initialize(coreOptions);
19292
+ return Core.db;
19293
+ }, "useFactory"),
19294
+ inject: [CORE_OPTIONS]
19295
+ },
19296
+ // Add streaming provider for async (will be null if not configured)
19297
+ {
19298
+ provide: STREAM_SERVER,
19299
+ useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
19300
+ await Core.initialize(coreOptions);
19301
+ return Core.streamServer;
19302
+ }, "useFactory"),
19303
+ inject: [CORE_OPTIONS]
19304
+ }
19305
+ ];
19306
+ return {
19307
+ module: CoreModule,
19308
+ global: true,
19309
+ imports: options.imports ?? [],
19310
+ providers,
19311
+ exports: [DB_SERVICE, CORE_OPTIONS, STREAM_SERVER]
19312
+ };
19313
+ }
19314
+ };
19315
+ __name(CoreModule, "CoreModule");
19316
+ CoreModule = __decorateClass([
19317
+ Global()
19318
+ ], CoreModule);
19223
19319
 
19224
19320
  // src/init/nestjs/StreamingModule.ts
19225
19321
  init_streaming3();