@okf/ootils 1.28.1 → 1.28.3
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/browser.d.mts +61 -43
- package/dist/browser.d.ts +61 -43
- package/dist/browser.js +38 -44
- package/dist/browser.mjs +38 -42
- package/dist/node.d.mts +61 -43
- package/dist/node.d.ts +61 -43
- package/dist/node.js +38 -44
- package/dist/node.mjs +38 -42
- package/dist/universal.d.mts +61 -43
- package/dist/universal.d.ts +61 -43
- package/dist/universal.js +38 -44
- package/dist/universal.mjs +38 -42
- package/package.json +1 -1
package/dist/browser.d.mts
CHANGED
|
@@ -669,7 +669,7 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
669
669
|
}
|
|
670
670
|
export { workerConfig_9 as workerConfig };
|
|
671
671
|
}
|
|
672
|
-
namespace
|
|
672
|
+
namespace USERS_ELASTIC_SYNC_QUEUE {
|
|
673
673
|
let id_10: string;
|
|
674
674
|
export { id_10 as id };
|
|
675
675
|
export namespace queueConfig_10 {
|
|
@@ -709,7 +709,7 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
709
709
|
}
|
|
710
710
|
export { workerConfig_10 as workerConfig };
|
|
711
711
|
}
|
|
712
|
-
namespace
|
|
712
|
+
namespace CONTENT_ELASTIC_SYNC_QUEUE {
|
|
713
713
|
let id_11: string;
|
|
714
714
|
export { id_11 as id };
|
|
715
715
|
export namespace queueConfig_11 {
|
|
@@ -723,8 +723,6 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
723
723
|
export { delay_11 as delay };
|
|
724
724
|
}
|
|
725
725
|
export { backoff_11 as backoff };
|
|
726
|
-
let delay_12: number;
|
|
727
|
-
export { delay_12 as delay };
|
|
728
726
|
let removeOnComplete_11: number;
|
|
729
727
|
export { removeOnComplete_11 as removeOnComplete };
|
|
730
728
|
let removeOnFail_11: number;
|
|
@@ -751,6 +749,48 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
751
749
|
}
|
|
752
750
|
export { workerConfig_11 as workerConfig };
|
|
753
751
|
}
|
|
752
|
+
namespace REINDEX_QUEUE {
|
|
753
|
+
let id_12: string;
|
|
754
|
+
export { id_12 as id };
|
|
755
|
+
export namespace queueConfig_12 {
|
|
756
|
+
export namespace defaultJobOptions_12 {
|
|
757
|
+
let attempts_12: number;
|
|
758
|
+
export { attempts_12 as attempts };
|
|
759
|
+
export namespace backoff_12 {
|
|
760
|
+
let type_12: string;
|
|
761
|
+
export { type_12 as type };
|
|
762
|
+
let delay_12: number;
|
|
763
|
+
export { delay_12 as delay };
|
|
764
|
+
}
|
|
765
|
+
export { backoff_12 as backoff };
|
|
766
|
+
let delay_13: number;
|
|
767
|
+
export { delay_13 as delay };
|
|
768
|
+
let removeOnComplete_12: number;
|
|
769
|
+
export { removeOnComplete_12 as removeOnComplete };
|
|
770
|
+
let removeOnFail_12: number;
|
|
771
|
+
export { removeOnFail_12 as removeOnFail };
|
|
772
|
+
}
|
|
773
|
+
export { defaultJobOptions_12 as defaultJobOptions };
|
|
774
|
+
export namespace streams_12 {
|
|
775
|
+
export namespace events_12 {
|
|
776
|
+
let maxLen_12: number;
|
|
777
|
+
export { maxLen_12 as maxLen };
|
|
778
|
+
}
|
|
779
|
+
export { events_12 as events };
|
|
780
|
+
}
|
|
781
|
+
export { streams_12 as streams };
|
|
782
|
+
}
|
|
783
|
+
export { queueConfig_12 as queueConfig };
|
|
784
|
+
export namespace workerConfig_12 {
|
|
785
|
+
let concurrency_12: number;
|
|
786
|
+
export { concurrency_12 as concurrency };
|
|
787
|
+
let lockDuration_12: number;
|
|
788
|
+
export { lockDuration_12 as lockDuration };
|
|
789
|
+
let maxStalledCount_12: number;
|
|
790
|
+
export { maxStalledCount_12 as maxStalledCount };
|
|
791
|
+
}
|
|
792
|
+
export { workerConfig_12 as workerConfig };
|
|
793
|
+
}
|
|
754
794
|
}
|
|
755
795
|
|
|
756
796
|
interface PlatformContextContentItem {
|
|
@@ -1260,49 +1300,27 @@ declare const UI_CONTENT: {
|
|
|
1260
1300
|
};
|
|
1261
1301
|
};
|
|
1262
1302
|
|
|
1263
|
-
interface GenCleanCamelCaseIdOptions {
|
|
1264
|
-
/** Strip all non-alphanumeric chars (A-Z, a-z, 0-9 only). Default: false */
|
|
1265
|
-
stripNonAlphanumeric?: boolean;
|
|
1266
|
-
/** Truncate result to this max length. Default: no limit */
|
|
1267
|
-
maxLength?: number;
|
|
1268
|
-
}
|
|
1269
|
-
declare const genCleanCamelCaseId: (id: string, options?: GenCleanCamelCaseIdOptions) => string;
|
|
1270
|
-
|
|
1271
1303
|
/**
|
|
1272
|
-
* Generates a clean, deterministic
|
|
1273
|
-
* Wraps genCleanCamelCaseId with stripNonAlphanumeric + maxLength 40.
|
|
1304
|
+
* Generates a clean, deterministic, alphanumeric camelCase ID from text.
|
|
1274
1305
|
*
|
|
1275
|
-
*
|
|
1306
|
+
* 1. Splits on non-alphanumeric characters, builds camelCase
|
|
1307
|
+
* 2. Strips all non a-zA-Z0-9 from result
|
|
1308
|
+
* 3. If input had no unicode letters/numbers at all (e.g. "---"), returns 'a'
|
|
1309
|
+
* 4. If camelCase had content but nothing survived ASCII strip (pure non-Latin),
|
|
1310
|
+
* generates a deterministic hash (FNV-1a) of the unicode camelCase
|
|
1311
|
+
* 5. Prepends 'a' if starts with digit
|
|
1312
|
+
* 6. Truncates to 40 chars
|
|
1276
1313
|
*
|
|
1277
|
-
*
|
|
1278
|
-
* genCleanContentTypeId("My Articles!") => "myArticles"
|
|
1279
|
-
* genCleanContentTypeId("myArticles") => "myArticles" (idempotent)
|
|
1280
|
-
* genCleanContentTypeId("123 Test") => "a123Test"
|
|
1281
|
-
*/
|
|
1282
|
-
declare const genCleanContentTypeId: (text: string) => string;
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Generates a clean, short, unique ID from text input.
|
|
1286
|
-
* Used for block valuePaths in templates.
|
|
1287
|
-
*
|
|
1288
|
-
* 1. Strips all characters except A-Z, a-z, 0-9
|
|
1289
|
-
* 2. Lowercases the result
|
|
1290
|
-
* 3. Prepends 'a' if starts with a digit
|
|
1291
|
-
* 4. Truncates to maxLength (default 10)
|
|
1292
|
-
* 5. Appends _{random id} (default 4 chars)
|
|
1293
|
-
*
|
|
1294
|
-
* Idempotent: if input already matches the output pattern
|
|
1295
|
-
* (lowercase alphanumeric + _hash suffix), returns as-is.
|
|
1296
|
-
*
|
|
1297
|
-
* @param text - The input text to convert
|
|
1298
|
-
* @param maxLength - Max characters before the random suffix (default 10)
|
|
1299
|
-
* @param shortIdLength - Length of the random suffix (default 4)
|
|
1314
|
+
* Idempotent: running twice produces the same output.
|
|
1300
1315
|
*
|
|
1301
1316
|
* @example
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
1317
|
+
* genCleanCamelCaseId("Author Name") => "authorName"
|
|
1318
|
+
* genCleanCamelCaseId("authorName") => "authorName" (idempotent)
|
|
1319
|
+
* genCleanCamelCaseId("123 Test") => "a123Test"
|
|
1320
|
+
* genCleanCamelCaseId("café latté") => "cafLatt"
|
|
1321
|
+
* genCleanCamelCaseId("مرحبا") => deterministic hash
|
|
1322
|
+
* genCleanCamelCaseId("---") => "a"
|
|
1305
1323
|
*/
|
|
1306
|
-
declare const
|
|
1324
|
+
declare const genCleanCamelCaseId: (id: string) => string;
|
|
1307
1325
|
|
|
1308
|
-
export { BASE_BULLMQ_CONFIG, FILTER_IDS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId,
|
|
1326
|
+
export { BASE_BULLMQ_CONFIG, FILTER_IDS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/browser.d.ts
CHANGED
|
@@ -669,7 +669,7 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
669
669
|
}
|
|
670
670
|
export { workerConfig_9 as workerConfig };
|
|
671
671
|
}
|
|
672
|
-
namespace
|
|
672
|
+
namespace USERS_ELASTIC_SYNC_QUEUE {
|
|
673
673
|
let id_10: string;
|
|
674
674
|
export { id_10 as id };
|
|
675
675
|
export namespace queueConfig_10 {
|
|
@@ -709,7 +709,7 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
709
709
|
}
|
|
710
710
|
export { workerConfig_10 as workerConfig };
|
|
711
711
|
}
|
|
712
|
-
namespace
|
|
712
|
+
namespace CONTENT_ELASTIC_SYNC_QUEUE {
|
|
713
713
|
let id_11: string;
|
|
714
714
|
export { id_11 as id };
|
|
715
715
|
export namespace queueConfig_11 {
|
|
@@ -723,8 +723,6 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
723
723
|
export { delay_11 as delay };
|
|
724
724
|
}
|
|
725
725
|
export { backoff_11 as backoff };
|
|
726
|
-
let delay_12: number;
|
|
727
|
-
export { delay_12 as delay };
|
|
728
726
|
let removeOnComplete_11: number;
|
|
729
727
|
export { removeOnComplete_11 as removeOnComplete };
|
|
730
728
|
let removeOnFail_11: number;
|
|
@@ -751,6 +749,48 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
751
749
|
}
|
|
752
750
|
export { workerConfig_11 as workerConfig };
|
|
753
751
|
}
|
|
752
|
+
namespace REINDEX_QUEUE {
|
|
753
|
+
let id_12: string;
|
|
754
|
+
export { id_12 as id };
|
|
755
|
+
export namespace queueConfig_12 {
|
|
756
|
+
export namespace defaultJobOptions_12 {
|
|
757
|
+
let attempts_12: number;
|
|
758
|
+
export { attempts_12 as attempts };
|
|
759
|
+
export namespace backoff_12 {
|
|
760
|
+
let type_12: string;
|
|
761
|
+
export { type_12 as type };
|
|
762
|
+
let delay_12: number;
|
|
763
|
+
export { delay_12 as delay };
|
|
764
|
+
}
|
|
765
|
+
export { backoff_12 as backoff };
|
|
766
|
+
let delay_13: number;
|
|
767
|
+
export { delay_13 as delay };
|
|
768
|
+
let removeOnComplete_12: number;
|
|
769
|
+
export { removeOnComplete_12 as removeOnComplete };
|
|
770
|
+
let removeOnFail_12: number;
|
|
771
|
+
export { removeOnFail_12 as removeOnFail };
|
|
772
|
+
}
|
|
773
|
+
export { defaultJobOptions_12 as defaultJobOptions };
|
|
774
|
+
export namespace streams_12 {
|
|
775
|
+
export namespace events_12 {
|
|
776
|
+
let maxLen_12: number;
|
|
777
|
+
export { maxLen_12 as maxLen };
|
|
778
|
+
}
|
|
779
|
+
export { events_12 as events };
|
|
780
|
+
}
|
|
781
|
+
export { streams_12 as streams };
|
|
782
|
+
}
|
|
783
|
+
export { queueConfig_12 as queueConfig };
|
|
784
|
+
export namespace workerConfig_12 {
|
|
785
|
+
let concurrency_12: number;
|
|
786
|
+
export { concurrency_12 as concurrency };
|
|
787
|
+
let lockDuration_12: number;
|
|
788
|
+
export { lockDuration_12 as lockDuration };
|
|
789
|
+
let maxStalledCount_12: number;
|
|
790
|
+
export { maxStalledCount_12 as maxStalledCount };
|
|
791
|
+
}
|
|
792
|
+
export { workerConfig_12 as workerConfig };
|
|
793
|
+
}
|
|
754
794
|
}
|
|
755
795
|
|
|
756
796
|
interface PlatformContextContentItem {
|
|
@@ -1260,49 +1300,27 @@ declare const UI_CONTENT: {
|
|
|
1260
1300
|
};
|
|
1261
1301
|
};
|
|
1262
1302
|
|
|
1263
|
-
interface GenCleanCamelCaseIdOptions {
|
|
1264
|
-
/** Strip all non-alphanumeric chars (A-Z, a-z, 0-9 only). Default: false */
|
|
1265
|
-
stripNonAlphanumeric?: boolean;
|
|
1266
|
-
/** Truncate result to this max length. Default: no limit */
|
|
1267
|
-
maxLength?: number;
|
|
1268
|
-
}
|
|
1269
|
-
declare const genCleanCamelCaseId: (id: string, options?: GenCleanCamelCaseIdOptions) => string;
|
|
1270
|
-
|
|
1271
1303
|
/**
|
|
1272
|
-
* Generates a clean, deterministic
|
|
1273
|
-
* Wraps genCleanCamelCaseId with stripNonAlphanumeric + maxLength 40.
|
|
1304
|
+
* Generates a clean, deterministic, alphanumeric camelCase ID from text.
|
|
1274
1305
|
*
|
|
1275
|
-
*
|
|
1306
|
+
* 1. Splits on non-alphanumeric characters, builds camelCase
|
|
1307
|
+
* 2. Strips all non a-zA-Z0-9 from result
|
|
1308
|
+
* 3. If input had no unicode letters/numbers at all (e.g. "---"), returns 'a'
|
|
1309
|
+
* 4. If camelCase had content but nothing survived ASCII strip (pure non-Latin),
|
|
1310
|
+
* generates a deterministic hash (FNV-1a) of the unicode camelCase
|
|
1311
|
+
* 5. Prepends 'a' if starts with digit
|
|
1312
|
+
* 6. Truncates to 40 chars
|
|
1276
1313
|
*
|
|
1277
|
-
*
|
|
1278
|
-
* genCleanContentTypeId("My Articles!") => "myArticles"
|
|
1279
|
-
* genCleanContentTypeId("myArticles") => "myArticles" (idempotent)
|
|
1280
|
-
* genCleanContentTypeId("123 Test") => "a123Test"
|
|
1281
|
-
*/
|
|
1282
|
-
declare const genCleanContentTypeId: (text: string) => string;
|
|
1283
|
-
|
|
1284
|
-
/**
|
|
1285
|
-
* Generates a clean, short, unique ID from text input.
|
|
1286
|
-
* Used for block valuePaths in templates.
|
|
1287
|
-
*
|
|
1288
|
-
* 1. Strips all characters except A-Z, a-z, 0-9
|
|
1289
|
-
* 2. Lowercases the result
|
|
1290
|
-
* 3. Prepends 'a' if starts with a digit
|
|
1291
|
-
* 4. Truncates to maxLength (default 10)
|
|
1292
|
-
* 5. Appends _{random id} (default 4 chars)
|
|
1293
|
-
*
|
|
1294
|
-
* Idempotent: if input already matches the output pattern
|
|
1295
|
-
* (lowercase alphanumeric + _hash suffix), returns as-is.
|
|
1296
|
-
*
|
|
1297
|
-
* @param text - The input text to convert
|
|
1298
|
-
* @param maxLength - Max characters before the random suffix (default 10)
|
|
1299
|
-
* @param shortIdLength - Length of the random suffix (default 4)
|
|
1314
|
+
* Idempotent: running twice produces the same output.
|
|
1300
1315
|
*
|
|
1301
1316
|
* @example
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
1317
|
+
* genCleanCamelCaseId("Author Name") => "authorName"
|
|
1318
|
+
* genCleanCamelCaseId("authorName") => "authorName" (idempotent)
|
|
1319
|
+
* genCleanCamelCaseId("123 Test") => "a123Test"
|
|
1320
|
+
* genCleanCamelCaseId("café latté") => "cafLatt"
|
|
1321
|
+
* genCleanCamelCaseId("مرحبا") => deterministic hash
|
|
1322
|
+
* genCleanCamelCaseId("---") => "a"
|
|
1305
1323
|
*/
|
|
1306
|
-
declare const
|
|
1324
|
+
declare const genCleanCamelCaseId: (id: string) => string;
|
|
1307
1325
|
|
|
1308
|
-
export { BASE_BULLMQ_CONFIG, FILTER_IDS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId,
|
|
1326
|
+
export { BASE_BULLMQ_CONFIG, FILTER_IDS, TEMP_removeDuplicateFilters, UI_CONTENT, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getFilterKeyForBlock, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|
package/dist/browser.js
CHANGED
|
@@ -35,8 +35,6 @@ __export(browser_exports, {
|
|
|
35
35
|
extractAllBlocksFromTpl: () => extractAllBlocksFromTpl,
|
|
36
36
|
extractAndOrganizeBlocks: () => extractAndOrganizeBlocks,
|
|
37
37
|
genCleanCamelCaseId: () => genCleanCamelCaseId,
|
|
38
|
-
genCleanContentTypeId: () => genCleanContentTypeId,
|
|
39
|
-
genCleanValuePath: () => genCleanValuePath,
|
|
40
38
|
genTagId: () => genTagId,
|
|
41
39
|
generateFilterKey: () => generateFilterKey,
|
|
42
40
|
getFilterKeyForBlock: () => getFilterKeyForBlock,
|
|
@@ -739,6 +737,30 @@ var BASE_BULLMQ_CONFIG = {
|
|
|
739
737
|
maxStalledCount: 3
|
|
740
738
|
}
|
|
741
739
|
},
|
|
740
|
+
USERS_ELASTIC_SYNC_QUEUE: {
|
|
741
|
+
id: "users-elastic-sync-queue",
|
|
742
|
+
queueConfig: {
|
|
743
|
+
defaultJobOptions: {
|
|
744
|
+
attempts: 3,
|
|
745
|
+
backoff: {
|
|
746
|
+
type: "exponential",
|
|
747
|
+
delay: 2e3
|
|
748
|
+
},
|
|
749
|
+
removeOnComplete: 30,
|
|
750
|
+
removeOnFail: 100
|
|
751
|
+
},
|
|
752
|
+
streams: {
|
|
753
|
+
events: {
|
|
754
|
+
maxLen: 10
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
},
|
|
758
|
+
workerConfig: {
|
|
759
|
+
concurrency: 50,
|
|
760
|
+
lockDuration: 9e4,
|
|
761
|
+
maxStalledCount: 3
|
|
762
|
+
}
|
|
763
|
+
},
|
|
742
764
|
CONTENT_ELASTIC_SYNC_QUEUE: {
|
|
743
765
|
id: "content-elastic-sync-queue",
|
|
744
766
|
queueConfig: {
|
|
@@ -2128,54 +2150,28 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
2128
2150
|
};
|
|
2129
2151
|
|
|
2130
2152
|
// src/utils/genCleanCamelCaseId.ts
|
|
2131
|
-
var
|
|
2153
|
+
var MAX_LENGTH = 40;
|
|
2154
|
+
function fnv1a(str, length = 8) {
|
|
2155
|
+
let hash = 2166136261;
|
|
2156
|
+
for (let i = 0; i < str.length; i++) {
|
|
2157
|
+
hash ^= str.charCodeAt(i);
|
|
2158
|
+
hash = hash * 16777619 >>> 0;
|
|
2159
|
+
}
|
|
2160
|
+
return hash.toString(36).slice(0, length);
|
|
2161
|
+
}
|
|
2162
|
+
var genCleanCamelCaseId = (id) => {
|
|
2132
2163
|
if (!id || typeof id !== "string") return id;
|
|
2133
|
-
|
|
2134
|
-
const baseClean = /^\p{Ll}[\p{L}\p{N}]*$/u.test(id) || /^a\d[\p{L}\p{N}]*$/u.test(id);
|
|
2135
|
-
const withinMaxLength = maxLength ? id.length <= maxLength : true;
|
|
2136
|
-
const hasNoNonAlpha = stripNonAlphanumeric ? /^[a-zA-Z0-9]+$/.test(id) : true;
|
|
2137
|
-
if (baseClean && withinMaxLength && hasNoNonAlpha) return id;
|
|
2164
|
+
if ((/^[a-z][a-zA-Z0-9]*$/.test(id) || /^a\d[a-zA-Z0-9]*$/.test(id)) && id.length <= MAX_LENGTH) return id;
|
|
2138
2165
|
const words = id.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
2139
2166
|
if (words.length === 0) return "a";
|
|
2140
2167
|
let result = words.map((word, i) => {
|
|
2141
2168
|
const lower = word.toLowerCase();
|
|
2142
2169
|
return i === 0 ? lower : lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
2143
2170
|
}).join("");
|
|
2171
|
+
const strippedResult = result.replace(/[^a-zA-Z0-9]/g, "");
|
|
2172
|
+
result = strippedResult || fnv1a(result);
|
|
2144
2173
|
if (/^\d/.test(result)) result = "a" + result;
|
|
2145
|
-
|
|
2146
|
-
result = result.replace(/[^a-zA-Z0-9]/g, "");
|
|
2147
|
-
}
|
|
2148
|
-
if (maxLength) {
|
|
2149
|
-
result = result.slice(0, maxLength);
|
|
2150
|
-
}
|
|
2151
|
-
return result;
|
|
2152
|
-
};
|
|
2153
|
-
|
|
2154
|
-
// src/utils/genCleanContentTypeId.ts
|
|
2155
|
-
var genCleanContentTypeId = (text) => genCleanCamelCaseId(text, { stripNonAlphanumeric: true, maxLength: 40 });
|
|
2156
|
-
|
|
2157
|
-
// src/utils/genCleanValuePath.ts
|
|
2158
|
-
var CHARS = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
2159
|
-
function genShortId(length = 4) {
|
|
2160
|
-
let result = "";
|
|
2161
|
-
for (let i = 0; i < length; i++) {
|
|
2162
|
-
result += CHARS[Math.floor(Math.random() * CHARS.length)];
|
|
2163
|
-
}
|
|
2164
|
-
return result;
|
|
2165
|
-
}
|
|
2166
|
-
var genCleanValuePath = (text) => {
|
|
2167
|
-
const maxLength = 10;
|
|
2168
|
-
const shortIdLength = 4;
|
|
2169
|
-
if (!text || typeof text !== "string") return text;
|
|
2170
|
-
const idempotencyPattern = new RegExp(`^[a-z][a-z0-9]*_[a-z0-9]{${shortIdLength}}$`);
|
|
2171
|
-
if (idempotencyPattern.test(text)) return text;
|
|
2172
|
-
let cleaned = text.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
2173
|
-
if (!cleaned) {
|
|
2174
|
-
throw new Error(`[genCleanValuePath] Input "${text}" contains no alphanumeric characters`);
|
|
2175
|
-
}
|
|
2176
|
-
if (/^\d/.test(cleaned)) cleaned = "a" + cleaned;
|
|
2177
|
-
const truncated = cleaned.slice(0, maxLength);
|
|
2178
|
-
return `${truncated}_${genShortId(shortIdLength)}`;
|
|
2174
|
+
return result.slice(0, MAX_LENGTH);
|
|
2179
2175
|
};
|
|
2180
2176
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2181
2177
|
0 && (module.exports = {
|
|
@@ -2194,8 +2190,6 @@ var genCleanValuePath = (text) => {
|
|
|
2194
2190
|
extractAllBlocksFromTpl,
|
|
2195
2191
|
extractAndOrganizeBlocks,
|
|
2196
2192
|
genCleanCamelCaseId,
|
|
2197
|
-
genCleanContentTypeId,
|
|
2198
|
-
genCleanValuePath,
|
|
2199
2193
|
genTagId,
|
|
2200
2194
|
generateFilterKey,
|
|
2201
2195
|
getFilterKeyForBlock,
|
package/dist/browser.mjs
CHANGED
|
@@ -681,6 +681,30 @@ var BASE_BULLMQ_CONFIG = {
|
|
|
681
681
|
maxStalledCount: 3
|
|
682
682
|
}
|
|
683
683
|
},
|
|
684
|
+
USERS_ELASTIC_SYNC_QUEUE: {
|
|
685
|
+
id: "users-elastic-sync-queue",
|
|
686
|
+
queueConfig: {
|
|
687
|
+
defaultJobOptions: {
|
|
688
|
+
attempts: 3,
|
|
689
|
+
backoff: {
|
|
690
|
+
type: "exponential",
|
|
691
|
+
delay: 2e3
|
|
692
|
+
},
|
|
693
|
+
removeOnComplete: 30,
|
|
694
|
+
removeOnFail: 100
|
|
695
|
+
},
|
|
696
|
+
streams: {
|
|
697
|
+
events: {
|
|
698
|
+
maxLen: 10
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
},
|
|
702
|
+
workerConfig: {
|
|
703
|
+
concurrency: 50,
|
|
704
|
+
lockDuration: 9e4,
|
|
705
|
+
maxStalledCount: 3
|
|
706
|
+
}
|
|
707
|
+
},
|
|
684
708
|
CONTENT_ELASTIC_SYNC_QUEUE: {
|
|
685
709
|
id: "content-elastic-sync-queue",
|
|
686
710
|
queueConfig: {
|
|
@@ -2070,54 +2094,28 @@ var autoGenFilterConfigsFromTpl = ({
|
|
|
2070
2094
|
};
|
|
2071
2095
|
|
|
2072
2096
|
// src/utils/genCleanCamelCaseId.ts
|
|
2073
|
-
var
|
|
2097
|
+
var MAX_LENGTH = 40;
|
|
2098
|
+
function fnv1a(str, length = 8) {
|
|
2099
|
+
let hash = 2166136261;
|
|
2100
|
+
for (let i = 0; i < str.length; i++) {
|
|
2101
|
+
hash ^= str.charCodeAt(i);
|
|
2102
|
+
hash = hash * 16777619 >>> 0;
|
|
2103
|
+
}
|
|
2104
|
+
return hash.toString(36).slice(0, length);
|
|
2105
|
+
}
|
|
2106
|
+
var genCleanCamelCaseId = (id) => {
|
|
2074
2107
|
if (!id || typeof id !== "string") return id;
|
|
2075
|
-
|
|
2076
|
-
const baseClean = /^\p{Ll}[\p{L}\p{N}]*$/u.test(id) || /^a\d[\p{L}\p{N}]*$/u.test(id);
|
|
2077
|
-
const withinMaxLength = maxLength ? id.length <= maxLength : true;
|
|
2078
|
-
const hasNoNonAlpha = stripNonAlphanumeric ? /^[a-zA-Z0-9]+$/.test(id) : true;
|
|
2079
|
-
if (baseClean && withinMaxLength && hasNoNonAlpha) return id;
|
|
2108
|
+
if ((/^[a-z][a-zA-Z0-9]*$/.test(id) || /^a\d[a-zA-Z0-9]*$/.test(id)) && id.length <= MAX_LENGTH) return id;
|
|
2080
2109
|
const words = id.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
|
|
2081
2110
|
if (words.length === 0) return "a";
|
|
2082
2111
|
let result = words.map((word, i) => {
|
|
2083
2112
|
const lower = word.toLowerCase();
|
|
2084
2113
|
return i === 0 ? lower : lower.charAt(0).toUpperCase() + lower.slice(1);
|
|
2085
2114
|
}).join("");
|
|
2115
|
+
const strippedResult = result.replace(/[^a-zA-Z0-9]/g, "");
|
|
2116
|
+
result = strippedResult || fnv1a(result);
|
|
2086
2117
|
if (/^\d/.test(result)) result = "a" + result;
|
|
2087
|
-
|
|
2088
|
-
result = result.replace(/[^a-zA-Z0-9]/g, "");
|
|
2089
|
-
}
|
|
2090
|
-
if (maxLength) {
|
|
2091
|
-
result = result.slice(0, maxLength);
|
|
2092
|
-
}
|
|
2093
|
-
return result;
|
|
2094
|
-
};
|
|
2095
|
-
|
|
2096
|
-
// src/utils/genCleanContentTypeId.ts
|
|
2097
|
-
var genCleanContentTypeId = (text) => genCleanCamelCaseId(text, { stripNonAlphanumeric: true, maxLength: 40 });
|
|
2098
|
-
|
|
2099
|
-
// src/utils/genCleanValuePath.ts
|
|
2100
|
-
var CHARS = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
2101
|
-
function genShortId(length = 4) {
|
|
2102
|
-
let result = "";
|
|
2103
|
-
for (let i = 0; i < length; i++) {
|
|
2104
|
-
result += CHARS[Math.floor(Math.random() * CHARS.length)];
|
|
2105
|
-
}
|
|
2106
|
-
return result;
|
|
2107
|
-
}
|
|
2108
|
-
var genCleanValuePath = (text) => {
|
|
2109
|
-
const maxLength = 10;
|
|
2110
|
-
const shortIdLength = 4;
|
|
2111
|
-
if (!text || typeof text !== "string") return text;
|
|
2112
|
-
const idempotencyPattern = new RegExp(`^[a-z][a-z0-9]*_[a-z0-9]{${shortIdLength}}$`);
|
|
2113
|
-
if (idempotencyPattern.test(text)) return text;
|
|
2114
|
-
let cleaned = text.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
2115
|
-
if (!cleaned) {
|
|
2116
|
-
throw new Error(`[genCleanValuePath] Input "${text}" contains no alphanumeric characters`);
|
|
2117
|
-
}
|
|
2118
|
-
if (/^\d/.test(cleaned)) cleaned = "a" + cleaned;
|
|
2119
|
-
const truncated = cleaned.slice(0, maxLength);
|
|
2120
|
-
return `${truncated}_${genShortId(shortIdLength)}`;
|
|
2118
|
+
return result.slice(0, MAX_LENGTH);
|
|
2121
2119
|
};
|
|
2122
2120
|
export {
|
|
2123
2121
|
BASE_BULLMQ_CONFIG,
|
|
@@ -2135,8 +2133,6 @@ export {
|
|
|
2135
2133
|
extractAllBlocksFromTpl,
|
|
2136
2134
|
extractAndOrganizeBlocks,
|
|
2137
2135
|
genCleanCamelCaseId,
|
|
2138
|
-
genCleanContentTypeId,
|
|
2139
|
-
genCleanValuePath,
|
|
2140
2136
|
genTagId,
|
|
2141
2137
|
generateFilterKey,
|
|
2142
2138
|
getFilterKeyForBlock,
|
package/dist/node.d.mts
CHANGED
|
@@ -676,7 +676,7 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
676
676
|
}
|
|
677
677
|
export { workerConfig_9 as workerConfig };
|
|
678
678
|
}
|
|
679
|
-
namespace
|
|
679
|
+
namespace USERS_ELASTIC_SYNC_QUEUE {
|
|
680
680
|
let id_10: string;
|
|
681
681
|
export { id_10 as id };
|
|
682
682
|
export namespace queueConfig_10 {
|
|
@@ -716,7 +716,7 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
716
716
|
}
|
|
717
717
|
export { workerConfig_10 as workerConfig };
|
|
718
718
|
}
|
|
719
|
-
namespace
|
|
719
|
+
namespace CONTENT_ELASTIC_SYNC_QUEUE {
|
|
720
720
|
let id_11: string;
|
|
721
721
|
export { id_11 as id };
|
|
722
722
|
export namespace queueConfig_11 {
|
|
@@ -730,8 +730,6 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
730
730
|
export { delay_11 as delay };
|
|
731
731
|
}
|
|
732
732
|
export { backoff_11 as backoff };
|
|
733
|
-
let delay_12: number;
|
|
734
|
-
export { delay_12 as delay };
|
|
735
733
|
let removeOnComplete_11: number;
|
|
736
734
|
export { removeOnComplete_11 as removeOnComplete };
|
|
737
735
|
let removeOnFail_11: number;
|
|
@@ -758,6 +756,48 @@ declare namespace BASE_BULLMQ_CONFIG {
|
|
|
758
756
|
}
|
|
759
757
|
export { workerConfig_11 as workerConfig };
|
|
760
758
|
}
|
|
759
|
+
namespace REINDEX_QUEUE {
|
|
760
|
+
let id_12: string;
|
|
761
|
+
export { id_12 as id };
|
|
762
|
+
export namespace queueConfig_12 {
|
|
763
|
+
export namespace defaultJobOptions_12 {
|
|
764
|
+
let attempts_12: number;
|
|
765
|
+
export { attempts_12 as attempts };
|
|
766
|
+
export namespace backoff_12 {
|
|
767
|
+
let type_12: string;
|
|
768
|
+
export { type_12 as type };
|
|
769
|
+
let delay_12: number;
|
|
770
|
+
export { delay_12 as delay };
|
|
771
|
+
}
|
|
772
|
+
export { backoff_12 as backoff };
|
|
773
|
+
let delay_13: number;
|
|
774
|
+
export { delay_13 as delay };
|
|
775
|
+
let removeOnComplete_12: number;
|
|
776
|
+
export { removeOnComplete_12 as removeOnComplete };
|
|
777
|
+
let removeOnFail_12: number;
|
|
778
|
+
export { removeOnFail_12 as removeOnFail };
|
|
779
|
+
}
|
|
780
|
+
export { defaultJobOptions_12 as defaultJobOptions };
|
|
781
|
+
export namespace streams_12 {
|
|
782
|
+
export namespace events_12 {
|
|
783
|
+
let maxLen_12: number;
|
|
784
|
+
export { maxLen_12 as maxLen };
|
|
785
|
+
}
|
|
786
|
+
export { events_12 as events };
|
|
787
|
+
}
|
|
788
|
+
export { streams_12 as streams };
|
|
789
|
+
}
|
|
790
|
+
export { queueConfig_12 as queueConfig };
|
|
791
|
+
export namespace workerConfig_12 {
|
|
792
|
+
let concurrency_12: number;
|
|
793
|
+
export { concurrency_12 as concurrency };
|
|
794
|
+
let lockDuration_12: number;
|
|
795
|
+
export { lockDuration_12 as lockDuration };
|
|
796
|
+
let maxStalledCount_12: number;
|
|
797
|
+
export { maxStalledCount_12 as maxStalledCount };
|
|
798
|
+
}
|
|
799
|
+
export { workerConfig_12 as workerConfig };
|
|
800
|
+
}
|
|
761
801
|
}
|
|
762
802
|
|
|
763
803
|
interface PlatformContextContentItem {
|
|
@@ -1267,50 +1307,28 @@ declare const UI_CONTENT: {
|
|
|
1267
1307
|
};
|
|
1268
1308
|
};
|
|
1269
1309
|
|
|
1270
|
-
interface GenCleanCamelCaseIdOptions {
|
|
1271
|
-
/** Strip all non-alphanumeric chars (A-Z, a-z, 0-9 only). Default: false */
|
|
1272
|
-
stripNonAlphanumeric?: boolean;
|
|
1273
|
-
/** Truncate result to this max length. Default: no limit */
|
|
1274
|
-
maxLength?: number;
|
|
1275
|
-
}
|
|
1276
|
-
declare const genCleanCamelCaseId: (id: string, options?: GenCleanCamelCaseIdOptions) => string;
|
|
1277
|
-
|
|
1278
1310
|
/**
|
|
1279
|
-
* Generates a clean, deterministic
|
|
1280
|
-
* Wraps genCleanCamelCaseId with stripNonAlphanumeric + maxLength 40.
|
|
1311
|
+
* Generates a clean, deterministic, alphanumeric camelCase ID from text.
|
|
1281
1312
|
*
|
|
1282
|
-
*
|
|
1313
|
+
* 1. Splits on non-alphanumeric characters, builds camelCase
|
|
1314
|
+
* 2. Strips all non a-zA-Z0-9 from result
|
|
1315
|
+
* 3. If input had no unicode letters/numbers at all (e.g. "---"), returns 'a'
|
|
1316
|
+
* 4. If camelCase had content but nothing survived ASCII strip (pure non-Latin),
|
|
1317
|
+
* generates a deterministic hash (FNV-1a) of the unicode camelCase
|
|
1318
|
+
* 5. Prepends 'a' if starts with digit
|
|
1319
|
+
* 6. Truncates to 40 chars
|
|
1283
1320
|
*
|
|
1284
|
-
*
|
|
1285
|
-
* genCleanContentTypeId("My Articles!") => "myArticles"
|
|
1286
|
-
* genCleanContentTypeId("myArticles") => "myArticles" (idempotent)
|
|
1287
|
-
* genCleanContentTypeId("123 Test") => "a123Test"
|
|
1288
|
-
*/
|
|
1289
|
-
declare const genCleanContentTypeId: (text: string) => string;
|
|
1290
|
-
|
|
1291
|
-
/**
|
|
1292
|
-
* Generates a clean, short, unique ID from text input.
|
|
1293
|
-
* Used for block valuePaths in templates.
|
|
1294
|
-
*
|
|
1295
|
-
* 1. Strips all characters except A-Z, a-z, 0-9
|
|
1296
|
-
* 2. Lowercases the result
|
|
1297
|
-
* 3. Prepends 'a' if starts with a digit
|
|
1298
|
-
* 4. Truncates to maxLength (default 10)
|
|
1299
|
-
* 5. Appends _{random id} (default 4 chars)
|
|
1300
|
-
*
|
|
1301
|
-
* Idempotent: if input already matches the output pattern
|
|
1302
|
-
* (lowercase alphanumeric + _hash suffix), returns as-is.
|
|
1303
|
-
*
|
|
1304
|
-
* @param text - The input text to convert
|
|
1305
|
-
* @param maxLength - Max characters before the random suffix (default 10)
|
|
1306
|
-
* @param shortIdLength - Length of the random suffix (default 4)
|
|
1321
|
+
* Idempotent: running twice produces the same output.
|
|
1307
1322
|
*
|
|
1308
1323
|
* @example
|
|
1309
|
-
*
|
|
1310
|
-
*
|
|
1311
|
-
*
|
|
1324
|
+
* genCleanCamelCaseId("Author Name") => "authorName"
|
|
1325
|
+
* genCleanCamelCaseId("authorName") => "authorName" (idempotent)
|
|
1326
|
+
* genCleanCamelCaseId("123 Test") => "a123Test"
|
|
1327
|
+
* genCleanCamelCaseId("café latté") => "cafLatt"
|
|
1328
|
+
* genCleanCamelCaseId("مرحبا") => deterministic hash
|
|
1329
|
+
* genCleanCamelCaseId("---") => "a"
|
|
1312
1330
|
*/
|
|
1313
|
-
declare const
|
|
1331
|
+
declare const genCleanCamelCaseId: (id: string) => string;
|
|
1314
1332
|
|
|
1315
1333
|
declare class MongoConnector {
|
|
1316
1334
|
static getInstance(): any;
|
|
@@ -2042,4 +2060,4 @@ declare function GET_GLOBAL_BULLMQ_CONFIG({ env, redisCredentials }: {
|
|
|
2042
2060
|
};
|
|
2043
2061
|
}): Object;
|
|
2044
2062
|
|
|
2045
|
-
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ChunksElasticSyncProducer, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId,
|
|
2063
|
+
export { AIChatSchema, AnnosElasticSyncProducer, AnnotationSchema, BASE_BULLMQ_CONFIG, BaseProducer, BaseWorker, ChunksElasticSyncProducer, ElasticSearchConnector, FILTER_IDS, GET_GLOBAL_BULLMQ_CONFIG, GeneratedEntitiesSchema, GeneratedTopicsSchema, MongoConnector, PlatformConfigsSchema, ProducerManager, RedisCacheConnector, SecretManagerConnector, TEMP_removeDuplicateFilters, TplSchema, UI_CONTENT, WorkerManager, _self_managed_buildAnnoHierarchyConfig, _self_managed_buildDocHierarchyConfig, _self_managed_getFixedAnnoRollupBlocks, _self_managed_getFixedAnnoTagBlock, autoGenFilterConfigsFromTpl, buildFilterConfigurations, compareAndGroupBlocks, deleteVal, extractAllBlocksFromTpl, extractAndOrganizeBlocks, genCleanCamelCaseId, genTagId, generateFilterKey, getAIChatModelByTenant, getAnnotationsModelByTenant, getDbByTenant, getFilterKeyForBlock, getGeneratedEntitiesModelByTenant, getGeneratedTopicsModelByTenant, getModelByTenant, getPlatformConfigsModelByTenant, getPlatformContextContent, getRollupPossibilities, getRoutePathToEditContent, getRoutePathToModerateContent, getRoutePathToPublishedContent, getTplModelByTenant, getVal, mergeAnnoDataIntoAnnotationsTags, parseSpecialConfigSyntax, processAuthorAndCommonFilters, _recursExtractBlocks as recursivelyExtractBlocks, segrigateDocs, setVal, toArray };
|