@jahia/javascript-modules-library 0.5.6 → 0.6.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.
Files changed (31) hide show
  1. package/README.md +215 -22
  2. package/dist/core/server/components/AbsoluteArea.d.ts +43 -18
  3. package/dist/core/server/components/AddResources.d.ts +1 -1
  4. package/dist/core/server/components/Area.d.ts +32 -16
  5. package/dist/core/server/components/render/HydrateInBrowser.d.ts +1 -1
  6. package/dist/core/server/components/render/Render.d.ts +4 -4
  7. package/dist/core/server/components/render/RenderChild.d.ts +16 -0
  8. package/dist/core/server/components/render/RenderChildren.d.ts +33 -0
  9. package/dist/core/server/framework/jahiaComponent.d.ts +7 -0
  10. package/dist/core/server/hooks/useServerContext.d.ts +6 -4
  11. package/dist/core/server/utils/i18n.d.ts +11 -0
  12. package/dist/core/server/utils/jcr/getChildNodes.d.ts +1 -2
  13. package/dist/core/server/utils/jcr/getNodesByJCRQuery.d.ts +1 -1
  14. package/dist/core/server/utils/urlBuilder/urlBuilder.d.ts +52 -15
  15. package/dist/globals.d.ts +3 -0
  16. package/dist/index.d.ts +6 -3
  17. package/dist/java.io.d.ts +164 -0
  18. package/dist/java.lang.d.ts +16 -0
  19. package/dist/java.util.d.ts +2 -1
  20. package/dist/javax.jcr.d.ts +13 -0
  21. package/dist/javax.servlet.http.d.ts +70 -0
  22. package/dist/nav/server/navBuilder/navBuilder.d.ts +5 -3
  23. package/dist/org.jahia.modules.javascript.modules.engine.js.server.d.ts +56 -50
  24. package/dist/org.jahia.services.content.d.ts +41 -1
  25. package/dist/org.jahia.services.content.decorator.d.ts +97 -2
  26. package/dist/org.jahia.services.render.d.ts +8 -0
  27. package/dist/org.jahia.services.usermanager.d.ts +11 -0
  28. package/dist/package.tgz +0 -0
  29. package/package.json +5 -1
  30. package/dist/core/server/hooks/useUrlBuilder.d.ts +0 -52
  31. package/dist/core/server/utils/jcr/getNodeFromPathOrId.d.ts +0 -14
package/dist/index.d.ts CHANGED
@@ -1,6 +1,8 @@
1
1
  export { RenderInBrowser } from "./core/server/components/render/RenderInBrowser.js";
2
2
  export { HydrateInBrowser } from "./core/server/components/render/HydrateInBrowser.js";
3
3
  export { Render } from "./core/server/components/render/Render.js";
4
+ export { RenderChild } from "./core/server/components/render/RenderChild.js";
5
+ export { RenderChildren } from "./core/server/components/render/RenderChildren.js";
4
6
  export { AbsoluteArea } from "./core/server/components/AbsoluteArea.js";
5
7
  export { AddContentButtons } from "./core/server/components/AddContentButtons.js";
6
8
  export { AddResources } from "./core/server/components/AddResources.js";
@@ -11,18 +13,19 @@ export { registerJahiaComponents } from "./core/server/framework/register.js";
11
13
  export { useGQLQuery } from "./core/server/hooks/useGQLQuery.js";
12
14
  export { useJCRQuery } from "./core/server/hooks/useJCRQuery.js";
13
15
  export { useServerContext, ServerContextProvider } from "./core/server/hooks/useServerContext.js";
14
- export { useUrlBuilder } from "./core/server/hooks/useUrlBuilder.js";
15
16
  export { getChildNodes } from "./core/server/utils/jcr/getChildNodes.js";
16
- export { getNodeFromPathOrId } from "./core/server/utils/jcr/getNodeFromPathOrId.js";
17
17
  export { getNodeProps } from "./core/server/utils/jcr/getNodeProps.js";
18
18
  export { getNodesByJCRQuery } from "./core/server/utils/jcr/getNodesByJCRQuery.js";
