@sitevision/api 2024.2.1 → 2024.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -58,6 +58,7 @@ import './server/MailBuilder';
58
58
  import './server/MailUtil';
59
59
  import './server/MathInstance';
60
60
  import './server/MessageDigesterFactory';
61
+ import './server/MessagesFactory';
61
62
  import './server/MetadataDefinitionUtil';
62
63
  import './server/MetadataUtil';
63
64
  import './server/MimeTypeUtil';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sitevision/api",
3
- "version": "2024.2.1",
3
+ "version": "2024.3.1",
4
4
  "author": "Sitevision AB",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -30,5 +30,5 @@
30
30
  "access": "public",
31
31
  "directory": "dist"
32
32
  },
33
- "gitHead": "ecc0cf7bfd6da83e4fd08c03614bb676c40cb66f"
33
+ "gitHead": "ac4d35923f8a61c4fdaccbd6ffe6c46be9fddd8a"
34
34
  }
@@ -0,0 +1,28 @@
1
+ import type { Node } from "../../types/javax/jcr/Node";
2
+ import type { ChannelWrapper } from "../../types/senselogic/sitevision/api/message/ChannelWrapper";
3
+
4
+ /**
5
+ * Factory for creating messages-related instances.
6
+ *
7
+ * <p>
8
+ * An instance of the Sitevision class implementing this interface can be obtained via
9
+ * {@link senselogic.sitevision.api.Utils#getMessagesFactory()}.
10
+ * See {@link senselogic.sitevision.api.Utils} for how to obtain an instance of the <code>Utils</code> interface.
11
+ * </p>
12
+ * @author Elias Abrache
13
+ * @since Sitevision 2024.03.01
14
+ */
15
+ export interface MessagesFactory {
16
+ /**
17
+ * Gets a wrapper for the specified channel.
18
+ * @param aChannel the channel node (node of type sv:topic).
19
+ * @return a channel wrapper for <code>aChannel</code>, or <code>null</code> if <code>aChannel</code>&#xA; isn't a channel, is archived, Social Collaboration isn't activated or operating user doesn't have a social user identity.
20
+ */
21
+ getChannelWrapper(aChannel: Node): ChannelWrapper;
22
+ }
23
+
24
+ declare namespace MessagesFactory {}
25
+
26
+ declare var messagesFactory: MessagesFactory;
27
+
28
+ export default messagesFactory;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _default = {
8
+ getChannelWrapper: function getChannelWrapper() {}
9
+ };
10
+ exports["default"] = _default;
@@ -85,6 +85,7 @@ import type { FormatterBuilderFactory } from "../FormatterBuilderFactory";
85
85
  import type { TextModuleRendererBuilder } from "../TextModuleRendererBuilder";
86
86
  import type { TagUtil } from "../TagUtil";
87
87
  import type { AliasUtil } from "../AliasUtil";
88
+ import type { MessagesFactory } from "../MessagesFactory";
88
89
 
89
90
  /**
90
91
  * Main entry point to get instances of interfaces in the Sitevision Utility API.
@@ -747,6 +748,13 @@ export interface Utils {
747
748
  * @since Sitevision 2022.10.2
748
749
  */
749
750
  getAliasUtil(): AliasUtil;
751
+
752
+ /**
753
+ * Gets an instance of a messages factory class.
754
+ * @return a messages factory class
755
+ * @since Sitevision 2024.03.01
756
+ */
757
+ getMessagesFactory(): MessagesFactory;
750
758
  }
751
759
 
752
760
  declare namespace Utils {}
@@ -87,6 +87,7 @@ var _default = {
87
87
  getFormatterBuilderFactory: function getFormatterBuilderFactory() {},
88
88
  getTextModuleRendererBuilder: function getTextModuleRendererBuilder() {},
89
89
  getTagUtil: function getTagUtil() {},
90
- getAliasUtil: function getAliasUtil() {}
90
+ getAliasUtil: function getAliasUtil() {},
91
+ getMessagesFactory: function getMessagesFactory() {}
91
92
  };
92
93
  exports["default"] = _default;
@@ -457,6 +457,52 @@ export interface WebContentUtil {
457
457
  * @since Sitevision 3.6
458
458
  */
459
459
  resolveToResourceURL(aNode: Node, aUnresolvedURL: String | string): string;
460
+
461
+ /**
462
+ * Removes the page content of the first root layout for a sv:page, sv:article or a sv:template.
463
+ *
464
+ * <p>
465
+ * Content of the <strong>first</strong> root layout available on the node will be removed.
466
+ * Use {@link #removeAllContent(Node, String)} instead to specify a specific root layout.
467
+ * </p>
468
+ *
469
+ * <p>
470
+ * Current user must have effective WRITE permission to mutate the node or a <code>ConstraintViolationException</code> is thrown.
471
+ * </p>
472
+ *
473
+ * <p>
474
+ * <em>This method is typically called to clear all content before adding new content via {@link #updateContent(Node, String)}</em>
475
+ * </p>
476
+ * @param aPageNode the node that will be altered, typically a node with primary node type sv:page or sv:article.&#xA; May not be null and may not be the site page
477
+ * @throws NullPointerException if aPageNode is null
478
+ * @throws IllegalArgumentException if aPageNode is of invalid type
479
+ * @throws ConstraintViolationException if current user is not allowed to alter aPageNode
480
+ * @throws RepositoryException if something else goes wrong
481
+ * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node)
482
+ * @since Sitevision 2024.03.1
483
+ */
484
+ removeAllContent(aPageNode: Node): void;
485
+
486
+ /**
487
+ * Removes the page content of a root layout for a sv:page, sv:article or a sv:template.
488
+ *
489
+ * <p>
490
+ * Current user must have effective WRITE permission to mutate the node or a <code>ConstraintViolationException</code> is thrown.
491
+ * </p>
492
+ *
493
+ * <p>
494
+ * <em>This method is typically called to clear all content before adding new content via {@link #updateContent(Node, Map)}</em>
495
+ * </p>
496
+ * @param aPageNode the node that will be altered, typically a node with primary node type sv:page or sv:article.&#xA; May not be null and may not be the site page
497
+ * @param aRootLayoutName the name of the root layout of aPageNode to remove content from (e.g. "Mittenspalt")
498
+ * @throws NullPointerException if aPageNode or aRootLayoutName is null
499
+ * @throws IllegalArgumentException if aPageNode is of invalid type or if there are no root layout named aRootLayoutName
500
+ * @throws ConstraintViolationException if current user is not allowed to alter aPageNode
501
+ * @throws RepositoryException if something else goes wrong
502
+ * @see senselogic.sitevision.api.security.PermissionUtil#hasEffectiveWritePermission(Node, Node)
503
+ * @since Sitevision 2024.03.1
504
+ */
505
+ removeAllContent(aPageNode: Node, aRootLayoutName: String | string): void;
460
506
  }
