@okf/ootils 1.35.0 → 1.36.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/universal.js CHANGED
@@ -1224,6 +1224,34 @@ var BASE_BULLMQ_CONFIG = {
1224
1224
  maxStalledCount: 3
1225
1225
  }
1226
1226
  },
1227
+ // One job per due ExternalConnection at each cron tick (hourly/daily/weekly).
1228
+ // The worker handler doesn't do the import itself — it calls okf-be's
1229
+ // /api/externalConnections/internal/runSync which fans out into the existing
1230
+ // DIRECT_DATA_IMPORT_QUEUE for the batched fetch+import work. Keeping this
1231
+ // queue separate from DDI gives clean dashboard separation, independent
1232
+ // concurrency (background-friendly), and independent pause/drain.
1233
+ SCHEDULED_EXTERNAL_SYNC_QUEUE: {
1234
+ id: "scheduled-external-sync-queue",
1235
+ queueConfig: {
1236
+ defaultJobOptions: {
1237
+ backoff: { type: "exponential", delay: 5e3 },
1238
+ attempts: 3,
1239
+ removeOnComplete: 30,
1240
+ removeOnFail: 100
1241
+ },
1242
+ streams: {
1243
+ events: {
1244
+ maxLen: 10
1245
+ }
1246
+ }
1247
+ },
1248
+ workerConfig: {
1249
+ concurrency: 1,
1250
+ lockDuration: 6e5,
1251
+ // 10 min — runSync HTTP call can be long
1252
+ maxStalledCount: 3
1253
+ }
1254
+ },
1227
1255
  REINDEX_QUEUE: {
1228
1256
  id: "reindex-queue",
1229
1257
  queueConfig: {
@@ -2067,7 +2095,10 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
2067
2095
  }),
2068
2096
  source: {
2069
2097
  filterType: "usersType",
2070
- profileTypes: allProfileTpls.map((tpl) => tpl.kp_content_type)
2098
+ profileTypes: allProfileTpls.map((tpl) => tpl.kp_content_type),
2099
+ pinnedOptions: [
2100
+ { display: "AI", value: null }
2101
+ ]
2071
2102
  },
