@okf/ootils 1.28.4 → 1.29.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/browser.js CHANGED
@@ -1556,30 +1556,34 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
1556
1556
  }
1557
1557
  return acc;
1558
1558
  }, []);
1559
- const authorTagConfigs = authorTagGroups.map((block) => ({
1560
- filterId: `authorTagFilter_${block.props.tagType}`,
1561
- blockId: `authorTagFilter_${block.props.tagType}`,
1562
- display: `Author Tag: ${block.props.tagType}`,
1563
- value: block.tplContentTypes,
1564
- filterKey: generateFilterKey({
1565
- filterType: "rollupRelationshipType",
1566
- relationshipValuePath: "meta.kp_contributed_by",
1567
- rollupResourceTypes: block.tplContentTypes,
1568
- tagType: block.props.tagType,
1569
- scope: "doc"
1570
- }),
1571
- source: {
1572
- filterType: "tagType",
1573
- tagType: block.props.tagType,
1574
- scope: "tags"
1575
- },
1576
- target: {
1577
- filterType: "rollupRelationshipType",
1578
- tagType: block.props.tagType,
1579
- rollupResourceTypes: block.tplContentTypes,
1580
- relationshipValuePath: "meta.kp_contributed_by"
1581
- }
1582
- }));
1559
+ const authorTagConfigs = authorTagGroups.map((block) => {
1560
+ const tagTpl = allTpls.find((t) => t.kp_content_type === block.props.tagType);
1561
+ const tagTitle = tagTpl?.general?.content?.title || block.props.tagType;
1562
+ return {
1563
+ filterId: `authorTagFilter_${block.props.tagType}`,
1564
+ blockId: `authorTagFilter_${block.props.tagType}`,
1565
+ display: `Author Tag: ${tagTitle}`,
1566
+ value: block.tplContentTypes,
1567
+ filterKey: generateFilterKey({
1568
+ filterType: "rollupRelationshipType",
1569
+ relationshipValuePath: "meta.kp_contributed_by",
1570
+ rollupResourceTypes: block.tplContentTypes,
1571
+ tagType: block.props.tagType,
1572
+ scope: "doc"
1573
+ }),
1574
+ source: {
1575
+ filterType: "tagType",
1576
+ tagType: block.props.tagType,
1577
+ scope: "tags"
1578
+ },
1579
+ target: {
1580
+ filterType: "rollupRelationshipType",
1581
+ tagType: block.props.tagType,
1582
+ rollupResourceTypes: block.tplContentTypes,
1583
+ relationshipValuePath: "meta.kp_contributed_by"
1584
+ }
1585
+ };
1586
+ });
1583
1587
  const commonAnnotationFilters = filterScopes.includes("anno") ? [{
1584
1588
  sectionId: "commonAnnotationFilters",
1585
1589
  sectionTitle: "Common Annotation Filters",
package/dist/browser.mjs CHANGED
@@ -1498,30 +1498,34 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
1498
1498
  }
1499
1499
  return acc;
1500
1500
  }, []);
