@jahia/javascript-modules-library 0.5.5 → 0.6.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/README.md +215 -22
- package/dist/core/server/components/AbsoluteArea.d.ts +43 -18
- package/dist/core/server/components/AddResources.d.ts +1 -1
- package/dist/core/server/components/Area.d.ts +32 -16
- package/dist/core/server/components/render/HydrateInBrowser.d.ts +21 -0
- package/dist/core/server/components/render/Render.d.ts +4 -4
- package/dist/core/server/components/render/RenderChild.d.ts +16 -0
- package/dist/core/server/components/render/RenderChildren.d.ts +33 -0
- package/dist/core/server/components/render/RenderInBrowser.d.ts +2 -0
- package/dist/core/server/components/render/internal/InBrowser.d.ts +2 -1
- package/dist/core/server/framework/jahiaComponent.d.ts +7 -0
- package/dist/core/server/hooks/useServerContext.d.ts +4 -2
- package/dist/core/server/utils/i18n.d.ts +11 -0
- package/dist/core/server/utils/jcr/getChildNodes.d.ts +1 -2
- package/dist/core/server/utils/jcr/getNodesByJCRQuery.d.ts +1 -1
- package/dist/core/server/utils/urlBuilder/urlBuilder.d.ts +52 -15
- package/dist/globals.d.ts +3 -0
- package/dist/index.d.ts +6 -3
- package/dist/java.io.d.ts +164 -0
- package/dist/java.lang.d.ts +16 -0
- package/dist/java.util.d.ts +2 -1
- package/dist/javax.jcr.d.ts +13 -0
- package/dist/javax.servlet.http.d.ts +70 -0
- package/dist/nav/server/navBuilder/navBuilder.d.ts +5 -3
- package/dist/org.jahia.modules.javascript.modules.engine.js.server.d.ts +56 -50
- package/dist/org.jahia.services.content.d.ts +41 -1
- package/dist/org.jahia.services.content.decorator.d.ts +97 -2
- package/dist/org.jahia.services.render.d.ts +6 -0
- package/dist/org.jahia.services.usermanager.d.ts +11 -0
- package/dist/package.tgz +0 -0
- package/package.json +5 -1
- package/dist/core/server/hooks/useUrlBuilder.d.ts +0 -52
- package/dist/core/server/utils/jcr/getNodeFromPathOrId.d.ts +0 -14
|
@@ -1,25 +1,62 @@
|
|
|
1
|
+
import type { JCRNodeWrapper } from "org.jahia.services.content";
|
|
1
2
|
import type { RenderContext, Resource } from "org.jahia.services.render";
|
|
2
3
|
/** Initialize the registry with default url builders */
|
|
3
4
|
export declare function initUrlBuilder(): void;
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
-
* found, it will log an warning and return '#'
|
|
6
|
+
* Generate a Jahia url for the provided node.
|
|
7
7
|
*
|
|
8
|
-
* @param renderContext The current renderContext
|
|
9
|
-
* @param currentResource The current resource
|
|
10
8
|
* @returns The final URL
|
|
11
9
|
*/
|
|
12
|
-
export declare function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** The
|
|
16
|
-
path?: string;
|
|
17
|
-
/** The parameters to append to the URL */
|
|
10
|
+
export declare function buildNodeUrl(
|
|
11
|
+
/** The node to build the URL for */
|
|
12
|
+
node: JCRNodeWrapper, config?: {
|
|
13
|
+
/** The querystring parameters to append to the URL */
|
|
18
14
|
parameters?: Record<string, string>;
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
/**
|
|
16
|
+
* The mode to use to build the URL. Defines the mode or override the one provided by the
|
|
17
|
+
* renderContext.
|
|
18
|
+
*/
|
|
19
|
+
mode?: "edit" | "preview" | "live";
|
|
20
|
+
/**
|
|
21
|
+
* The language to use to build the URL. Defines the languages or overrides the one provided by
|
|
22
|
+
* the current resource
|
|
23
|
+
*/
|
|
22
24
|
language?: string;
|
|
23
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* The extension to use to build the URL. Defines the extension or overrides the one provided by
|
|
27
|
+
* the current resource
|
|
28
|
+
*/
|
|
24
29
|
extension?: string;
|
|
25
|
-
},
|
|
30
|
+
}, context?: {
|
|
31
|
+
/** Provided in react context, but you need to provide one otherwise. * */
|
|
32
|
+
renderContext?: RenderContext;
|
|
33
|
+
/** Provided in react context, you need to provide one otherwise. * */
|
|
34
|
+
currentResource?: Resource;
|
|
35
|
+
}): string;
|
|
36
|
+
/**
|
|
37
|
+
* Build a URL for a file in a module. Note that to be accessible, the folder that contains the file
|
|
38
|
+
* must be part of the jahia.static-resources in package.json.
|
|
39
|
+
*
|
|
40
|
+
* The URL must not be absolute (start with a / or a protocol).
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildModuleFileUrl(
|
|
43
|
+
/** Relative path of the file from the module's root (examples: css/my.css, images/myImage.webp) */
|
|
44
|
+
filePath: string, config?: {
|
|
45
|
+
/** Defines a custom module name to access its files */
|
|
46
|
+
moduleName?: string;
|
|
47
|
+
/** Querystring parameters to append to the URL */
|
|
48
|
+
parameters?: Record<string, string>;
|
|
49
|
+
}, context?: {
|
|
50
|
+
/** Provided in react context, you need to provide one (or the module name) otherwise. */
|
|
51
|
+
renderContext?: RenderContext;
|
|
52
|
+
}): string;
|
|
53
|
+
/** Build an url for any endpoint on the server (/cms/*, /graphql, ect). */
|
|
54
|
+
export declare function buildEndpointUrl(
|
|
55
|
+
/** Endpoint to call */
|
|
56
|
+
endpoint: string, config?: {
|
|
57
|
+
/** Querystring parameters to append to the URL */
|
|
58
|
+
parameters?: Record<string, string>;
|
|
59
|
+
}, context?: {
|
|
60
|
+
/** Provided in react context, you need to provide one otherwise. */
|
|
61
|
+
renderContext?: RenderContext;
|
|
62
|
+
}): string;
|
package/dist/globals.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ declare module "virtual:jahia-server" {
|
|
|
17
17
|
import type {
|
|
18
18
|
ConfigHelper,
|
|
19
19
|
GQLHelper,
|
|
20
|
+
JcrHelper,
|
|
20
21
|
OSGiHelper,
|
|
21
22
|
RegistryHelper,
|
|
22
23
|
RenderHelper,
|
|
@@ -28,6 +29,8 @@ declare module "virtual:jahia-server" {
|
|
|
28
29
|
const server: {
|
|
29
30
|
/** This helper provides access to OSGi configuration */
|
|
30
31
|
config: ConfigHelper;
|
|
32
|
+
/** This helper allows to perform JCR operations */
|
|
33
|
+
jcr: JcrHelper;
|
|
31
34
|
/** This helper provides access Jahia's GraphQL API, to execute queries and mutations */
|
|
32
35
|
gql: GQLHelper;
|
|
33
36
|
/** This helper provides access to OSGi bundle for resource loading and service access */
|
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 {
|
|
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
|
+
}
|
package/dist/java.util.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare module 'java.util' {
|
|
2
|
-
|
|
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
|
package/dist/javax.jcr.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
*
|
|
214
|
+
*
|
|
215
|
+
* @param node the node at which to start the resolution
|
|
213
216
|
* @param renderContext the current render context
|
|
214
|
-
* @param contextSite
|
|
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
|
-
*
|
|
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
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
235
|
-
*
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
*
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
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
|
|
269
|
+
* @throws IllegalAccessException if the underlying tag cannot be accessed
|
|
265
270
|
* @throws InvocationTargetException if the underlying tag cannot be invoked
|
|
266
|
-
* @throws JspException
|
|
267
|
-
* @throws IOException
|
|
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
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
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
|
|
288
|
+
* @throws IllegalAccessException if the underlying tag cannot be accessed
|
|
283
289
|
* @throws InvocationTargetException if the underlying tag cannot be invoked
|
|
284
|
-
* @throws JspException
|
|
285
|
-
* @throws IOException
|
|
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;
|