@sitevision/api 2023.8.1 → 2024.1.1-beta.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.
Files changed (25) hide show
  1. package/client/requester/index.js +25 -4
  2. package/index.d.ts +1 -0
  3. package/package.json +2 -4
  4. package/server/FilterBuilder/index.d.ts +3 -4
  5. package/server/NodeTypeUtil/index.d.ts +88 -0
  6. package/server/NodeTypeUtil/index.js +1 -0
  7. package/server/PermissionCheckBuilder/index.d.ts +59 -0
  8. package/server/PermissionCheckBuilder/index.js +11 -0
  9. package/server/PermissionUtil.Permission/index.d.ts +3 -0
  10. package/server/PermissionUtil.Permission/index.js +4 -1
  11. package/server/Requester/index.d.ts +10 -1
  12. package/server/ResourceLocatorUtil/index.d.ts +25 -0
  13. package/server/ResourceLocatorUtil/index.js +4 -1
  14. package/server/SearchFactory/index.d.ts +8 -0
  15. package/server/SearchFactory/index.js +2 -1
  16. package/server/SearchUtil/index.d.ts +3 -5
  17. package/server/SearcherBuilder/index.d.ts +35 -0
  18. package/server/SearcherBuilder/index.js +1 -0
  19. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.d.ts +63 -0
  20. package/types/senselogic/sitevision/api/render/velocity/VelocityAccess.NodeTypeUtilConstants/index.js +10 -1
  21. package/types/senselogic/sitevision/api/search/searcher/Searcher/index.d.ts +7 -3
  22. package/types/senselogic/sitevision/api/search/searcher/component/PermissionCheck/index.d.ts +27 -0
  23. package/types/senselogic/sitevision/api/search/searcher/component/PermissionCheck/index.js +8 -0
  24. package/types/senselogic/sitevision/api/search/searcher/component/PermissionStrategy/index.d.ts +31 -0
  25. package/types/senselogic/sitevision/api/search/searcher/component/PermissionStrategy/index.js +11 -0
@@ -4,10 +4,31 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports["default"] = void 0;
7
+ /**
8
+ * Mocking interface for requester
9
+ * Bit of a hack, since it's really returns an $.ajax object.
10
+ * But $.ajax wraps a promise.
11
+ */
7
12
  var _default = {
8
- doGet: function doGet() {},
9
- doPost: function doPost() {},
10
- doPut: function doPut() {},
11
- doDelete: function doDelete() {}
13
+ doGet: function doGet() {
14
+ return new Promise(function (resolve) {
15
+ resolve();
16
+ });
17
+ },
18
+ doPost: function doPost() {
19
+ return new Promise(function (resolve) {
20
+ resolve();
21
+ });
22
+ },
23
+ doPut: function doPut() {
24
+ return new Promise(function (resolve) {
25
+ resolve();
26
+ });
27
+ },
28
+ doDelete: function doDelete() {
29
+ return new Promise(function (resolve) {
30
+ resolve();
31
+ });
32
+ }
12
33
  };
13
34
  exports["default"] = _default;
package/index.d.ts CHANGED
@@ -73,6 +73,7 @@ import './server/OfflineVersionPropertyUtil';
73
73
  import './server/OnlineVersionPropertyUtil';
74
74
  import './server/OutputUtil';
75
75
  import './server/PageUtil';
76
+ import './server/PermissionCheckBuilder';
76
77
  import './server/PermissionUtil';
77
78
  import './server/PermissionUtil.Permission';
78
79
  import './server/PortletContextUtil';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitevision/api",
3
- "version": "2023.8.1",
3
+ "version": "2024.1.1-beta.0",
4
4
  "author": "Sitevision AB",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,7 +14,6 @@
14
14
  "url": "https://github.com/sitevision/sitevision-apps/issues"
15
15
  },
16
16
  "scripts": {
17
- "prepack": "yarn build",
18
17
  "build": "rimraf dist/ && rimraf build/ && scripts/copysrc.sh && node scripts/generateindex.js && babel build --out-dir dist --copy-files && copyfiles package.json README.md dist/",
19
18
  "test": "yarn build && tsc --noEmit dist/index.d.ts && echo 'No errors found.'",
20
19
  "deploy": "yarn build && npm publish dist"
@@ -29,6 +28,5 @@
29
28
  "publishConfig": {
30
29
  "access": "public",
31
30
  "directory": "dist"
32
- },
33
- "gitHead": "84e58906704af5e7bcc97eae2a5b4b4c89a8031f"
31
+ }
34
32
  }
