@jahia/javascript-modules-library 0.0.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 (87) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +35 -0
  3. package/core/index.js +1 -0
  4. package/core/server/components/AbsoluteArea.js +1 -0
  5. package/core/server/components/AddContentButtons.js +1 -0
  6. package/core/server/components/AddResources.js +1 -0
  7. package/core/server/components/Area.js +1 -0
  8. package/core/server/components/index.js +1 -0
  9. package/core/server/components/render/HydrateInBrowser.js +1 -0
  10. package/core/server/components/render/Render.js +1 -0
  11. package/core/server/components/render/RenderInBrowser.js +1 -0
  12. package/core/server/components/render/index.js +1 -0
  13. package/core/server/components/render/internal/InBrowser.js +1 -0
  14. package/core/server/framework/defineJahiaComponent.js +1 -0
  15. package/core/server/framework/index.js +1 -0
  16. package/core/server/framework/register.js +1 -0
  17. package/core/server/hooks/index.js +1 -0
  18. package/core/server/hooks/useGQLQuery.js +1 -0
  19. package/core/server/hooks/useJCRQuery.js +1 -0
  20. package/core/server/hooks/useServerContext.js +1 -0
  21. package/core/server/hooks/useUrlBuilder.js +1 -0
  22. package/core/server/index.js +1 -0
  23. package/core/server/utils/index.js +1 -0
  24. package/core/server/utils/jcr/getChildNodes.js +1 -0
  25. package/core/server/utils/jcr/getNodeFromPathOrId.js +1 -0
  26. package/core/server/utils/jcr/getNodeProps.js +1 -0
  27. package/core/server/utils/jcr/getNodesByJCRQuery.js +1 -0
  28. package/core/server/utils/jcr/index.js +1 -0
  29. package/core/server/utils/urlBuilder/index.js +1 -0
  30. package/core/server/utils/urlBuilder/urlBuilder.js +1 -0
  31. package/index.js +1 -0
  32. package/nav/index.js +1 -0
  33. package/nav/server/index.js +1 -0
  34. package/nav/server/navBuilder/index.js +1 -0
  35. package/nav/server/navBuilder/navBuilder.js +24 -0
  36. package/package.json +60 -0
  37. package/types/@jahia/javascript-modules-library-private.d.ts +60 -0
  38. package/types/core/index.d.ts +1 -0
  39. package/types/core/server/components/AbsoluteArea.d.ts +29 -0
  40. package/types/core/server/components/AddContentButtons.d.ts +13 -0
  41. package/types/core/server/components/AddResources.d.ts +31 -0
  42. package/types/core/server/components/Area.d.ts +27 -0
  43. package/types/core/server/components/index.d.ts +5 -0
  44. package/types/core/server/components/render/HydrateInBrowser.d.ts +13 -0
  45. package/types/core/server/components/render/Render.d.ts +23 -0
  46. package/types/core/server/components/render/RenderInBrowser.d.ts +13 -0
  47. package/types/core/server/components/render/index.d.ts +3 -0
  48. package/types/core/server/components/render/internal/InBrowser.d.ts +8 -0
  49. package/types/core/server/framework/defineJahiaComponent.d.ts +41 -0
  50. package/types/core/server/framework/index.d.ts +2 -0
  51. package/types/core/server/framework/register.d.ts +7 -0
  52. package/types/core/server/hooks/index.d.ts +4 -0
  53. package/types/core/server/hooks/useGQLQuery.d.ts +5 -0
  54. package/types/core/server/hooks/useJCRQuery.d.ts +3 -0
  55. package/types/core/server/hooks/useServerContext.d.ts +14 -0
  56. package/types/core/server/hooks/useUrlBuilder.d.ts +31 -0
  57. package/types/core/server/index.d.ts +4 -0
  58. package/types/core/server/utils/index.d.ts +2 -0
  59. package/types/core/server/utils/jcr/getChildNodes.d.ts +9 -0
  60. package/types/core/server/utils/jcr/getNodeFromPathOrId.d.ts +12 -0
  61. package/types/core/server/utils/jcr/getNodeProps.d.ts +7 -0
  62. package/types/core/server/utils/jcr/getNodesByJCRQuery.d.ts +9 -0
  63. package/types/core/server/utils/jcr/index.d.ts +4 -0
  64. package/types/core/server/utils/urlBuilder/index.d.ts +1 -0
  65. package/types/core/server/utils/urlBuilder/urlBuilder.d.ts +27 -0
  66. package/types/globals.d.ts +11 -0
  67. package/types/index.d.ts +19 -0
  68. package/types/java.io.d.ts +694 -0
  69. package/types/java.net.d.ts +190 -0
  70. package/types/java.security.d.ts +27 -0
  71. package/types/java.util.d.ts +1536 -0
  72. package/types/javax.jcr.d.ts +1250 -0
  73. package/types/javax.servlet.d.ts +426 -0
  74. package/types/javax.servlet.http.d.ts +1431 -0
  75. package/types/nav/index.d.ts +1 -0
  76. package/types/nav/server/index.d.ts +1 -0
  77. package/types/nav/server/navBuilder/index.d.ts +1 -0
  78. package/types/nav/server/navBuilder/navBuilder.d.ts +78 -0
  79. package/types/org.jahia.modules.npm.modules.engine.js.server.d.ts +292 -0
  80. package/types/org.jahia.services.content.d.ts +1463 -0
  81. package/types/org.jahia.services.content.decorator.d.ts +92 -0
  82. package/types/org.jahia.services.query.d.ts +35 -0
  83. package/types/org.jahia.services.render.d.ts +168 -0
  84. package/types/org.jahia.services.usermanager.d.ts +85 -0
  85. package/types/org.osgi.framework.d.ts +1004 -0
  86. package/types/server.d.ts +27 -0
  87. package/types/servercontext.d.ts +29 -0
