@jahia/javascript-modules-library 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/bin/jahia-deploy.mjs +14 -0
  2. package/core/server/components/AddResources.js +1 -1
  3. package/core/server/components/render/internal/InBrowser.js +1 -1
  4. package/core/server/framework/register.js +1 -1
  5. package/core/server/hooks/useJCRQuery.js +1 -1
  6. package/core/server/hooks/useUrlBuilder.js +1 -1
  7. package/index.js +1 -1
  8. package/package.json +33 -5
  9. package/types/bin/jahia-deploy.d.mts +1 -0
  10. package/types/core/server/components/AbsoluteArea.d.ts +22 -16
  11. package/types/core/server/components/AddContentButtons.d.ts +13 -7
  12. package/types/core/server/components/AddResources.d.ts +18 -18
  13. package/types/core/server/components/Area.d.ts +21 -15
  14. package/types/core/server/components/render/HydrateInBrowser.d.ts +12 -8
  15. package/types/core/server/components/render/Render.d.ts +24 -16
  16. package/types/core/server/components/render/RenderInBrowser.d.ts +12 -8
  17. package/types/core/server/components/render/internal/InBrowser.d.ts +7 -7
  18. package/types/core/server/framework/defineJahiaComponent.d.ts +15 -36
  19. package/types/core/server/framework/register.d.ts +7 -3
  20. package/types/index.d.ts +19 -2
  21. package/types/java.io.d.ts +70 -58
  22. package/types/java.net.d.ts +24 -4
  23. package/types/java.util.d.ts +87 -83
  24. package/core/index.js +0 -1
  25. package/core/server/components/index.js +0 -1
  26. package/core/server/components/render/index.js +0 -1
  27. package/core/server/framework/index.js +0 -1
  28. package/core/server/hooks/index.js +0 -1
  29. package/core/server/index.js +0 -1
  30. package/core/server/utils/index.js +0 -1
  31. package/core/server/utils/jcr/index.js +0 -1
  32. package/core/server/utils/urlBuilder/index.js +0 -1
  33. package/nav/index.js +0 -1
  34. package/nav/server/index.js +0 -1
  35. package/nav/server/navBuilder/index.js +0 -1
  36. package/types/core/index.d.ts +0 -1
  37. package/types/core/server/components/index.d.ts +0 -5
  38. package/types/core/server/components/render/index.d.ts +0 -3
  39. package/types/core/server/framework/index.d.ts +0 -2
  40. package/types/core/server/hooks/index.d.ts +0 -4
  41. package/types/core/server/index.d.ts +0 -4
  42. package/types/core/server/utils/index.d.ts +0 -2
  43. package/types/core/server/utils/jcr/index.d.ts +0 -4
  44. package/types/core/server/utils/urlBuilder/index.d.ts +0 -1
  45. package/types/nav/index.d.ts +0 -1
  46. package/types/nav/server/index.d.ts +0 -1
  47. package/types/nav/server/navBuilder/index.d.ts +0 -1
