@okf/ootils 1.6.6 → 1.6.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@elastic/elasticsearch';
2
2
  import Redis from 'ioredis';
3
- import mongoose, { Connection, Document, Types } from 'mongoose';
3
+ import mongoose, { Document, Types } from 'mongoose';
4
4
  import * as bullmq from 'bullmq';
5
5
  import { Queue } from 'bullmq/dist/esm/classes/queue';
6
6
  import { Worker } from 'bullmq/dist/esm/classes/worker';
@@ -329,28 +329,6 @@ declare function getDbByTenant({ tenant, env: _env }: {
329
329
  env: any;
330
330
  }): any;
331
331
 
332
- interface GlobalConfigType {
333
- env?: string;
334
- dbConfigs?: {
335
- [env: string]: {
336
- CLUSTER_NAME: string;
337
- DB_URI: string;
338
- connectTo?: string[];
339
- };
340
- };
341
- mongodb?: {
342
- [clusterName: string]: Connection;
343
- };
344
- }
345
- /**
346
- * Initialize the global configuration (replaces entire config)
347
- */
348
- declare const initializeGlobalConfig: (config: GlobalConfigType) => void;
349
- /**
350
- * Update specific parts of the global configuration (merges with existing)
351
- */
352
- declare const updateGlobalConfig: (updates: Partial<GlobalConfigType>) => void;
353
-
354
332
  declare function getModelByTenant({ tenant, modelName, schema, env }: {
355
333
  tenant: any;
356
334
  modelName: any;
@@ -705,4 +683,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
705
683
  };
706
684
  }): Object;
707
685
 
708
- export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getTplModelByTenant, getVal, initializeGlobalConfig, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
686
+ export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getTplModelByTenant, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
package/dist/node.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Client } from '@elastic/elasticsearch';
2
2
  import Redis from 'ioredis';
3
- import mongoose, { Connection, Document, Types } from 'mongoose';
3
+ import mongoose, { Document, Types } from 'mongoose';
4
4
  import * as bullmq from 'bullmq';
5
5
  import { Queue } from 'bullmq/dist/esm/classes/queue';
6
6
  import { Worker } from 'bullmq/dist/esm/classes/worker';
@@ -329,28 +329,6 @@ declare function getDbByTenant({ tenant, env: _env }: {
329
329
  env: any;
330
330
  }): any;
331
331
 
332
- interface GlobalConfigType {
333
- env?: string;
334
- dbConfigs?: {
335
- [env: string]: {
336
- CLUSTER_NAME: string;
337
- DB_URI: string;
338
- connectTo?: string[];
339
- };
340
- };
341
- mongodb?: {
342
- [clusterName: string]: Connection;
343
- };
344
- }
345
- /**
346
- * Initialize the global configuration (replaces entire config)
347
- */
348
- declare const initializeGlobalConfig: (config: GlobalConfigType) => void;
349
- /**
350
- * Update specific parts of the global configuration (merges with existing)
351
- */
352
- declare const updateGlobalConfig: (updates: Partial<GlobalConfigType>) => void;
353
-
354
332
  declare function getModelByTenant({ tenant, modelName, schema, env }: {
355
333
  tenant: any;
356
334
  modelName: any;
@@ -705,4 +683,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
705
683
  };
706
684
  }): Object;
707
685
 
708
- export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getTplModelByTenant, getVal, initializeGlobalConfig, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray, updateGlobalConfig };
686
+ export { AIChatSchema, AnnotationSchema, BaseProducer, BaseWorker, ElasticSearchConnector, GET_GLOBAL_BULLMQ_CONFIG, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, TplSchema, WorkerManager, deleteVal, extractAllBlocksFromTpl, genTagId, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getTplModelByTenant, getVal, _recursExtractBlocks as recursivelyExtractBlocks, setVal, toArray };
package/dist/node.js CHANGED
@@ -1105,8 +1105,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1105
1105
  },
1106
1106
  streams: {
1107
1107
  events: {
1108
- maxLen: 1e3
1109
- // Keep only last 1000 events
1108
+ maxLen: 10
1109
+ // Keep very low, cuz we dont really use historical stream events as of now
1110
1110
  }
1111
1111
  }
1112
1112
  },
@@ -1136,8 +1136,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1136
1136
  },
1137
1137
  streams: {
1138
1138
  events: {
1139
- maxLen: 1e3
1140
- // Keep only last 1000 events
1139
+ maxLen: 10
1140
+ // Keep very low, cuz we dont really use historical stream events as of now
1141
1141
  }
1142
1142
  }
1143
1143
  },
@@ -1166,8 +1166,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1166
1166
  },
1167
1167
  streams: {
1168
1168
  events: {
1169
- maxLen: 1e3
1170
- // Keep only last 1000 events
1169
+ maxLen: 10
1170
+ // Keep very low, cuz we dont really use historical stream events as of now
1171
1171
  }
1172
1172
  }