@@ -75,13 +75,12 @@ export interface FilterBuilder extends Builder {
75
75
  *
76
76
  * <p>
77
77
  * <strong>Query syntax note! </strong>Query strings should be expressed according to the <em>Solr query syntax</em>.
78
- * The syntax is basically the <em>
78
+ * The syntax is basically the<em>
79
79
  * <a href="http://lucene.apache.org/core/4_10_3/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description">
80
- * Lucene query syntax</a></em>
81
- * with <em><a href="http://wiki.apache.org/solr/SolrQuerySyntax#Differences_From_Lucene_Query_Parser">some minor differences</a></em>.
80
+ * Lucene query syntax</a></em> with some minor differences (solr syntax allows open-ended range queries and pure negative queries).
82
81
  * Also note that a general recommendation is to always use the <em>prefix operators</em> (<code>+</code>/<code>-</code>) instead of the
83
82
  * <em>boolean keywords</em> (AND/OR/NOT) to avoid unexpected behaviour. For deeper understanding, see for example
84
- * <a href="http://searchhub.org/2011/12/28/why-not-and-or-and-not/">Why Not AND, OR, And NOT?</a>.
83
+ * <a href="https://lucidworks.com/post/solr-boolean-operators/" target="_blank">Why Not AND, OR, And NOT?</a>.
85
84
  * </p>
86
85
  * @param aFilterQuery the filter query, a <code>null</code> or whitespace-only value will be ignored
87
86
  * @return this builder
@@ -361,6 +361,12 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
361
361
  */
362
362
  IMAGE_FILTER_TYPE: "sv:imageFilter";
363
363
 
364
+ /**
365
+ * The primary node type name for the image filter repository type.
366
+ * @since Sitevision 2023.09.1
367
+ */
368
+ IMAGE_FILTER_REPOSITORY_TYPE: "sv:imageFilterRepository";
369
+
364
370
  /**
365
371
  * The primary node type name for the image repository type.
366
372
  * @since Sitevision 3.6.3
@@ -517,6 +523,36 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
517
523
  */
518
524
  METADATA_MULTIPLE_TAG_DEFINITION_TYPE: "sv:metadataMultipleTagDefinition";
519
525
 
526
+ /**
527
+ * The primary node type name for the metadata date definition type.
528
+ * @since Sitevision 2024.01.1
529
+ */
530
+ METADATA_DATE_DEFINITION_TYPE: "sv:metadataDateDefinition";
531
+
532
+ /**
533
+ * The primary node type name for the metadata system image definition type.
534
+ * @since Sitevision 2024.01.1
535
+ */
536
+ METADATA_SYSTEM_IMAGE_DEFINITION_TYPE: "sv:metadataSystemImageDefinition";
537
+
538
+ /**
539
+ * The primary node type name for the metadata system integer definition type.
540
+ * @since Sitevision 2024.01.1
541
+ */
542
+ METADATA_SYSTEM_INTEGER_DEFINITION_TYPE: "sv:metadataSystemIntegerDefinition";
543
+
544
+ /**
545
+ * The primary node type name for the metadata system link definition type.
546
+ * @since Sitevision 2024.01.1
547
+ */
548
+ METADATA_SYSTEM_LINK_DEFINITION_TYPE: "sv:metadataSystemLinkDefinition";
549
+
550
+ /**
551
+ * The primary node type name for the metadata system text definition type.
552
+ * @since Sitevision 2024.01.1
553
+ */
554
+ METADATA_SYSTEM_TEXT_DEFINITION_TYPE: "sv:metadataSystemTextDefinition";
555
+
520
556
  /**
521
557
  * The primary node type name for the mobile app type.
522
558
  * @since Sitevision 3.6.3
@@ -1122,6 +1158,24 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
1122
1158
  */
1123
1159
  OAUTH2_CONFIGURATION_TYPE: "sv:oAuth2Configuration";
1124
1160
 
1161
+ /**
1162
+ * The primary node type name for the work status type.
1163
+ * @since Sitevision 2023.09.2
1164
+ */
1165
+ WORK_STATUS_TYPE: "sv:workStatus";
1166
+
1167
+ /**
1168
+ * The primary node type name for the work status template type.
1169
+ * @since Sitevision 2023.09.2
1170
+ */
1171
+ WORK_STATUS_TEMPLATE_TYPE: "sv:workStatusTemplate";
1172
+
1173
+ /**
1174
+ * The primary node type name for the work status template repository type.
1175
+ * @since Sitevision 2023.09.2
1176
+ */
1177
+ WORK_STATUS_TEMPLATE_REPOSITORY_TYPE: "sv:workStatusTemplateRepository";
1178
+
1125
1179
  /**
1126
1180
  * Checks if a node is a layout.
1127
1181
  * @param aNode the node to be checked
@@ -1452,6 +1506,40 @@ export interface NodeTypeUtil extends NodeTypeUtilConstants {
1452
1506
  */
1453
1507
  isAnyUserType(aNode: Node): boolean;
1454
1508
 
1509
+ /**
1510
+ * Convenience method that checks if a node is of "Metadata definition node" type.
1511
+ *
1512
+ * <p>
1513
+ * "Metadata definition node" types are:
1514
+ * </p>
1515
+ * <ul>
1516
+ * <li>{@link #METADATA_TEXT_DEFINITION_TYPE sv:metadataTextDefinition}</li>
1517
+ * <li>{@link #METADATA_SINGLE_DEFINITION_TYPE sv:metadataSingleDefinition}</li>
1518
+ * <li>{@link #METADATA_MULTIPLE_DEFINITION_TYPE sv:metadataMultipleDefinition}</li>
1519
+ * <li>{@link #METADATA_INTEGER_DEFINITION_TYPE sv:metadataIntegerDefinition}</li>
1520
+ * <li>{@link #METADATA_DATE_DEFINITION_TYPE sv:metadataDateDefinition}</li>
1521
+ * <li>{@link #METADATA_USER_DEFINITION_TYPE sv:metadataUserDefinition}</li>
1522
+ * <li>{@link #METADATA_DIRECTORY_DEFINITION_TYPE sv:metadataDirectoryDefinition}</li>
1523
+ * <li>{@link #METADATA_LINK_DEFINITION_TYPE sv:metadataLinkDefinition}</li>
1524
+ * <li>{@link #METADATA_TEXT_PORTLET_DEFINITION_TYPE sv:metadataTextPortletDefinition}</li>
1525
+ * <li>{@link #METADATA_IMAGE_PORTLET_DEFINITION_TYPE sv:metadataImagePortletDefinition}</li>
1526
+ * <li>{@link #METADATA_MEDIA_PORTLET_DEFINITION_TYPE sv:metadataMediaPortletDefinition}</li>
1527
+ * <li>{@link #METADATA_RELATED_INFORMATION_DEFINITION_TYPE sv:metadataRelatedInformationDefinition}</li>
1528
+ * <li>{@link #METADATA_SINGLE_TAG_DEFINITION_TYPE sv:metadataSingleTagDefinition}</li>
1529
+ * <li>{@link #METADATA_MULTIPLE_TAG_DEFINITION_TYPE sv:metadataMultipleTagDefinition}</li>
1530
+ * <li>{@link #METADATA_KEYWORD_DEFINITION_TYPE sv:metadataKeywordDefinition}</li>
1531
+ * <li>{@link #METADATA_SYSTEM_DEFINITION_TYPE sv:metadataSystemDefinition}</li>
1532
+ * <li>{@link #METADATA_SYSTEM_IMAGE_DEFINITION_TYPE sv:metadataSystemImageDefinition}</li>
1533
+ * <li>{@link #METADATA_SYSTEM_INTEGER_DEFINITION_TYPE sv:metadataSystemIntegerDefinition}</li>
1534
+ * <li>{@link #METADATA_SYSTEM_LINK_DEFINITION_TYPE sv:metadataSystemLinkDefinition}</li>
1535
+ * <li>{@link #METADATA_SYSTEM_TEXT_DEFINITION_TYPE sv:metadataSystemTextDefinition}</li>
1536
+ * </ul>
1537
+ * @param aNode the node to be checked
1538
+ * @return whether aNode is a "metadata definition node" or not.
1539
+ * @since Sitevision 2024.01.1
1540
+ */
1541
+ isAnyMetadataDefinitionType(aNode: Node): boolean;
1542
+
1455
1543
  /**
1456
1544
  * Checks a node against a given node type name to see if they match.
1457
1545
  * @param aNode the node to be checked
@@ -42,6 +42,7 @@ var _default = {
42
42
  isAnyRenderableType: function isAnyRenderableType() {},
43
43
  isAnyContentType: function isAnyContentType() {},
44
44
  isAnyUserType: function isAnyUserType() {},
45
+ isAnyMetadataDefinitionType: function isAnyMetadataDefinitionType() {},
45
46
  isType: function isType() {},
46
47
  isTypeOf: function isTypeOf() {}
47
48
  };
@@ -0,0 +1,59 @@
1
+ import type { PermissionStrategy } from "../../types/senselogic/sitevision/api/search/searcher/component/PermissionStrategy";
2
+ import type { PermissionCheck } from "../../types/senselogic/sitevision/api/search/searcher/component/PermissionCheck";
3
+ import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder";
4
+
5
+ /**
6
+ * <p>
7
+ * Builder for creating a {@link senselogic.sitevision.api.search.searcher.component.PermissionCheck} component.
8
+ * </p>
9
+ *
10
+ * <p>
11
+ * PermissionCheck has one <em>optional</em> attribute:
12
+ * </p>
13
+ * <ul>
14
+ * <li>
15
+ * <em>permission strategy</em> - the permission checking strategy.
16
+ * Default is {@link senselogic.sitevision.api.search.searcher.component.PermissionStrategy#EARLY_CHECK}.
17
+ * </li>
18
+ * </ul>
19
+ *
20
+ * <p>
21
+ * <strong>Tip!</strong> The {@link senselogic.sitevision.api.base.Builder Builder interface documentation} contains
22
+ * more information about Builders and how to work with them!
23
+ * </p>
24
+ *
25
+ * <p>
26
+ * An instance of the Sitevision class implementing this interface can be obtained via
27
+ * {@link senselogic.sitevision.api.search.SearchFactory#getPermissionCheckBuilder()}.
28
+ * See {@link senselogic.sitevision.api.search.SearchFactory} for how to obtain an instance of the <code>SearchFactory</code> interface.
29
+ * </p>
30
+ * @author Magnus Lövgren
31
+ * @since Sitevision 2023.09.1
32
+ */
33
+ export interface PermissionCheckBuilder extends Builder {
34
+ /**
35
+ * Sets the permission strategy.
36
+ * @param aPermissionStrategy the permission strategy
37
+ * @return this builder
38
+ */
39
+ setPermissionStrategy(
40
+ aPermissionStrategy: PermissionStrategy
41
+ ): PermissionCheckBuilder;
42
+
43
+ /**
44
+ * Creates a PermissionCheck component instance using currently specified state/behaviour.
45
+ *
46
+ * <p>
47
+ * Default strategy {@link senselogic.sitevision.api.search.searcher.component.PermissionStrategy#EARLY_CHECK} will be used
48
+ * if the component has no state (i.e. no {@link PermissionStrategy} explicitly set) when built.
49
+ * </p>
50
+ * @return a permission check component
51
+ */
52
+ build(): PermissionCheck;
53
+ }
54
+
55
+ declare namespace PermissionCheckBuilder {}
56
+
57
+ declare var permissionCheckBuilder: PermissionCheckBuilder;
58
+
59
+ export default permissionCheckBuilder;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ setPermissionStrategy: function setPermissionStrategy() {},
9
+ build: function build() {}
10
+ };
11
+ exports["default"] = _default;
@@ -49,6 +49,9 @@ declare enum Permission {
49
49
  MANAGE_DOWNLOAD_PROTECTION,
50
50
  MANAGE_CHANNELS,
51
51
  CREATE_PRIVATE_CHANNELS,
52
+ MANAGE_PINNING,
53
+ MANAGE_TYPES_IDENTIFIERS,
54
+ MANAGE_CUSTOM_SEARCH_INDEX,
52
55
  }
