@plyaz/core 1.22.5 → 1.22.7

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, Query, Res, Put, Global, Injectable, Headers as Headers$1, Req, SetMetadata } from '@nestjs/common';
32
32
  import { promisify } from 'util';
33
33
  import * as yaml from 'yaml';
34
34
  import { tap, of } from 'rxjs';
@@ -19188,140 +19188,12 @@ init_NotificationsMapper();
19188
19188
  init_NotificationsValidator();
19189
19189
  init_streaming2();
19190
19190
 
19191
- // src/init/nestjs/index.ts
19192
- init_CoreInitializer();
19193
-
19194
- // src/init/nestjs/configureNestApp.ts
19195
- init_CoreInitializer();
19196
-
19197
- // src/init/nestjs/CoreModule.ts
19198
- init_CoreInitializer();
19199
- init_DbService();
19200
- var STREAM_SERVER = Symbol("STREAM_SERVER");
19201
- var StreamingController = class {
19202
- constructor(streamServer) {
19203
- this.streamServer = streamServer;
19204
- }
19205
- async stream(req, res) {
19206
- const handler = this.streamServer.getHandler("nestjs");
19207
- await handler(req, res);
19208
- }
19209
- };
19210
- __name(StreamingController, "StreamingController");
19211
- __decorateClass([
19212
- Get("stream"),
19213
- __decorateParam(0, Req()),
19214
- __decorateParam(1, Res())
19215
- ], StreamingController.prototype, "stream", 1);
19216
- StreamingController = __decorateClass([
19217
- Controller("events"),
19218
- __decorateParam(0, Inject(STREAM_SERVER))
19219
- ], StreamingController);
19220
-
19221
- // src/init/nestjs/CoreModule.ts
19222
- var CORE_OPTIONS = Symbol("CORE_OPTIONS");
19223
-
19224
- // src/init/nestjs/StreamingModule.ts
19225
- init_streaming3();
19226
- (class _StreamingModule {
19227
- static {
19228
- __name(this, "StreamingModule");
19229
- }
19230
- static {
19231
- this.streamServer = null;
19232
- }
19233
- async onModuleDestroy() {
19234
- if (_StreamingModule.streamServer) {
19235
- _StreamingModule.streamServer.dispose();
19236
- _StreamingModule.streamServer = null;
19237
- }
19238
- StreamRegistry.dispose();
19239
- }
19240
- /**
19241
- * Register StreamingModule with static configuration
19242
- */
19243
- static forRoot(config = {}) {
19244
- const includeController = config.includeController !== false;
19245
- const providers = [
19246
- {
19247
- provide: STREAM_SERVER,
19248
- useFactory: /* @__PURE__ */ __name(async () => {
19249
- return _StreamingModule.initializeStreamServer(config);
19250
- }, "useFactory")
19251
- }
19252
- ];
19253
- return {
19254
- module: _StreamingModule,
19255
- global: config.isGlobal !== false,
19256
- controllers: includeController ? [StreamingController] : [],
19257
- providers,
19258
- exports: [STREAM_SERVER]
19259
- };
19260
- }
19261
- /**
19262
- * Register StreamingModule with async configuration
19263
- */
19264
- static forRootAsync(options) {
19265
- const includeController = options.includeController !== false;
19266
- const configProvider = {
19267
- provide: "STREAMING_MODULE_CONFIG",
19268
- useFactory: options.useFactory,
19269
- inject: options.inject ?? []
19270
- };
19271
- const streamServerProvider = {
19272
- provide: STREAM_SERVER,
19273
- useFactory: /* @__PURE__ */ __name(async (config) => {
19274
- return _StreamingModule.initializeStreamServer(config);
19275
- }, "useFactory"),
19276
- inject: ["STREAMING_MODULE_CONFIG"]
19277
- };
19278
- return {
19279
- module: _StreamingModule,
19280
- global: options.isGlobal !== false,
19281
- imports: options.imports ?? [],
19282
- controllers: includeController ? [StreamingController] : [],
19283
- providers: [configProvider, streamServerProvider],
19284
- exports: [STREAM_SERVER]
19285
- };
19286
- }
19287
- /**
19288
- * Initialize StreamServer with configuration
19289
- */
19290
- // eslint-disable-next-line complexity
19291
- static async initializeStreamServer(config) {
19292
- if (_StreamingModule.streamServer) {
19293
- _StreamingModule.streamServer.dispose();
19294
- }
19295
- const builder = StreamServer.create().withSSE({
19296
- heartbeatInterval: config.server?.broadcaster?.heartbeatInterval ?? STREAMING_DEFAULTS.HEARTBEAT_INTERVAL_MS
19297
- });
19298
- const defaultChannels = config.server?.defaultChannels ?? STREAMING_DEFAULTS.DEFAULT_CHANNELS;
19299
- builder.withDefaultChannels(defaultChannels);
19300
- const streamServer = builder.build();
19301
- streamServer.initialize();
19302
- _StreamingModule.streamServer = streamServer;
19303
- if (config.endpoints?.length) {
19304
- await StreamRegistry.initialize({
19305
- broadcaster: streamServer.getBroadcaster(),
19306
- endpoints: config.endpoints
19307
- });
19308
- }
19309
- return streamServer;
19310
- }
19311
- /**
19312
- * Get the current StreamServer instance (for testing/debugging)
19313
- */
19314
- static getStreamServer() {
19315
- return _StreamingModule.streamServer;
19316
- }
19317
- });
19318
-
19319
19191
  // src/backend/notifications/notifications.controller.ts
