@ngn-net/nestjs-telescope 0.3.0 → 0.3.1
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/constants.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/** Injection token for telescope configuration options */
|
|
2
2
|
export declare const TELESCOPE_OPTIONS = "TELESCOPE_OPTIONS";
|
|
3
|
+
/** Injection token for Telescope's dedicated Mongoose connection name */
|
|
4
|
+
export declare const TELESCOPE_MONGO_CONNECTION = "TELESCOPE_MONGO";
|
|
3
5
|
/** Default base path for the Telescope UI & API */
|
|
4
6
|
export declare const DEFAULT_TELESCOPE_PATH = "telescope";
|
|
5
7
|
/** Default JWT secret (should always be overridden in production) */
|
|
@@ -8,5 +10,7 @@ export declare const DEFAULT_JWT_SECRET = "telescope-change-me";
|
|
|
8
10
|
export declare const DEFAULT_MAX_ENTRIES = 1000;
|
|
9
11
|
/** Default password for UI authentication */
|
|
10
12
|
export declare const DEFAULT_PASSWORD = "password";
|
|
13
|
+
/** Default MongoDB URI for Telescope's dedicated connection */
|
|
14
|
+
export declare const DEFAULT_MONGO_URI = "mongodb://localhost:27017/telescope";
|
|
11
15
|
/** Minimum interval (ms) between prune operations */
|
|
12
16
|
export declare const PRUNE_THROTTLE_MS = 60000;
|
package/dist/constants.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// src/constants.ts
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.PRUNE_THROTTLE_MS = exports.DEFAULT_PASSWORD = exports.DEFAULT_MAX_ENTRIES = exports.DEFAULT_JWT_SECRET = exports.DEFAULT_TELESCOPE_PATH = exports.TELESCOPE_OPTIONS = void 0;
|
|
4
|
+
exports.PRUNE_THROTTLE_MS = exports.DEFAULT_MONGO_URI = exports.DEFAULT_PASSWORD = exports.DEFAULT_MAX_ENTRIES = exports.DEFAULT_JWT_SECRET = exports.DEFAULT_TELESCOPE_PATH = exports.TELESCOPE_MONGO_CONNECTION = exports.TELESCOPE_OPTIONS = void 0;
|
|
5
5
|
/** Injection token for telescope configuration options */
|
|
6
6
|
exports.TELESCOPE_OPTIONS = 'TELESCOPE_OPTIONS';
|
|
7
|
+
/** Injection token for Telescope's dedicated Mongoose connection name */
|
|
8
|
+
exports.TELESCOPE_MONGO_CONNECTION = 'TELESCOPE_MONGO';
|
|
7
9
|
/** Default base path for the Telescope UI & API */
|
|
8
10
|
exports.DEFAULT_TELESCOPE_PATH = 'telescope';
|
|
9
11
|
/** Default JWT secret (should always be overridden in production) */
|
|
@@ -12,5 +14,7 @@ exports.DEFAULT_JWT_SECRET = 'telescope-change-me';
|
|
|
12
14
|
exports.DEFAULT_MAX_ENTRIES = 1000;
|
|
13
15
|
/** Default password for UI authentication */
|
|
14
16
|
exports.DEFAULT_PASSWORD = 'password';
|
|
17
|
+
/** Default MongoDB URI for Telescope's dedicated connection */
|
|
18
|
+
exports.DEFAULT_MONGO_URI = 'mongodb://localhost:27017/telescope';
|
|
15
19
|
/** Minimum interval (ms) between prune operations */
|
|
16
20
|
exports.PRUNE_THROTTLE_MS = 60_000;
|
|
@@ -18,6 +18,8 @@ export interface TelescopeOptions {
|
|
|
18
18
|
ignoreCommands?: string[];
|
|
19
19
|
/** Additional middleware to apply to UI routes */
|
|
20
20
|
uiMiddleware?: any[];
|
|
21
|
+
/** MongoDB URI for Telescope's dedicated connection (default: 'mongodb://localhost:27017/telescope') */
|
|
22
|
+
mongoUri?: string;
|
|
21
23
|
}
|
|
22
24
|
export interface TelescopeOptionsFactory {
|
|
23
25
|
createTelescopeOptions(): Promise<TelescopeOptions> | TelescopeOptions;
|
|
@@ -17,6 +17,7 @@ const common_1 = require("@nestjs/common");
|
|
|
17
17
|
const mongoose_1 = require("@nestjs/mongoose");
|
|
18
18
|
const mongoose_2 = require("mongoose");
|
|
19
19
|
const telescope_entry_entity_1 = require("./entities/telescope-entry.entity");
|
|
20
|
+
const constants_1 = require("../constants");
|
|
20
21
|
let TelescopeRepository = class TelescopeRepository {
|
|
21
22
|
entryModel;
|
|
22
23
|
constructor(entryModel) {
|
|
@@ -96,6 +97,6 @@ let TelescopeRepository = class TelescopeRepository {
|
|
|
96
97
|
exports.TelescopeRepository = TelescopeRepository;
|
|
97
98
|
exports.TelescopeRepository = TelescopeRepository = __decorate([
|
|
98
99
|
(0, common_1.Injectable)(),
|
|
99
|
-
__param(0, (0, mongoose_1.InjectModel)(telescope_entry_entity_1.TelescopeEntry.name)),
|
|
100
|
+
__param(0, (0, mongoose_1.InjectModel)(telescope_entry_entity_1.TelescopeEntry.name, constants_1.TELESCOPE_MONGO_CONNECTION)),
|
|
100
101
|
__metadata("design:paramtypes", [mongoose_2.Model])
|
|
101
102
|
], TelescopeRepository);
|
package/dist/telescope.module.js
CHANGED
|
@@ -100,10 +100,10 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
100
100
|
catch (e) { }
|
|
101
101
|
}
|
|
102
102
|
static forRoot(options = {}) {
|
|
103
|
+
const mongoUri = options.mongoUri || process.env.TELESCOPE_MONGO_URI || constants_1.DEFAULT_MONGO_URI;
|
|
103
104
|
const imports = [
|
|
104
|
-
mongoose_1.MongooseModule.
|
|
105
|
-
|
|
106
|
-
]),
|
|
105
|
+
mongoose_1.MongooseModule.forRoot(mongoUri, { connectionName: constants_1.TELESCOPE_MONGO_CONNECTION }),
|
|
106
|
+
mongoose_1.MongooseModule.forFeature([{ name: telescope_entry_entity_1.TelescopeEntry.name, schema: telescope_entry_entity_1.TelescopeEntrySchema }], constants_1.TELESCOPE_MONGO_CONNECTION),
|
|
107
107
|
jwt_1.JwtModule.register({
|
|
108
108
|
secret: options.jwtSecret || process.env.TELESCOPE_JWT_SECRET || constants_1.DEFAULT_JWT_SECRET,
|
|
109
109
|
signOptions: { expiresIn: '1d' },
|
|
@@ -143,9 +143,15 @@ let TelescopeModule = TelescopeModule_1 = class TelescopeModule {
|
|
|
143
143
|
telescope_jwt_guard_1.JwtAuthGuard,
|
|
144
144
|
];
|
|
145
145
|
const imports = [
|
|
146
|
-
mongoose_1.MongooseModule.
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
mongoose_1.MongooseModule.forRootAsync({
|
|
147
|
+
connectionName: constants_1.TELESCOPE_MONGO_CONNECTION,
|
|
148
|
+
imports: options.imports || [],
|
|
149
|
+
inject: [constants_1.TELESCOPE_OPTIONS],
|
|
150
|
+
useFactory: async (telescopeOpts) => ({
|
|
151
|
+
uri: telescopeOpts.mongoUri || process.env.TELESCOPE_MONGO_URI || constants_1.DEFAULT_MONGO_URI,
|
|
152
|
+
}),
|
|
153
|
+
}),
|
|
154
|
+
mongoose_1.MongooseModule.forFeature([{ name: telescope_entry_entity_1.TelescopeEntry.name, schema: telescope_entry_entity_1.TelescopeEntrySchema }], constants_1.TELESCOPE_MONGO_CONNECTION),
|
|
149
155
|
jwt_1.JwtModule.registerAsync({
|
|
150
156
|
imports: options.imports || [],
|
|
151
157
|
inject: [constants_1.TELESCOPE_OPTIONS],
|
package/dist/ui/manifest.json
CHANGED