53
56
 
54
57
  export default Permission;
@@ -33,6 +33,9 @@ var _default = {
33
33
  MANAGE_PUBLISHING_PROJECT: "MANAGE_PUBLISHING_PROJECT",
34
34
  MANAGE_DOWNLOAD_PROTECTION: "MANAGE_DOWNLOAD_PROTECTION",
35
35
  MANAGE_CHANNELS: "MANAGE_CHANNELS",
36
- CREATE_PRIVATE_CHANNELS: "CREATE_PRIVATE_CHANNELS"
36
+ CREATE_PRIVATE_CHANNELS: "CREATE_PRIVATE_CHANNELS",
37
+ MANAGE_PINNING: "MANAGE_PINNING",
38
+ MANAGE_TYPES_IDENTIFIERS: "MANAGE_TYPES_IDENTIFIERS",
39
+ MANAGE_CUSTOM_SEARCH_INDEX: "MANAGE_CUSTOM_SEARCH_INDEX"
37
40
  };
38
41
  exports["default"] = _default;
@@ -31,7 +31,16 @@ import type { RequesterChainable } from "../../types/senselogic/sitevision/api/s
31
31
  * - request data type <em>(default is "application/x-www-form-urlencoded").</em>
32
32
  * <ul>
33
33
  * <li><em>"text/plain" - data will be sent as a string entity</em></li>
