@okf/ootils 1.45.0 → 1.47.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.d.mts +74 -3
- package/dist/browser.d.ts +74 -3
- package/dist/browser.js +74 -7
- package/dist/browser.mjs +74 -7
- package/dist/node.d.mts +74 -3
- package/dist/node.d.ts +74 -3
- package/dist/node.js +74 -7
- package/dist/node.mjs +74 -7
- package/dist/universal.d.mts +74 -3
- package/dist/universal.d.ts +74 -3
- package/dist/universal.js +74 -7
- package/dist/universal.mjs +74 -7
- package/package.json +1 -1
package/dist/node.d.ts
CHANGED
|
@@ -1342,6 +1342,21 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1342
1342
|
filterType: string;
|
|
1343
1343
|
valuePath: string;
|
|
1344
1344
|
};
|
|
1345
|
+
} | {
|
|
1346
|
+
filterId: string;
|
|
1347
|
+
blockId: string;
|
|
1348
|
+
display: string;
|
|
1349
|
+
value: string;
|
|
1350
|
+
filterKey: string | undefined;
|
|
1351
|
+
source: {
|
|
1352
|
+
filterType: string;
|
|
1353
|
+
scope: string;
|
|
1354
|
+
profileTypes?: undefined;
|
|
1355
|
+
};
|
|
1356
|
+
target: {
|
|
1357
|
+
filterType: string;
|
|
1358
|
+
valuePath: string;
|
|
1359
|
+
};
|
|
1345
1360
|
})[];
|
|
1346
1361
|
}[];
|
|
1347
1362
|
};
|
|
@@ -1471,6 +1486,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1471
1486
|
filters: any[];
|
|
1472
1487
|
rollups: any[];
|
|
1473
1488
|
rollupDisplayMap: Record<string, string>;
|
|
1489
|
+
childByParentId: Record<string, any>;
|
|
1474
1490
|
}[];
|
|
1475
1491
|
};
|
|
1476
1492
|
target: {
|
|
@@ -1631,6 +1647,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1631
1647
|
filters: any[];
|
|
1632
1648
|
rollups: any[];
|
|
1633
1649
|
rollupDisplayMap: Record<string, string>;
|
|
1650
|
+
childByParentId: Record<string, any>;
|
|
1634
1651
|
}[];
|
|
1635
1652
|
};
|
|
1636
1653
|
target: {
|
|
@@ -1697,6 +1714,21 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1697
1714
|
filterType: string;
|
|
1698
1715
|
valuePath: string;
|
|
1699
1716
|
};
|
|
1717
|
+
} | {
|
|
1718
|
+
filterId: string;
|
|
1719
|
+
blockId: string;
|
|
1720
|
+
display: string;
|
|
1721
|
+
value: string;
|
|
1722
|
+
filterKey: string | undefined;
|
|
1723
|
+
source: {
|
|
1724
|
+
filterType: string;
|
|
1725
|
+
scope: string;
|
|
1726
|
+
profileTypes?: undefined;
|
|
1727
|
+
};
|
|
1728
|
+
target: {
|
|
1729
|
+
filterType: string;
|
|
1730
|
+
valuePath: string;
|
|
1731
|
+
};
|
|
1700
1732
|
})[];
|
|
1701
1733
|
})[];
|
|
1702
1734
|
} | null)[];
|
|
@@ -1981,8 +2013,39 @@ declare class BlockRegistry {
|
|
|
1981
2013
|
comp: string;
|
|
1982
2014
|
props?: any;
|
|
1983
2015
|
}): boolean;
|
|
1984
|
-
/**
|
|
1985
|
-
|
|
2016
|
+
/**
|
|
2017
|
+
* Check if a specific block has a specific capability.
|
|
2018
|
+
*
|
|
2019
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2020
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2021
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2022
|
+
* for the `annotation` capability when the instance sets
|
|
2023
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2024
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2025
|
+
* existing 2-arg callers are unaffected.
|
|
2026
|
+
*/
|
|
2027
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2028
|
+
props?: any;
|
|
2029
|
+
}): boolean;
|
|
2030
|
+
/**
|
|
2031
|
+
* Per-instance annotation kill-switch.
|
|
2032
|
+
*
|
|
2033
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2034
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2035
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2036
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2037
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2038
|
+
*
|
|
2039
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2040
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2041
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2042
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2043
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2044
|
+
* type-level `false` isn't enough on its own.
|
|
2045
|
+
*/
|
|
2046
|
+
isAnnotationDisabledForBlock(block: {
|
|
2047
|
+
props?: any;
|
|
2048
|
+
}): boolean;
|
|
1986
2049
|
/**
|
|
1987
2050
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
1988
2051
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -2004,7 +2067,15 @@ declare class BlockRegistry {
|
|
|
2004
2067
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
2005
2068
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
2006
2069
|
*
|
|
2007
|
-
*
|
|
2070
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2071
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2072
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2073
|
+
* and because this method is the central gate used across every repo, the
|
|
2074
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2075
|
+
* chunking/anno sync, filters).
|
|
2076
|
+
*
|
|
2077
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2078
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2008
2079
|
*/
|
|
2009
2080
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2010
2081
|
comp: string;
|
package/dist/node.js
CHANGED
|
@@ -3063,11 +3063,44 @@ var BlockRegistry = class {
|
|
|
3063
3063
|
return value === cond.equals;
|
|
3064
3064
|
});
|
|
3065
3065
|
}
|
|
3066
|
-
/**
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3066
|
+
/**
|
|
3067
|
+
* Check if a specific block has a specific capability.
|
|
3068
|
+
*
|
|
3069
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
3070
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
3071
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
3072
|
+
* for the `annotation` capability when the instance sets
|
|
3073
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
3074
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
3075
|
+
* existing 2-arg callers are unaffected.
|
|
3076
|
+
*/
|
|
3077
|
+
hasCapability(compType, capability, block) {
|
|
3078
|
+
const def = this.blocks.get(compType);
|
|
3079
|
+
if (!def) return false;
|
|
3080
|
+
if (!def.capabilities[capability]) return false;
|
|
3081
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
3082
|
+
return false;
|
|
3083
|
+
}
|
|
3084
|
+
return true;
|
|
3085
|
+
}
|
|
3086
|
+
/**
|
|
3087
|
+
* Per-instance annotation kill-switch.
|
|
3088
|
+
*
|
|
3089
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
3090
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
3091
|
+
* block instance can be opted out of annotation entirely by setting
|
|
3092
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
3093
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
3094
|
+
*
|
|
3095
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
3096
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
3097
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
3098
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
3099
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
3100
|
+
* type-level `false` isn't enough on its own.
|
|
3101
|
+
*/
|
|
3102
|
+
isAnnotationDisabledForBlock(block) {
|
|
3103
|
+
return block?.props?.annotations?.disable === true;
|
|
3071
3104
|
}
|
|
3072
3105
|
/**
|
|
3073
3106
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -3097,10 +3130,19 @@ var BlockRegistry = class {
|
|
|
3097
3130
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3098
3131
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3099
3132
|
*
|
|
3100
|
-
*
|
|
3133
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
3134
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
3135
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
3136
|
+
* and because this method is the central gate used across every repo, the
|
|
3137
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
3138
|
+
* chunking/anno sync, filters).
|
|
3139
|
+
*
|
|
3140
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
3141
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
3101
3142
|
*/
|
|
3102
3143
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
3103
3144
|
return allBlocks.filter((block) => {
|
|
3145
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
3104
3146
|
const blockDef = this.blocks.get(block.comp);
|
|
3105
3147
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3106
3148
|
return block.props?.annotation?.enable === true;
|
|
@@ -4167,6 +4209,24 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
|
|
|
4167
4209
|
filterType: "dateRangeType",
|
|
4168
4210
|
valuePath: "kp_date_published"
|
|
4169
4211
|
}
|
|
4212
|
+
},
|
|
4213
|
+
// "Documents" filter — narrows results to specific chosen documents of the
|
|
4214
|
+
// datasets in view, matched on their own _id. Options list those datasets'
|
|
4215
|
+
// documents by title (documentsType fetch, which uses the ambient contentTypes);
|
|
4216
|
+
// the backend matches { _id: { $in: [ids] } } via target valuePath "_id"
|
|
4217
|
+
// (getValuePathQuery ObjectId-casts any `_id`-ending path).
|
|
4218
|
+
{
|
|
4219
|
+
filterId: "documentsFilter",
|
|
4220
|
+
blockId: "documentsFilter",
|
|
4221
|
+
display: "Documents",
|
|
4222
|
+
value: "documents",
|
|
4223
|
+
filterKey: generateFilterKey({
|
|
4224
|
+
filterType: "valuePathType",
|
|
4225
|
+
valuePath: "_id",
|
|
4226
|
+
scope: "doc"
|
|
4227
|
+
}),
|
|
4228
|
+
source: { filterType: "documentsType", scope: "tags" },
|
|
4229
|
+
target: { filterType: "valuePathType", valuePath: "_id" }
|
|
4170
4230
|
}
|
|
4171
4231
|
]
|
|
4172
4232
|
}] : [];
|
|
@@ -4527,12 +4587,19 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
4527
4587
|
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
4528
4588
|
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
4529
4589
|
}
|
|
4590
|
+
const childByParentId = {};
|
|
4591
|
+
for (const r of rollupsWithParents) {
|
|
4592
|
+
if (r.parentFilterId && r.isTagRollup && r.source?.filterType === "tagType") {
|
|
4593
|
+
childByParentId[r.parentFilterId] = r;
|
|
4594
|
+
}
|
|
4595
|
+
}
|
|
4530
4596
|
return {
|
|
4531
4597
|
contentType: tpl.kp_content_type,
|
|
4532
4598
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
4533
4599
|
filters: filtersWithParents,
|
|
4534
4600
|
rollups: rollupsWithParents,
|
|
4535
|
-
rollupDisplayMap
|
|
4601
|
+
rollupDisplayMap,
|
|
4602
|
+
childByParentId
|
|
4536
4603
|
};
|
|
4537
4604
|
});
|
|
4538
4605
|
const filteredPerDataset = perDataset.filter(
|
package/dist/node.mjs
CHANGED
|
@@ -2971,11 +2971,44 @@ var BlockRegistry = class {
|
|
|
2971
2971
|
return value === cond.equals;
|
|
2972
2972
|
});
|
|
2973
2973
|
}
|
|
2974
|
-
/**
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2974
|
+
/**
|
|
2975
|
+
* Check if a specific block has a specific capability.
|
|
2976
|
+
*
|
|
2977
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2978
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2979
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2980
|
+
* for the `annotation` capability when the instance sets
|
|
2981
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2982
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2983
|
+
* existing 2-arg callers are unaffected.
|
|
2984
|
+
*/
|
|
2985
|
+
hasCapability(compType, capability, block) {
|
|
2986
|
+
const def = this.blocks.get(compType);
|
|
2987
|
+
if (!def) return false;
|
|
2988
|
+
if (!def.capabilities[capability]) return false;
|
|
2989
|
+
if (capability === "annotation" && block && this.isAnnotationDisabledForBlock(block)) {
|
|
2990
|
+
return false;
|
|
2991
|
+
}
|
|
2992
|
+
return true;
|
|
2993
|
+
}
|
|
2994
|
+
/**
|
|
2995
|
+
* Per-instance annotation kill-switch.
|
|
2996
|
+
*
|
|
2997
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2998
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2999
|
+
* block instance can be opted out of annotation entirely by setting
|
|
3000
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
3001
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
3002
|
+
*
|
|
3003
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
3004
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
3005
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
3006
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
3007
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
3008
|
+
* type-level `false` isn't enough on its own.
|
|
3009
|
+
*/
|
|
3010
|
+
isAnnotationDisabledForBlock(block) {
|
|
3011
|
+
return block?.props?.annotations?.disable === true;
|
|
2979
3012
|
}
|
|
2980
3013
|
/**
|
|
2981
3014
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
@@ -3005,10 +3038,19 @@ var BlockRegistry = class {
|
|
|
3005
3038
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
3006
3039
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
3007
3040
|
*
|
|
3008
|
-
*
|
|
3041
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
3042
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
3043
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
3044
|
+
* and because this method is the central gate used across every repo, the
|
|
3045
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
3046
|
+
* chunking/anno sync, filters).
|
|
3047
|
+
*
|
|
3048
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
3049
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
3009
3050
|
*/
|
|
3010
3051
|
getAnnotationEnabledBlocks(allBlocks) {
|
|
3011
3052
|
return allBlocks.filter((block) => {
|
|
3053
|
+
if (this.isAnnotationDisabledForBlock(block)) return false;
|
|
3012
3054
|
const blockDef = this.blocks.get(block.comp);
|
|
3013
3055
|
if (blockDef) return !!blockDef.capabilities.annotation;
|
|
3014
3056
|
return block.props?.annotation?.enable === true;
|
|
@@ -4075,6 +4117,24 @@ var processAuthorAndCommonFilters = (allTpls, filterScopes, annoEnabledBlocks =
|
|
|
4075
4117
|
filterType: "dateRangeType",
|
|
4076
4118
|
valuePath: "kp_date_published"
|
|
4077
4119
|
}
|
|
4120
|
+
},
|
|
4121
|
+
// "Documents" filter — narrows results to specific chosen documents of the
|
|
4122
|
+
// datasets in view, matched on their own _id. Options list those datasets'
|
|
4123
|
+
// documents by title (documentsType fetch, which uses the ambient contentTypes);
|
|
4124
|
+
// the backend matches { _id: { $in: [ids] } } via target valuePath "_id"
|
|
4125
|
+
// (getValuePathQuery ObjectId-casts any `_id`-ending path).
|
|
4126
|
+
{
|
|
4127
|
+
filterId: "documentsFilter",
|
|
4128
|
+
blockId: "documentsFilter",
|
|
4129
|
+
display: "Documents",
|
|
4130
|
+
value: "documents",
|
|
4131
|
+
filterKey: generateFilterKey({
|
|
4132
|
+
filterType: "valuePathType",
|
|
4133
|
+
valuePath: "_id",
|
|
4134
|
+
scope: "doc"
|
|
4135
|
+
}),
|
|
4136
|
+
source: { filterType: "documentsType", scope: "tags" },
|
|
4137
|
+
target: { filterType: "valuePathType", valuePath: "_id" }
|
|
4078
4138
|
}
|
|
4079
4139
|
]
|
|
4080
4140
|
}] : [];
|
|
@@ -4435,12 +4495,19 @@ var _self_managed_buildDocHierarchyConfig = ({
|
|
|
4435
4495
|
const t = allTpls.find((tp) => tp.kp_content_type === ct);
|
|
4436
4496
|
if (t?.general?.content?.title) rollupDisplayMap[ct] = t.general.content.title;
|
|
4437
4497
|
}
|
|
4498
|
+
const childByParentId = {};
|
|
4499
|
+
for (const r of rollupsWithParents) {
|
|
4500
|
+
if (r.parentFilterId && r.isTagRollup && r.source?.filterType === "tagType") {
|
|
4501
|
+
childByParentId[r.parentFilterId] = r;
|
|
4502
|
+
}
|
|
4503
|
+
}
|
|
4438
4504
|
return {
|
|
4439
4505
|
contentType: tpl.kp_content_type,
|
|
4440
4506
|
display: tplData?.general?.content?.title || tpl.kp_content_type,
|
|
4441
4507
|
filters: filtersWithParents,
|
|
4442
4508
|
rollups: rollupsWithParents,
|
|
4443
|
-
rollupDisplayMap
|
|
4509
|
+
rollupDisplayMap,
|
|
4510
|
+
childByParentId
|
|
4444
4511
|
};
|
|
4445
4512
|
});
|
|
4446
4513
|
const filteredPerDataset = perDataset.filter(
|
package/dist/universal.d.mts
CHANGED
|
@@ -1334,6 +1334,21 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1334
1334
|
filterType: string;
|
|
1335
1335
|
valuePath: string;
|
|
1336
1336
|
};
|
|
1337
|
+
} | {
|
|
1338
|
+
filterId: string;
|
|
1339
|
+
blockId: string;
|
|
1340
|
+
display: string;
|
|
1341
|
+
value: string;
|
|
1342
|
+
filterKey: string | undefined;
|
|
1343
|
+
source: {
|
|
1344
|
+
filterType: string;
|
|
1345
|
+
scope: string;
|
|
1346
|
+
profileTypes?: undefined;
|
|
1347
|
+
};
|
|
1348
|
+
target: {
|
|
1349
|
+
filterType: string;
|
|
1350
|
+
valuePath: string;
|
|
1351
|
+
};
|
|
1337
1352
|
})[];
|
|
1338
1353
|
}[];
|
|
1339
1354
|
};
|
|
@@ -1463,6 +1478,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1463
1478
|
filters: any[];
|
|
1464
1479
|
rollups: any[];
|
|
1465
1480
|
rollupDisplayMap: Record<string, string>;
|
|
1481
|
+
childByParentId: Record<string, any>;
|
|
1466
1482
|
}[];
|
|
1467
1483
|
};
|
|
1468
1484
|
target: {
|
|
@@ -1623,6 +1639,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1623
1639
|
filters: any[];
|
|
1624
1640
|
rollups: any[];
|
|
1625
1641
|
rollupDisplayMap: Record<string, string>;
|
|
1642
|
+
childByParentId: Record<string, any>;
|
|
1626
1643
|
}[];
|
|
1627
1644
|
};
|
|
1628
1645
|
target: {
|
|
@@ -1689,6 +1706,21 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1689
1706
|
filterType: string;
|
|
1690
1707
|
valuePath: string;
|
|
1691
1708
|
};
|
|
1709
|
+
} | {
|
|
1710
|
+
filterId: string;
|
|
1711
|
+
blockId: string;
|
|
1712
|
+
display: string;
|
|
1713
|
+
value: string;
|
|
1714
|
+
filterKey: string | undefined;
|
|
1715
|
+
source: {
|
|
1716
|
+
filterType: string;
|
|
1717
|
+
scope: string;
|
|
1718
|
+
profileTypes?: undefined;
|
|
1719
|
+
};
|
|
1720
|
+
target: {
|
|
1721
|
+
filterType: string;
|
|
1722
|
+
valuePath: string;
|
|
1723
|
+
};
|
|
1692
1724
|
})[];
|
|
1693
1725
|
})[];
|
|
1694
1726
|
} | null)[];
|
|
@@ -1973,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
1973
2005
|
comp: string;
|
|
1974
2006
|
props?: any;
|
|
1975
2007
|
}): boolean;
|
|
1976
|
-
/**
|
|
1977
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
1978
2041
|
/**
|
|
1979
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
1980
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -1996,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
1996
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
1997
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
1998
2061
|
*
|
|
1999
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2000
2071
|
*/
|
|
2001
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2002
2073
|
comp: string;
|
package/dist/universal.d.ts
CHANGED
|
@@ -1334,6 +1334,21 @@ declare const processAuthorAndCommonFilters: (allTpls: any[], filterScopes: stri
|
|
|
1334
1334
|
filterType: string;
|
|
1335
1335
|
valuePath: string;
|
|
1336
1336
|
};
|
|
1337
|
+
} | {
|
|
1338
|
+
filterId: string;
|
|
1339
|
+
blockId: string;
|
|
1340
|
+
display: string;
|
|
1341
|
+
value: string;
|
|
1342
|
+
filterKey: string | undefined;
|
|
1343
|
+
source: {
|
|
1344
|
+
filterType: string;
|
|
1345
|
+
scope: string;
|
|
1346
|
+
profileTypes?: undefined;
|
|
1347
|
+
};
|
|
1348
|
+
target: {
|
|
1349
|
+
filterType: string;
|
|
1350
|
+
valuePath: string;
|
|
1351
|
+
};
|
|
1337
1352
|
})[];
|
|
1338
1353
|
}[];
|
|
1339
1354
|
};
|
|
@@ -1463,6 +1478,7 @@ declare const _self_managed_buildDocHierarchyConfig: ({ combinedDocumentBlocks,
|
|
|
1463
1478
|
filters: any[];
|
|
1464
1479
|
rollups: any[];
|
|
1465
1480
|
rollupDisplayMap: Record<string, string>;
|
|
1481
|
+
childByParentId: Record<string, any>;
|
|
1466
1482
|
}[];
|
|
1467
1483
|
};
|
|
1468
1484
|
target: {
|
|
@@ -1623,6 +1639,7 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1623
1639
|
filters: any[];
|
|
1624
1640
|
rollups: any[];
|
|
1625
1641
|
rollupDisplayMap: Record<string, string>;
|
|
1642
|
+
childByParentId: Record<string, any>;
|
|
1626
1643
|
}[];
|
|
1627
1644
|
};
|
|
1628
1645
|
target: {
|
|
@@ -1689,6 +1706,21 @@ declare const autoGenFilterConfigsFromTpl: ({ selectedTpls, allTpls, filterScope
|
|
|
1689
1706
|
filterType: string;
|
|
1690
1707
|
valuePath: string;
|
|
1691
1708
|
};
|
|
1709
|
+
} | {
|
|
1710
|
+
filterId: string;
|
|
1711
|
+
blockId: string;
|
|
1712
|
+
display: string;
|
|
1713
|
+
value: string;
|
|
1714
|
+
filterKey: string | undefined;
|
|
1715
|
+
source: {
|
|
1716
|
+
filterType: string;
|
|
1717
|
+
scope: string;
|
|
1718
|
+
profileTypes?: undefined;
|
|
1719
|
+
};
|
|
1720
|
+
target: {
|
|
1721
|
+
filterType: string;
|
|
1722
|
+
valuePath: string;
|
|
1723
|
+
};
|
|
1692
1724
|
})[];
|
|
1693
1725
|
})[];
|
|
1694
1726
|
} | null)[];
|
|
@@ -1973,8 +2005,39 @@ declare class BlockRegistry {
|
|
|
1973
2005
|
comp: string;
|
|
1974
2006
|
props?: any;
|
|
1975
2007
|
}): boolean;
|
|
1976
|
-
/**
|
|
1977
|
-
|
|
2008
|
+
/**
|
|
2009
|
+
* Check if a specific block has a specific capability.
|
|
2010
|
+
*
|
|
2011
|
+
* Type-level by default (keyed off `compType`). Pass the block INSTANCE as the
|
|
2012
|
+
* optional third arg to honour per-instance overrides — today the only one is
|
|
2013
|
+
* the annotation kill-switch: an annotation-capable block type returns `false`
|
|
2014
|
+
* for the `annotation` capability when the instance sets
|
|
2015
|
+
* `props.annotations.disable: true` in its tpl config. All other capabilities
|
|
2016
|
+
* (and the no-instance form) fall through to the plain type-level check, so
|
|
2017
|
+
* existing 2-arg callers are unaffected.
|
|
2018
|
+
*/
|
|
2019
|
+
hasCapability(compType: string, capability: keyof BlockCapabilities, block?: {
|
|
2020
|
+
props?: any;
|
|
2021
|
+
}): boolean;
|
|
2022
|
+
/**
|
|
2023
|
+
* Per-instance annotation kill-switch.
|
|
2024
|
+
*
|
|
2025
|
+
* A block type may be annotation-capable at the registry level (e.g.
|
|
2026
|
+
* LexicalTextEditor has `capabilities.annotation === true`), but an individual
|
|
2027
|
+
* block instance can be opted out of annotation entirely by setting
|
|
2028
|
+
* `props.annotations.disable: true` in its tpl config. Generic and config-only:
|
|
2029
|
+
* to stop annotation on any field, add that prop — no code change.
|
|
2030
|
+
*
|
|
2031
|
+
* The single home for this `props.annotations.disable` path (note: `annotations`
|
|
2032
|
+
* plural, distinct from the legacy singular `annotation.enable`). Consumed
|
|
2033
|
+
* internally by `hasCapability` and `getAnnotationEnabledBlocks`, and directly
|
|
2034
|
+
* by consumers that must actively suppress annotation UI (e.g. the FE block
|
|
2035
|
+
* generators forcing disableViewHighlights/disableCreateHighlights), where a
|
|
2036
|
+
* type-level `false` isn't enough on its own.
|
|
2037
|
+
*/
|
|
2038
|
+
isAnnotationDisabledForBlock(block: {
|
|
2039
|
+
props?: any;
|
|
2040
|
+
}): boolean;
|
|
1978
2041
|
/**
|
|
1979
2042
|
* Returns true if the block stores its value as an array (Mongo schema type is Array).
|
|
1980
2043
|
* Useful for callers that need to know whether to query `valuePath.0` for existence
|
|
@@ -1996,7 +2059,15 @@ declare class BlockRegistry {
|
|
|
1996
2059
|
* For backwards compat with un-migrated blocks (e.g. deprecated KPRichInput/RichTextEditor),
|
|
1997
2060
|
* falls back to the legacy per-instance `props.annotation.enable` toggle.
|
|
1998
2061
|
*
|
|
1999
|
-
*
|
|
2062
|
+
* Per-instance kill-switch: any block is excluded when its tpl config sets
|
|
2063
|
+
* `props.annotations.disable: true`, regardless of type-level capability. This
|
|
2064
|
+
* is the single, config-only way to turn off annotation for a specific field —
|
|
2065
|
+
* and because this method is the central gate used across every repo, the
|
|
2066
|
+
* switch applies everywhere (annotate UI, AI auto-annotation, explorer,
|
|
2067
|
+
* chunking/anno sync, filters).
|
|
2068
|
+
*
|
|
2069
|
+
* Today: every registered annotation-capable block (e.g. LexicalTextEditor) is
|
|
2070
|
+
* auto-enabled unless explicitly disabled on the instance.
|
|
2000
2071
|
*/
|
|
2001
2072
|
getAnnotationEnabledBlocks(allBlocks: Array<{
|
|
2002
2073
|
comp: string;
|