2072
2103
  target: {
2073
2104
  filterType: "valuePathType",
@@ -2331,6 +2362,9 @@ var sortFiltersHierarchically = (filters) => {
2331
2362
  };
2332
2363
 
2333
2364
  // src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
2365
+ var injectFilterOptionsBy = (filters) => filters.map(
2366
+ (f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
2367
+ );
2334
2368
  var _self_managed_buildDocHierarchyConfig = ({
2335
2369
  combinedDocumentBlocks,
2336
2370
  docRollupBlocks,
@@ -2343,27 +2377,11 @@ var _self_managed_buildDocHierarchyConfig = ({
2343
2377
  const commonGroup = allGroups.find(
2344
2378
  (g) => g.contentTypes.length === selectedTpls.length
2345
2379
  );
2346
- const commonFilterConfigs = commonGroup ? sortFiltersHierarchically(
2347
- attachParentFields(
2348
- buildFilterConfigurations({
2349
- groups: [commonGroup],
2350
- type: "tags",
2351
- selectedTpls,
2352
- allTpls,
2353
- isRollup: false,
2354
- isAnno: false
2355
- }).flatMap((s) => s.configs),
2356
- allTpls
2357
- )
2358
- ) : [];
2359
- const multiDatasetGroups = selectedTpls.length >= 2 ? allGroups.filter(
2360
- (g) => g.contentTypes.length > 1 && g.contentTypes.length < selectedTpls.length
2361
- ) : [];
2362
- const sharedAcrossMultiple = multiDatasetGroups.map((group) => {
2363
- const groupFilterConfigs = sortFiltersHierarchically(
2380
+ const commonFilterConfigs = commonGroup ? injectFilterOptionsBy(
2381
+ sortFiltersHierarchically(
2364
2382
  attachParentFields(
2365
2383
  buildFilterConfigurations({
2366
- groups: [group],
2384
+ groups: [commonGroup],
2367
2385
  type: "tags",
2368
2386
  selectedTpls,
2369
2387
  allTpls,
@@ -2372,6 +2390,26 @@ var _self_managed_buildDocHierarchyConfig = ({
2372
2390
  }).flatMap((s) => s.configs),
2373
2391
  allTpls
2374
2392
  )
2393
+ )
2394
+ ) : [];
2395
+ const multiDatasetGroups = selectedTpls.length >= 2 ? allGroups.filter(
2396
+ (g) => g.contentTypes.length > 1 && g.contentTypes.length < selectedTpls.length
2397
+ ) : [];
2398
+ const sharedAcrossMultiple = multiDatasetGroups.map((group) => {
2399
+ const groupFilterConfigs = injectFilterOptionsBy(
2400
+ sortFiltersHierarchically(
2401
+ attachParentFields(
2402
+ buildFilterConfigurations({
2403
+ groups: [group],
2404
+ type: "tags",
2405
+ selectedTpls,
2406
+ allTpls,
2407
+ isRollup: false,
2408
+ isAnno: false
2409
+ }).flatMap((s) => s.configs),
2410
+ allTpls
2411
+ )
2412
+ )
2375
2413
  );
2376
2414
  const display = group.contentTypes.map((ct) => {
2377
2415
  const tplData = allTpls.find(
@@ -2430,8 +2468,10 @@ var _self_managed_buildDocHierarchyConfig = ({
2430
2468
  (f) => !rollupSourceKeys.has(JSON.stringify(f.source))
2431
2469
  );
2432
2470
  const combined = [...dedupedFilters, ...rollupConfigs];
2433
- const combinedWithParents = sortFiltersHierarchically(
2434
- attachParentFields(combined, allTpls)
2471
+ const combinedWithParents = injectFilterOptionsBy(
2472
+ sortFiltersHierarchically(
2473
+ attachParentFields(combined, allTpls)
2474
+ )
2435
2475
  );
2436
2476
  const rollupFilterIds = new Set(rollupConfigs.map((r) => r.filterId));
2437
2477
  const filtersWithParents = combinedWithParents.filter(
@@ -1155,6 +1155,34 @@ var BASE_BULLMQ_CONFIG = {
1155
1155
  maxStalledCount: 3
1156
1156
  }
1157
1157
  },
1158
+ // One job per due ExternalConnection at each cron tick (hourly/daily/weekly).
1159
+ // The worker handler doesn't do the import itself — it calls okf-be's
1160
+ // /api/externalConnections/internal/runSync which fans out into the existing
1161
+ // DIRECT_DATA_IMPORT_QUEUE for the batched fetch+import work. Keeping this
1162
+ // queue separate from DDI gives clean dashboard separation, independent
1163
+ // concurrency (background-friendly), and independent pause/drain.
1164
+ SCHEDULED_EXTERNAL_SYNC_QUEUE: {
1165
+ id: "scheduled-external-sync-queue",
1166
+ queueConfig: {
1167
+ defaultJobOptions: {
1168
+ backoff: { type: "exponential", delay: 5e3 },
1169
+ attempts: 3,
1170
+ removeOnComplete: 30,
1171
+ removeOnFail: 100
1172
+ },
1173
+ streams: {
1174
+ events: {
1175
+ maxLen: 10
1176
+ }
1177
+ }
1178
+ },
1179
+ workerConfig: {
1180
+ concurrency: 1,
1181
+ lockDuration: 6e5,
1182
+ // 10 min — runSync HTTP call can be long
1183
+ maxStalledCount: 3
1184
+ }
1185
+ },
1158
1186
  REINDEX_QUEUE: {
1159
1187
  id: "reindex-queue",
1160
1188
  queueConfig: {
@@ -1998,7 +2026,10 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
1998
2026
  }),
1999
2027
  source: {
2000
2028
  filterType: "usersType",
2001
- profileTypes: allProfileTpls.map((tpl) => tpl.kp_content_type)
2029
+ profileTypes: allProfileTpls.map((tpl) => tpl.kp_content_type),
2030
+ pinnedOptions: [
2031
+ { display: "AI", value: null }
2032
+ ]
2002
2033
  },
2003
2034
  target: {
2004
2035
  filterType: "valuePathType",
@@ -2262,6 +2293,9 @@ var sortFiltersHierarchically = (filters) => {
2262
2293
  };
2263
2294
 
2264
2295
  // src/utils/autoGenFilterConfigsFromTpl/utils/_self_managed_buildDocHierarchyConfig.ts
2296
+ var injectFilterOptionsBy = (filters) => filters.map(
2297
+ (f) => f.parentFilterId ? { ...f, source: { ...f.source, filterOptionsBy: { filterId: f.parentFilterId } } } : f
2298
+ );
2265
2299
  var _self_managed_buildDocHierarchyConfig = ({
2266
2300
  combinedDocumentBlocks,
2267
2301
  docRollupBlocks,
@@ -2274,27 +2308,11 @@ var _self_managed_buildDocHierarchyConfig = ({
2274
2308
  const commonGroup = allGroups.find(
2275
2309
  (g) => g.contentTypes.length === selectedTpls.length
2276
2310
  );
2277
- const commonFilterConfigs = commonGroup ? sortFiltersHierarchically(
2278
- attachParentFields(
2279
- buildFilterConfigurations({
2280
- groups: [commonGroup],
2281
- type: "tags",
2282
- selectedTpls,
2283
- allTpls,
2284
- isRollup: false,
2285
- isAnno: false
2286
- }).flatMap((s) => s.configs),
2287
- allTpls
2288
- )
2289
- ) : [];
2290
- const multiDatasetGroups = selectedTpls.length >= 2 ? allGroups.filter(
2291
- (g) => g.contentTypes.length > 1 && g.contentTypes.length < selectedTpls.length
2292
- ) : [];
2293
- const sharedAcrossMultiple = multiDatasetGroups.map((group) => {
2294
- const groupFilterConfigs = sortFiltersHierarchically(
2311
+ const commonFilterConfigs = commonGroup ? injectFilterOptionsBy(
2312
+ sortFiltersHierarchically(
2295
2313
  attachParentFields(
2296
2314
  buildFilterConfigurations({
2297
- groups: [group],
2315
+ groups: [commonGroup],
2298
2316
  type: "tags",
2299
2317
  selectedTpls,
2300
2318
  allTpls,
@@ -2303,6 +2321,26 @@ var _self_managed_buildDocHierarchyConfig = ({
2303
2321
  }).flatMap((s) => s.configs),
2304
2322
  allTpls
2305
2323
  )
2324
+ )
2325
+ ) : [];
2326
+ const multiDatasetGroups = selectedTpls.length >= 2 ? allGroups.filter(
2327
+ (g) => g.contentTypes.length > 1 && g.contentTypes.length < selectedTpls.length
2328
+ ) : [];
2329
+ const sharedAcrossMultiple = multiDatasetGroups.map((group) => {
2330
+ const groupFilterConfigs = injectFilterOptionsBy(
2331
+ sortFiltersHierarchically(
2332
+ attachParentFields(
2333
+ buildFilterConfigurations({
2334
+ groups: [group],
2335
+ type: "tags",
2336
+ selectedTpls,
2337
+ allTpls,
2338
+ isRollup: false,
2339
+ isAnno: false
2340
+ }).flatMap((s) => s.configs),
2341
+ allTpls
2342
+ )
2343
+ )
2306
2344
  );
2307
2345
  const display = group.contentTypes.map((ct) => {
2308
2346
  const tplData = allTpls.find(
@@ -2361,8 +2399,10 @@ var _self_managed_buildDocHierarchyConfig = ({
2361
2399
  (f) => !rollupSourceKeys.has(JSON.stringify(f.source))
2362
2400
  );
2363
2401
  const combined = [...dedupedFilters, ...rollupConfigs];
2364
- const combinedWithParents = sortFiltersHierarchically(
2365
- attachParentFields(combined, allTpls)
2402
+ const combinedWithParents = injectFilterOptionsBy(
2403
+ sortFiltersHierarchically(
2404
+ attachParentFields(combined, allTpls)
2405
+ )
2366
2406
  );
2367
2407
  const rollupFilterIds = new Set(rollupConfigs.map((r) => r.filterId));
2368
2408
  const filtersWithParents = combinedWithParents.filter(
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.35.0",
6
+ "version": "1.36.1",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",