34
- * <li><em>"application/json" - data will be sent as JSON</em></li>
34
+ * <li>
35
+ * <em>"application/json" - data will be sent as JSON</em>
36
+ * <ul>
37
+ * <li>
38
+ * <em>When the targeted API expects "application/vnd.api+json",
39
+ * you should set the "contentType" option to "application/json" while ensuring that the
40
+ * <strong>headers</strong> options include the expected "Content-Type"</em>
41
+ * </li>
42
+ * </ul>
43
+ * </li>
35
44
  * <li><em>"multipart/form-data" [@since Sitevision 4.5.4] - request will be sent as multipart form entity</em></li>
36
45
  * </ul>
37
46
  * </li>
@@ -13,6 +13,17 @@ import type { Object } from "../../types/java/lang/Object";
13
13
  * @author Magnus Lövgren
14
14
  */
15
15
  export interface ResourceLocatorUtil {
16
+ /**
17
+ * Gets the JCR Root Node for current Site.
18
+ *
19
+ * <p>
20
+ * <em>This is a non-throwing convenience for the {@link javax.jcr.Session#getRootNode() Session.getRootNode()} method.</em>
21
+ * </p>
22
+ * @return the JCR Root Node, or null if indeterminable
23
+ * @since Sitevision 2023.11.1
24
+ */
25
+ getRootNode(): Node;
26
+
16
27
  /**
17
28
  * Gets current site (i.e. the site node of the page for the currently executing portlet).
18
29
  *
@@ -442,6 +453,20 @@ export interface ResourceLocatorUtil {
442
453
  * @see senselogic.sitevision.api.cookie.SiteCookieUtil
443
454
  */
444
455
  getSiteCookieRepository(): Node;
456
+
457
+ /**
458
+ * Gets the image filter repository (sv:imageFilterRepository) for the site of current node.
459
+ * @return the image filter repository, or null if indeterminable.
460
+ * @since Sitevision 2023.09.1
461
+ */
462
+ getImageFilterRepository(): Node;
463
+
464
+ /**
465
+ * Gets the work status template repository (sv:workStatusTemplateRepository) for the site of current node.
466
+ * @return the work status template repository, or null if indeterminable.
467
+ * @since Sitevision 2023.09.2
468
+ */
469
+ getWorkStatusTemplateRepository(): Node;
445
470
  }
446
471
 
447
472
  declare namespace ResourceLocatorUtil {}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports["default"] = void 0;