461
507
 
462
508
  declare namespace WebContentUtil {}
@@ -9,6 +9,7 @@ var _default = {
9
9
  updateContentWithRawHtml: function updateContentWithRawHtml() {},
10
10
  appendContent: function appendContent() {},
11
11
  appendContentWithRawHtml: function appendContentWithRawHtml() {},
12
- resolveToResourceURL: function resolveToResourceURL() {}
12
+ resolveToResourceURL: function resolveToResourceURL() {},
13
+ removeAllContent: function removeAllContent() {}
13
14
  };
14
15
  exports["default"] = _default;
@@ -0,0 +1,91 @@
1
+ import type { Node } from "../../../../../javax/jcr/Node";
2
+
3
+ import type { Wrapper } from "../../base/Wrapper";
4
+
5
+ /**
6
+ * Channel administration interface.
7
+ *
8
+ * <p>
9
+ * This wrapper provides methods to update an existing channel (node of type sv:topic).
10
+ * </p>
11
+ *
12
+ * <p>
13
+ * An instance of the Sitevision class implementing this interface can be obtained via
14
+ * {@link MessagesFactory#getChannelWrapper(javax.jcr.Node)}.
15
+ * See {@link MessagesFactory} for how to obtain an instance of the MessagesFactory interface.
16
+ * </p>
17
+ * @author Elias Abrache
18
+ * @since Sitevision 2024.03.01
19
+ */
20
+ export type ChannelWrapper = Wrapper & {
21
+ /**
22
+ * Adds a user identity as member of the wrapped channel.
23
+ *
24
+ * <p>
25
+ * Requires enabled Social collaboration, and for the operating user to have a social user identity.
26
+ * </p>
27
+ *
28
+ * <p>
29
+ * <em>Only non-members will be added</em>, i.e. a user identity that already is a member will be ignored.
30
+ * Channels that are <em>archived</em> don't accept any new members.
31
+ * </p>
32
+ *
33
+ * <p>
34
+ * <strong>Permission notes!</strong>
35
+ * </p>
36
+ * <p>
37
+ * <em>Open channels</em> require the operating user to either have membership or the
38
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission.
39
+ * </p>
40
+ * <p>
41
+ * <em>Private channels</em> require the operating user to have membership.
42
+ * </p>
43
+ * @param aUserIdentity a user identity (or user)
44
+ * @return true if aUserIdentity was added as member of the wrapped channel, false otherwise.&#xA; false is always returned if aUserIdentity is null or already a member of the wrapped channel.
45
+ */
46
+ addMember(aUserIdentity: Node): boolean;
47
+
48
+ /**
49
+ * Removes a member from the wrapped channel.
50
+ *
51
+ * <p>
52
+ * <em>Only members can be removed</em>, i.e. a user identity that is a non-member will be ignored.
53
+ * Members can not be removed from channels that are <em>archived</em>.
54
+ * </p>
55
+ *
56
+ * <p>
57
+ * <strong>Permission notes!</strong>
58
+ * </p>
59
+ * <p>
60
+ * <em>Open channels</em> require the operating user to have one of the following:
61
+ * </p>
62
+ * <ul>
63
+ * <li>
64
+ * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission.
65
+ * </li>
66
+ * <li>
67
+ * Be channel administrator (author of the channel).
68
+ * </li>
69
+ * <li>
70
+ * Operating user matches the user identity (i.e. "is yourself").
71
+ * </li>
72
+ * </ul>
73
+ * <p>
74
+ * <em>Private channels</em> require the operating user to have one of the following:
75
+ * </p>
76
+ * <ul>
77
+ * <li>
78
+ * Membership and the {@link senselogic.sitevision.api.security.PermissionUtil.Permission#MANAGE_CHANNELS} permission.
79
+ * </li>
80
+ * <li>
81
+ * Be channel administrator (author of the channel).
82
+ * </li>
83
+ * <li>
84
+ * Operating user matches the user identity (i.e. "is yourself").
85
+ * </li>
86
+ * </ul>
87
+ * @param aUserIdentity a user identity (or user)
88
+ * @return true if aUserIdentity was removed as member from the wrapped channel, false otherwise.&#xA; false is always returned if aUserIdentity is null or not a member of the wrapped channel.
89
+ */
90
+ removeMember(aUserIdentity: Node): boolean;
91
+ };
@@ -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
+ addMember: function addMember() {},
9
+ removeMember: function removeMember() {}
10
+ };
11
+ exports["default"] = _default;