1173
1173
  },
@@ -1196,8 +1196,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1196
1196
  },
1197
1197
  streams: {
1198
1198
  events: {
1199
- maxLen: 1e3
1200
- // Keep only last 1000 events
1199
+ maxLen: 10
1200
+ // Keep very low, cuz we dont really use historical stream events as of now
1201
1201
  }
1202
1202
  }
1203
1203
  },
@@ -1225,8 +1225,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1225
1225
  },
1226
1226
  streams: {
1227
1227
  events: {
1228
- maxLen: 1e3
1229
- // Keep only last 1000 events
1228
+ maxLen: 10
1229
+ // Keep very low, cuz we dont really use historical stream events as of now
1230
1230
  }
1231
1231
  }
1232
1232
  },
@@ -1254,8 +1254,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1254
1254
  },
1255
1255
  streams: {
1256
1256
  events: {
1257
- maxLen: 1e3
1258
- // Keep only last 1000 events
1257
+ maxLen: 10
1258
+ // Keep very low, cuz we dont really use historical stream events as of now
1259
1259
  }
1260
1260
  }
1261
1261
  },
@@ -1283,8 +1283,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1283
1283
  },
1284
1284
  streams: {
1285
1285
  events: {
1286
- maxLen: 1e3
1287
- // Keep only last 1000 events
1286
+ maxLen: 10
1287
+ // Keep very low, cuz we dont really use historical stream events as of now
1288
1288
  }
1289
1289
  }
1290
1290
  },
@@ -1312,8 +1312,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1312
1312
  },
1313
1313
  streams: {
1314
1314
  events: {
1315
- maxLen: 1e3
1316
- // Keep only last 1000 events
1315
+ maxLen: 10
1316
+ // Keep very low, cuz we dont really use historical stream events as of now
1317
1317
  }
1318
1318
  }
1319
1319
  },
@@ -1390,11 +1390,9 @@ __export(node_exports, {
1390
1390
  getPlatformConfigsModelByTenant: () => import_getModelByTenant2.getPlatformConfigsModelByTenant,
1391
1391
  getTplModelByTenant: () => import_getModelByTenant2.getTplModelByTenant,
1392
1392
  getVal: () => getVal,
1393
- initializeGlobalConfig: () => initializeGlobalConfig,
1394
1393
  recursivelyExtractBlocks: () => _recursExtractBlocks,
1395
1394
  setVal: () => setVal,
1396
- toArray: () => toArray,
1397
- updateGlobalConfig: () => updateGlobalConfig
1395
+ toArray: () => toArray
1398
1396
  });
1399
1397
  module.exports = __toCommonJS(node_exports);
1400
1398
 
@@ -1990,29 +1988,6 @@ RedisCacheConnector.instance = null;
1990
1988
 
1991
1989
  // src/node.ts
1992
1990
  init_getDbByTenant();
1993
-
1994
- // src/db/getGlobalConfig.ts
1995
- var globalConfig = {};
1996
- var initializeGlobalConfig = (config) => {
1997
- globalConfig = {
1998
- env: config.env,
1999
- dbConfigs: config.dbConfigs ? { ...config.dbConfigs } : void 0,
2000
- mongodb: config.mongodb ? { ...config.mongodb } : void 0
2001
- };
2002
- console.log(`Global config initialized for environment: ${config.env}`);
2003
- };
2004
- var updateGlobalConfig = (updates) => {
2005
- globalConfig = {
2006
- ...globalConfig,
2007
- ...updates,
2008
- // Handle nested objects properly
2009
- dbConfigs: updates.dbConfigs ? { ...globalConfig.dbConfigs, ...updates.dbConfigs } : globalConfig.dbConfigs,
2010
- mongodb: updates.mongodb ? { ...globalConfig.mongodb, ...updates.mongodb } : globalConfig.mongodb
2011
- };
2012
- console.log("Global config updated:", Object.keys(updates));
2013
- };
2014
-
2015
- // src/node.ts
2016
1991
  var import_getModelByTenant2 = __toESM(require_getModelByTenant());
2017
1992
  init_models();
2018
1993
  var import_WorkerManager = __toESM(require_WorkerManager());
@@ -2044,9 +2019,7 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
2044
2019
  getPlatformConfigsModelByTenant,
2045
2020
  getTplModelByTenant,
2046
2021
  getVal,
2047
- initializeGlobalConfig,
2048
2022
  recursivelyExtractBlocks,
2049
2023
  setVal,
2050
- toArray,
2051
- updateGlobalConfig
2024
+ toArray
2052
2025
  });
package/dist/node.mjs CHANGED
@@ -1110,8 +1110,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1110
1110
  },
1111
1111
  streams: {
1112
1112
  events: {
1113
- maxLen: 1e3
1114
- // Keep only last 1000 events
1113
+ maxLen: 10
1114
+ // Keep very low, cuz we dont really use historical stream events as of now
1115
1115
  }
1116
1116
  }