7
7
  var _default = {
8
+ getRootNode: function getRootNode() {},
8
9
  getSite: function getSite() {},
9
10
  getSitePage: function getSitePage() {},
10
11
  getColorRepository: function getColorRepository() {},
@@ -45,6 +46,8 @@ var _default = {
45
46
  getTrashcan: function getTrashcan() {},
46
47
  getPrincipalRepository: function getPrincipalRepository() {},
47
48
  getAliasRepository: function getAliasRepository() {},
48
- getSiteCookieRepository: function getSiteCookieRepository() {}
49
+ getSiteCookieRepository: function getSiteCookieRepository() {},
50
+ getImageFilterRepository: function getImageFilterRepository() {},
51
+ getWorkStatusTemplateRepository: function getWorkStatusTemplateRepository() {}
49
52
  };
50
53
  exports["default"] = _default;
@@ -13,6 +13,7 @@ import type { SpellCheckBuilder } from "../SpellCheckBuilder";
13
13
  import type { StandardParserBuilder } from "../StandardParserBuilder";
14
14
  import type { QueryStringUtil } from "../QueryStringUtil";
15
15
  import type { MonitorBuilder } from "../MonitorBuilder";
16
+ import type { PermissionCheckBuilder } from "../PermissionCheckBuilder";
16
17
 
17
18
  /**
18
19
  * Factory for creating search-related instances.
@@ -112,6 +113,13 @@ export interface SearchFactory {
112
113
  * @since Sitevision 4.1
113
114
  */
114
115
  getMonitorBuilder(): MonitorBuilder;
116
+
117
+ /**
118
+ * Gets a PermissionCheckBuilder instance.
119
+ * @return a PermissionCheckBuilder instance
120
+ * @since Sitevision 2023.09.1
121
+ */
122
+ getPermissionCheckBuilder(): PermissionCheckBuilder;
115
123
  }
116
124
 
117
125
  declare namespace SearchFactory {}
@@ -17,6 +17,7 @@ var _default = {
17
17
  getSpellCheckBuilder: function getSpellCheckBuilder() {},
18
18
  getStandardParserBuilder: function getStandardParserBuilder() {},
19
19
  getQueryStringUtil: function getQueryStringUtil() {},
20
- getMonitorBuilder: function getMonitorBuilder() {}
20
+ getMonitorBuilder: function getMonitorBuilder() {},
21
+ getPermissionCheckBuilder: function getPermissionCheckBuilder() {}
21
22
  };
22
23
  exports["default"] = _default;
@@ -40,12 +40,10 @@ import type { SearchResult } from "../../types/senselogic/sitevision/api/search/
40
40
  * <strong>Query syntax note! </strong>Query strings should be expressed according to the <em>Solr query syntax</em>.
41
41
  * The syntax is basically the
42
42
  * <em><a href="http://lucene.apache.org/core/4_10_3/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description">
43
- * Lucene query syntax</a></em>
44
- * with <em><a href="http://wiki.apache.org/solr/SolrQuerySyntax#Differences_From_Lucene_Query_Parser">some minor differences</a></em>.
43
+ * Lucene query syntax</a></em> with some minor differences (solr syntax allows open-ended range queries and pure negative queries).
45
44
  * Also note that a general recommendation is to always use the <em>prefix operators</em> (<code>+</code>/<code>-</code>) instead of the
46
- * <em>boolean keywords</em> (AND/OR/NOT)
47
- * to avoid unexpected behaviour. For deeper understanding, see for example
48
- * <a href="https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/">Why Not AND, OR, And NOT?</a>.
45
+ * <em>boolean keywords</em> (AND/OR/NOT) to avoid unexpected behaviour. For deeper understanding, see for example
46
+ * <a href="https://lucidworks.com/post/solr-boolean-operators/" target="_blank">Why Not AND, OR, And NOT?</a>.
49
47
  * </p>
50
48
  *
51
49
  * <p>
@@ -5,6 +5,7 @@ import type { Parser } from "../../types/senselogic/sitevision/api/search/search
5
5
  import type { Sort } from "../../types/senselogic/sitevision/api/search/searcher/component/Sort";
6
6
  import type { SpellCheck } from "../../types/senselogic/sitevision/api/search/searcher/component/SpellCheck";
7
7
  import type { Monitor } from "../../types/senselogic/sitevision/api/search/searcher/component/Monitor";
8
+ import type { PermissionCheck } from "../../types/senselogic/sitevision/api/search/searcher/component/PermissionCheck";
8
9
  import type { Searcher } from "../../types/senselogic/sitevision/api/search/searcher/Searcher";
9
10
  import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder";
10
11
 
@@ -53,6 +54,12 @@ import type { Builder } from "../../types/senselogic/sitevision/api/base/Builder
53
54
  * </em>
54
55
  * Default: <code>null</code> (i.e. no monitoring).
55
56
  * </li>
57
+ * <li>
58
+ * {@link senselogic.sitevision.api.search.searcher.component.PermissionCheck}<em>
59
+ * - how should permission checks be performed? (Note! Only applicable when querying a sv:nodeIndex)
60
+ * </em>
61
+ * Default: <code>null</code> (legacy default permission checking strategy will be used).
62
+ * </li>
56
63
  * </ul>
