@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,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;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare module 'org.jahia.services.content.decorator' {
|
|
2
2
|
import { Locale, Set, List } from 'java.util';
|
|
3
|
-
import { JCRNodeWrapper } from 'org.jahia.services.content';
|
|
3
|
+
import { JCRNodeWrapper, JCRNodeIteratorWrapper } from 'org.jahia.services.content';
|
|
4
4
|
/**
|
|
5
5
|
* JCR node representing the Jahia virtual site.
|
|
6
6
|
*
|
|
@@ -8,7 +8,7 @@ import { JCRNodeWrapper } from 'org.jahia.services.content';
|
|
|
8
8
|
* Date: Mar 30, 2010
|
|
9
9
|
* Time: 12:37:45 PM
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export interface JCRSiteNode extends JCRNodeWrapper {
|
|
12
12
|
/**
|
|
13
13
|
* @return list of inactive live languages
|
|
14
14
|
*/
|
|
@@ -58,6 +58,7 @@ export class JCRSiteNode {
|
|
|
58
58
|
getServerName(): string;
|
|
59
59
|
getServerNameAliases(): string[];
|
|
60
60
|
getAllServerNames(): string[];
|
|
61
|
+
getSiteKey(): string;
|
|
61
62
|
getInstalledModules(): string[];
|
|
62
63
|
/**
|
|
63
64
|
* Returns a set of all installed modules for this site, their direct and transitive dependencies (the whole dependency tree).
|
|
@@ -87,6 +88,100 @@ export class JCRSiteNode {
|
|
|
87
88
|
* @return true if this site is the default one on the server
|
|
88
89
|
*/
|
|
89
90
|
isDefault(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Returns a list holding the primary node type and all mixin node types for this node
|
|
93
|
+
*
|
|
94
|
+
* @return a list holding the primary node type and all mixin node types
|
|
95
|
+
* @throws RepositoryException in case of JCR-related errors
|
|
96
|
+
*/
|
|
97
|
+
getNodeTypes(): string[];
|
|
98
|
+
/**
|
|
99
|
+
* {@inheritDoc}
|
|
100
|
+
*
|
|
101
|
+
* @return The wrapped node at relPath.
|
|
102
|
+
*/
|
|
103
|
+
getNode(s: string): JCRNodeWrapper;
|
|
104
|
+
/**
|
|
105
|
+
* Returns all child nodes of this node accessible through the current
|
|
106
|
+
* Session. Does not include properties of this
|
|
107
|
+
* Node. The same reacquisition semantics apply as with {@link
|
|
108
|
+
* #getNode(String)}. If this node has no accessible child nodes, then an
|
|
109
|
+
* empty iterator is returned.
|
|
110
|
+
*
|
|
111
|
+
* @return A NodeIterator over all child Nodes of
|
|
112
|
+
* this Node.
|
|
113
|
+
* @throws RepositoryException if an error occurs.
|
|
114
|
+
*/
|
|
115
|
+
getNodes(): JCRNodeIteratorWrapper;
|
|
116
|
+
/**
|
|
117
|
+
* Gets all child nodes of this node accessible through the current
|
|
118
|
+
* Session that match namePattern. The pattern may
|
|
119
|
+
* be a full name or a partial name with one or more wildcard characters
|
|
120
|
+
* ("*"), or a disjunction (using the "|"
|
|
121
|
+
* character to represent logical OR) of these. For example,
|
|
122
|
+
*
|
|
123
|
+
* N.getNodes("jcr:* | myapp:report | my doc")
|
|
124
|
+
*
|
|
125
|
+
* would return a NodeIterator holding all accessible child
|
|
126
|
+
* nodes of N that are either called 'myapp:report',
|
|
127
|
+
* begin with the prefix 'jcr:' or are called 'my
|
|
128
|
+
* doc'.
|
|
129
|
+
*
|
|
130
|
+
* The substrings within the pattern that are delimited by "|"
|
|
131
|
+
* characters and which may contain wildcard characters ("*")
|
|
132
|
+
* are called globs.
|
|
133
|
+
*
|
|
134
|
+
* Note that leading and trailing whitespace around a glob is ignored, but
|
|
135
|
+
* whitespace within a disjunct forms part of the pattern to be matched.
|
|
136
|
+
*
|
|
137
|
+
* The pattern is matched against the names (not the paths) of the immediate
|
|
138
|
+
* child nodes of this node.
|
|
139
|
+
*
|
|
140
|
+
* If this node has no accessible matching child nodes, then an empty
|
|
141
|
+
* iterator is returned.
|
|
142
|
+
*
|
|
143
|
+
* The same reacquisition semantics apply as with {@link
|
|
144
|
+
* #getNode(String)}.
|
|
145
|
+
*
|
|
146
|
+
* @param namePattern a name pattern.
|
|
147
|
+
* @return a NodeIterator.
|
|
148
|
+
* @throws RepositoryException if an unexpected error occurs.
|
|
149
|
+
*/
|
|
150
|
+
getNodes(s: string): JCRNodeIteratorWrapper;
|
|
151
|
+
/**
|
|
152
|
+
* Gets all child nodes of this node accessible through the current
|
|
153
|
+
* Session that match one or more of the nameGlob
|
|
154
|
+
* strings in the passed array.
|
|
155
|
+
*
|
|
156
|
+
* A glob may be a full name or a partial name with one or more wildcard
|
|
157
|
+
* characters ("*"). For example,
|
|
158
|
+
*
|
|
159
|
+
* N.getNodes(new String[] {"jcr:*", "myapp:report", "my
|
|
160
|
+
* doc"})
|
|
161
|
+
*
|
|
162
|
+
* would return a NodeIterator holding all accessible child
|
|
163
|
+
* nodes of N that are either called 'myapp:report',
|
|
164
|
+
* begin with the prefix 'jcr:' or are called 'my
|
|
165
|
+
* doc'.
|
|
166
|
+
*
|
|
167
|
+
* Note that unlike in the case of the {@link #getNodes(String)} leading and
|
|
168
|
+
* trailing whitespace around a glob is not ignored.
|
|
169
|
+
*
|
|
170
|
+
* The globs are matched against the names (not the paths) of the immediate
|
|
171
|
+
* child nodes of this node.
|
|
172
|
+
*
|
|
173
|
+
* If this node has no accessible matching child nodes, then an empty
|
|
174
|
+
* iterator is returned.
|
|
175
|
+
*
|
|
176
|
+
* The same reacquisition semantics apply as with {@link
|
|
177
|
+
* #getNode(String)}.
|
|
178
|
+
*
|
|
179
|
+
* @param nameGlobs an array of globbing strings.
|
|
180
|
+
* @return a NodeIterator.
|
|
181
|
+
* @throws RepositoryException if an unexpected error occurs.
|
|
182
|
+
* @since JCR 2.0
|
|
183
|
+
*/
|
|
184
|
+
getNodes(nameGlobs: string[]): JCRNodeIteratorWrapper;
|
|
90
185
|
}
|
|
91
186
|
|
|
92
187
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
declare module 'org.jahia.services.render' {
|
|
2
2
|
import { Locale, Set, List, Map } from 'java.util';
|
|
3
3
|
import { JCRNodeWrapper } from 'org.jahia.services.content';
|
|
4
|
+
import { Serializable } from 'java.io';
|
|
4
5
|
import { HttpServletRequest, HttpServletResponse } from 'javax.servlet.http';
|
|
6
|
+
import { SettingsBean } from 'org.jahia.settings';
|
|
5
7
|
import { JCRSiteNode } from 'org.jahia.services.content.decorator';
|
|
6
8
|
import { JahiaUser } from 'org.jahia.services.usermanager';
|
|
9
|
+
import { ExtendedNodeType } from 'org.jahia.services.content.nodetypes';
|
|
7
10
|
/**
|
|
8
11
|
* Template rendering context with the information about current request/response pair and optional template parameters.
|
|
9
12
|
*
|
|
@@ -39,6 +42,7 @@ export class RenderContext {
|
|
|
39
42
|
*/
|
|
40
43
|
getRedirect(): string;
|
|
41
44
|
isEnterpriseEdition(): boolean;
|
|
45
|
+
getSettings(): SettingsBean;
|
|
42
46
|
/**
|
|
43
47
|
* @param node to check
|
|
44
48
|
* @return true if the node is visible (in visibleTypes or without nonVisibleTypes)
|
|
@@ -89,7 +93,9 @@ export class Resource {
|
|
|
89
93
|
getDependencies(): Set<string>;
|
|
90
94
|
getRegexpDependencies(): Set<string>;
|
|
91
95
|
getMissingResources(): string[];
|
|
96
|
+
getModuleParams(): Map<string, Serializable>;
|
|
92
97
|
getPath(): string;
|
|
98
|
+
getResourceNodeType(): ExtendedNodeType;
|
|
93
99
|
getNodePath(): string;
|
|
94
100
|
}
|
|
95
101
|
/**
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare module 'org.jahia.services.usermanager' {
|
|
2
|
+
import { Properties } from 'java.util';
|
|
2
3
|
/**
|
|
3
4
|
* A JahiaUser represents a physical person who is defined by a username and
|
|
4
5
|
* a password for authentication purpose. Every other property of a JahiaUser
|
|
@@ -22,6 +23,16 @@ export class JahiaUser {
|
|
|
22
23
|
* @return the unique String identifier of this user.
|
|
23
24
|
*/
|
|
24
25
|
getUserKey(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Get user's properties list.
|
|
28
|
+
* The properties here should not be modified, as the modifications will
|
|
29
|
+
* not be serialized. Use the setProperty() method to modify a user's
|
|
30
|
+
* properties.
|
|
31
|
+
*
|
|
32
|
+
* @return Return a reference on the user's properties list, or null if no
|
|
33
|
+
* property is present.
|
|
34
|
+
*/
|
|
35
|
+
getProperties(): Properties;
|
|
25
36
|
/**
|
|
26
37
|
* Retrieve the requested user property.
|
|
27
38
|
*
|
package/dist/package.tgz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jahia/javascript-modules-library",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"homepage": "https://github.com/Jahia/javascript-modules/tree/main/javascript-modules-library#readme",
|
|
5
|
+
"bugs": {
|
|
6
|
+
"url": "https://github.com/Jahia/javascript-modules/issues"
|
|
7
|
+
},
|
|
4
8
|
"repository": {
|
|
5
9
|
"type": "git",
|
|
6
10
|
"url": "git+https://github.com:Jahia/javascript-modules.git",
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
interface UrlBuilderType {
|
|
2
|
-
/**
|
|
3
|
-
* Builds a static URL for an asset.
|
|
4
|
-
*
|
|
5
|
-
* @returns The built URL.
|
|
6
|
-
*/
|
|
7
|
-
buildStaticUrl(props: {
|
|
8
|
-
/** The path of the asset */
|
|
9
|
-
assetPath: string;
|
|
10
|
-
/**
|
|
11
|
-
* The name of the module used as prefix for the URL. If not provided, the current module is
|
|
12
|
-
* used.
|
|
13
|
-
*/
|
|
14
|
-
moduleName?: string;
|
|
15
|
-
/** The parameters to append to the URL */
|
|
16
|
-
parameters?: Record<string, string>;
|
|
17
|
-
}): string;
|
|
18
|
-
/**
|
|
19
|
-
* Builds a URL for a JCR node.
|
|
20
|
-
*
|
|
21
|
-
* @returns {string} The built URL.
|
|
22
|
-
*/
|
|
23
|
-
buildNodeUrl(props: {
|
|
24
|
-
/** The path of JCR node */
|
|
25
|
-
nodePath: string;
|
|
26
|
-
/** The extension to use to build the URL */
|
|
27
|
-
extension?: string;
|
|
28
|
-
/** The language to use to build the URL */
|
|
29
|
-
language?: string;
|
|
30
|
-
/** The mode to use to build the URL ('edit', 'preview', 'live') */
|
|
31
|
-
mode?: "edit" | "preview" | "live";
|
|
32
|
-
/** The parameters to append to the URL */
|
|
33
|
-
parameters?: Record<string, string>;
|
|
34
|
-
}): string;
|
|
35
|
-
/**
|
|
36
|
-
* Builds an HTML fragment URL for a JCR node.
|
|
37
|
-
*
|
|
38
|
-
* @returns {string} The built URL.
|
|
39
|
-
*/
|
|
40
|
-
buildHtmlFragmentUrl(props: {
|
|
41
|
-
/** The path of JCR node */
|
|
42
|
-
nodePath: string;
|
|
43
|
-
/** The language to use to build the URL */
|
|
44
|
-
language?: string;
|
|
45
|
-
/** The mode to use to build the URL ('edit', 'preview', 'live') */
|
|
46
|
-
mode?: "edit" | "preview" | "live";
|
|
47
|
-
/** The parameters to append to the URL */
|
|
48
|
-
parameters?: Record<string, string>;
|
|
49
|
-
}): string;
|
|
50
|
-
}
|
|
51
|
-
export declare function useUrlBuilder(): UrlBuilderType;
|
|
52
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { JCRNodeWrapper, JCRSessionWrapper } from "org.jahia.services.content";
|
|
2
|
-
/**
|
|
3
|
-
* Returns a node from a path or identifier
|
|
4
|
-
*
|
|
5
|
-
* @param session - The JCR session.
|
|
6
|
-
* @returns The node.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getNodeFromPathOrId(props: {
|
|
9
|
-
/** The node identifier */
|
|
10
|
-
identifier: string;
|
|
11
|
-
} | {
|
|
12
|
-
/** The node path */
|
|
13
|
-
path: string;
|
|
14
|
-
}, session: JCRSessionWrapper): JCRNodeWrapper | null;
|