19192
+ init_CoreInitializer();
19320
19193
  var BACKEND_NOTIFICATIONS_DOMAIN_SERVICE = "BACKEND_NOTIFICATIONS_DOMAIN_SERVICE";
19321
19194
  var NotificationsController = class {
19322
- constructor(notificationsService, coreOptions) {
19195
+ constructor(notificationsService) {
19323
19196
  this.notificationsService = notificationsService;
19324
- this.coreOptions = coreOptions;
19325
19197
  }
19326
19198
  health() {
19327
19199
  return SuccessResponseStandard("Service is healthy", {
@@ -19373,7 +19245,7 @@ var NotificationsController = class {
19373
19245
  context: { field: "token" }
19374
19246
  });
19375
19247
  }
19376
- const encryptionKey = this.coreOptions.env?.ENCRYPTION_KEY;
19248
+ const encryptionKey = Core.initOptions.env?.ENCRYPTION_KEY;
19377
19249
  if (!encryptionKey) {
19378
19250
  throw new CorePackageError(
19379
19251
  "Unsubscribe feature not configured",
@@ -19423,8 +19295,7 @@ __decorateClass([
19423
19295
  ], NotificationsController.prototype, "unsubscribe", 1);
19424
19296
  NotificationsController = __decorateClass([
19425
19297
  Controller("notifications"),
19426
- __decorateParam(0, Inject(BACKEND_NOTIFICATIONS_DOMAIN_SERVICE)),
19427
- __decorateParam(1, Inject(CORE_OPTIONS))
19298
+ __decorateParam(0, Inject(BACKEND_NOTIFICATIONS_DOMAIN_SERVICE))
19428
19299
  ], NotificationsController);
19429
19300
 
19430
19301
  // src/backend/notifications/notifications.module.ts
@@ -23642,8 +23513,8 @@ __name(createHandler, "createHandler");
23642
23513
  init_DbService();
23643
23514
  var CORE_DB_SERVICE = "CORE_DB_SERVICE";
23644
23515
  var CORE_ENV = "CORE_ENV";
23645
- var CORE_OPTIONS2 = "CORE_OPTIONS";
23646
- var CoreModule2 = {
23516
+ var CORE_OPTIONS = "CORE_OPTIONS";
23517
+ var CoreModule = {
23647
23518
  /**
23648
23519
  * Register CoreModule with static configuration
23649
23520
  */
@@ -23654,7 +23525,7 @@ var CoreModule2 = {
23654
23525
  global: isGlobal,
23655
23526
  providers: [
23656
23527
  {
23657
- provide: CORE_OPTIONS2,
23528
+ provide: CORE_OPTIONS,
23658
23529
  useValue: options
23659
23530
  },
23660
23531
  {
@@ -23680,7 +23551,7 @@ var CoreModule2 = {
23680
23551
  useFactory: /* @__PURE__ */ __name(() => DbService.getInstance(), "useFactory")
23681
23552
  }
23682
23553
  ],
23683
- exports: [CORE_DB_SERVICE, CORE_ENV, CORE_OPTIONS2, DbService]
23554
+ exports: [CORE_DB_SERVICE, CORE_ENV, CORE_OPTIONS, DbService]
23684
23555
  };
23685
23556
  },
23686
23557
  /**
@@ -23694,13 +23565,13 @@ var CoreModule2 = {
23694
23565
  imports: options.imports ?? [],
23695
23566
  providers: [
23696
23567
  {
23697
- provide: CORE_OPTIONS2,
23568
+ provide: CORE_OPTIONS,
23698
23569
  inject: options.inject ?? [],
23699
23570
  useFactory: options.useFactory
23700
23571
  },
23701
23572
  {
23702
23573
  provide: CORE_ENV,
23703
- inject: [CORE_OPTIONS2],
23574
+ inject: [CORE_OPTIONS],
23704
23575
  useFactory: /* @__PURE__ */ __name((coreOptions) => {
23705
23576
  if (coreOptions.envPath) {
23706
23577
  config({ path: coreOptions.envPath });
@@ -23710,7 +23581,7 @@ var CoreModule2 = {
23710
23581
  },
23711
23582
  {
23712
23583
  provide: CORE_DB_SERVICE,
23713
- inject: [CORE_OPTIONS2],
23584
+ inject: [CORE_OPTIONS],
23714
23585
  useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
23715
23586
  if (coreOptions.db) {
23716
23587
  return DbService.initialize(coreOptions.db);
@@ -23723,7 +23594,7 @@ var CoreModule2 = {
23723
23594
  useFactory: /* @__PURE__ */ __name(() => DbService.getInstance(), "useFactory")
23724
23595
  }
23725
23596
  ],
23726
- exports: [CORE_DB_SERVICE, CORE_ENV, CORE_OPTIONS2, DbService]
23597
+ exports: [CORE_DB_SERVICE, CORE_ENV, CORE_OPTIONS, DbService]
23727
23598
  };
23728
23599
  }
23729
23600
  };
@@ -23744,6 +23615,6 @@ setCoreDependencies({
23744
23615
  setGetCoreDomainServices(getCoreDomainServices);
23745
23616
  setGetCoreStreamEndpoints(getCoreStreamEndpoints);
23746
23617
 
23747
- export { AnonymousAuthAdapter, ApiClientService, BACKEND_EXAMPLE_DOMAIN_SERVICE, BACKEND_FILES_DOMAIN_SERVICE, BACKEND_NOTIFICATIONS_DOMAIN_SERVICE, BackendEventPersistenceHandler, BackendExampleDomainService, BackendFilesDomainService, BackendNotificationsDomainService, BaseAuthAdapter, BaseBackendDomainService, BaseChannelController, BaseDomainService, BaseFrameworkAdapter, BaseMapper, BaseStreamEndpoint, BaseTransportAdapter, BaseValidator, CORE_DB_SERVICE, CORE_ENV, CORE_OPTIONS2 as CORE_OPTIONS, CacheKeyBuilder, CacheManager, CacheService, Caching, ConditionUtils, ContextUtils, Core, CoreEventManager, CoreModule2 as CoreModule, DEFAULT_ENCRYPTION_FIELDS, DbService, ErrorHandlingInterceptor, ExampleController, ExampleModule, ExampleRepository, ExpressFrameworkAdapter, FeatureDisabled, FeatureEnabled, FeatureFlagConfigFactory, FeatureFlagConfigValidator, FeatureFlagContextBuilder, FeatureFlagController, FeatureFlagDatabaseRepository, FeatureFlagDomainService, FeatureFlagEngine, FeatureFlagGuard, FeatureFlagLoggingInterceptor, FeatureFlagMiddleware, FeatureFlagModule, FeatureFlagService, FeatureFlagServiceFactory, FilesChannelController, FilesController, FilesModule, FilesRepository, FilesStreamEndpoint, FrontendEventPersistenceHandler, HashUtils, IdUtils, MediaVariantsRepository, MiddlewareChain, NestJSFrameworkAdapter, NextJSFrameworkAdapter, NotificationPreferencesRepository, NotificationService, NotificationsChannelController, NotificationsController, NotificationsModule, NotificationsRepository, NotificationsStreamEndpoint, ObjectUtils, PACKAGE_NAME, SSETransportAdapter, ServiceRegistry, ShortUrlRepository, StorageService, StreamBroadcaster, StreamConnectionManager, StreamRegistry, StreamServer, StreamServerBuilder, SystemChannelController, SystemStreamEndpoint, TABLE_REGISTRY, TimeUtils, TokenAuthAdapter, TypeGuardUtils, VARIANT_NAMES, VERSION, ValueUtils, WebSocketTransportAdapter, WebhooksController, WebhooksModule, backendExampleDomainService, backendExampleDomainService as backendExampleService, backendFilesDomainService, backendNotificationsDomainService, base64ToBlob, base64ToBuffer, bufferToBase64, camelToSnake, cleanupRateLimitTracking, clearCoreDependencies, createApiClientInstance, createBackendContext, createFrontendContext, createHandler, createHmrSafeSingleton, createRateLimitMiddleware, createRolloutIdentifier, createStandaloneApiClient, dateToNullable, detectRuntime, downloadBase64, downloadBlob, evaluateArrayOperator, evaluateConditionOperator, evaluateEqualityOperator, evaluateNumericOperator, evaluateStringOperator, backendExampleDomainService as exampleService, fileToBase64, formatDate, formatFileSize, generateCorrelationId, generateFilename, generateId, generateShortId, generateSpanId, generateTraceId, generateUniqueFilename, getApiClient, getBackendFilesDomainService, getBackendNotificationsDomainService, getCacheService, getCoreDependencies, getCoreDependency, getField, getFilenameFromKey, getNestedProperty, getPackageVersion, getRateLimitStats, getValidProviders, hasCoreDependency, hasNestedProperty, hasProperty, hashString, inferExtensionFromMimeType, initApiClient, isArrayOperator, isDefined, isEqualityOperator, isInQuietHours, isInRollout, isNumber, isNumericOperator, isObject, isString, isStringOperator, isTruthy, isValidUUID, keysToCamel, keysToSnake, loadEnvFile, createHandler as nextHandler, parseDate, parseDateSafe, parseFileKey, parseFileSize, pickDefined, resetFilesDomainService, resetNotificationsDomainService, setCoreDependencies, setNestedProperty, snakeToCamel, toBoolean, toNullable, toNumber, toOptional, trimString };
23618
+ export { AnonymousAuthAdapter, ApiClientService, BACKEND_EXAMPLE_DOMAIN_SERVICE, BACKEND_FILES_DOMAIN_SERVICE, BACKEND_NOTIFICATIONS_DOMAIN_SERVICE, BackendEventPersistenceHandler, BackendExampleDomainService, BackendFilesDomainService, BackendNotificationsDomainService, BaseAuthAdapter, BaseBackendDomainService, BaseChannelController, BaseDomainService, BaseFrameworkAdapter, BaseMapper, BaseStreamEndpoint, BaseTransportAdapter, BaseValidator, CORE_DB_SERVICE, CORE_ENV, CORE_OPTIONS, CacheKeyBuilder, CacheManager, CacheService, Caching, ConditionUtils, ContextUtils, Core, CoreEventManager, CoreModule, DEFAULT_ENCRYPTION_FIELDS, DbService, ErrorHandlingInterceptor, ExampleController, ExampleModule, ExampleRepository, ExpressFrameworkAdapter, FeatureDisabled, FeatureEnabled, FeatureFlagConfigFactory, FeatureFlagConfigValidator, FeatureFlagContextBuilder, FeatureFlagController, FeatureFlagDatabaseRepository, FeatureFlagDomainService, FeatureFlagEngine, FeatureFlagGuard, FeatureFlagLoggingInterceptor, FeatureFlagMiddleware, FeatureFlagModule, FeatureFlagService, FeatureFlagServiceFactory, FilesChannelController, FilesController, FilesModule, FilesRepository, FilesStreamEndpoint, FrontendEventPersistenceHandler, HashUtils, IdUtils, MediaVariantsRepository, MiddlewareChain, NestJSFrameworkAdapter, NextJSFrameworkAdapter, NotificationPreferencesRepository, NotificationService, NotificationsChannelController, NotificationsController, NotificationsModule, NotificationsRepository, NotificationsStreamEndpoint, ObjectUtils, PACKAGE_NAME, SSETransportAdapter, ServiceRegistry, ShortUrlRepository, StorageService, StreamBroadcaster, StreamConnectionManager, StreamRegistry, StreamServer, StreamServerBuilder, SystemChannelController, SystemStreamEndpoint, TABLE_REGISTRY, TimeUtils, TokenAuthAdapter, TypeGuardUtils, VARIANT_NAMES, VERSION, ValueUtils, WebSocketTransportAdapter, WebhooksController, WebhooksModule, backendExampleDomainService, backendExampleDomainService as backendExampleService, backendFilesDomainService, backendNotificationsDomainService, base64ToBlob, base64ToBuffer, bufferToBase64, camelToSnake, cleanupRateLimitTracking, clearCoreDependencies, createApiClientInstance, createBackendContext, createFrontendContext, createHandler, createHmrSafeSingleton, createRateLimitMiddleware, createRolloutIdentifier, createStandaloneApiClient, dateToNullable, detectRuntime, downloadBase64, downloadBlob, evaluateArrayOperator, evaluateConditionOperator, evaluateEqualityOperator, evaluateNumericOperator, evaluateStringOperator, backendExampleDomainService as exampleService, fileToBase64, formatDate, formatFileSize, generateCorrelationId, generateFilename, generateId, generateShortId, generateSpanId, generateTraceId, generateUniqueFilename, getApiClient, getBackendFilesDomainService, getBackendNotificationsDomainService, getCacheService, getCoreDependencies, getCoreDependency, getField, getFilenameFromKey, getNestedProperty, getPackageVersion, getRateLimitStats, getValidProviders, hasCoreDependency, hasNestedProperty, hasProperty, hashString, inferExtensionFromMimeType, initApiClient, isArrayOperator, isDefined, isEqualityOperator, isInQuietHours, isInRollout, isNumber, isNumericOperator, isObject, isString, isStringOperator, isTruthy, isValidUUID, keysToCamel, keysToSnake, loadEnvFile, createHandler as nextHandler, parseDate, parseDateSafe, parseFileKey, parseFileSize, pickDefined, resetFilesDomainService, resetNotificationsDomainService, setCoreDependencies, setNestedProperty, snakeToCamel, toBoolean, toNullable, toNumber, toOptional, trimString };
23748
23619
  //# sourceMappingURL=entry-backend.mjs.map
23749
23620
  //# sourceMappingURL=entry-backend.mjs.map