57
64
  * <p>
58
65
  * What <em>index</em> to query can also be specified. Default is the <em>default node index</em>
@@ -201,6 +208,34 @@ export interface SearcherBuilder extends Builder {
201
208
  */
202
209
  setMonitor(aMonitor: Monitor): SearcherBuilder;
203
210
 
211
+ /**
212
+ * Sets the permission check component.
213
+ *
214
+ * <p>
215
+ * <strong>Note! This component is only applicable when querying a Node index (<code>sv:nodeIndex</code>)!</strong>
216
+ * </p>
217
+ * <p>
218
+ * When querying a Custom Node index that is populated with <em>external data</em>, you should typically set a permission check component
219
+ * that specifies the {@link senselogic.sitevision.api.search.searcher.component.PermissionStrategy#EARLY_CHECK} strategy.
220
+ * </p>
221
+ * <p>
222
+ * <em>
223
+ * Legacy: a <code>Searcher</code> without any <code>PermissionCheck</code> component will use a legacy default strategy when checking
224
+ * permissions. This strategy is a mix of <code>EARLY_CHECK</code> and <code>LATE_CHECK</code> that is kept as-is for legacy reasons only.
225
+ * New search solutions with <code>Searcher</code> should typically specify a <code>PermissionCheck</code> component when querying
226
+ * a <code>sv:nodeIndex</code>.
227
+ * </em>
228
+ * </p>
229
+ * <p>
230
+ * A <code>PermissionCheck</code> instance is created via the {@link PermissionCheckBuilder#build()} method.
231
+ * </p>
232
+ * @param aPermissionCheck the permission check component
233
+ * @return this builder
234
+ * @see PermissionCheck
235
+ * @since Sitevision 2023.09.1
236
+ */
237
+ setPermissionCheck(aPermissionCheck: PermissionCheck): SearcherBuilder;
238
+
204
239
  /**
205
240
  * Creates a Searcher instance using currently specified components.
206
241
  * @return a Searcher instance
@@ -12,6 +12,7 @@ var _default = {
12
12
  setSort: function setSort() {},
13
13
  setSpellCheck: function setSpellCheck() {},
14
14
  setMonitor: function setMonitor() {},
15
+ setPermissionCheck: function setPermissionCheck() {},
15
16
  build: function build() {}
16
17
  };
17
18
  exports["default"] = _default;
@@ -372,6 +372,13 @@ export type NodeTypeUtilConstants = {
372
372
  */
373
373
  getIMAGE_FILTER_TYPE(): string;
374
374
 
375
+ /**
376
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#IMAGE_FILTER_REPOSITORY_TYPE}.
377
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#IMAGE_FILTER_REPOSITORY_TYPE}
378
+ * @since Sitevision 2023.09.1
379
+ */
380
+ getIMAGE_FILTER_REPOSITORY_TYPE(): string;
381
+
375
382
  /**
376
383
  * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#IMAGE_REPOSITORY_TYPE}.
377
384
  * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#IMAGE_REPOSITORY_TYPE}
@@ -554,6 +561,41 @@ export type NodeTypeUtilConstants = {
554
561
  */
555
562
  getMETADATA_MULTIPLE_TAG_DEFINITION_TYPE(): string;
556
563
 
564
+ /**
565
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_IMAGE_DEFINITION_TYPE}.
566
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_IMAGE_DEFINITION_TYPE}
567
+ * @since Sitevision 2024.01.1
568
+ */
569
+ getMETADATA_SYSTEM_IMAGE_DEFINITION_TYPE(): string;
570
+
571
+ /**
572
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_INTEGER_DEFINITION_TYPE}.
573
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_INTEGER_DEFINITION_TYPE}
574
+ * @since Sitevision 2024.01.1
575
+ */
576
+ getMETADATA_SYSTEM_INTEGER_DEFINITION_TYPE(): string;
577
+
578
+ /**
579
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_LINK_DEFINITION_TYPE}.
580
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_LINK_DEFINITION_TYPE}
581
+ * @since Sitevision 2024.01.1
582
+ */
583
+ getMETADATA_SYSTEM_LINK_DEFINITION_TYPE(): string;
584
+
585
+ /**
586
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_TEXT_DEFINITION_TYPE}.
587
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_SYSTEM_TEXT_DEFINITION_TYPE}
588
+ * @since Sitevision 2024.01.1
589
+ */
590
+ getMETADATA_SYSTEM_TEXT_DEFINITION_TYPE(): string;
591
+
592
+ /**
593
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_DATE_DEFINITION_TYPE}.
594
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#METADATA_DATE_DEFINITION_TYPE}
595
+ * @since Sitevision 2024.01.1
596
+ */
597
+ getMETADATA_DATE_DEFINITION_TYPE(): string;
598
+
557
599
  /**
558
600
  * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#MOBILE_APP_TYPE}.
559
601
  * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#MOBILE_APP_TYPE}
@@ -1240,4 +1282,25 @@ export type NodeTypeUtilConstants = {
1240
1282
  * @since Sitevision 7
1241
1283
  */
1242
1284
  getOAUTH2_CONFIGURATION_TYPE(): string;
1285
+
1286
+ /**
1287
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#WORK_STATUS_TYPE}.
1288
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#WORK_STATUS_TYPE}
1289
+ * @since Sitevision 2023.09.2
1290
+ */
1291
+ getWORK_STATUS_TYPE(): string;
1292
+
1293
+ /**
1294
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#WORK_STATUS_TEMPLATE_TYPE}.
1295
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#WORK_STATUS_TEMPLATE_TYPE}
1296
+ * @since Sitevision 2023.09.2
1297
+ */
1298
+ getWORK_STATUS_TEMPLATE_TYPE(): string;
1299
+
1300
+ /**
1301
+ * Get accessor for {@link senselogic.sitevision.api.node.NodeTypeUtil#WORK_STATUS_TEMPLATE_REPOSITORY_TYPE}.
1302
+ * @return {@link senselogic.sitevision.api.node.NodeTypeUtil#WORK_STATUS_TEMPLATE_REPOSITORY_TYPE}
1303
+ * @since Sitevision 2023.09.2
1304
+ */
1305
+ getWORK_STATUS_TEMPLATE_REPOSITORY_TYPE(): string;
1243
1306
  };