@@ -7,7 +7,7 @@ export class BufferedReader {
7
7
  * @return The character read, as an integer in the range
8
8
  * 0 to 65535 (`0x00-0xffff`), or -1 if the
9
9
  * end of the stream has been reached
10
- * @exception IOException If an I/O error occurs
10
+ * @throws IOException If an I/O error occurs
11
11
  */
12
12
  read(): number;
13
13
  /**
@@ -17,22 +17,24 @@ export class BufferedReader {
17
17
  * {@link Reader#read(char[], int, int) read} method of the
18
18
  * {@link Reader} class. As an additional convenience, it
19
19
  * attempts to read as many characters as possible by repeatedly invoking
20
- * the read method of the underlying stream. This iterated
21
- * read continues until one of the following conditions becomes
22
- * true:
20
+ * the `read` method of the underlying stream. This iterated
21
+ * `read` continues until one of the following conditions becomes
22
+ * true:
23
+ *
23
24
  *
24
25
  * The specified number of characters have been read,
25
26
  *
26
- * The read method of the underlying stream returns
27
- * -1, indicating end-of-file, or
27
+ * The `read` method of the underlying stream returns
28
+ * `-1`, indicating end-of-file, or
28
29
  *
29
- * The ready method of the underlying stream
30
- * returns false, indicating that further input requests
30
+ * The `ready` method of the underlying stream
31
+ * returns `false`, indicating that further input requests
31
32
  * would block.
32
33
  *
33
- * If the first read on the underlying stream returns
34
- * -1 to indicate end-of-file then this method returns
35
- * -1. Otherwise this method returns the number of characters
34
+ *
35
+ * If the first `read` on the underlying stream returns
36
+ * `-1` to indicate end-of-file then this method returns
37
+ * `-1`. Otherwise this method returns the number of characters
36
38
  * actually read.
37
39
  *
38
40
  * Subclasses of this class are encouraged, but not required, to
@@ -43,18 +45,17 @@ export class BufferedReader {
43
45
  * however, the buffer is empty, the mark is not valid, and the requested
44
46
  * length is at least as large as the buffer, then this method will read
45
47
  * characters directly from the underlying stream into the given array.
46
- * Thus redundant BufferedReaders will not copy data
48
+ * Thus redundant `BufferedReader`s will not copy data
47
49
  * unnecessarily.
48
50
  *
49
- * @param cbuf Destination buffer
50
- * @param off Offset at which to start storing characters
51
- * @param len Maximum number of characters to read
51
+ * @param cbuf {@inheritDoc}
52
+ * @param off {@inheritDoc}
53
+ * @param len {@inheritDoc}
52
54
  *
53
- * @return The number of characters read, or -1 if the end of the
54
- * stream has been reached
55
+ * @return {@inheritDoc}
55
56
  *
56
- * @exception IOException If an I/O error occurs
57
- * @exception IndexOutOfBoundsException {@inheritDoc}
57
+ * @throws IndexOutOfBoundsException {@inheritDoc}
58
+ * @throws IOException {@inheritDoc}
58
59
  */
59
60
  read(cbuf: string[], off: number, len: number): number;
60
61
  /**
@@ -67,7 +68,7 @@ export class BufferedReader {
67
68
  * any line-termination characters, or null if the end of the
68
69
  * stream has been reached without reading any characters
69
70
  *
70
- * @exception IOException If an I/O error occurs
71
+ * @throws IOException If an I/O error occurs
71
72
  *
72
73
  * @see java.nio.file.Files#readAllLines
73
74
  */
@@ -77,7 +78,7 @@ export class BufferedReader {
77
78
  * stream is ready if the buffer is not empty, or if the underlying
78
79
  * character stream is ready.
79
80
  *
80
- * @exception IOException If an I/O error occurs
81
+ * @throws IOException If an I/O error occurs
81
82
  */
82
83
  ready(): boolean;
83
84
  }
@@ -95,7 +96,7 @@ export class File {
95
96
  getName(): string;
96
97
  /**
97
98
  * Returns the pathname string of this abstract pathname's parent, or
98
- * null if this pathname does not name a parent directory.
99
+ * `null` if this pathname does not name a parent directory.
99
100
  *
100
101
  * The parent of an abstract pathname consists of the
101
102
  * pathname's prefix, if any, and each name in the pathname's name
@@ -103,13 +104,13 @@ export class File {
103
104
  * the pathname does not name a parent directory.
104
105
  *
105
106
  * @return The pathname string of the parent directory named by this
106
- * abstract pathname, or null if this pathname
107
+ * abstract pathname, or `null` if this pathname
107
108
  * does not name a parent
108
109
  */
109
110
  getParent(): string;
110
111
  /**
111
112
  * Returns the abstract pathname of this abstract pathname's parent,
112
- * or null if this pathname does not name a parent
113
+ * or `null` if this pathname does not name a parent
113
114
  * directory.
114
115
  *
115
116
  * The parent of an abstract pathname consists of the
@@ -118,7 +119,7 @@ export class File {
118
119
  * the pathname does not name a parent directory.
119
120
  *
120
121
  * @return The abstract pathname of the parent directory named by this
121
- * abstract pathname, or null if this pathname
122
+ * abstract pathname, or `null` if this pathname
122
123
  * does not name a parent
123
124
  *
124
125
  * @since 1.2
@@ -135,12 +136,12 @@ export class File {
135
136
  /**
136
137
  * Tests whether this abstract pathname is absolute. The definition of
137
138
  * absolute pathname is system dependent. On UNIX systems, a pathname is
138
- * absolute if its prefix is "/". On Microsoft Windows systems, a
139
+ * absolute if its prefix is `"/"`. On Microsoft Windows systems, a
139
140
  * pathname is absolute if its prefix is a drive specifier followed by
140
- * "\\", or if its prefix is "\\\\".
141
+ * `"\\"`, or if its prefix is `"\\\\"`.
141
142
  *
142
- * @return true if this abstract pathname is absolute,
143
- * false otherwise
143
+ * @return `true` if this abstract pathname is absolute,
144
+ * `false` otherwise
144
145
  */
145
146
  isAbsolute(): boolean;
146
147
  /**
@@ -150,7 +151,7 @@ export class File {
150
151
  * string is simply returned as if by the {@link #getPath}
151
152
  * method. If this abstract pathname is the empty abstract pathname then
152
153
  * the pathname string of the current user directory, which is named by the
153
- * system property user.dir, is returned. Otherwise this
154
+ * system property `user.dir`, is returned. Otherwise this
154
155
  * pathname is resolved in a system-dependent way. On UNIX systems, a
155
156
  * relative pathname is made absolute by resolving it against the current
156
157
  * user directory. On Microsoft Windows systems, a relative pathname is made absolute
@@ -251,9 +252,9 @@ export class File {
251
252
  * java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
252
253
  * Files.readAttributes} method may be used.
253
254
  *
254
- * @return true if and only if the file denoted by this
255
+ * @return `true` if and only if the file denoted by this
255
256
  * abstract pathname exists and is a directory;
256
- * false otherwise
257
+ * `false` otherwise
257
258
  *
258
259
  * @throws SecurityException
259
260
  * If a security manager exists and its {@link
@@ -273,9 +274,9 @@ export class File {
273
274
  * java.nio.file.Files#readAttributes(Path,Class,LinkOption[])
274
275
  * Files.readAttributes} method may be used.
275
276
  *
276
- * @return true if and only if the file denoted by this
277
+ * @return `true` if and only if the file denoted by this
277
278
  * abstract pathname exists and is a normal file;
278
- * false otherwise
279
+ * `false` otherwise
279
280
  *
280
281
  * @throws SecurityException
281
282
  * If a security manager exists and its {@link
@@ -287,10 +288,10 @@ export class File {
287
288
  * Tests whether the file named by this abstract pathname is a hidden
288
289
  * file. The exact definition of hidden is system-dependent. On
289
290
  * UNIX systems, a file is considered to be hidden if its name begins with
290
- * a period character ('.'). On Microsoft Windows systems, a file is
291
+ * a period character (`'.'`). On Microsoft Windows systems, a file is
291
292
  * considered to be hidden if it has been marked as such in the filesystem.
292
293
  *
293
- * @return true if and only if the file denoted by this
294
+ * @return `true` if and only if the file denoted by this
294
295
  * abstract pathname is hidden according to the conventions of the
295
296
  * underlying platform
296
297
  *
@@ -304,10 +305,13 @@ export class File {
304
305
  isHidden(): boolean;
305
306
  /**
306
307
  * Returns the size of the partition named by this
307
- * abstract pathname.
308
+ * abstract pathname. If the total number of bytes in the partition is
309
+ * greater than {@link Long#MAX_VALUE}, then `Long.MAX_VALUE` will be
310
+ * returned.
308
311
  *
309
312
  * @return The size, in bytes, of the partition or `0L` if this
310
- * abstract pathname does not name a partition
313
+ * abstract pathname does not name a partition or if the size
314
+ * cannot be obtained
311
315
  *
312
316
  * @throws SecurityException
313
317
  * If a security manager has been installed and it denies
@@ -316,10 +320,13 @@ export class File {
316
320
  * read access to the file named by this abstract pathname
317
321
  *
318
322
  * @since 1.6
323
+ * @see FileStore#getTotalSpace
319
324
  */
320
325
  getTotalSpace(): number;
321
326
  /**
322
- * Returns the number of unallocated bytes in the partition named by this abstract path name.
327
+ * Returns the number of unallocated bytes in the partition named by this abstract path name. If the
328
+ * number of unallocated bytes in the partition is greater than
329
+ * {@link Long#MAX_VALUE}, then `Long.MAX_VALUE` will be returned.
323
330
  *
324
331
  * The returned number of unallocated bytes is a hint, but not
325
332
  * a guarantee, that it is possible to use most or any of these
@@ -331,9 +338,10 @@ export class File {
331
338
  * will succeed.
332
339
  *
333
340
  * @return The number of unallocated bytes on the partition or `0L`
334
- * if the abstract pathname does not name a partition. This
335
- * value will be less than or equal to the total file system size
336
- * returned by {@link #getTotalSpace}.
341
+ * if the abstract pathname does not name a partition or if this
342
+ * number cannot be obtained. This value will be less than or
343
+ * equal to the total file system size returned by
344
+ * {@link #getTotalSpace}.
337
345
  *
338
346
  * @throws SecurityException
339
347
  * If a security manager has been installed and it denies
@@ -342,28 +350,32 @@ export class File {
342
350
  * read access to the file named by this abstract pathname
343
351
  *
344
352
  * @since 1.6
353
+ * @see FileStore#getUnallocatedSpace
345
354
  */
346
355
  getFreeSpace(): number;
347
356
  /**
348
357
  * Returns the number of bytes available to this virtual machine on the
349
- * partition named by this abstract pathname. When
350
- * possible, this method checks for write permissions and other operating
351
- * system restrictions and will therefore usually provide a more accurate
352
- * estimate of how much new data can actually be written than {@link
353
- * #getFreeSpace}.
358
+ * partition named by this abstract pathname. If
359
+ * the number of available bytes in the partition is greater than
360
+ * {@link Long#MAX_VALUE}, then `Long.MAX_VALUE` will be returned.
361
+ * When possible, this method checks for write permissions and other
362
+ * operating system restrictions and will therefore usually provide a more
363
+ * accurate estimate of how much new data can actually be written than
364
+ * {@link #getFreeSpace}.
354
365
  *
355
366
  * The returned number of available bytes is a hint, but not a
356
367
  * guarantee, that it is possible to use most or any of these bytes. The
357
- * number of unallocated bytes is most likely to be accurate immediately
368
+ * number of available bytes is most likely to be accurate immediately
358
369
  * after this call. It is likely to be made inaccurate by any external
359
370
  * I/O operations including those made on the system outside of this
360
371
  * virtual machine. This method makes no guarantee that write operations
361
372
  * to this file system will succeed.
362
373
  *
363
374
  * @return The number of available bytes on the partition or `0L`
364
- * if the abstract pathname does not name a partition. On
365
- * systems where this information is not available, this method
366
- * will be equivalent to a call to {@link #getFreeSpace}.
375
+ * if the abstract pathname does not name a partition or if this
376
+ * number cannot be obtained. On systems where this information
377
+ * is not available, this method will be equivalent to a call to
378
+ * {@link #getFreeSpace}.
367
379
  *
368
380
  * @throws SecurityException
369
381
  * If a security manager has been installed and it denies
@@ -372,6 +384,7 @@ export class File {
372
384
  * read access to the file named by this abstract pathname
373
385
  *
374
386
  * @since 1.6
387
+ * @see FileStore#getUsableSpace
375
388
  */
376
389
  getUsableSpace(): number;
377
390
  }
@@ -476,9 +489,8 @@ export class PrintWriter {
476
489
  print(obj: any): void;
477
490
  /**
478
491
  * Terminates the current line by writing the line separator string. The
479
- * line separator string is defined by the system property
480
- * `line.separator`, and is not necessarily a single newline
481
- * character (`'\n'`).
492
+ * line separator is {@link System#lineSeparator()} and is not necessarily
493
+ * a single newline character (`'\n'`).
482
494
  */
483
495
  println(): void;
484
496
  /**
@@ -545,7 +557,7 @@ export class PrintWriter {
545
557
  * extra arguments are ignored. The number of arguments is
546
558
  * variable and may be zero. The maximum number of arguments is
547
559
  * limited by the maximum dimension of a Java array as defined by
548
- * The Java Virtual Machine Specification.
560
+ * The Java Virtual Machine Specification.
549
561
  * The behaviour on a
550
562
  * `null` argument depends on the conversion.
551
563
  *
@@ -592,7 +604,7 @@ export class PrintWriter {
592
604
  * extra arguments are ignored. The number of arguments is
593
605
  * variable and may be zero. The maximum number of arguments is
594
606
  * limited by the maximum dimension of a Java array as defined by
595
- * The Java Virtual Machine Specification.
607
+ * The Java Virtual Machine Specification.
596
608
  * The behaviour on a
597
609
  * `null` argument depends on the conversion.
598
610
  *
@@ -630,7 +642,7 @@ export class PrintWriter {
630
642
  * extra arguments are ignored. The number of arguments is
631
643
  * variable and may be zero. The maximum number of arguments is
632
644
  * limited by the maximum dimension of a Java array as defined by
633
- * The Java Virtual Machine Specification.
645
+ * The Java Virtual Machine Specification.
634
646
  * The behaviour on a
635
647
  * `null` argument depends on the conversion.
636
648
  *
@@ -669,7 +681,7 @@ export class PrintWriter {
669
681
  * extra arguments are ignored. The number of arguments is
670
682
  * variable and may be zero. The maximum number of arguments is
671
683
  * limited by the maximum dimension of a Java array as defined by
672
- * The Java Virtual Machine Specification.
684
+ * The Java Virtual Machine Specification.
673
685
  * The behaviour on a
674
686
  * `null` argument depends on the conversion.
675
687
  *
@@ -42,7 +42,7 @@ declare module 'java.net' {
42
42
  * A URL may have appended to it a "fragment", also known
43
43
  * as a "ref" or a "reference". The fragment is indicated by the sharp
44
44
  * sign character "#" followed by more characters. For example,
45
- * * http://java.sun.com/index.html#chapter1
45
+ * * http://www.example.com/index.html#chapter1
46
46
  *
47
47
  *
48
48
  * This fragment is not technically part of the URL. Rather, it
@@ -55,13 +55,13 @@ declare module 'java.net' {
55
55
  * which contains only enough information to reach the resource
56
56
  * relative to another URL. Relative URLs are frequently used within
57
57
  * HTML pages. For example, if the contents of the URL:
58
- * * http://java.sun.com/index.html
58
+ * * http://www.example.com/index.html
59
59
  *
60
60
  * contained within it the relative URL:
61
61
  * * FAQ.html
62
62
  *
63
63
  * it would be a shorthand for:
64
- * * http://java.sun.com/FAQ.html
64
+ * * http://www.example.com/FAQ.html
65
65
  *
66
66
  *
67
67
  * The relative URL need not specify all the components of a URL. If
@@ -89,6 +89,26 @@ declare module 'java.net' {
89
89
  * used, but only for HTML form encoding, which is not the same
90
90
  * as the encoding scheme defined in RFC2396.
91
91
  *
92
+ * @apiNote
93
+ *
94
+ * Applications working with file paths and file URIs should take great
95
+ * care to use the appropriate methods to convert between the two.
96
+ * The {@link Path#of(URI)} factory method and the {@link File#File(URI)}
97
+ * constructor can be used to create {@link Path} or {@link File}
98
+ * objects from a file URI. {@link Path#toUri()} and {@link File#toURI()}
99
+ * can be used to create a {@link URI} from a file path, which can be
100
+ * converted to URL using {@link URI#toURL()}.
101
+ * Applications should never try to {@linkplain #URL(String, String, String)
102
+ * construct} or {@linkplain #URL(String) parse} a `URL`
103
+ * from the direct string representation of a `File` or `Path`
104
+ * instance.
105
+ *
106
+ * Some components of a URL or URI, such as userinfo, may
107
+ * be abused to construct misleading URLs or URIs. Applications
108
+ * that deal with URLs or URIs should take into account
109
+ * the recommendations advised in RFC3986,
110
+ * Section 7, Security Considerations.
111
+ *
92
112
  * @author James Gosling
93
113
  * @since 1.0
94
114
  */
@@ -181,7 +201,7 @@ export class URL {
181
201
  *
182
202
  *
183
203
  * @return the contents of this URL.
184
- * @exception IOException if an I/O exception occurs.
204
+ * @throws IOException if an I/O exception occurs.
185
205
  * @see java.net.URLConnection#getContent()
186
206
  */
187
207
  getContent(): any;