19
- export { buildUrl, initUrlBuilder } from "./core/server/utils/urlBuilder/urlBuilder.js";
19
+ export { buildEndpointUrl, buildNodeUrl, buildModuleFileUrl, initUrlBuilder, } from "./core/server/utils/urlBuilder/urlBuilder.js";
20
+ export { getSiteLocales } from "./core/server/utils/i18n.js";
20
21
  export { buildNavMenu } from "./nav/server/navBuilder/navBuilder.js";
22
+ export type { MenuEntry } from "./nav/server/navBuilder/navBuilder.js";
21
23
  export { default as server } from "virtual:jahia-server";
22
24
 
23
25
  // Include declarations for all Java types
24
26
  export * from "./globals";
25
27
  export * from "./java.io";
28
+ export * from "./java.lang";
26
29
  export * from "./java.net";
27
30
  export * from "./java.security";
28
31
  export * from "./java.util";
package/dist/java.io.d.ts CHANGED
@@ -702,5 +702,169 @@ export class PrintWriter {
702
702
  */
703
703
  format(l: Locale, format: string, ...args: any[]): PrintWriter;
704
704
  }
705
+ /**
706
+ * Serializability of a class is enabled by the class implementing the
707
+ * java.io.Serializable interface.
708
+ *
709
+ * Warning: Deserialization of untrusted data is inherently dangerous
710
+ * and should be avoided. Untrusted data should be carefully validated according to the
711
+ * "Serialization and Deserialization" section of the
712
+ * {@extLink secure_coding_guidelines_javase Secure Coding Guidelines for Java SE}.
713
+ * {@extLink serialization_filter_guide Serialization Filtering} describes best
714
+ * practices for defensive use of serial filters.
715
+ *
716
+ *
717
+ * Classes that do not implement this
718
+ * interface will not have any of their state serialized or
719
+ * deserialized. All subtypes of a serializable class are themselves
720
+ * serializable. The serialization interface has no methods or fields
721
+ * and serves only to identify the semantics of being serializable.
722
+ *
723
+ * It is possible for subtypes of non-serializable classes to be serialized
724
+ * and deserialized. During serialization, no data will be written for the
725
+ * fields of non-serializable superclasses. During deserialization, the fields of non-serializable
726
+ * superclasses will be initialized using the no-arg constructor of the first (bottommost)
727
+ * non-serializable superclass. This constructor must be accessible to the subclass that is being
728
+ * deserialized. It is an error to declare a class Serializable if this is not
729
+ * the case; the error will be detected at runtime. A serializable subtype may
730
+ * assume responsibility for saving and restoring the state of a non-serializable
731
+ * supertype's public, protected, and (if accessible) package-access fields. See
732
+ * the
733
+ * Java Object Serialization Specification, section 3.1, for
734
+ * a detailed specification of the deserialization process, including handling of
735
+ * serializable and non-serializable classes.
736
+ *
737
+ * When traversing a graph, an object may be encountered that does not
738
+ * support the Serializable interface. In this case the
739
+ * NotSerializableException will be thrown and will identify the class
740
+ * of the non-serializable object.
741
+ *
742
+ * Classes that require special handling during the serialization and
743
+ * deserialization process must implement special methods with these exact
744
+ * signatures:
745
+ *
746
+ * * private void writeObject(java.io.ObjectOutputStream out)
747
+ * throws IOException
748
+ * private void readObject(java.io.ObjectInputStream in)
749
+ * throws IOException, ClassNotFoundException;
750
+ * private void readObjectNoData()
751
+ * throws ObjectStreamException;
752
+ *
753
+ *
754
+ * The writeObject method is responsible for writing the state of the
755
+ * object for its particular class so that the corresponding
756
+ * readObject method can restore it. The default mechanism for saving
757
+ * the Object's fields can be invoked by calling
758
+ * out.defaultWriteObject. The method does not need to concern
759
+ * itself with the state belonging to its superclasses or subclasses.
760
+ * State is saved by writing the individual fields to the
761
+ * ObjectOutputStream using the writeObject method or by using the
762
+ * methods for primitive data types supported by DataOutput.
763
+ *
764
+ * The readObject method is responsible for reading from the stream and
765
+ * restoring the classes fields. It may call in.defaultReadObject to invoke
766
+ * the default mechanism for restoring the object's non-static and
767
+ * non-transient fields. The defaultReadObject method uses information in
768
+ * the stream to assign the fields of the object saved in the stream with the
769
+ * correspondingly named fields in the current object. This handles the case
770
+ * when the class has evolved to add new fields. The method does not need to
771
+ * concern itself with the state belonging to its superclasses or subclasses.
772
+ * State is restored by reading data from the ObjectInputStream for
773
+ * the individual fields and making assignments to the appropriate fields
774
+ * of the object. Reading primitive data types is supported by DataInput.
775
+ *
776
+ * The readObjectNoData method is responsible for initializing the state of
777
+ * the object for its particular class in the event that the serialization
778
+ * stream does not list the given class as a superclass of the object being
779
+ * deserialized. This may occur in cases where the receiving party uses a
780
+ * different version of the deserialized instance's class than the sending
781
+ * party, and the receiver's version extends classes that are not extended by
782
+ * the sender's version. This may also occur if the serialization stream has
783
+ * been tampered; hence, readObjectNoData is useful for initializing
784
+ * deserialized objects properly despite a "hostile" or incomplete source
785
+ * stream.
786
+ *
787
+ * Serializable classes that need to designate an alternative object to be
788
+ * used when writing an object to the stream should implement this
789
+ * special method with the exact signature:
790
+ *
791
+ * * ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
792
+ *
793
+ *
794
+ * This writeReplace method is invoked by serialization if the method
795
+ * exists and it would be accessible from a method defined within the
796
+ * class of the object being serialized. Thus, the method can have private,
797
+ * protected and package-private access. Subclass access to this method
798
+ * follows java accessibility rules.
799
+ *
800
+ * Classes that need to designate a replacement when an instance of it
801
+ * is read from the stream should implement this special method with the
802
+ * exact signature.
803
+ *
804
+ * * ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
805
+ *
806
+ *
807
+ * This readResolve method follows the same invocation rules and
808
+ * accessibility rules as writeReplace.
809
+ *
810
+ * Enum types are all serializable and receive treatment defined by
811
+ * the
812
+ * Java Object Serialization Specification during
813
+ * serialization and deserialization. Any declarations of the special
814
+ * handling methods discussed above are ignored for enum types.
815
+ *
816
+ * Record classes can implement `Serializable` and receive treatment defined
817
+ * by the
818
+ * Java Object Serialization Specification, Section 1.13,
819
+ * "Serialization of Records". Any declarations of the special
820
+ * handling methods discussed above are ignored for record types.
821
+ *
822
+ * The serialization runtime associates with each serializable class a version
823
+ * number, called a serialVersionUID, which is used during deserialization to
824
+ * verify that the sender and receiver of a serialized object have loaded
825
+ * classes for that object that are compatible with respect to serialization.
826
+ * If the receiver has loaded a class for the object that has a different
827
+ * serialVersionUID than that of the corresponding sender's class, then
828
+ * deserialization will result in an {@link InvalidClassException}. A
829
+ * serializable class can declare its own serialVersionUID explicitly by
830
+ * declaring a field named `"serialVersionUID"` that must be static,
831
+ * final, and of type `long`:
832
+ *
833
+ * * ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
834
+ *
835
+ *
836
+ * If a serializable class does not explicitly declare a serialVersionUID, then
837
+ * the serialization runtime will calculate a default serialVersionUID value
838
+ * for that class based on various aspects of the class, as described in the
839
+ * Java Object Serialization
840
+ * Specification. This specification defines the
841
+ * serialVersionUID of an enum type to be 0L. However, it is strongly
842
+ * recommended that all serializable classes other than enum types explicitly declare
843
+ * serialVersionUID values, since the default serialVersionUID computation is
844
+ * highly sensitive to class details that may vary depending on compiler
845
+ * implementations, and can thus result in unexpected
846
+ * `InvalidClassException`s during deserialization. Therefore, to
847
+ * guarantee a consistent serialVersionUID value across different java compiler
848
+ * implementations, a serializable class must declare an explicit
849
+ * serialVersionUID value. It is also strongly advised that explicit
850
+ * serialVersionUID declarations use the `private` modifier where
851
+ * possible, since such declarations apply only to the immediately declaring
852
+ * class--serialVersionUID fields are not useful as inherited members. Array
853
+ * classes cannot declare an explicit serialVersionUID, so they always have
854
+ * the default computed value, but the requirement for matching
855
+ * serialVersionUID values is waived for array classes.
856
+ *
857
+ * @see java.io.ObjectOutputStream
858
+ * @see java.io.ObjectInputStream
859
+ * @see java.io.ObjectOutput
860
+ * @see java.io.ObjectInput
861
+ * @see java.io.Externalizable
862
+ * @see
863
+ * Java Object Serialization Specification
864
+ * @since 1.1
865
+ */
866
+ export class Serializable {
867
+
868
+ }
705
869
 