1501
- const authorTagConfigs = authorTagGroups.map((block) => ({
1502
- filterId: `authorTagFilter_${block.props.tagType}`,
1503
- blockId: `authorTagFilter_${block.props.tagType}`,
1504
- display: `Author Tag: ${block.props.tagType}`,
1505
- value: block.tplContentTypes,
1506
- filterKey: generateFilterKey({
1507
- filterType: "rollupRelationshipType",
1508
- relationshipValuePath: "meta.kp_contributed_by",
1509
- rollupResourceTypes: block.tplContentTypes,
1510
- tagType: block.props.tagType,
1511
- scope: "doc"
1512
- }),
1513
- source: {
1514
- filterType: "tagType",
1515
- tagType: block.props.tagType,
1516
- scope: "tags"
1517
- },
1518
- target: {
1519
- filterType: "rollupRelationshipType",
1520
- tagType: block.props.tagType,
1521
- rollupResourceTypes: block.tplContentTypes,
1522
- relationshipValuePath: "meta.kp_contributed_by"
1523
- }
1524
- }));
1501
+ const authorTagConfigs = authorTagGroups.map((block) => {
1502
+ const tagTpl = allTpls.find((t) => t.kp_content_type === block.props.tagType);
1503
+ const tagTitle = tagTpl?.general?.content?.title || block.props.tagType;
1504
+ return {
1505
+ filterId: `authorTagFilter_${block.props.tagType}`,
1506
+ blockId: `authorTagFilter_${block.props.tagType}`,
1507
+ display: `Author Tag: ${tagTitle}`,
1508
+ value: block.tplContentTypes,
1509
+ filterKey: generateFilterKey({
1510
+ filterType: "rollupRelationshipType",
1511
+ relationshipValuePath: "meta.kp_contributed_by",
1512
+ rollupResourceTypes: block.tplContentTypes,
1513
+ tagType: block.props.tagType,
1514
+ scope: "doc"
1515
+ }),
1516
+ source: {
1517
+ filterType: "tagType",
1518
+ tagType: block.props.tagType,
1519
+ scope: "tags"
1520
+ },
1521
+ target: {
1522
+ filterType: "rollupRelationshipType",
1523
+ tagType: block.props.tagType,
1524
+ rollupResourceTypes: block.tplContentTypes,
1525
+ relationshipValuePath: "meta.kp_contributed_by"
1526
+ }
1527
+ };
1528
+ });
1525
1529
  const commonAnnotationFilters = filterScopes.includes("anno") ? [{
1526
1530
  sectionId: "commonAnnotationFilters",
1527
1531
  sectionTitle: "Common Annotation Filters",
package/dist/node.d.mts CHANGED
@@ -1761,7 +1761,7 @@ interface IAIChat extends Document {
1761
1761
  lastActivity: Date;
1762
1762
  messages: IMessage[];
1763
1763
  ACLScope: "aiChat" | "reports";
1764
- widgetAskAI_Id?: string;
1764
+ widgetAskAICacheKey?: string;
1765
1765
  immutableActiveFilters?: any;
1766
1766
  immutableContentTypes?: string[];
1767
1767
  }
package/dist/node.d.ts CHANGED
@@ -1761,7 +1761,7 @@ interface IAIChat extends Document {
1761
1761
  lastActivity: Date;
1762
1762
  messages: IMessage[];
1763
1763
  ACLScope: "aiChat" | "reports";
1764
- widgetAskAI_Id?: string;
1764
+ widgetAskAICacheKey?: string;
1765
1765
  immutableActiveFilters?: any;
1766
1766
  immutableContentTypes?: string[];
1767
1767
  }
package/dist/node.js CHANGED
@@ -1047,13 +1047,13 @@ var init_AIChat = __esm({
1047
1047
  default: "aiChat",
1048
1048
  index: true
1049
1049
  },
1050
- // Deterministic ID linking this chat to a specific WidgetAskAI widget in a report.
1051
- // The Report Agent generates widget configs on the backend, so at report creation
1052
- // time no chat exists yet the LLM query hasn't been fired. Without this ID,
1053
- // every page load would trigger a fresh LLM call. With it, the first render runs
1054
- // the LLM and saves the chat under this ID; subsequent renders find the existing
1055
- // chat and return the cached response immediately.
1056
- widgetAskAI_Id: {
1050
+ // Used exclusively by WidgetAskAI (the Ask AI widget inside Reports).
1051
+ // This field is NOT used by the standalone AskAI chat feature.
1052
+ // It is a SHA256 hash of (query + contentTypes + activeFilters), computed
1053
+ // on the backend. Enables content-addressable caching so that identical
1054
+ // WidgetAskAI configurations return cached responses instantly without
1055
+ // re-invoking the LLM.
1056
+ widgetAskAICacheKey: {
1057
1057
  type: String,
1058
1058
  sparse: true,
1059
1059
  unique: true
@@ -3150,30 +3150,34 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
3150
3150
  }
3151
3151
  return acc;
3152
3152
  }, []);
3153
- const authorTagConfigs = authorTagGroups.map((block) => ({
3154
- filterId: `authorTagFilter_${block.props.tagType}`,
3155
- blockId: `authorTagFilter_${block.props.tagType}`,
3156
- display: `Author Tag: ${block.props.tagType}`,
3157
- value: block.tplContentTypes,
3158
- filterKey: generateFilterKey({
3159
- filterType: "rollupRelationshipType",
3160
- relationshipValuePath: "meta.kp_contributed_by",
3161
- rollupResourceTypes: block.tplContentTypes,
3162
- tagType: block.props.tagType,
3163
- scope: "doc"
3164
- }),
3165
- source: {
3166
- filterType: "tagType",
3167
- tagType: block.props.tagType,
3168
- scope: "tags"
3169
- },
3170
- target: {
3171
- filterType: "rollupRelationshipType",
3172
- tagType: block.props.tagType,
3173
- rollupResourceTypes: block.tplContentTypes,
3174
- relationshipValuePath: "meta.kp_contributed_by"
3175
- }
3176
- }));
3153
+ const authorTagConfigs = authorTagGroups.map((block) => {
3154
+ const tagTpl = allTpls.find((t) => t.kp_content_type === block.props.tagType);
3155
+ const tagTitle = tagTpl?.general?.content?.title || block.props.tagType;
3156
+ return {
3157
+ filterId: `authorTagFilter_${block.props.tagType}`,
3158
+ blockId: `authorTagFilter_${block.props.tagType}`,
3159
+ display: `Author Tag: ${tagTitle}`,
3160
+ value: block.tplContentTypes,
3161
+ filterKey: generateFilterKey({
3162
+ filterType: "rollupRelationshipType",
3163
+ relationshipValuePath: "meta.kp_contributed_by",
3164
+ rollupResourceTypes: block.tplContentTypes,
3165
+ tagType: block.props.tagType,
3166
+ scope: "doc"
3167
+ }),
3168
+ source: {
3169
+ filterType: "tagType",
3170
+ tagType: block.props.tagType,
3171
+ scope: "tags"
3172
+ },
3173
+ target: {
3174
+ filterType: "rollupRelationshipType",
3175
+ tagType: block.props.tagType,
3176
+ rollupResourceTypes: block.tplContentTypes,
3177
+ relationshipValuePath: "meta.kp_contributed_by"
3178
+ }
3179
+ };
3180
+ });
3177
3181
  const commonAnnotationFilters = filterScopes.includes("anno") ? [{
3178
3182
  sectionId: "commonAnnotationFilters",
3179
3183
  sectionTitle: "Common Annotation Filters",
package/dist/node.mjs CHANGED
@@ -1052,13 +1052,13 @@ var init_AIChat = __esm({
1052
1052
  default: "aiChat",
1053
1053
  index: true
1054
1054
  },
1055
- // Deterministic ID linking this chat to a specific WidgetAskAI widget in a report.
1056
- // The Report Agent generates widget configs on the backend, so at report creation
1057
- // time no chat exists yet the LLM query hasn't been fired. Without this ID,
1058
- // every page load would trigger a fresh LLM call. With it, the first render runs
1059
- // the LLM and saves the chat under this ID; subsequent renders find the existing
1060
- // chat and return the cached response immediately.
1061
- widgetAskAI_Id: {
1055
+ // Used exclusively by WidgetAskAI (the Ask AI widget inside Reports).
1056
+ // This field is NOT used by the standalone AskAI chat feature.
1057
+ // It is a SHA256 hash of (query + contentTypes + activeFilters), computed
1058
+ // on the backend. Enables content-addressable caching so that identical
1059
+ // WidgetAskAI configurations return cached responses instantly without
1060
+ // re-invoking the LLM.
1061
+ widgetAskAICacheKey: {
1062
1062
  type: String,
1063
1063
  sparse: true,
1064
1064
  unique: true
@@ -3091,30 +3091,34 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
3091
3091
  }
3092
3092
  return acc;
3093
3093
  }, []);
3094
- const authorTagConfigs = authorTagGroups.map((block) => ({
3095
- filterId: `authorTagFilter_${block.props.tagType}`,
3096
- blockId: `authorTagFilter_${block.props.tagType}`,
3097
- display: `Author Tag: ${block.props.tagType}`,
3098
- value: block.tplContentTypes,
3099
- filterKey: generateFilterKey({
3100
- filterType: "rollupRelationshipType",
3101
- relationshipValuePath: "meta.kp_contributed_by",
3102
- rollupResourceTypes: block.tplContentTypes,
3103
- tagType: block.props.tagType,
3104
- scope: "doc"
3105
- }),
3106
- source: {
3107
- filterType: "tagType",
3108
- tagType: block.props.tagType,
3109
- scope: "tags"
3110
- },
3111
- target: {
3112
- filterType: "rollupRelationshipType",
3113
- tagType: block.props.tagType,
3114
- rollupResourceTypes: block.tplContentTypes,
3115
- relationshipValuePath: "meta.kp_contributed_by"
3116
- }
3117
- }));
3094
+ const authorTagConfigs = authorTagGroups.map((block) => {
3095
+ const tagTpl = allTpls.find((t) => t.kp_content_type === block.props.tagType);
3096
+ const tagTitle = tagTpl?.general?.content?.title || block.props.tagType;
3097
+ return {
3098
+ filterId: `authorTagFilter_${block.props.tagType}`,
3099
+ blockId: `authorTagFilter_${block.props.tagType}`,
3100
+ display: `Author Tag: ${tagTitle}`,
3101
+ value: block.tplContentTypes,
3102
+ filterKey: generateFilterKey({
3103
+ filterType: "rollupRelationshipType",
3104
+ relationshipValuePath: "meta.kp_contributed_by",
3105
+ rollupResourceTypes: block.tplContentTypes,
3106
+ tagType: block.props.tagType,
3107
+ scope: "doc"
3108
+ }),
3109
+ source: {
3110
+ filterType: "tagType",
3111
+ tagType: block.props.tagType,
3112
+ scope: "tags"
3113
+ },
3114
+ target: {
3115
+ filterType: "rollupRelationshipType",
3116
+ tagType: block.props.tagType,
3117
+ rollupResourceTypes: block.tplContentTypes,
3118
+ relationshipValuePath: "meta.kp_contributed_by"
3119
+ }
3120
+ };
3121
+ });
3118
3122
  const commonAnnotationFilters = filterScopes.includes("anno") ? [{
3119
3123
  sectionId: "commonAnnotationFilters",
3120
3124
  sectionTitle: "Common Annotation Filters",
package/dist/universal.js CHANGED
@@ -1556,30 +1556,34 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
1556
1556
  }
1557
1557
  return acc;
1558
1558
  }, []);
1559
- const authorTagConfigs = authorTagGroups.map((block) => ({
1560
- filterId: `authorTagFilter_${block.props.tagType}`,
1561
- blockId: `authorTagFilter_${block.props.tagType}`,
1562
- display: `Author Tag: ${block.props.tagType}`,
1563
- value: block.tplContentTypes,
1564
- filterKey: generateFilterKey({
1565
- filterType: "rollupRelationshipType",
1566
- relationshipValuePath: "meta.kp_contributed_by",
1567
- rollupResourceTypes: block.tplContentTypes,
1568
- tagType: block.props.tagType,
1569
- scope: "doc"
1570
- }),
1571
- source: {
1572
- filterType: "tagType",
1573
- tagType: block.props.tagType,
1574
- scope: "tags"
1575
- },
1576
- target: {
1577
- filterType: "rollupRelationshipType",
1578
- tagType: block.props.tagType,
1579
- rollupResourceTypes: block.tplContentTypes,
1580
- relationshipValuePath: "meta.kp_contributed_by"
1581
- }
1582
- }));
1559
+ const authorTagConfigs = authorTagGroups.map((block) => {
1560
+ const tagTpl = allTpls.find((t) => t.kp_content_type === block.props.tagType);
1561
+ const tagTitle = tagTpl?.general?.content?.title || block.props.tagType;
1562
+ return {
1563
+ filterId: `authorTagFilter_${block.props.tagType}`,
1564
+ blockId: `authorTagFilter_${block.props.tagType}`,
1565
+ display: `Author Tag: ${tagTitle}`,
1566
+ value: block.tplContentTypes,
1567
+ filterKey: generateFilterKey({
1568
+ filterType: "rollupRelationshipType",
1569
+ relationshipValuePath: "meta.kp_contributed_by",
1570
+ rollupResourceTypes: block.tplContentTypes,
1571
+ tagType: block.props.tagType,
1572
+ scope: "doc"
1573
+ }),
1574
+ source: {
1575
+ filterType: "tagType",
1576
+ tagType: block.props.tagType,
1577
+ scope: "tags"
1578
+ },
1579
+ target: {
1580
+ filterType: "rollupRelationshipType",
1581
+ tagType: block.props.tagType,
1582
+ rollupResourceTypes: block.tplContentTypes,
1583
+ relationshipValuePath: "meta.kp_contributed_by"
1584
+ }
1585
+ };
1586
+ });
1583
1587
  const commonAnnotationFilters = filterScopes.includes("anno") ? [{
1584
1588
  sectionId: "commonAnnotationFilters",
1585
1589
  sectionTitle: "Common Annotation Filters",
@@ -1498,30 +1498,34 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
1498
1498
  }
1499
1499
  return acc;
1500
1500
  }, []);
1501
- const authorTagConfigs = authorTagGroups.map((block) => ({
1502
- filterId: `authorTagFilter_${block.props.tagType}`,
1503
- blockId: `authorTagFilter_${block.props.tagType}`,
1504
- display: `Author Tag: ${block.props.tagType}`,
1505
- value: block.tplContentTypes,
1506
- filterKey: generateFilterKey({
1507
- filterType: "rollupRelationshipType",
1508
- relationshipValuePath: "meta.kp_contributed_by",
1509
- rollupResourceTypes: block.tplContentTypes,
1510
- tagType: block.props.tagType,
1511
- scope: "doc"
1512
- }),
1513
- source: {
1514
- filterType: "tagType",
1515
- tagType: block.props.tagType,
1516
- scope: "tags"
1517
- },
1518
- target: {
1519
- filterType: "rollupRelationshipType",
1520
- tagType: block.props.tagType,
1521
- rollupResourceTypes: block.tplContentTypes,
1522
- relationshipValuePath: "meta.kp_contributed_by"
1523
- }
1524
- }));
1501
+ const authorTagConfigs = authorTagGroups.map((block) => {
1502
+ const tagTpl = allTpls.find((t) => t.kp_content_type === block.props.tagType);
1503
+ const tagTitle = tagTpl?.general?.content?.title || block.props.tagType;
1504
+ return {
1505
+ filterId: `authorTagFilter_${block.props.tagType}`,
1506
+ blockId: `authorTagFilter_${block.props.tagType}`,
1507
+ display: `Author Tag: ${tagTitle}`,
1508
+ value: block.tplContentTypes,
1509
+ filterKey: generateFilterKey({
1510
+ filterType: "rollupRelationshipType",
1511
+ relationshipValuePath: "meta.kp_contributed_by",
1512
+ rollupResourceTypes: block.tplContentTypes,
1513
+ tagType: block.props.tagType,
1514
+ scope: "doc"
1515
+ }),
1516
+ source: {
1517
+ filterType: "tagType",
1518
+ tagType: block.props.tagType,
1519
+ scope: "tags"
1520
+ },
1521
+ target: {
1522
+ filterType: "rollupRelationshipType",
1523
+ tagType: block.props.tagType,
1524
+ rollupResourceTypes: block.tplContentTypes,
1525
+ relationshipValuePath: "meta.kp_contributed_by"
1526
+ }
1527
+ };
1528
+ });
1525
1529
  const commonAnnotationFilters = filterScopes.includes("anno") ? [{
1526
1530
  sectionId: "commonAnnotationFilters",
1527
1531
  sectionTitle: "Common Annotation Filters",
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.28.4",
6
+ "version": "1.29.0",
7
7
  "description": "Utility functions for both browser and Node.js",
8
8
  "main": "dist/index.js",
9
9
  "module": "dist/index.mjs",