@okf/ootils 1.41.2 → 1.42.0
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 +24 -1
- package/dist/node.d.ts +24 -1
- package/dist/node.js +88 -0
- package/dist/node.mjs +88 -0
- package/package.json +1 -1
package/dist/node.d.mts
CHANGED
|
@@ -2788,6 +2788,29 @@ declare class AnnosElasticSyncProducer extends BaseProducer {
|
|
|
2788
2788
|
addJobWithName(jobData: Object): Promise<Object>;
|
|
2789
2789
|
}
|
|
2790
2790
|
|
|
2791
|
+
declare class ContentElasticSyncProducer extends BaseProducer {
|
|
2792
|
+
static addJobsAndClose(params: any): Promise<{
|
|
2793
|
+
jobCount: number;
|
|
2794
|
+
jobIds: (string | undefined)[];
|
|
2795
|
+
}>;
|
|
2796
|
+
static removeJobsAndClose(jobIds: any, env: any): Promise<{
|
|
2797
|
+
removed: number;
|
|
2798
|
+
results: any[];
|
|
2799
|
+
}>;
|
|
2800
|
+
constructor(options?: {});
|
|
2801
|
+
env: any;
|
|
2802
|
+
addJobs({ documents, tenant, contentType, operationType, sourceMetadata }: {
|
|
2803
|
+
documents: any;
|
|
2804
|
+
tenant: any;
|
|
2805
|
+
contentType: any;
|
|
2806
|
+
operationType: any;
|
|
2807
|
+
sourceMetadata: any;
|
|
2808
|
+
}): Promise<{
|
|
2809
|
+
jobCount: number;
|
|
2810
|
+
jobIds: (string | undefined)[];
|
|
2811
|
+
}>;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2791
2814
|
/**
|
|
2792
2815
|
* Creates BullMQ configuration with explicit dependencies
|
|
2793
2816
|
* @param {Object} params Configuration parameters
|
|
@@ -2807,4 +2830,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
2807
2830
|
};
|
|
2808
2831
|
}): Object;
|
|
2809
2832
|
|
|
2810
|
-
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseFlowProducer, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, collectMarkIdsInOrder, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnoFilterBucketKey, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
|
2833
|
+
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseFlowProducer, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ContentElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, collectMarkIdsInOrder, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnoFilterBucketKey, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/node.d.ts
CHANGED
|
@@ -2788,6 +2788,29 @@ declare class AnnosElasticSyncProducer extends BaseProducer {
|
|
|
2788
2788
|
addJobWithName(jobData: Object): Promise<Object>;
|
|
2789
2789
|
}
|
|
2790
2790
|
|
|
2791
|
+
declare class ContentElasticSyncProducer extends BaseProducer {
|
|
2792
|
+
static addJobsAndClose(params: any): Promise<{
|
|
2793
|
+
jobCount: number;
|
|
2794
|
+
jobIds: (string | undefined)[];
|
|
2795
|
+
}>;
|
|
2796
|
+
static removeJobsAndClose(jobIds: any, env: any): Promise<{
|
|
2797
|
+
removed: number;
|
|
2798
|
+
results: any[];
|
|
2799
|
+
}>;
|
|
2800
|
+
constructor(options?: {});
|
|
2801
|
+
env: any;
|
|
2802
|
+
addJobs({ documents, tenant, contentType, operationType, sourceMetadata }: {
|
|
2803
|
+
documents: any;
|
|
2804
|
+
tenant: any;
|
|
2805
|
+
contentType: any;
|
|
2806
|
+
operationType: any;
|
|
2807
|
+
sourceMetadata: any;
|
|
2808
|
+
}): Promise<{
|
|
2809
|
+
jobCount: number;
|
|
2810
|
+
jobIds: (string | undefined)[];
|
|
2811
|
+
}>;
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2791
2814
|
/**
|
|
2792
2815
|
* Creates BullMQ configuration with explicit dependencies
|
|
2793
2816
|
* @param {Object} params Configuration parameters
|
|
@@ -2807,4 +2830,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
2807
2830
|
};
|
|
2808
2831
|
}): Object;
|
|
2809
2832
|
|
|
2810
|
-
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseFlowProducer, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, collectMarkIdsInOrder, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnoFilterBucketKey, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
|
2833
|
+
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseFlowProducer, BaseProducer, BaseWorker, type BlockCapabilities, type BlockDef, BlockRegistry, CHUNKING_PRESETS, ChunksElasticSyncProducer, ContentElasticSyncProducer, ELASTIC_MAPPING_PRESETS, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MONGO_SCHEMA_PRESETS, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, blockRegistry, buildFilterConfigurations, collectMarkIdsInOrder, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnoFilterBucketKey, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToContentTypeLanding, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToMyContent, getRoutePathToPublishedContent, getRoutePathToReviewDashboard, getRoutePathToTCI, getRoutePathToTagCategoryLanding, getTplModelByTenant, getVal, isTplAnnotationEnabled, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, plainTextToLexical, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/node.js
CHANGED
|
@@ -2280,6 +2280,91 @@ var require_AnnosElasticSyncProducer = __commonJS({
|
|
|
2280
2280
|
}
|
|
2281
2281
|
});
|
|
2282
2282
|
|
|
2283
|
+
// src/bullmq/ContentElasticSyncProducer.js
|
|
2284
|
+
var require_ContentElasticSyncProducer = __commonJS({
|
|
2285
|
+
"src/bullmq/ContentElasticSyncProducer.js"(exports2, module2) {
|
|
2286
|
+
"use strict";
|
|
2287
|
+
var { BaseProducer: BaseProducer2 } = require_BaseProducer();
|
|
2288
|
+
var { GET_GLOBAL_BULLMQ_CONFIG: GET_GLOBAL_BULLMQ_CONFIG2 } = require_GET_GLOBAL_BULLMQ_CONFIG();
|
|
2289
|
+
var { SecretManagerConnector: SecretManagerConnector2 } = (init_SecretManagerConnector(), __toCommonJS(SecretManagerConnector_exports));
|
|
2290
|
+
var ContentElasticSyncProducer2 = class _ContentElasticSyncProducer extends BaseProducer2 {
|
|
2291
|
+
// Preserve class name through minification for ProducerManager lookup
|
|
2292
|
+
static get name() {
|
|
2293
|
+
return "ContentElasticSyncProducer";
|
|
2294
|
+
}
|
|
2295
|
+
// env is OPTIONAL — cross-env routing: jobs land in the target env's Redis
|
|
2296
|
+
// so that env's deployed workers pick them up (see okf-be
|
|
2297
|
+
// CreateChunksProducer for the rationale and the localhost `_local_<user>`
|
|
2298
|
+
// queue-id quirk).
|
|
2299
|
+
constructor(options = {}) {
|
|
2300
|
+
const env = options.env || process.env.ENV;
|
|
2301
|
+
const c = SecretManagerConnector2.getEnvSpecificConfigs(env);
|
|
2302
|
+
const redisCredentials = options.redisCredentials || {
|
|
2303
|
+
REDIS_HOST: c.REDIS_HOST,
|
|
2304
|
+
REDIS_PORT: c.REDIS_PORT,
|
|
2305
|
+
REDIS_PASSWORD: c.REDIS_PASSWORD
|
|
2306
|
+
};
|
|
2307
|
+
const GLOBAL_BULLMQ_CONFIG = GET_GLOBAL_BULLMQ_CONFIG2({
|
|
2308
|
+
env,
|
|
2309
|
+
redisCredentials
|
|
2310
|
+
});
|
|
2311
|
+
super(GLOBAL_BULLMQ_CONFIG.CONTENT_ELASTIC_SYNC_QUEUE);
|
|
2312
|
+
this.env = env;
|
|
2313
|
+
}
|
|
2314
|
+
async addJobs({ documents, tenant, contentType, operationType, sourceMetadata }) {
|
|
2315
|
+
if (!documents || documents.length === 0 || contentType === "staticPages") {
|
|
2316
|
+
return { jobCount: 0, jobIds: [] };
|
|
2317
|
+
}
|
|
2318
|
+
const batchSize = 200;
|
|
2319
|
+
let jobs = [];
|
|
2320
|
+
for (let i = 0; i < documents.length; i += batchSize) {
|
|
2321
|
+
const batch = documents.slice(i, i + batchSize);
|
|
2322
|
+
jobs.push({
|
|
2323
|
+
name: "processContentElasticSync",
|
|
2324
|
+
data: {
|
|
2325
|
+
docIds: batch.map((doc) => doc._id),
|
|
2326
|
+
tenant,
|
|
2327
|
+
env: this.env,
|
|
2328
|
+
contentType,
|
|
2329
|
+
operationType,
|
|
2330
|
+
sourceMetadata: {
|
|
2331
|
+
...sourceMetadata,
|
|
2332
|
+
contentId: batch.map((d) => d._id)
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
});
|
|
2336
|
+
}
|
|
2337
|
+
const addedJobs = await this.addBulkJobs(jobs);
|
|
2338
|
+
const jobIds = addedJobs.map((job) => job.id);
|
|
2339
|
+
console.log(`\u{1F4E6} Added ${addedJobs.length} jobs for ${contentType} contents sync atomically`);
|
|
2340
|
+
return {
|
|
2341
|
+
jobCount: addedJobs.length,
|
|
2342
|
+
jobIds
|
|
2343
|
+
};
|
|
2344
|
+
}
|
|
2345
|
+
static async addJobsAndClose(params) {
|
|
2346
|
+
const producer = new _ContentElasticSyncProducer({ env: params?.env });
|
|
2347
|
+
try {
|
|
2348
|
+
return await producer.addJobs(params);
|
|
2349
|
+
} finally {
|
|
2350
|
+
await producer.stop();
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
static async removeJobsAndClose(jobIds, env) {
|
|
2354
|
+
const producer = new _ContentElasticSyncProducer({ env });
|
|
2355
|
+
try {
|
|
2356
|
+
return await producer.removeJobs(jobIds);
|
|
2357
|
+
} finally {
|
|
2358
|
+
await producer.stop();
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
};
|
|
2362
|
+
module2.exports = {
|
|
2363
|
+
ContentElasticSyncProducer: ContentElasticSyncProducer2
|
|
2364
|
+
};
|
|
2365
|
+
}
|
|
2366
|
+
});
|
|
2367
|
+
|
|
2283
2368
|
// src/node.ts
|
|
2284
2369
|
var node_exports = {};
|
|
2285
2370
|
__export(node_exports, {
|
|
@@ -2293,6 +2378,7 @@ __export(node_exports, {
|
|
|
2293
2378
|
BlockRegistry: () => BlockRegistry,
|
|
2294
2379
|
CHUNKING_PRESETS: () => CHUNKING_PRESETS,
|
|
2295
2380
|
ChunksElasticSyncProducer: () => import_ChunksElasticSyncProducer.ChunksElasticSyncProducer,
|
|
2381
|
+
ContentElasticSyncProducer: () => import_ContentElasticSyncProducer.ContentElasticSyncProducer,
|
|
2296
2382
|
ELASTIC_MAPPING_PRESETS: () => ELASTIC_MAPPING_PRESETS,
|
|
2297
2383
|
ElasticSearchConnector: () => import_ElasticSearchConnector.ElasticSearchConnector,
|
|
2298
2384
|
FILTER_IDS: () => FILTER_IDS,
|
|
@@ -5015,6 +5101,7 @@ var import_BaseFlowProducer = __toESM(require_BaseFlowProducer());
|
|
|
5015
5101
|
var import_BaseWorker = __toESM(require_BaseWorker());
|
|
5016
5102
|
var import_ChunksElasticSyncProducer = __toESM(require_ChunksElasticSyncProducer());
|
|
5017
5103
|
var import_AnnosElasticSyncProducer = __toESM(require_AnnosElasticSyncProducer());
|
|
5104
|
+
var import_ContentElasticSyncProducer = __toESM(require_ContentElasticSyncProducer());
|
|
5018
5105
|
var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG());
|
|
5019
5106
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5020
5107
|
0 && (module.exports = {
|
|
@@ -5028,6 +5115,7 @@ var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG()
|
|
|
5028
5115
|
BlockRegistry,
|
|
5029
5116
|
CHUNKING_PRESETS,
|
|
5030
5117
|
ChunksElasticSyncProducer,
|
|
5118
|
+
ContentElasticSyncProducer,
|
|
5031
5119
|
ELASTIC_MAPPING_PRESETS,
|
|
5032
5120
|
ElasticSearchConnector,
|
|
5033
5121
|
FILTER_IDS,
|
package/dist/node.mjs
CHANGED
|
@@ -2285,6 +2285,91 @@ var require_AnnosElasticSyncProducer = __commonJS({
|
|
|
2285
2285
|
}
|
|
2286
2286
|
});
|
|
2287
2287
|
|
|
2288
|
+
// src/bullmq/ContentElasticSyncProducer.js
|
|
2289
|
+
var require_ContentElasticSyncProducer = __commonJS({
|
|
2290
|
+
"src/bullmq/ContentElasticSyncProducer.js"(exports, module) {
|
|
2291
|
+
"use strict";
|
|
2292
|
+
var { BaseProducer: BaseProducer2 } = require_BaseProducer();
|
|
2293
|
+
var { GET_GLOBAL_BULLMQ_CONFIG: GET_GLOBAL_BULLMQ_CONFIG2 } = require_GET_GLOBAL_BULLMQ_CONFIG();
|
|
2294
|
+
var { SecretManagerConnector: SecretManagerConnector2 } = (init_SecretManagerConnector(), __toCommonJS(SecretManagerConnector_exports));
|
|
2295
|
+
var ContentElasticSyncProducer2 = class _ContentElasticSyncProducer extends BaseProducer2 {
|
|
2296
|
+
// Preserve class name through minification for ProducerManager lookup
|
|
2297
|
+
static get name() {
|
|
2298
|
+
return "ContentElasticSyncProducer";
|
|
2299
|
+
}
|
|
2300
|
+
// env is OPTIONAL — cross-env routing: jobs land in the target env's Redis
|
|
2301
|
+
// so that env's deployed workers pick them up (see okf-be
|
|
2302
|
+
// CreateChunksProducer for the rationale and the localhost `_local_<user>`
|
|
2303
|
+
// queue-id quirk).
|
|
2304
|
+
constructor(options = {}) {
|
|
2305
|
+
const env = options.env || process.env.ENV;
|
|
2306
|
+
const c = SecretManagerConnector2.getEnvSpecificConfigs(env);
|
|
2307
|
+
const redisCredentials = options.redisCredentials || {
|
|
2308
|
+
REDIS_HOST: c.REDIS_HOST,
|
|
2309
|
+
REDIS_PORT: c.REDIS_PORT,
|
|
2310
|
+
REDIS_PASSWORD: c.REDIS_PASSWORD
|
|
2311
|
+
};
|
|
2312
|
+
const GLOBAL_BULLMQ_CONFIG = GET_GLOBAL_BULLMQ_CONFIG2({
|
|
2313
|
+
env,
|
|
2314
|
+
redisCredentials
|
|
2315
|
+
});
|
|
2316
|
+
super(GLOBAL_BULLMQ_CONFIG.CONTENT_ELASTIC_SYNC_QUEUE);
|
|
2317
|
+
this.env = env;
|
|
2318
|
+
}
|
|
2319
|
+
async addJobs({ documents, tenant, contentType, operationType, sourceMetadata }) {
|
|
2320
|
+
if (!documents || documents.length === 0 || contentType === "staticPages") {
|
|
2321
|
+
return { jobCount: 0, jobIds: [] };
|
|
2322
|
+
}
|
|
2323
|
+
const batchSize = 200;
|
|
2324
|
+
let jobs = [];
|
|
2325
|
+
for (let i = 0; i < documents.length; i += batchSize) {
|
|
2326
|
+
const batch = documents.slice(i, i + batchSize);
|
|
2327
|
+
jobs.push({
|
|
2328
|
+
name: "processContentElasticSync",
|
|
2329
|
+
data: {
|
|
2330
|
+
docIds: batch.map((doc) => doc._id),
|
|
2331
|
+
tenant,
|
|
2332
|
+
env: this.env,
|
|
2333
|
+
contentType,
|
|
2334
|
+
operationType,
|
|
2335
|
+
sourceMetadata: {
|
|
2336
|
+
...sourceMetadata,
|
|
2337
|
+
contentId: batch.map((d) => d._id)
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
});
|
|
2341
|
+
}
|
|
2342
|
+
const addedJobs = await this.addBulkJobs(jobs);
|
|
2343
|
+
const jobIds = addedJobs.map((job) => job.id);
|
|
2344
|
+
console.log(`\u{1F4E6} Added ${addedJobs.length} jobs for ${contentType} contents sync atomically`);
|
|
2345
|
+
return {
|
|
2346
|
+
jobCount: addedJobs.length,
|
|
2347
|
+
jobIds
|
|
2348
|
+
};
|
|
2349
|
+
}
|
|
2350
|
+
static async addJobsAndClose(params) {
|
|
2351
|
+
const producer = new _ContentElasticSyncProducer({ env: params?.env });
|
|
2352
|
+
try {
|
|
2353
|
+
return await producer.addJobs(params);
|
|
2354
|
+
} finally {
|
|
2355
|
+
await producer.stop();
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
static async removeJobsAndClose(jobIds, env) {
|
|
2359
|
+
const producer = new _ContentElasticSyncProducer({ env });
|
|
2360
|
+
try {
|
|
2361
|
+
return await producer.removeJobs(jobIds);
|
|
2362
|
+
} finally {
|
|
2363
|
+
await producer.stop();
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
};
|
|
2367
|
+
module.exports = {
|
|
2368
|
+
ContentElasticSyncProducer: ContentElasticSyncProducer2
|
|
2369
|
+
};
|
|
2370
|
+
}
|
|
2371
|
+
});
|
|
2372
|
+
|
|
2288
2373
|
// src/utils/getterSetterDeleter/utils/set_deleteVal.ts
|
|
2289
2374
|
var set_deleteVal = (action, data, valuePath, value) => {
|
|
2290
2375
|
if (valuePath === void 0) return;
|
|
@@ -4943,12 +5028,14 @@ var import_BaseFlowProducer = __toESM(require_BaseFlowProducer());
|
|
|
4943
5028
|
var import_BaseWorker = __toESM(require_BaseWorker());
|
|
4944
5029
|
var import_ChunksElasticSyncProducer = __toESM(require_ChunksElasticSyncProducer());
|
|
4945
5030
|
var import_AnnosElasticSyncProducer = __toESM(require_AnnosElasticSyncProducer());
|
|
5031
|
+
var import_ContentElasticSyncProducer = __toESM(require_ContentElasticSyncProducer());
|
|
4946
5032
|
var import_GET_GLOBAL_BULLMQ_CONFIG = __toESM(require_GET_GLOBAL_BULLMQ_CONFIG());
|
|
4947
5033
|
var export_AnnosElasticSyncProducer = import_AnnosElasticSyncProducer.AnnosElasticSyncProducer;
|
|
4948
5034
|
var export_BaseFlowProducer = import_BaseFlowProducer.BaseFlowProducer;
|
|
4949
5035
|
var export_BaseProducer = import_BaseProducer.BaseProducer;
|
|
4950
5036
|
var export_BaseWorker = import_BaseWorker.BaseWorker;
|
|
4951
5037
|
var export_ChunksElasticSyncProducer = import_ChunksElasticSyncProducer.ChunksElasticSyncProducer;
|
|
5038
|
+
var export_ContentElasticSyncProducer = import_ContentElasticSyncProducer.ContentElasticSyncProducer;
|
|
4952
5039
|
var export_ElasticSearchConnector = import_ElasticSearchConnector.ElasticSearchConnector;
|
|
4953
5040
|
var export_GET_GLOBAL_BULLMQ_CONFIG = import_GET_GLOBAL_BULLMQ_CONFIG.GET_GLOBAL_BULLMQ_CONFIG;
|
|
4954
5041
|
var export_MongoConnector = import_MongoConnector3.MongoConnector;
|
|
@@ -4972,6 +5059,7 @@ export {
|
|
|
4972
5059
|
BlockRegistry,
|
|
4973
5060
|
CHUNKING_PRESETS,
|
|
4974
5061
|
export_ChunksElasticSyncProducer as ChunksElasticSyncProducer,
|
|
5062
|
+
export_ContentElasticSyncProducer as ContentElasticSyncProducer,
|
|
4975
5063
|
ELASTIC_MAPPING_PRESETS,
|
|
4976
5064
|
export_ElasticSearchConnector as ElasticSearchConnector,
|
|
4977
5065
|
FILTER_IDS,
|