706
870
  }
@@ -0,0 +1,16 @@
1
+ declare module 'java.lang' {
2
+ /**
3
+ * Implementing this interface allows an object to be the target of the enhanced
4
+ * `for` statement (sometimes called the "for-each loop" statement).
5
+ *
6
+ * @param the type of elements returned by the iterator
7
+ *
8
+ * @since 1.5
9
+ * @jls 14.14.2 The enhanced `for` statement
10
+ */
11
+ export class Iterable<T> {
12
+ [Symbol.iterator](): globalThis.Iterator<T>;
13
+
14
+ }
15
+
16
+ }
@@ -1,5 +1,6 @@
1
1
  declare module 'java.util' {
2
- export class Collection<E> {
2
+ import { Iterable } from 'java.lang';
3
+ export class Collection<E> extends Iterable<E> {
3
4
  /**
4
5
  * Returns the number of elements in this collection. If this collection
5
6
  * contains more than `Integer.MAX_VALUE` elements, returns
@@ -725,6 +725,19 @@ export class NodeIterator {
725
725
  * Nodes.
726
726
  */
727
727
  nextNode(): Node;
728
+ /**
729
+ * Returns the total number of of items available through this iterator. For
730
+ * example, for some node N, N.getNodes().getSize()
731
+ * returns the number of child nodes of N visible through the
732
+ * current Session. In some implementations precise information
733
+ * about the number of elements may not be available. In such cases this
734
+ * method must return -1. API clients will then be able to use
735
+ * RangeIterator.getNumberRemaining to get an estimate on the
736
+ * number of elements.
737
+ *
738
+ * @return a long
739
+ */
740
+ getSize(): number;
728
741
  /**
729
742
  * Returns `true` if the iteration has more elements.
730
743
  * (In other words, returns `true` if {@link #next} would
@@ -978,6 +978,76 @@ export class HttpServletRequest {
978
978
  *
979
979
  */
980
980
  export class HttpServletResponse {
981
+ /**
982
+ * Encodes the specified URL by including the session ID,
983
+ * or, if encoding is not needed, returns the URL unchanged.
984
+ * The implementation of this method includes the logic to
985
+ * determine whether the session ID needs to be encoded in the URL.
986
+ * For example, if the browser supports cookies, or session
987
+ * tracking is turned off, URL encoding is unnecessary.
988
+ *
989
+ * For robust session tracking, all URLs emitted by a servlet
990
+ * should be run through this
991
+ * method. Otherwise, URL rewriting cannot be used with browsers
992
+ * which do not support cookies.
993
+ *
994
+ * If the URL is relative, it is always relative to the current
995
+ * HttpServletRequest.
996
+ *
997
+ * @param url the url to be encoded.
998
+ * @return the encoded URL if encoding is needed;
999
+ * the unchanged URL otherwise.
1000
+ * @exception IllegalArgumentException if the url is not valid
1001
+ */
1002
+ encodeURL(url: string): string;
1003
+ /**
1004
+ * Encodes the specified URL for use in the
1005
+ * sendRedirect method or, if encoding is not needed,
1006
+ * returns the URL unchanged. The implementation of this method
1007
+ * includes the logic to determine whether the session ID
1008
+ * needs to be encoded in the URL. For example, if the browser supports
1009
+ * cookies, or session tracking is turned off, URL encoding is
1010
+ * unnecessary. Because the rules for making this determination can
1011
+ * differ from those used to decide whether to
1012
+ * encode a normal link, this method is separated from the
1013
+ * encodeURL method.
1014
+ *
1015
+ * All URLs sent to the HttpServletResponse.sendRedirect
1016
+ * method should be run through this method. Otherwise, URL
1017
+ * rewriting cannot be used with browsers which do not support
1018
+ * cookies.
1019
+ *
1020
+ * If the URL is relative, it is always relative to the current
1021
+ * HttpServletRequest.
1022
+ *
1023
+ * @param url the url to be encoded.
1024
+ * @return the encoded URL if encoding is needed;
1025
+ * the unchanged URL otherwise.
1026
+ * @exception IllegalArgumentException if the url is not valid
1027
+ *
1028
+ * @see #sendRedirect
1029
+ * @see #encodeUrl
1030
+ */
1031
+ encodeRedirectURL(url: string): string;
1032
+ /**
1033
+ * @deprecated As of version 2.1, use encodeURL(String url) instead
1034
+ *
1035
+ * @param url the url to be encoded.
1036
+ * @return the encoded URL if encoding is needed;
1037
+ * the unchanged URL otherwise.
1038
+ * @exception IllegalArgumentException if the url is not valid
1039
+ */
1040
+ encodeUrl(url: string): string;
1041
+ /**
1042
+ * @deprecated As of version 2.1, use
1043
+ * encodeRedirectURL(String url) instead
1044
+ *
1045
+ * @param url the url to be encoded.
1046
+ * @return the encoded URL if encoding is needed;
1047
+ * the unchanged URL otherwise.
1048
+ * @exception IllegalArgumentException if the url is not valid
1049
+ */
1050
+ encodeRedirectUrl(url: string): string;
981
1051
  /**
982
1052
  * Gets the current status code of this response.
983
1053
  *
@@ -1,6 +1,7 @@
1
1
  import type { JCRNodeWrapper } from "org.jahia.services.content";
2
2
  import type { RenderContext, Resource } from "org.jahia.services.render";
3
- interface MenuEntry {
3
+ /** @deprecated */
4
+ export interface MenuEntry {
4
5
  /** The HTML rendered HTML menu entry */
5
6
  render: string;
6
7
  /** The node object for the menu entry */
@@ -17,6 +18,8 @@ interface MenuEntry {
17
18
  /**
18
19
  * Build a navigation menu
19
20
  *
21
+ * @deprecated We recommend building your own navigation menu using the JCR API; it will be more
22
+ * efficient and flexible.
20
23
  * @param maxDepth The maximum depth of the menu
21
24
  * @param base The base path of the menu
22
25
  * @param menuEntryView The view to use for each menu entry
@@ -25,5 +28,4 @@ interface MenuEntry {
25
28
  * @param currentResource The current resource
26
29
  * @returns An array of menu entries objects
27
30
  */
28
- export declare function buildNavMenu(maxDepth: number, base: string, menuEntryView: string, startLevelValue: number, renderContext: RenderContext, currentResource: Resource): MenuEntry[];
29
- export {};
31
+ export declare function buildNavMenu(maxDepth: number, base: string, menuEntryView: string | undefined, startLevelValue: number, renderContext: RenderContext, currentResource: Resource): MenuEntry[];
@@ -192,6 +192,7 @@ export class RenderHelper {
192
192
  transformToJsNode(node: JCRNodeWrapper, includeChildren: boolean, includeDescendants: boolean, includeAllTranslations: boolean): any;
193
193
  /**
194
194
  * Get the render parameters for the given resource
195
+ *
195
196
  * @param resource the resource for which to retrieve the render parameters
196
197
  * @return a Map<String,Object> containing the render parameters
197
198
  */
@@ -201,6 +202,7 @@ export class RenderHelper {
201
202
  * don't need encoding are those defined 'unreserved' in section 2.3 of
202
203
  * the 'URI generic syntax' RFC 2396. Not the entire path string is escaped,
203
204
  * but every individual part (i.e. the slashes are not escaped).
205
+ *
204
206
  * @param path the path to encode
205
207
  * @return a String containing the escaped path
206
208
  * @throws NullPointerException if path is null.
@@ -209,15 +211,17 @@ export class RenderHelper {
209
211
  /**
210
212
  * Find the first displayable node in the given node's hierarchy. A displayable node is a node that has a content
211
213
  * or page template associated with it.
212
- * @param node the node at which to start the resolution
214
+ *
215
+ * @param node the node at which to start the resolution
213
216
  * @param renderContext the current render context
214
- * @param contextSite the site in which to resolve the template
217
+ * @param contextSite the site in which to resolve the template
215
218
  * @return the first displayable {@link JCRNodeWrapper} found in the hierarchy
216
219
  */
217
- findDisplayableNode(node: JCRNodeWrapper, renderContext: RenderContext, contextSite: JCRSiteNode): JCRNodeWrapper;
220
+ findDisplayableNode(node: JCRNodeWrapper, renderContext: RenderContext, contextSite: JCRSiteNode | null): JCRNodeWrapper;
218
221
  /**
219
222
  * Returns the node which corresponds to the bound component of the j:bindedComponent property in the specified node.
220
- * @param node the node to get the bound component for
223
+ *
224
+ * @param node the node to get the bound component for
221
225
  * @param context current render context
222
226
  * @return the bound {@link JCRNodeWrapper}
223
227
  */
@@ -227,62 +231,64 @@ export class RenderHelper {
227
231
  render(attr: any, renderContext: RenderContext, currentResource: Resource): string;
228
232
  /**
229
233
  * Render a tag that adds resources to the page. Resources might for example be CSS files, Javascript files or inline
230
- * @param attr may contain the following:
231
- *
232
- * insert (boolean) : If true, the resource will be inserted into the document. Typically used
233
- * for on-demand loading of resources.
234
- * async (boolean) : If true, the resource will be loaded asynchronously. For scripts, this means
235
- * the script
236
- * will be executed as soon as it's available, without blocking the rest of the page.
237
- * defer (boolean) : If true, the resource will be deferred, i.e., loaded after the document
238
- * has been parsed.
239
- * For scripts, this means the script will not be executed until after the page has loaded.
240
- * type (string) : The type of the resource. This could be 'javascript' for .js files, 'css' for
241
- * .css files, etc.
242
- * The type will be used to resolve the directory in the module where the resources are located. For example
243
- * for the 'css' type it will look for the resources in the css directory of the module.
244
- * resources (string) : The path to the resource file, relative to the module. It is also allowed to
245
- * specify multiple resources by separating them with commas. It is also allowed to use absolute URLs to
246
- * include remote resources.
247
- * inlineResource (string) : Inline HTML that markup will be considered as a resource.
248
- * title (string) : The title of the resource. This is typically not used for scripts or stylesheets,
249
- * but may be used for other types of resources.
250
- * key (string) : A unique key for the resource. This could be used to prevent duplicate resources
251
- * from being added to the document.
252
- * targetTag (string): The HTML tag where the resource should be added. This could be 'head' for
253
- * resources that should be added to the <head> tag, 'body' for resources that should be added to
254
- * the <body> tag, etc.
255
- * rel (string) : The relationship of the resource to the document. This is typically 'stylesheet'
256
- * for CSS files.
257
- * media (string) : The media for which the resource is intended. This is typically used for CSS
258
- * files, with values like 'screen', 'print', etc.
259
- * condition (string) : A condition that must be met for the resource to be loaded. This could be
260
- * used for conditional comments in IE, for example.
261
- *
234
+ *
235
+ * @param attr may contain the following:
236
+ *
237
+ * insert (boolean) : If true, the resource will be inserted into the document. Typically used
238
+ * for on-demand loading of resources.
239
+ * async (boolean) : If true, the resource will be loaded asynchronously. For scripts, this means
240
+ * the script
241
+ * will be executed as soon as it's available, without blocking the rest of the page.
242
+ * defer (boolean) : If true, the resource will be deferred, i.e., loaded after the document
243
+ * has been parsed.
244
+ * For scripts, this means the script will not be executed until after the page has loaded.
245
+ * type (string) : The type of the resource. This could be 'javascript' for .js files, 'css' for
246
+ * .css files, etc.
247
+ * The type will be used to resolve the directory in the module where the resources are located. For example
248
+ * for the 'css' type it will look for the resources in the css directory of the module.
249
+ * resources (string) : The path to the resource file, relative to the module. It is also allowed to
250
+ * specify multiple resources by separating them with commas. It is also allowed to use absolute URLs to
251
+ * include remote resources.
252
+ * inlineResource (string) : Inline HTML that markup will be considered as a resource.
253
+ * title (string) : The title of the resource. This is typically not used for scripts or stylesheets,
254
+ * but may be used for other types of resources.
255
+ * key (string) : A unique key for the resource. This could be used to prevent duplicate resources
256
+ * from being added to the document.
257
+ * targetTag (string): The HTML tag where the resource should be added. This could be 'head' for
258
+ * resources that should be added to the <head> tag, 'body' for resources that should be added to
259
+ * the <body> tag, etc.
260
+ * rel (string) : The relationship of the resource to the document. This is typically 'stylesheet'
261
+ * for CSS files.
262
+ * media (string) : The media for which the resource is intended. This is typically used for CSS
263
+ * files, with values like 'screen', 'print', etc.
264
+ * condition (string) : A condition that must be met for the resource to be loaded. This could be
265
+ * used for conditional comments in IE, for example.
266
+ *
262
267
  * @param renderContext the current rendering context
263
268
  * @return a String containing the rendered HTML tags for the provided resources.
264
- * @throws IllegalAccessException if the underlying tag cannot be accessed
269
+ * @throws IllegalAccessException if the underlying tag cannot be accessed
265
270
  * @throws InvocationTargetException if the underlying tag cannot be invoked
266
- * @throws JspException if the underlying tag throws a JSP exception
267
- * @throws IOException if the underlying tag throws an IO exception
271
+ * @throws JspException if the underlying tag throws a JSP exception
272
+ * @throws IOException if the underlying tag throws an IO exception
268
273
  */
269
274
  addResources(attr: any, renderContext: RenderContext): string;
270
275
  /**
271
276
  * Add a cache dependency to the current resource. This will be used to flush the current resource when the
272
277
  * dependencies are modified.
273
- * @param attr may be the following:
274
- *
275
- * node (JCRNodeWrapper) : The node to add as a dependency.
276
- * uuid (String) : The UUID of the node to add as a dependency.
277
- * path (String) : The path of the node to add as a dependency.
278
- * flushOnPathMatchingRegexp (String) : A regular expression that will be used to flush the cache
279
- * when the path of the modified nodes matches the regular expression.
280
- *
278
+ *
279
+ * @param attr may be the following:
280
+ *
281
+ * node (JCRNodeWrapper) : The node to add as a dependency.
282
+ * uuid (String) : The UUID of the node to add as a dependency.
283
+ * path (String) : The path of the node to add as a dependency.
284
+ * flushOnPathMatchingRegexp (String) : A regular expression that will be used to flush the cache
285
+ * when the path of the modified nodes matches the regular expression.
286
+ *
281
287
  * @param renderContext the current rendering context
282
- * @throws IllegalAccessException if the underlying tag cannot be accessed
288
+ * @throws IllegalAccessException if the underlying tag cannot be accessed
283
289
  * @throws InvocationTargetException if the underlying tag cannot be invoked
284
- * @throws JspException if the underlying tag throws a JSP exception
285
- * @throws IOException if the underlying tag throws an IO exception
290
+ * @throws JspException if the underlying tag throws a JSP exception
291
+ * @throws IOException if the underlying tag throws an IO exception
286
292
  */
287
293
  addCacheDependency(attr: any, renderContext: RenderContext): void;
288
294
  renderAbsoluteArea(attr: any, renderContext: RenderContext): string;
@@ -1,10 +1,12 @@
1
1
  declare module 'org.jahia.services.content' {
2
2
  import { ServletRequest } from 'javax.servlet';
3
+ import { Iterable } from 'java.lang';
3
4
  import { Locale, List, Map, Date } from 'java.util';
4
5
  import { HttpServletRequest } from 'javax.servlet.http';
5
6
  import { QueryWrapper } from 'org.jahia.services.query';
6
7
  import { JCRSiteNode } from 'org.jahia.services.content.decorator';
7
8
  import { JahiaUser } from 'org.jahia.services.usermanager';
9
+ import { ExtendedNodeType } from 'org.jahia.services.content.nodetypes';
8
10
  import { NodeIterator, Item, Node, PropertyIterator, Binary, Property } from 'javax.jcr';
9
11
  export class JCRCallback<T> {
10
12
  /**
@@ -163,7 +165,7 @@ export class JCRItemWrapper {
163
165
  /**
164
166
  * @author Christophe Laprun
165
167
  */
166
- export class JCRNodeIteratorWrapper {
168
+ export class JCRNodeIteratorWrapper extends Iterable<JCRNodeWrapper> {
167
169
  /**
168
170
  * Returns the next Node in the iteration.
169
171
  *
@@ -173,6 +175,19 @@ export class JCRNodeIteratorWrapper {
173
175
  * Nodes.
174
176
  */
175
177
  nextNode(): Node;
178
+ /**
179
+ * Returns the total number of of items available through this iterator. For
180
+ * example, for some node N, N.getNodes().getSize()
181
+ * returns the number of child nodes of N visible through the
182
+ * current Session. In some implementations precise information
183
+ * about the number of elements may not be available. In such cases this
184
+ * method must return -1. API clients will then be able to use
185
+ * RangeIterator.getNumberRemaining to get an estimate on the
186
+ * number of elements.
187
+ *
188
+ * @return a long
189
+ */
190
+ getSize(): number;
176
191
  /**
177
192
  * Returns `true` if the iteration has more elements.
178
193
  * (In other words, returns `true` if {@link #next} would
@@ -204,6 +219,12 @@ export class JCRNodeWrapper {
204
219
  * @return The wrapped property at relPath.
205
220
  */
206
221
  getProperty(relPath: string): JCRPropertyWrapper;
222
+ /**
223
+ * {@inheritDoc}
224
+ *
225
+ * @return an array of ExtendedNodeType objects.
226
+ */
227
+ getMixinNodeTypes(): ExtendedNodeType[];
207
228
  /**
208
229
  * Checks if the current user has a permission or not
209
230
  *
@@ -387,6 +408,24 @@ export class JCRNodeWrapper {
387
408
  * {@inheritDoc}
388
409
  */
389
410
  getPath(): string;
411
+ /**
412
+ * Get the translation node
413
+ * Use only in un-localized session
414
+ *
415
+ * @param locale
416
+ * @return
417
+ * @throws RepositoryException in case of JCR-related errors
418
+ */
419
+ getI18N(locale: Locale): Node;
420
+ /**
421
+ * Get the translation node
422
+ * Use only in un-localized session
423
+ *
424
+ * @param locale
425
+ * @return
426
+ * @throws RepositoryException in case of JCR-related errors
427
+ */
428
+ getI18N(locale: Locale, fallback: boolean): Node;
390
429
  /**
391
430
  * Returns available translation sub-nodes of this node.
392
431
  *
@@ -1311,6 +1350,7 @@ export class JCRSessionWrapper {
1311
1350
  getNode(path: string): JCRNodeWrapper;
1312
1351
  getNode(path: string, checkVersion: boolean): JCRNodeWrapper;
1313
1352
  getUser(): JahiaUser;
1353
+ getAliasedUser(): JahiaUser;
1314
1354
  getNodeByIdentifier(id: string): JCRNodeWrapper;
1315
1355
  getProperty(absPath: string): Property;
1316
1356
  nodeExists(absPath: string): boolean;