@@ -0,0 +1,426 @@
1
+ declare module 'javax.servlet' {
2
+ import { Locale, Enumeration, Map } from 'java.util';
3
+ import { BufferedReader } from 'java.io';
4
+ export class ServletInputStream {
5
+ /**
6
+ *
7
+ * Reads the input stream, one line at a time. Starting at an
8
+ * offset, reads bytes into an array, until it reads a certain number
9
+ * of bytes or reaches a newline character, which it reads into the
10
+ * array as well.
11
+ *
12
+ * This method returns -1 if it reaches the end of the input
13
+ * stream before reading the maximum number of bytes.
14
+ *
15
+ *
16
+ *
17
+ * @param b an array of bytes into which data is read
18
+ *
19
+ * @param off an integer specifying the character at which
20
+ * this method begins reading
21
+ *
22
+ * @param len an integer specifying the maximum number of
23
+ * bytes to read
24
+ *
25
+ * @return an integer specifying the actual number of bytes
26
+ * read, or -1 if the end of the stream is reached
27
+ *
28
+ * @exception IOException if an input or output exception has occurred
29
+ *
30
+ */
31
+ readLine(b: number[], off: number, len: number): number;
32
+ /**
33
+ * Returns true when all the data from the stream has been read else
34
+ * it returns false.
35
+ *
36
+ * @return true when all data for this particular request
37
+ * has been read, otherwise returns false.
38
+ *
39
+ * @since Servlet 3.1
40
+ */
41
+ isFinished(): boolean;
42
+ /**
43
+ * Returns true if data can be read without blocking else returns
44
+ * false.
45
+ *
46
+ * @return true if data can be obtained without blocking,
47
+ * otherwise returns false.
48
+ *
49
+ * @since Servlet 3.1
50
+ */
51
+ isReady(): boolean;
52
+ }
53
+ export class ServletOutputStream {
54
+ print(s: string): void;
55
+ print(b: boolean): void;
56
+ print(i: number): void;
57
+ println(): void;
58
+ println(s: string): void;
59
+ println(b: boolean): void;
60
+ println(i: number): void;
61
+ }
62
+ /**
63
+ * Defines an object to provide client request information to a servlet. The
64
+ * servlet container creates a ServletRequest object and passes
65
+ * it as an argument to the servlet's service method.
66
+ *
67
+ * A ServletRequest object provides data including
68
+ * parameter name and values, attributes, and an input stream.
69
+ * Interfaces that extend ServletRequest can provide
70
+ * additional protocol-specific data (for example, HTTP data is
71
+ * provided by {@link javax.servlet.http.HttpServletRequest}.
72
+ *
73
+ * @author Various
74
+ *
75
+ * @see javax.servlet.http.HttpServletRequest
76
+ *
77
+ */
78
+ export class ServletRequest {
79
+ /**
80
+ * Returns the value of the named attribute as an Object,
81
+ * or null if no attribute of the given name exists.
82
+ *
83
+ * Attributes can be set two ways. The servlet container may set
84
+ * attributes to make available custom information about a request.
85
+ * For example, for requests made using HTTPS, the attribute
86
+ * javax.servlet.request.X509Certificate can be used to
87
+ * retrieve information on the certificate of the client. Attributes
88
+ * can also be set programatically using
89
+ * {@link ServletRequest#setAttribute}. This allows information to be
90
+ * embedded into a request before a {@link RequestDispatcher} call.
91
+ *
92
+ * Attribute names should follow the same conventions as package
93
+ * names. This specification reserves names matching java.*,
94
+ * javax.*, and sun.*.
95
+ *
96
+ * @param name a String specifying the name of the attribute
97
+ *
98
+ * @return an Object containing the value of the attribute,
99
+ * or null if the attribute does not exist
100
+ */
101
+ getAttribute(name: string): any;
102
+ /**
103
+ * Returns an Enumeration containing the
104
+ * names of the attributes available to this request.
105
+ * This method returns an empty Enumeration
106
+ * if the request has no attributes available to it.
107
+ *
108
+ * @return an Enumeration of strings containing the names
109
+ * of the request's attributes
110
+ */
111
+ getAttributeNames(): Enumeration<string>;
112
+ /**
113
+ * Returns the name of the character encoding used in the body of this
114
+ * request. This method returns null if the request
115
+ * does not specify a character encoding
116
+ *
117
+ * @return a String containing the name of the character
118
+ * encoding, or null if the request does not specify a
119
+ * character encoding
120
+ */
121
+ getCharacterEncoding(): string;
122
+ /**
123
+ * Returns the length, in bytes, of the request body and made available by
124
+ * the input stream, or -1 if the length is not known ir is greater than
125
+ * Integer.MAX_VALUE. For HTTP servlets,
126
+ * same as the value of the CGI variable CONTENT_LENGTH.
127
+ *
128
+ * @return an integer containing the length of the request body or -1 if
129
+ * the length is not known or is greater than Integer.MAX_VALUE.
130
+ */
131
+ getContentLength(): number;
132
+ /**
133
+ * Returns the length, in bytes, of the request body and made available by
134
+ * the input stream, or -1 if the length is not known. For HTTP servlets,
135
+ * same as the value of the CGI variable CONTENT_LENGTH.
136
+ *
137
+ * @return a long containing the length of the request body or -1L if
138
+ * the length is not known
139
+ *
140
+ * @since Servlet 3.1
141
+ */
142
+ getContentLengthLong(): number;
143
+ /**
144
+ * Returns the MIME type of the body of the request, or
145
+ * null if the type is not known. For HTTP servlets,
146
+ * same as the value of the CGI variable CONTENT_TYPE.
147
+ *
148
+ * @return a String containing the name of the MIME type
149
+ * of the request, or null if the type is not known
150
+ */
151
+ getContentType(): string;
152
+ /**
153
+ * Retrieves the body of the request as binary data using
154
+ * a {@link ServletInputStream}. Either this method or
155
+ * {@link #getReader} may be called to read the body, not both.
156
+ *
157
+ * @return a {@link ServletInputStream} object containing
158
+ * the body of the request
159
+ *
160
+ * @exception IllegalStateException if the {@link #getReader} method
161
+ * has already been called for this request
162
+ *
163
+ * @exception IOException if an input or output exception occurred
164
+ */
165
+ getInputStream(): ServletInputStream;
166
+ /**
167
+ * Returns the value of a request parameter as a String,
168
+ * or null if the parameter does not exist. Request parameters
169
+ * are extra information sent with the request. For HTTP servlets,
170
+ * parameters are contained in the query string or posted form data.
171
+ *
172
+ * You should only use this method when you are sure the
173
+ * parameter has only one value. If the parameter might have
174
+ * more than one value, use {@link #getParameterValues}.
175
+ *
176
+ * If you use this method with a multivalued
177
+ * parameter, the value returned is equal to the first value
178
+ * in the array returned by getParameterValues.
179
+ *
180
+ * If the parameter data was sent in the request body, such as occurs
181
+ * with an HTTP POST request, then reading the body directly via {@link
182
+ * #getInputStream} or {@link #getReader} can interfere
183
+ * with the execution of this method.
184
+ *
185
+ * @param name a String specifying the name of the parameter
186
+ *
187
+ * @return a String representing the single value of
188
+ * the parameter
189
+ *
190
+ * @see #getParameterValues
191
+ */
192
+ getParameter(name: string): string;
193
+ /**
194
+ *
195
+ * Returns an Enumeration of String
196
+ * objects containing the names of the parameters contained
197
+ * in this request. If the request has
198
+ * no parameters, the method returns an empty Enumeration.
199
+ *
200
+ * @return an Enumeration of String
201
+ * objects, each String containing the name of
202
+ * a request parameter; or an empty Enumeration
203
+ * if the request has no parameters
204
+ */
205
+ getParameterNames(): Enumeration<string>;
206
+ /**
207
+ * Returns an array of String objects containing
208
+ * all of the values the given request parameter has, or
209
+ * null if the parameter does not exist.
210
+ *
211
+ * If the parameter has a single value, the array has a length
212
+ * of 1.
213
+ *
214
+ * @param name a String containing the name of
215
+ * the parameter whose value is requested
216
+ *
217
+ * @return an array of String objects
218
+ * containing the parameter's values
219
+ *
220
+ * @see #getParameter
221
+ */
222
+ getParameterValues(name: string): string[];
223
+ /**
224
+ * Returns a java.util.Map of the parameters of this request.
225
+ *
226
+ * Request parameters are extra information sent with the request.
227
+ * For HTTP servlets, parameters are contained in the query string or
228
+ * posted form data.
229
+ *
230
+ * @return an immutable java.util.Map containing parameter names as
231
+ * keys and parameter values as map values. The keys in the parameter
232
+ * map are of type String. The values in the parameter map are of type
233
+ * String array.
234
+ */
235
+ getParameterMap(): Map<string, string[]>;
236
+ /**
237
+ * Returns the name and version of the protocol the request uses
238
+ * in the form protocol/majorVersion.minorVersion, for
239
+ * example, HTTP/1.1. For HTTP servlets, the value
240
+ * returned is the same as the value of the CGI variable
241
+ * SERVER_PROTOCOL.
242
+ *
243
+ * @return a String containing the protocol
244
+ * name and version number
245
+ */
246
+ getProtocol(): string;
247
+ /**
248
+ * Returns the name of the scheme used to make this request,
249
+ * for example,
250
+ * http, https, or ftp.
251
+ * Different schemes have different rules for constructing URLs,
252
+ * as noted in RFC 1738.
253
+ *
254
+ * @return a String containing the name
255
+ * of the scheme used to make this request
256
+ */
257
+ getScheme(): string;
258
+ /**
259
+ * Returns the host name of the server to which the request was sent.
260
+ * It is the value of the part before ":" in the Host
261
+ * header value, if any, or the resolved server name, or the server IP
262
+ * address.
263
+ *
264
+ * @return a String containing the name of the server
265
+ */
266
+ getServerName(): string;
267
+ /**
268
+ * Returns the port number to which the request was sent.
269
+ * It is the value of the part after ":" in the Host
270
+ * header value, if any, or the server port where the client connection
271
+ * was accepted on.
272
+ *
273
+ * @return an integer specifying the port number
274
+ */
275
+ getServerPort(): number;
276
+ /**
277
+ * Retrieves the body of the request as character data using
278
+ * a BufferedReader. The reader translates the character
279
+ * data according to the character encoding used on the body.
280
+ * Either this method or {@link #getInputStream} may be called to read the
281
+ * body, not both.
282
+ *
283
+ * @return a BufferedReader containing the body of the request
284
+ *
285
+ * @exception UnsupportedEncodingException if the character set encoding
286
+ * used is not supported and the text cannot be decoded
287
+ *
288
+ * @exception IllegalStateException if {@link #getInputStream} method
289
+ * has been called on this request
290
+ *
291
+ * @exception IOException if an input or output exception occurred
292
+ *
293
+ * @see #getInputStream
294
+ */
295
+ getReader(): BufferedReader;
296
+ /**
297
+ * Returns the Internet Protocol (IP) address of the client
298
+ * or last proxy that sent the request.
299
+ * For HTTP servlets, same as the value of the
300
+ * CGI variable REMOTE_ADDR.
301
+ *
302
+ * @return a String containing the
303
+ * IP address of the client that sent the request
304
+ */
305
+ getRemoteAddr(): string;
306
+ /**
307
+ * Returns the fully qualified name of the client
308
+ * or the last proxy that sent the request.
309
+ * If the engine cannot or chooses not to resolve the hostname
310
+ * (to improve performance), this method returns the dotted-string form of
311
+ * the IP address. For HTTP servlets, same as the value of the CGI variable
312
+ * REMOTE_HOST.
313
+ *
314
+ * @return a String containing the fully
315
+ * qualified name of the client
316
+ */
317
+ getRemoteHost(): string;
318
+ /**
319
+ * Returns the preferred Locale that the client will
320
+ * accept content in, based on the Accept-Language header.
321
+ * If the client request doesn't provide an Accept-Language header,
322
+ * this method returns the default locale for the server.
323
+ *
324
+ * @return the preferred Locale for the client
325
+ */
326
+ getLocale(): Locale;
327
+ /**
328
+ * Returns an Enumeration of Locale objects
329
+ * indicating, in decreasing order starting with the preferred locale, the
330
+ * locales that are acceptable to the client based on the Accept-Language
331
+ * header.
332
+ * If the client request doesn't provide an Accept-Language header,
333
+ * this method returns an Enumeration containing one
334
+ * Locale, the default locale for the server.
335
+ *
336
+ * @return an Enumeration of preferred
337
+ * Locale objects for the client
338
+ */
339
+ getLocales(): Enumeration<Locale>;
340
+ /**
341
+ *
342
+ * Returns a boolean indicating whether this request was made using a
343
+ * secure channel, such as HTTPS.
344
+ *
345
+ * @return a boolean indicating if the request was made using a
346
+ * secure channel
347
+ */
348
+ isSecure(): boolean;
349
+ /**
350
+ * @deprecated As of Version 2.1 of the Java Servlet API,
351
+ * use {@link ServletContext#getRealPath} instead.
352
+ */
353
+ getRealPath(path: string): string;
354
+ /**
355
+ * Returns the Internet Protocol (IP) source port of the client
356
+ * or last proxy that sent the request.
357
+ *
358
+ * @return an integer specifying the port number
359
+ *
360
+ * @since Servlet 2.4
361
+ */
362
+ getRemotePort(): number;
363
+ /**
364
+ * Returns the host name of the Internet Protocol (IP) interface on
365
+ * which the request was received.
366
+ *
367
+ * @return a String containing the host
368
+ * name of the IP on which the request was received.
369
+ *
370
+ * @since Servlet 2.4
371
+ */
372
+ getLocalName(): string;
373
+ /**
374
+ * Returns the Internet Protocol (IP) address of the interface on
375
+ * which the request was received.
376
+ *
377
+ * @return a String containing the
378
+ * IP address on which the request was received.
379
+ *
380
+ * @since Servlet 2.4
381
+ */
382
+ getLocalAddr(): string;
383
+ /**
384
+ * Returns the Internet Protocol (IP) port number of the interface
385
+ * on which the request was received.
386
+ *
387
+ * @return an integer specifying the port number
388
+ *
389
+ * @since Servlet 2.4
390
+ */
391
+ getLocalPort(): number;
392
+ /**
393
+ * Checks if this request has been put into asynchronous mode.
394
+ *
395
+ * A ServletRequest is put into asynchronous mode by calling
396
+ * {@link #startAsync} or
397
+ * {@link #startAsync(ServletRequest,ServletResponse)} on it.
398
+ *
399
+ * This method returns false if this request was
400
+ * put into asynchronous mode, but has since been dispatched using
401
+ * one of the {@link AsyncContext#dispatch} methods or released
402
+ * from asynchronous mode via a call to {@link AsyncContext#complete}.
403
+ *
404
+ * @return true if this request has been put into asynchronous mode,
405
+ * false otherwise
406
+ *
407
+ * @since Servlet 3.0
408
+ */
409
+ isAsyncStarted(): boolean;
410
+ /**
411
+ * Checks if this request supports asynchronous operation.
412
+ *
413
+ * Asynchronous operation is disabled for this request if this request
414
+ * is within the scope of a filter or servlet that has not been annotated
415
+ * or flagged in the deployment descriptor as being able to support
416
+ * asynchronous handling.
417
+ *
418
+ * @return true if this request supports asynchronous operation, false
419
+ * otherwise
420
+ *
421
+ * @since Servlet 3.0
422
+ */
423
+ isAsyncSupported(): boolean;
424
+ }
425
+
426
+ }