1117
1117
  },
@@ -1141,8 +1141,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1141
1141
  },
1142
1142
  streams: {
1143
1143
  events: {
1144
- maxLen: 1e3
1145
- // Keep only last 1000 events
1144
+ maxLen: 10
1145
+ // Keep very low, cuz we dont really use historical stream events as of now
1146
1146
  }
1147
1147
  }
1148
1148
  },
@@ -1171,8 +1171,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1171
1171
  },
1172
1172
  streams: {
1173
1173
  events: {
1174
- maxLen: 1e3
1175
- // Keep only last 1000 events
1174
+ maxLen: 10
1175
+ // Keep very low, cuz we dont really use historical stream events as of now
1176
1176
  }
1177
1177
  }
1178
1178
  },
@@ -1201,8 +1201,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1201
1201
  },
1202
1202
  streams: {
1203
1203
  events: {
1204
- maxLen: 1e3
1205
- // Keep only last 1000 events
1204
+ maxLen: 10
1205
+ // Keep very low, cuz we dont really use historical stream events as of now
1206
1206
  }
1207
1207
  }
1208
1208
  },
@@ -1230,8 +1230,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1230
1230
  },
1231
1231
  streams: {
1232
1232
  events: {
1233
- maxLen: 1e3
1234
- // Keep only last 1000 events
1233
+ maxLen: 10
1234
+ // Keep very low, cuz we dont really use historical stream events as of now
1235
1235
  }
1236
1236
  }
1237
1237
  },
@@ -1259,8 +1259,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1259
1259
  },
1260
1260
  streams: {
1261
1261
  events: {
1262
- maxLen: 1e3
1263
- // Keep only last 1000 events
1262
+ maxLen: 10
1263
+ // Keep very low, cuz we dont really use historical stream events as of now
1264
1264
  }
1265
1265
  }
1266
1266
  },
@@ -1288,8 +1288,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1288
1288
  },
1289
1289
  streams: {
1290
1290
  events: {
1291
- maxLen: 1e3
1292
- // Keep only last 1000 events
1291
+ maxLen: 10
1292
+ // Keep very low, cuz we dont really use historical stream events as of now
1293
1293
  }
1294
1294
  }
1295
1295
  },
@@ -1317,8 +1317,8 @@ var init_GLOBAL_BULLMQ_CONFIG = __esm({
1317
1317
  },
1318
1318
  streams: {
1319
1319
  events: {
1320
- maxLen: 1e3
1321
- // Keep only last 1000 events
1320
+ maxLen: 10
1321
+ // Keep very low, cuz we dont really use historical stream events as of now
1322
1322
  }
1323
1323
  }
1324
1324
  },
@@ -1962,29 +1962,6 @@ RedisCacheConnector.instance = null;
1962
1962
 
1963
1963
  // src/node.ts
1964
1964
  init_getDbByTenant();
1965
-
1966
- // src/db/getGlobalConfig.ts
1967
- var globalConfig = {};
1968
- var initializeGlobalConfig = (config) => {
1969
- globalConfig = {
1970
- env: config.env,
1971
- dbConfigs: config.dbConfigs ? { ...config.dbConfigs } : void 0,
1972
- mongodb: config.mongodb ? { ...config.mongodb } : void 0
1973
- };
1974
- console.log(`Global config initialized for environment: ${config.env}`);
1975
- };
1976
- var updateGlobalConfig = (updates) => {
1977
- globalConfig = {
1978
- ...globalConfig,
1979
- ...updates,
1980
- // Handle nested objects properly
1981
- dbConfigs: updates.dbConfigs ? { ...globalConfig.dbConfigs, ...updates.dbConfigs } : globalConfig.dbConfigs,
1982
- mongodb: updates.mongodb ? { ...globalConfig.mongodb, ...updates.mongodb } : globalConfig.mongodb
1983
- };
1984
- console.log("Global config updated:", Object.keys(updates));
1985
- };
1986
-
1987
- // src/node.ts
1988
1965
  var import_getModelByTenant2 = __toESM(require_getModelByTenant());
1989
1966
  init_models();
1990
1967
  var import_WorkerManager = __toESM(require_WorkerManager());
@@ -2027,9 +2004,7 @@ export {
2027
2004
  export_getPlatformConfigsModelByTenant as getPlatformConfigsModelByTenant,
2028
2005
  export_getTplModelByTenant as getTplModelByTenant,
2029
2006
  getVal,
2030
- initializeGlobalConfig,
2031
2007
  _recursExtractBlocks as recursivelyExtractBlocks,
2032
2008
  setVal,
2033
- toArray,
2034
- updateGlobalConfig
2009
+ toArray
2035
2010
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.6",
6
+ "version": "1.6.8",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",