@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.
- package/dist/entry-backend.cjs +196 -99
- package/dist/entry-backend.cjs.map +1 -1
- package/dist/entry-backend.mjs +97 -1
- package/dist/entry-backend.mjs.map +1 -1
- package/dist/index.cjs +197 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +97 -1
- package/dist/index.mjs.map +1 -1
- package/dist/init/nestjs/CoreModule.d.ts +2 -1
- package/dist/init/nestjs/CoreModule.d.ts.map +1 -1
- package/dist/init/nestjs/index.cjs +13 -10
- package/dist/init/nestjs/index.cjs.map +1 -1
- package/dist/init/nestjs/index.mjs +8 -7
- package/dist/init/nestjs/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -28,7 +28,7 @@ import { StorageService as StorageService$1 } from '@plyaz/storage';
|
|
|
28
28
|
import { NotificationService as NotificationService$1, verifyToken } from '@plyaz/notifications';
|
|
29
29
|
import { createRequire } from 'module';
|
|
30
30
|
import * as ServerErrorMiddleware from '@plyaz/errors/middleware/backend';
|
|
31
|
-
import { Get, Param, Post, HttpCode, HttpStatus, Body, Patch, Delete, Controller, Inject, Module, Req, Res, Query, Put,
|
|
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 { z } from 'zod';
|
|
33
33
|
import { tap, of } from 'rxjs';
|
|
34
34
|
import { catchError } from 'rxjs/operators';
|
|
@@ -21074,6 +21074,102 @@ StreamingController = __decorateClass([
|
|
|
21074
21074
|
|
|
21075
21075
|
// src/init/nestjs/CoreModule.ts
|
|
21076
21076
|
var CORE_OPTIONS = Symbol("CORE_OPTIONS");
|
|
21077
|
+
var DB_SERVICE = Symbol("DB_SERVICE");
|
|
21078
|
+
var CoreModule = class {
|
|
21079
|
+
/**
|
|
21080
|
+
* Register CoreModule with static configuration
|
|
21081
|
+
*/
|
|
21082
|
+
static forRoot(options = {}) {
|
|
21083
|
+
const streamingEnabled = options.streaming?.enabled === true;
|
|
21084
|
+
const controllers = streamingEnabled ? [StreamingController] : [];
|
|
21085
|
+
const moduleExports = [DB_SERVICE, CORE_OPTIONS];
|
|
21086
|
+
const providers = [
|
|
21087
|
+
{
|
|
21088
|
+
provide: CORE_OPTIONS,
|
|
21089
|
+
useValue: options
|
|
21090
|
+
},
|
|
21091
|
+
{
|
|
21092
|
+
provide: DbService,
|
|
21093
|
+
useFactory: /* @__PURE__ */ __name(async () => {
|
|
21094
|
+
await Core.initialize(options);
|
|
21095
|
+
return Core.db;
|
|
21096
|
+
}, "useFactory")
|
|
21097
|
+
},
|
|
21098
|
+
{
|
|
21099
|
+
provide: DB_SERVICE,
|
|
21100
|
+
useFactory: /* @__PURE__ */ __name(async () => {
|
|
21101
|
+
await Core.initialize(options);
|
|
21102
|
+
return Core.db;
|
|
21103
|
+
}, "useFactory")
|
|
21104
|
+
}
|
|
21105
|
+
];
|
|
21106
|
+
if (streamingEnabled) {
|
|
21107
|
+
providers.push({
|
|
21108
|
+
provide: STREAM_SERVER,
|
|
21109
|
+
useFactory: /* @__PURE__ */ __name(async () => {
|
|
21110
|
+
await Core.initialize(options);
|
|
21111
|
+
return Core.streamServer;
|
|
21112
|
+
}, "useFactory")
|
|
21113
|
+
});
|
|
21114
|
+
moduleExports.push(STREAM_SERVER);
|
|
21115
|
+
}
|
|
21116
|
+
return {
|
|
21117
|
+
module: CoreModule,
|
|
21118
|
+
global: true,
|
|
21119
|
+
controllers,
|
|
21120
|
+
providers,
|
|
21121
|
+
exports: moduleExports
|
|
21122
|
+
};
|
|
21123
|
+
}
|
|
21124
|
+
/**
|
|
21125
|
+
* Register CoreModule with async configuration
|
|
21126
|
+
*/
|
|
21127
|
+
static forRootAsync(options) {
|
|
21128
|
+
const providers = [
|
|
21129
|
+
{
|
|
21130
|
+
provide: CORE_OPTIONS,
|
|
21131
|
+
useFactory: options.useFactory,
|
|
21132
|
+
inject: options.inject ?? []
|
|
21133
|
+
},
|
|
21134
|
+
{
|
|
21135
|
+
provide: DbService,
|
|
21136
|
+
useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
|
|
21137
|
+
await Core.initialize(coreOptions);
|
|
21138
|
+
return Core.db;
|
|
21139
|
+
}, "useFactory"),
|
|
21140
|
+
inject: [CORE_OPTIONS]
|
|
21141
|
+
},
|
|
21142
|
+
{
|
|
21143
|
+
provide: DB_SERVICE,
|
|
21144
|
+
useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
|
|
21145
|
+
await Core.initialize(coreOptions);
|
|
21146
|
+
return Core.db;
|
|
21147
|
+
}, "useFactory"),
|
|
21148
|
+
inject: [CORE_OPTIONS]
|
|
21149
|
+
},
|
|
21150
|
+
// Add streaming provider for async (will be null if not configured)
|
|
21151
|
+
{
|
|
21152
|
+
provide: STREAM_SERVER,
|
|
21153
|
+
useFactory: /* @__PURE__ */ __name(async (coreOptions) => {
|
|
21154
|
+
await Core.initialize(coreOptions);
|
|
21155
|
+
return Core.streamServer;
|
|
21156
|
+
}, "useFactory"),
|
|
21157
|
+
inject: [CORE_OPTIONS]
|
|
21158
|
+
}
|
|
21159
|
+
];
|
|
21160
|
+
return {
|
|
21161
|
+
module: CoreModule,
|
|
21162
|
+
global: true,
|
|
21163
|
+
imports: options.imports ?? [],
|
|
21164
|
+
providers,
|
|
21165
|
+
exports: [DB_SERVICE, CORE_OPTIONS, STREAM_SERVER]
|
|
21166
|
+
};
|
|
21167
|
+
}
|
|
21168
|
+
};
|
|
21169
|
+
__name(CoreModule, "CoreModule");
|
|
21170
|
+
CoreModule = __decorateClass([
|
|
21171
|
+
Global()
|
|
21172
|
+
], CoreModule);
|
|
21077
21173
|
(class _StreamingModule {
|
|
21078
21174
|
static {
|
|
21079
21175
|
__name(this, "StreamingModule");
|