@@ -61,6 +61,7 @@ var _default = {
61
61
  getGRADE_FIELD_TYPE: function getGRADE_FIELD_TYPE() {},
62
62
  getICON_REPOSITORY_TYPE: function getICON_REPOSITORY_TYPE() {},
63
63
  getIMAGE_FILTER_TYPE: function getIMAGE_FILTER_TYPE() {},
64
+ getIMAGE_FILTER_REPOSITORY_TYPE: function getIMAGE_FILTER_REPOSITORY_TYPE() {},
64
65
  getIMAGE_REPOSITORY_TYPE: function getIMAGE_REPOSITORY_TYPE() {},
65
66
  getLAYOUT_REPOSITORY_TYPE: function getLAYOUT_REPOSITORY_TYPE() {},
66
67
  getLIST_STYLE_TYPE: function getLIST_STYLE_TYPE() {},
@@ -87,6 +88,11 @@ var _default = {
87
88
  getMETADATA_USER_DEFINITION_TYPE: function getMETADATA_USER_DEFINITION_TYPE() {},
88
89
  getMETADATA_SINGLE_TAG_DEFINITION_TYPE: function getMETADATA_SINGLE_TAG_DEFINITION_TYPE() {},
89
90
  getMETADATA_MULTIPLE_TAG_DEFINITION_TYPE: function getMETADATA_MULTIPLE_TAG_DEFINITION_TYPE() {},
91
+ getMETADATA_SYSTEM_IMAGE_DEFINITION_TYPE: function getMETADATA_SYSTEM_IMAGE_DEFINITION_TYPE() {},
92
+ getMETADATA_SYSTEM_INTEGER_DEFINITION_TYPE: function getMETADATA_SYSTEM_INTEGER_DEFINITION_TYPE() {},
93
+ getMETADATA_SYSTEM_LINK_DEFINITION_TYPE: function getMETADATA_SYSTEM_LINK_DEFINITION_TYPE() {},
94
+ getMETADATA_SYSTEM_TEXT_DEFINITION_TYPE: function getMETADATA_SYSTEM_TEXT_DEFINITION_TYPE() {},
95
+ getMETADATA_DATE_DEFINITION_TYPE: function getMETADATA_DATE_DEFINITION_TYPE() {},
90
96
  getMOBILE_APP_TYPE: function getMOBILE_APP_TYPE() {},
91
97
  getMULTIPLE_SELECTION_FIELD_TYPE: function getMULTIPLE_SELECTION_FIELD_TYPE() {},
92
98
  getNAMED_REFERENCE_TYPE: function getNAMED_REFERENCE_TYPE() {},
@@ -184,6 +190,9 @@ var _default = {
184
190
  getEXTERNAL_TOPIC_TIMELINE_ENTRY_TYPE: function getEXTERNAL_TOPIC_TIMELINE_ENTRY_TYPE() {},
185
191
  getEXTERNAL_COMMENT_ENTRY_TYPE: function getEXTERNAL_COMMENT_ENTRY_TYPE() {},
186
192
  getOAUTH2_CONFIGURATION_REPOSITORY_TYPE: function getOAUTH2_CONFIGURATION_REPOSITORY_TYPE() {},
187
- getOAUTH2_CONFIGURATION_TYPE: function getOAUTH2_CONFIGURATION_TYPE() {}
193
+ getOAUTH2_CONFIGURATION_TYPE: function getOAUTH2_CONFIGURATION_TYPE() {},
194
+ getWORK_STATUS_TYPE: function getWORK_STATUS_TYPE() {},
195
+ getWORK_STATUS_TEMPLATE_TYPE: function getWORK_STATUS_TEMPLATE_TYPE() {},
196
+ getWORK_STATUS_TEMPLATE_REPOSITORY_TYPE: function getWORK_STATUS_TEMPLATE_REPOSITORY_TYPE() {}
188
197
  };
189
198
  exports["default"] = _default;
@@ -47,6 +47,11 @@ import type { SearchResult } from "../../SearchResult";
47
47
  * - how should querying be monitored? (e.g. should search query logging mode be on or off?)
48
48
  * </em>
49
49
  * </li>
50
+ * <li>
51
+ * {@link senselogic.sitevision.api.search.searcher.component.PermissionCheck}<em>
52
+ * - how should permission checks be performed? (Note! Only applicable when querying a sv:nodeIndex)
53
+ * </em>
54
+ * </li>
50
55
  * </ul>
51
56
  * <p>
52
57
  * All components are optional and are assembled using a {@link senselogic.sitevision.api.search.searcher.builder.SearcherBuilder}.
@@ -135,11 +140,10 @@ import type { SearchResult } from "../../SearchResult";
135
140
  * <strong>Query syntax note! </strong>Query strings should be expressed according to the <em>Solr query syntax</em>.
136
141
  * The syntax is basically the
137
142
  * <em><a href="http://lucene.apache.org/core/4_10_3/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description">
138
- * Lucene query syntax</a></em>
139
- * with <em><a href="http://wiki.apache.org/solr/SolrQuerySyntax#Differences_From_Lucene_Query_Parser">some minor differences</a></em>.
143
+ * Lucene query syntax</a></em> with some minor differences (solr syntax allows open-ended range queries and pure negative queries).
140
144
  * Also note that a general recommendation is to always use the <em>prefix operators</em> (<code>+</code>/<code>-</code>) instead of the
141
145
  * <em>boolean keywords</em> (AND/OR/NOT) to avoid unexpected behaviour. For deeper understanding, see for example
142
- * <a href="https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/">Why Not AND, OR, And NOT?</a>.
146
+ * <a href="https://lucidworks.com/post/solr-boolean-operators/" target="_blank">Why Not AND, OR, And NOT?</a>.
143
147
  * </p>
144
148
  *
145
149
  * <p>
@@ -0,0 +1,27 @@
1
+ /**
2
+ * <p>
3
+ * A permission check component that defines permission checking behaviour for a {@link senselogic.sitevision.api.search.searcher.Searcher}.
4
+ * </p>
5
+ *
6
+ * <p>
7
+ * <strong>Note! This component is only applicable when querying a Node index (<code>sv:nodeIndex</code>)!</strong>
8
+ * </p>
9
+ *
10
+ * <p>
11
+ * The actual behaviour is specified when it is constructed using the
12
+ * {@link senselogic.sitevision.api.search.searcher.builder.PermissionCheckBuilder}.
13
+ * The component is applied to the <code>Searcher</code> via
14
+ * {@link senselogic.sitevision.api.search.searcher.builder.SearcherBuilder#setPermissionCheck(PermissionCheck)}
15
+ * when the <code>Searcher</code> is constructed.
16
+ * </p>
17
+ *
18
+ * <p>
19
+ * An instance of the Sitevision class implementing this interface can be obtained via
20
+ * {@link senselogic.sitevision.api.search.searcher.builder.PermissionCheckBuilder#build()}.
21
+ * See {@link senselogic.sitevision.api.search.searcher.builder.PermissionCheckBuilder} for how to obtain an instance of the
22
+ * <code>PermissionCheck</code> interface.
23
+ * </p>
24
+ * @author Magnus Lövgren
25
+ * @since Sitevision 2023.09.1
26
+ */
27
+ export type PermissionCheck = {};
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {};
8
+ exports["default"] = _default;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Permission strategy, determines how a {@link senselogic.sitevision.api.search.searcher.component.PermissionCheck}
3
+ * component will perform its checks.
4
+ *
5
+ * <p>
6
+ * Example of how to get the {@link #EARLY_CHECK} state:
7
+ * </p>
8
+ * <ul>
9
+ * <li>
10
+ * In a bundled <strong>WebApp/RESTApp</strong>:<pre><code>
11
+ * import EARLY_CHECK from '@sitevision/api/server/PermissionStrategy.EARLY_CHECK';</code></pre>
12
+ * </li>
13
+ * <li>
14
+ * Using server-side <strong>JavaScript</strong> in a Script module:<pre><code>
15
+ * const earlyCheckEnum = require('PermissionStrategy.EARLY_CHECK');</code></pre>
16
+ * </li>
17
+ * <li>
18
+ * Using <strong>Velocity</strong>:<pre><code>
19
+ * #set ($instanceCreatorUtil = $sitevisionUtils.instanceCreatorUtil)
20
+ * #set ($enumClassName = 'senselogic.sitevision.api.search.searcher.component.PermissionStrategy')
21
+ * #set ($earlyCheckEnum = $instanceCreatorUtil.getEnumInstance($enumClassName, 'EARLY_CHECK'))</code></pre>
22
+ * </li>
23
+ * </ul>
24
+ * @author Magnus Lövgren
25
+ * @since Sitevision 2023.09.1
26
+ * @see PermissionCheck
27
+ */
28
+ export type PermissionStrategy = {
29
+ EARLY_CHECK: "EARLY_CHECK";
30
+ LATE_CHECK: "LATE_CHECK";
31
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ EARLY_CHECK: "EARLY_CHECK",
9
+ LATE_CHECK: "LATE_CHECK"
10
+ };
11
+ exports["default"] = _default;