@okf/ootils 1.3.9 → 1.3.11
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/node.d.mts +68 -91
- package/dist/node.d.ts +68 -91
- package/dist/node.js +648 -442
- package/dist/node.mjs +653 -440
- package/package.json +1 -1
package/dist/node.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose, { Connection, Document,
|
|
1
|
+
import mongoose, { Connection, Document, Types } from 'mongoose';
|
|
2
2
|
import IORedis from 'ioredis';
|
|
3
3
|
import * as bullmq from 'bullmq';
|
|
4
4
|
import { Queue } from 'bullmq/dist/esm/classes/queue';
|
|
@@ -157,42 +157,45 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
157
157
|
blockPathPrefix?: string;
|
|
158
158
|
}) => void;
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
declare class MongoConnector {
|
|
161
|
+
static getInstance(): any;
|
|
162
|
+
static getClusterConnections(): any;
|
|
163
|
+
static getEnv(): any;
|
|
164
|
+
static getDbConfigs(): any;
|
|
165
|
+
constructor(options: any);
|
|
166
|
+
clusterConnections: {};
|
|
167
|
+
env: any;
|
|
168
|
+
dbConfigs: any;
|
|
169
|
+
mongoOptions: any;
|
|
170
|
+
/**
|
|
171
|
+
* Creates multiple MongoDB clusterConnections based on configuration (SYNCHRONOUS)
|
|
172
|
+
* @returns Object containing named database clusterConnections
|
|
173
|
+
*/
|
|
174
|
+
multiConnectToMongoDB(): {};
|
|
175
|
+
multiConnectToMongoDBAsync(): Promise<{}>;
|
|
176
|
+
/**
|
|
177
|
+
* Helper function to close clusterConnections object
|
|
178
|
+
*/
|
|
179
|
+
closeConnectionsObject(clusterConnections: any): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Graceful shutdown - close all MongoDB clusterConnections
|
|
182
|
+
*/
|
|
183
|
+
closeAllConnections(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
declare namespace MongoConnector {
|
|
186
|
+
let instance: any;
|
|
162
187
|
}
|
|
163
|
-
interface DatabaseConfig {
|
|
164
|
-
connectTo: string[];
|
|
165
|
-
CLUSTER_NAME: string;
|
|
166
|
-
DB_URI: string;
|
|
167
|
-
}
|
|
168
|
-
interface DbConfigs {
|
|
169
|
-
[env: string]: DatabaseConfig;
|
|
170
|
-
}
|
|
171
|
-
interface MultiConnectParams {
|
|
172
|
-
env?: string;
|
|
173
|
-
dbConfigs?: DbConfigs;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Creates multiple MongoDB connections based on environment configuration
|
|
177
|
-
* @param params - Object containing env and dbConfigs (optional, uses global config if not provided)
|
|
178
|
-
* @param params.env - Environment string (e.g., 'development', 'production', 'staging')
|
|
179
|
-
* @param params.dbConfigs - Database configuration object
|
|
180
|
-
* @returns Object containing named database connections
|
|
181
|
-
*/
|
|
182
|
-
declare const multiConnectToMongoDB: ({ env, dbConfigs }?: MultiConnectParams) => DbConnections;
|
|
183
188
|
|
|
184
189
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* configs across envs, we need to be able to specify env
|
|
190
|
-
* as well
|
|
190
|
+
* Get database connection by tenant
|
|
191
|
+
* @param tenant - Tenant identifier for the database
|
|
192
|
+
* @param env - Optional environment override (defaults to current environment)
|
|
193
|
+
* @returns Mongoose Connection instance for the tenant-specific database
|
|
191
194
|
*/
|
|
192
|
-
declare
|
|
193
|
-
tenant:
|
|
194
|
-
env
|
|
195
|
-
})
|
|
195
|
+
declare function getDbByTenant({ tenant, env: _env }: {
|
|
196
|
+
tenant: any;
|
|
197
|
+
env: any;
|
|
198
|
+
}): any;
|
|
196
199
|
|
|
197
200
|
interface GlobalConfigType {
|
|
198
201
|
env?: string;
|
|
@@ -216,63 +219,37 @@ declare const initializeGlobalConfig: (config: GlobalConfigType) => void;
|
|
|
216
219
|
*/
|
|
217
220
|
declare const updateGlobalConfig: (updates: Partial<GlobalConfigType>) => void;
|
|
218
221
|
|
|
219
|
-
|
|
220
|
-
tenant:
|
|
221
|
-
modelName:
|
|
222
|
-
schema:
|
|
223
|
-
env
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
declare const getModelByTenant: <T extends Document = Document>({ tenant, modelName, schema, env, }: GetModelByTenantParams) => Model<T>;
|
|
251
|
-
declare const getAnnotationsModelByTenant: ({ tenant, env, mongodb, dbConfigs, modelName }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
252
|
-
_id: unknown;
|
|
253
|
-
}> & {
|
|
254
|
-
__v: number;
|
|
255
|
-
}, any>;
|
|
256
|
-
declare const getChunksModelByTenant: ({ tenant, env, mongodb, dbConfigs, modelName }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
257
|
-
_id: unknown;
|
|
258
|
-
}> & {
|
|
259
|
-
__v: number;
|
|
260
|
-
}, any>;
|
|
261
|
-
declare const getPlatformConfigsModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
262
|
-
_id: unknown;
|
|
263
|
-
}> & {
|
|
264
|
-
__v: number;
|
|
265
|
-
}, any>;
|
|
266
|
-
declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
267
|
-
_id: unknown;
|
|
268
|
-
}> & {
|
|
269
|
-
__v: number;
|
|
270
|
-
}, any>;
|
|
271
|
-
declare const getAIChatModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
272
|
-
_id: unknown;
|
|
273
|
-
}> & {
|
|
274
|
-
__v: number;
|
|
275
|
-
}, any>;
|
|
222
|
+
declare function getModelByTenant({ tenant, modelName, schema, env }: {
|
|
223
|
+
tenant: any;
|
|
224
|
+
modelName: any;
|
|
225
|
+
schema: any;
|
|
226
|
+
env: any;
|
|
227
|
+
}): any;
|
|
228
|
+
declare function getAIChatModelByTenant({ tenant, env, mongodb, dbConfigs }: {
|
|
229
|
+
tenant: any;
|
|
230
|
+
env: any;
|
|
231
|
+
mongodb: any;
|
|
232
|
+
dbConfigs: any;
|
|
233
|
+
}): any;
|
|
234
|
+
declare function getAnnotationsModelByTenant({ tenant, env, mongodb, dbConfigs, modelName }: {
|
|
235
|
+
tenant: any;
|
|
236
|
+
env: any;
|
|
237
|
+
mongodb: any;
|
|
238
|
+
dbConfigs: any;
|
|
239
|
+
modelName: any;
|
|
240
|
+
}): any;
|
|
241
|
+
declare function getPlatformConfigsModelByTenant({ tenant, env, mongodb, dbConfigs }: {
|
|
242
|
+
tenant: any;
|
|
243
|
+
env: any;
|
|
244
|
+
mongodb: any;
|
|
245
|
+
dbConfigs: any;
|
|
246
|
+
}): any;
|
|
247
|
+
declare function getTplModelByTenant({ tenant, env, mongodb, dbConfigs }: {
|
|
248
|
+
tenant: any;
|
|
249
|
+
env: any;
|
|
250
|
+
mongodb: any;
|
|
251
|
+
dbConfigs: any;
|
|
252
|
+
}): any;
|
|
276
253
|
|
|
277
254
|
interface GetTplParams {
|
|
278
255
|
name: string;
|
|
@@ -594,4 +571,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
594
571
|
};
|
|
595
572
|
}): Object;
|
|
596
573
|
|
|
597
|
-
export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, GET_GLOBAL_BULLMQ_CONFIG, PlatformConfigsSchema, TplSchema, WorkerManager, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant,
|
|
574
|
+
export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, TplSchema, WorkerManager, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import mongoose, { Connection, Document,
|
|
1
|
+
import mongoose, { Connection, Document, Types } from 'mongoose';
|
|
2
2
|
import IORedis from 'ioredis';
|
|
3
3
|
import * as bullmq from 'bullmq';
|
|
4
4
|
import { Queue } from 'bullmq/dist/esm/classes/queue';
|
|
@@ -157,42 +157,45 @@ declare const _recursExtractBlocks: ({ data, cb, sectionStack, blockPathPrefix }
|
|
|
157
157
|
blockPathPrefix?: string;
|
|
158
158
|
}) => void;
|
|
159
159
|
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
declare class MongoConnector {
|
|
161
|
+
static getInstance(): any;
|
|
162
|
+
static getClusterConnections(): any;
|
|
163
|
+
static getEnv(): any;
|
|
164
|
+
static getDbConfigs(): any;
|
|
165
|
+
constructor(options: any);
|
|
166
|
+
clusterConnections: {};
|
|
167
|
+
env: any;
|
|
168
|
+
dbConfigs: any;
|
|
169
|
+
mongoOptions: any;
|
|
170
|
+
/**
|
|
171
|
+
* Creates multiple MongoDB clusterConnections based on configuration (SYNCHRONOUS)
|
|
172
|
+
* @returns Object containing named database clusterConnections
|
|
173
|
+
*/
|
|
174
|
+
multiConnectToMongoDB(): {};
|
|
175
|
+
multiConnectToMongoDBAsync(): Promise<{}>;
|
|
176
|
+
/**
|
|
177
|
+
* Helper function to close clusterConnections object
|
|
178
|
+
*/
|
|
179
|
+
closeConnectionsObject(clusterConnections: any): Promise<void>;
|
|
180
|
+
/**
|
|
181
|
+
* Graceful shutdown - close all MongoDB clusterConnections
|
|
182
|
+
*/
|
|
183
|
+
closeAllConnections(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
declare namespace MongoConnector {
|
|
186
|
+
let instance: any;
|
|
162
187
|
}
|
|
163
|
-
interface DatabaseConfig {
|
|
164
|
-
connectTo: string[];
|
|
165
|
-
CLUSTER_NAME: string;
|
|
166
|
-
DB_URI: string;
|
|
167
|
-
}
|
|
168
|
-
interface DbConfigs {
|
|
169
|
-
[env: string]: DatabaseConfig;
|
|
170
|
-
}
|
|
171
|
-
interface MultiConnectParams {
|
|
172
|
-
env?: string;
|
|
173
|
-
dbConfigs?: DbConfigs;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Creates multiple MongoDB connections based on environment configuration
|
|
177
|
-
* @param params - Object containing env and dbConfigs (optional, uses global config if not provided)
|
|
178
|
-
* @param params.env - Environment string (e.g., 'development', 'production', 'staging')
|
|
179
|
-
* @param params.dbConfigs - Database configuration object
|
|
180
|
-
* @returns Object containing named database connections
|
|
181
|
-
*/
|
|
182
|
-
declare const multiConnectToMongoDB: ({ env, dbConfigs }?: MultiConnectParams) => DbConnections;
|
|
183
188
|
|
|
184
189
|
/**
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* configs across envs, we need to be able to specify env
|
|
190
|
-
* as well
|
|
190
|
+
* Get database connection by tenant
|
|
191
|
+
* @param tenant - Tenant identifier for the database
|
|
192
|
+
* @param env - Optional environment override (defaults to current environment)
|
|
193
|
+
* @returns Mongoose Connection instance for the tenant-specific database
|
|
191
194
|
*/
|
|
192
|
-
declare
|
|
193
|
-
tenant:
|
|
194
|
-
env
|
|
195
|
-
})
|
|
195
|
+
declare function getDbByTenant({ tenant, env: _env }: {
|
|
196
|
+
tenant: any;
|
|
197
|
+
env: any;
|
|
198
|
+
}): any;
|
|
196
199
|
|
|
197
200
|
interface GlobalConfigType {
|
|
198
201
|
env?: string;
|
|
@@ -216,63 +219,37 @@ declare const initializeGlobalConfig: (config: GlobalConfigType) => void;
|
|
|
216
219
|
*/
|
|
217
220
|
declare const updateGlobalConfig: (updates: Partial<GlobalConfigType>) => void;
|
|
218
221
|
|
|
219
|
-
|
|
220
|
-
tenant:
|
|
221
|
-
modelName:
|
|
222
|
-
schema:
|
|
223
|
-
env
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
}
|
|
250
|
-
declare const getModelByTenant: <T extends Document = Document>({ tenant, modelName, schema, env, }: GetModelByTenantParams) => Model<T>;
|
|
251
|
-
declare const getAnnotationsModelByTenant: ({ tenant, env, mongodb, dbConfigs, modelName }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
252
|
-
_id: unknown;
|
|
253
|
-
}> & {
|
|
254
|
-
__v: number;
|
|
255
|
-
}, any>;
|
|
256
|
-
declare const getChunksModelByTenant: ({ tenant, env, mongodb, dbConfigs, modelName }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
257
|
-
_id: unknown;
|
|
258
|
-
}> & {
|
|
259
|
-
__v: number;
|
|
260
|
-
}, any>;
|
|
261
|
-
declare const getPlatformConfigsModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
262
|
-
_id: unknown;
|
|
263
|
-
}> & {
|
|
264
|
-
__v: number;
|
|
265
|
-
}, any>;
|
|
266
|
-
declare const getTplModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
267
|
-
_id: unknown;
|
|
268
|
-
}> & {
|
|
269
|
-
__v: number;
|
|
270
|
-
}, any>;
|
|
271
|
-
declare const getAIChatModelByTenant: ({ tenant, env, mongodb, dbConfigs }: GetModelShortParams) => Model<Document<unknown, any, any, Record<string, any>>, {}, {}, {}, Document<unknown, {}, Document<unknown, any, any, Record<string, any>>, {}> & Document<unknown, any, any, Record<string, any>> & Required<{
|
|
272
|
-
_id: unknown;
|
|
273
|
-
}> & {
|
|
274
|
-
__v: number;
|
|
275
|
-
}, any>;
|
|
222
|
+
declare function getModelByTenant({ tenant, modelName, schema, env }: {
|
|
223
|
+
tenant: any;
|
|
224
|
+
modelName: any;
|
|
225
|
+
schema: any;
|
|
226
|
+
env: any;
|
|
227
|
+
}): any;
|
|
228
|
+
declare function getAIChatModelByTenant({ tenant, env, mongodb, dbConfigs }: {
|
|
229
|
+
tenant: any;
|
|
230
|
+
env: any;
|
|
231
|
+
mongodb: any;
|
|
232
|
+
dbConfigs: any;
|
|
233
|
+
}): any;
|
|
234
|
+
declare function getAnnotationsModelByTenant({ tenant, env, mongodb, dbConfigs, modelName }: {
|
|
235
|
+
tenant: any;
|
|
236
|
+
env: any;
|
|
237
|
+
mongodb: any;
|
|
238
|
+
dbConfigs: any;
|
|
239
|
+
modelName: any;
|
|
240
|
+
}): any;
|
|
241
|
+
declare function getPlatformConfigsModelByTenant({ tenant, env, mongodb, dbConfigs }: {
|
|
242
|
+
tenant: any;
|
|
243
|
+
env: any;
|
|
244
|
+
mongodb: any;
|
|
245
|
+
dbConfigs: any;
|
|
246
|
+
}): any;
|
|
247
|
+
declare function getTplModelByTenant({ tenant, env, mongodb, dbConfigs }: {
|
|
248
|
+
tenant: any;
|
|
249
|
+
env: any;
|
|
250
|
+
mongodb: any;
|
|
251
|
+
dbConfigs: any;
|
|
252
|
+
}): any;
|
|
276
253
|
|
|
277
254
|
interface GetTplParams {
|
|
278
255
|
name: string;
|
|
@@ -594,4 +571,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
594
571
|
};
|
|
595
572
|
}): Object;
|
|
596
573
|
|
|
597
|
-
export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, GET_GLOBAL_BULLMQ_CONFIG, PlatformConfigsSchema, TplSchema, WorkerManager, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant,
|
|
574
|
+
export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, TplSchema, WorkerManager, connectToRedis, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAIConfigs, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getRedisClient, getTpl, getTplModelByTenant, getVal, initializeGlobalConfig, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
|