xq-lsp 1.8.1 → 1.8.2
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/CHANGELOG.md +8 -0
- package/dist/completion.js +14 -0
- package/dist/runtimes/existdb/file.xq +53 -0
- package/dist/runtimes/existdb/request.xq +16 -0
- package/dist/runtimes/existdb/response.xq +57 -4
- package/dist/runtimes/existdb/scheduler.xq +173 -0
- package/dist/runtimes/existdb/system.xq +23 -5
- package/dist/runtimes/existdb/util.xq +91 -12
- package/dist/runtimes/existdb/xmldb.xq +12 -1
- package/package.json +1 -1
- package/src/completion.ts +15 -0
- package/src/runtimes/existdb/file.xq +53 -0
- package/src/runtimes/existdb/request.xq +16 -0
- package/src/runtimes/existdb/response.xq +57 -4
- package/src/runtimes/existdb/scheduler.xq +173 -0
- package/src/runtimes/existdb/system.xq +23 -5
- package/src/runtimes/existdb/util.xq +91 -12
- package/src/runtimes/existdb/xmldb.xq +12 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.8.2](https://github.com/DrRataplan/xq-lsp/compare/lsp-v1.8.1...lsp-v1.8.2) (2026-09-01)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* recover eXist-db functions the generator silently dropped ([6e76557](https://github.com/DrRataplan/xq-lsp/commit/6e765574bb484fa650ab83cf33ee301686b92604))
|
|
9
|
+
* use an explicit textEdit for auto-declare-namespace completions ([b319917](https://github.com/DrRataplan/xq-lsp/commit/b3199170a138bc2281cff86bbd4368b0d1c5b9f7))
|
|
10
|
+
|
|
3
11
|
## [1.8.1](https://github.com/DrRataplan/xq-lsp/compare/lsp-v1.8.0...lsp-v1.8.1) (2026-07-29)
|
|
4
12
|
|
|
5
13
|
|
package/dist/completion.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CompletionItem, CompletionItemKind, InsertTextFormat, MarkupKind } from "vscode-languageserver/node.js";
|
|
2
2
|
import { getCompletions as getCoreCompletions } from "./completion-core.js";
|
|
3
3
|
import { findImportInsertPosition, findDeclareNsInsertPosition, computeRelativePath } from "./namespace-diagnostics.js";
|
|
4
|
+
import { offsetToPosition } from "./references.js";
|
|
4
5
|
export function getCompletions(ctx, currentAnalysis, importedAnalyses, snippets, lastValidAnalysis, availableAnalyses, knownNamespaces, editContext) {
|
|
5
6
|
return getCoreCompletions(ctx, currentAnalysis, importedAnalyses, snippets, lastValidAnalysis, availableAnalyses, knownNamespaces).map((e) => {
|
|
6
7
|
const item = {
|
|
@@ -33,6 +34,19 @@ export function getCompletions(ctx, currentAnalysis, importedAnalyses, snippets,
|
|
|
33
34
|
newText = `declare namespace ${e.additionalEdit.prefix} = "${e.additionalEdit.namespaceUri}";\n`;
|
|
34
35
|
}
|
|
35
36
|
item.additionalTextEdits = [{ range: { start: insertPos, end: insertPos }, newText }];
|
|
37
|
+
// The "declare namespace" entry's own insertText is just an echo of what's already
|
|
38
|
+
// typed after the prefix (often ""). Some clients (e.g. eglot) fall back to inserting
|
|
39
|
+
// the item's label verbatim at the cursor when insertText is empty, which would dump
|
|
40
|
+
// the whole `declare namespace tei = "...";` statement inline. An explicit textEdit
|
|
41
|
+
// with a concrete range forces every spec-compliant client onto the deterministic
|
|
42
|
+
// replace path instead of guessing, so only the additionalTextEdit above lands the text.
|
|
43
|
+
if (e.additionalEdit.kind === "declare-namespace") {
|
|
44
|
+
const start = ctx.cursorOffset - e.insertText.length;
|
|
45
|
+
item.textEdit = {
|
|
46
|
+
range: { start: offsetToPosition(docText, start), end: offsetToPosition(docText, ctx.cursorOffset) },
|
|
47
|
+
newText: e.insertText,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
return item;
|
|
38
52
|
});
|
|
@@ -116,6 +116,59 @@ declare function file:read-unicode($path as item()) as xs:string? external;
|
|
|
116
116
|
:)
|
|
117
117
|
declare function file:read-unicode($path as item(), $encoding as xs:string) as xs:string? external;
|
|
118
118
|
|
|
119
|
+
(:~
|
|
120
|
+
: Writes the node set into a file on the file system. $parameters contains a
|
|
121
|
+
: sequence of zero or more serialization parameters specified as key=value
|
|
122
|
+
: pairs. The serialization options are the same as those recognized by
|
|
123
|
+
: "declare option exist:serialize". The function does NOT automatically
|
|
124
|
+
: inherit the serialization options of the XQuery it is called from. This
|
|
125
|
+
: method is only available to the DBA role.
|
|
126
|
+
: @param $node-set The contents to write to the file system.
|
|
127
|
+
: @param $path The full path or URI to the file
|
|
128
|
+
: @param $parameters The serialization parameters: either a sequence of key=value pairs or an output:serialization-parameters element as defined by the standard fn:serialize function.
|
|
129
|
+
: @return true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.
|
|
130
|
+
:)
|
|
131
|
+
declare function file:serialize($node-set as node()*, $path as item(), $parameters as item()*) as xs:boolean? external;
|
|
132
|
+
|
|
133
|
+
(:~
|
|
134
|
+
: Writes the node set into a file on the file system, optionally appending to
|
|
135
|
+
: it. $parameters contains a sequence of zero or more serialization parameters
|
|
136
|
+
: specified as key=value pairs. The serialization options are the same as
|
|
137
|
+
: those recognized by "declare option exist:serialize". The function does NOT
|
|
138
|
+
: automatically inherit the serialization options of the XQuery it is called
|
|
139
|
+
: from. This method is only available to the DBA role.
|
|
140
|
+
: @param $node-set The contents to write to the file system.
|
|
141
|
+
: @param $path The full path or URI to the file
|
|
142
|
+
: @param $parameters The serialization parameters: either a sequence of key=value pairs or an output:serialization-parameters element as defined by the standard fn:serialize function.
|
|
143
|
+
: @param $append Should content be appended?
|
|
144
|
+
: @return true on success - false if the specified file can not be created or is not writable. The empty sequence is returned if the argument sequence is empty.
|
|
145
|
+
:)
|
|
146
|
+
declare function file:serialize(
|
|
147
|
+
$node-set as node()*,
|
|
148
|
+
$path as item(),
|
|
149
|
+
$parameters as item()*,
|
|
150
|
+
$append as xs:boolean
|
|
151
|
+
) as xs:boolean? external;
|
|
152
|
+
|
|
153
|
+
(:~
|
|
154
|
+
: Writes binary data into a file on the file system. This method is only
|
|
155
|
+
: available to the DBA role.
|
|
156
|
+
: @param $binarydata The contents to write to the file system.
|
|
157
|
+
: @param $path The full path or URI to the file
|
|
158
|
+
: @return true on success - false if the specified file can not be created or is not writable
|
|
159
|
+
:)
|
|
160
|
+
declare function file:serialize-binary($binarydata as xs:base64Binary, $path as item()) as xs:boolean external;
|
|
161
|
+
|
|
162
|
+
(:~
|
|
163
|
+
: Writes binary data into a file on the file system, optionally appending the
|
|
164
|
+
: content. This method is only available to the DBA role.
|
|
165
|
+
: @param $binarydata The contents to write to the file system.
|
|
166
|
+
: @param $path The full path or URI to the file
|
|
167
|
+
: @param $append Should content be appended?
|
|
168
|
+
: @return true on success - false if the specified file can not be created or is not writable
|
|
169
|
+
:)
|
|
170
|
+
declare function file:serialize-binary($binarydata as xs:base64Binary, $path as item(), $append as xs:boolean) as xs:boolean external;
|
|
171
|
+
|
|
119
172
|
(:~
|
|
120
173
|
: Synchronize a collection with a directory hierarchy. This method is only
|
|
121
174
|
: available to the DBA role.
|
|
@@ -240,3 +240,19 @@ declare function request:is-multipart-content() as xs:boolean external;
|
|
|
240
240
|
: @param $value The attribute value
|
|
241
241
|
:)
|
|
242
242
|
declare function request:set-attribute($name as xs:string, $value as item()*) as empty-sequence() external;
|
|
243
|
+
: Returns the empty sequence if no item of $available is acceptable; the
|
|
244
|
+
: caller should then respond with 406 Not Acceptable.
|
|
245
|
+
: @param $available The media types the server can produce, in order of preference.
|
|
246
|
+
: @return the best matching media type, or the empty sequence if none is acceptable
|
|
247
|
+
:)
|
|
248
|
+
declare function request:negotiate-content-type($available as xs:string*) as xs:string? external;
|
|
249
|
+
|
|
250
|
+
(:~
|
|
251
|
+
: Returns $default if no item of $available is acceptable.
|
|
252
|
+
: @param $available The media types the server can produce, in order of preference.
|
|
253
|
+
: @param $default The media type to fall back to when no item of $available is acceptable.
|
|
254
|
+
: @return the best matching media type, or $default if none is acceptable
|
|
255
|
+
:)
|
|
256
|
+
declare function request:negotiate-content-type($available as xs:string*, $default as xs:string?) as xs:string? external;
|
|
257
|
+
|
|
258
|
+
(:~
|
|
@@ -13,18 +13,54 @@ declare function response:redirect-to($uri as xs:anyURI) as empty-sequence() ext
|
|
|
13
13
|
|
|
14
14
|
(:~
|
|
15
15
|
: Sets a HTTP Cookie on the HTTP Response.
|
|
16
|
+
: @param $name The cookie name
|
|
17
|
+
: @param $value The cookie value
|
|
16
18
|
:)
|
|
17
|
-
declare function response:set-cookie() as empty-sequence() external;
|
|
19
|
+
declare function response:set-cookie($name as xs:string, $value as xs:string) as empty-sequence() external;
|
|
20
|
+
|
|
21
|
+
(:~
|
|
22
|
+
: Sets a HTTP Cookie on the HTTP Response.
|
|
23
|
+
: @param $name The cookie name
|
|
24
|
+
: @param $value The cookie value
|
|
25
|
+
: @param $max-age The xs:duration of the cookie
|
|
26
|
+
:)
|
|
27
|
+
declare function response:set-cookie(
|
|
28
|
+
$name as xs:string,
|
|
29
|
+
$value as xs:string,
|
|
30
|
+
$max-age as xs:duration?,
|
|
31
|
+
$secure-flag as xs:boolean?
|
|
32
|
+
) as empty-sequence() external;
|
|
33
|
+
|
|
34
|
+
(:~
|
|
35
|
+
: Sets a HTTP Cookie on the HTTP Response.
|
|
36
|
+
: @param $name The cookie name
|
|
37
|
+
: @param $value The cookie value
|
|
38
|
+
: @param $max-age The xs:duration of the cookie
|
|
39
|
+
: @param $domain The cookie domain
|
|
40
|
+
: @param $path The cookie path
|
|
41
|
+
:)
|
|
42
|
+
declare function response:set-cookie(
|
|
43
|
+
$name as xs:string,
|
|
44
|
+
$value as xs:string,
|
|
45
|
+
$max-age as xs:duration?,
|
|
46
|
+
$secure-flag as xs:boolean?,
|
|
47
|
+
$domain as xs:string?,
|
|
48
|
+
$path as xs:string?
|
|
49
|
+
) as empty-sequence() external;
|
|
18
50
|
|
|
19
51
|
(:~
|
|
20
52
|
: Sets a HTTP Header on the HTTP Response.
|
|
53
|
+
: @param $name The header name
|
|
54
|
+
: @param $value The header value
|
|
21
55
|
:)
|
|
22
|
-
declare function response:set-date-header() as empty-sequence() external;
|
|
56
|
+
declare function response:set-date-header($name as xs:string, $value as xs:string) as empty-sequence() external;
|
|
23
57
|
|
|
24
58
|
(:~
|
|
25
59
|
: Sets a HTTP Header on the HTTP Response.
|
|
60
|
+
: @param $name The header name
|
|
61
|
+
: @param $value The header value
|
|
26
62
|
:)
|
|
27
|
-
declare function response:set-header() as empty-sequence() external;
|
|
63
|
+
declare function response:set-header($name as xs:string, $value as xs:string) as empty-sequence() external;
|
|
28
64
|
|
|
29
65
|
(:~
|
|
30
66
|
: Sets a HTTP server status code on the HTTP Response.
|
|
@@ -46,5 +82,22 @@ declare function response:stream($content as item()*, $serialization-options as
|
|
|
46
82
|
: ContentType HTTP header is set to the value given in $content-type. Note:
|
|
47
83
|
: the servlet output stream will be closed afterwards and mime-type settings
|
|
48
84
|
: in the prolog will not be passed.
|
|
85
|
+
: @param $binary-data The binary data to stream
|
|
86
|
+
: @param $content-type The ContentType HTTP header value
|
|
87
|
+
: @param $filename The filename. If provided, a Content-Disposition header is set for the filename in the HTTP Response
|
|
88
|
+
:)
|
|
89
|
+
declare function response:stream-binary($binary-data as xs:base64Binary, $content-type as xs:string, $filename as xs:string?) as empty-sequence() external;
|
|
90
|
+
|
|
91
|
+
(:~
|
|
92
|
+
: @param $binary-resource-path The path to the stored binary resource, e.g. /db/path/to/image.png
|
|
93
|
+
: @param $content-type The ContentType HTTP header value
|
|
94
|
+
:)
|
|
95
|
+
declare function response:stream-binary-resource($binary-resource-path as xs:string, $content-type as xs:string) as empty-sequence() external;
|
|
96
|
+
|
|
97
|
+
(:~
|
|
98
|
+
: A Content-Disposition header is set from $filename.
|
|
99
|
+
: @param $binary-resource-path The path to the stored binary resource, e.g. /db/path/to/image.png
|
|
100
|
+
: @param $content-type The ContentType HTTP header value
|
|
101
|
+
: @param $filename The filename. If provided, a Content-Disposition header is set for the filename in the HTTP Response
|
|
49
102
|
:)
|
|
50
|
-
declare function response:stream-binary() as empty-sequence() external;
|
|
103
|
+
declare function response:stream-binary-resource($binary-resource-path as xs:string, $content-type as xs:string, $filename as xs:string?) as empty-sequence() external;
|
|
@@ -33,3 +33,176 @@ declare function scheduler:pause-scheduled-job($job-name as xs:string) as xs:boo
|
|
|
33
33
|
: @return the indicator of successful resumption
|
|
34
34
|
:)
|
|
35
35
|
declare function scheduler:resume-scheduled-job($job-name as xs:string) as xs:boolean external;
|
|
36
|
+
|
|
37
|
+
(:~
|
|
38
|
+
: Schedules the Java Class named (the class must extend
|
|
39
|
+
: org.exist.scheduler.UserJavaJob) according to the Cron expression. The job
|
|
40
|
+
: will be registered using the job name.
|
|
41
|
+
: @param $java-classname The full name of the class to be executed. It must extend the org.exist.scheduler.UserJavaJob class.
|
|
42
|
+
: @param $cron-expression The cron expression. Please see the scheduler documentation.
|
|
43
|
+
: @param $job-name The name of the job.
|
|
44
|
+
:)
|
|
45
|
+
declare function scheduler:schedule-java-cron-job($java-classname as xs:string, $cron-expression as xs:string, $job-name as xs:string) as item()* external;
|
|
46
|
+
|
|
47
|
+
(:~
|
|
48
|
+
: Schedules the Java Class named (the class must extend
|
|
49
|
+
: org.exist.scheduler.UserJavaJob) according to the Cron expression. The job
|
|
50
|
+
: will be registered using the name passed in $job-name. The final argument
|
|
51
|
+
: can be used to specify parameters for the job, which will be passed to the
|
|
52
|
+
: query as external variables. Parameters are specified in an XML fragment
|
|
53
|
+
: with the following structure: <parameters><param name="param-name1"
|
|
54
|
+
: value="param-value1"/></parameters>.
|
|
55
|
+
: @param $java-classname The full name of the class to be executed. It must extend the org.exist.scheduler.UserJavaJob class.
|
|
56
|
+
: @param $cron-expression The cron expression. Please see the scheduler documentation.
|
|
57
|
+
: @param $job-name The name of the job.
|
|
58
|
+
: @param $job-parameters The XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
59
|
+
:)
|
|
60
|
+
declare function scheduler:schedule-java-cron-job(
|
|
61
|
+
$java-classname as xs:string,
|
|
62
|
+
$cron-expression as xs:string,
|
|
63
|
+
$job-name as xs:string,
|
|
64
|
+
$job-parameters as element()?
|
|
65
|
+
) as item()* external;
|
|
66
|
+
|
|
67
|
+
(:~
|
|
68
|
+
: Schedules the Java Class named (the class must extend
|
|
69
|
+
: org.exist.scheduler.UserJavaJob) according to the periodic value. The job
|
|
70
|
+
: will be registered using the job name. The $job-parameters argument can be
|
|
71
|
+
: used to specify parameters for the job, which will be passed to the query as
|
|
72
|
+
: external variables. Parameters are specified in an XML fragment with the
|
|
73
|
+
: following structure: <parameters><param name="param-name1"
|
|
74
|
+
: value="param-value1"/></parameters>, Given the delay and the repeat.
|
|
75
|
+
: @param $java-classname The full name of the class to be executed. It must extend the org.exist.scheduler.UserJavaJob class.
|
|
76
|
+
: @param $period Time in milliseconds between execution of the job
|
|
77
|
+
: @param $job-name The name of the job.
|
|
78
|
+
: @param $job-parameters The XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
79
|
+
: @param $delay The period in milliseconds to delay the start of a job.
|
|
80
|
+
: @param $repeat The number of times to repeat the job after the initial execution. A value of -1 means repeat forever.
|
|
81
|
+
:)
|
|
82
|
+
declare function scheduler:schedule-java-periodic-job(
|
|
83
|
+
$java-classname as xs:string,
|
|
84
|
+
$period as xs:integer,
|
|
85
|
+
$job-name as xs:string,
|
|
86
|
+
$job-parameters as element()?,
|
|
87
|
+
$delay as xs:integer,
|
|
88
|
+
$repeat as xs:integer
|
|
89
|
+
) as item()* external;
|
|
90
|
+
|
|
91
|
+
(:~
|
|
92
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the Cron
|
|
93
|
+
: expression. XQuery job's will be launched under the guest account initially,
|
|
94
|
+
: although the running XQuery may switch permissions through calls to
|
|
95
|
+
: xmldb:login(). The job will be registered using the job name. Jobs submitted
|
|
96
|
+
: via this function are transitory and will be lost on a server restart. To
|
|
97
|
+
: ensure the persistence of scheduled tasks add them to the conf.xml file.
|
|
98
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
99
|
+
: @param $cron-expression The cron expression. Please see the scheduler documentation.
|
|
100
|
+
: @param $job-name The name of the job.
|
|
101
|
+
:)
|
|
102
|
+
declare function scheduler:schedule-xquery-cron-job($xquery-resource as xs:string, $cron-expression as xs:string, $job-name as xs:string) as item()* external;
|
|
103
|
+
|
|
104
|
+
(:~
|
|
105
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the Cron
|
|
106
|
+
: expression. XQuery job's will be launched under the guest account initially,
|
|
107
|
+
: although the running XQuery may switch permissions through calls to
|
|
108
|
+
: xmldb:login(). The job will be registered using the job name. The final
|
|
109
|
+
: argument can be used to specify parameters for the job, which will be passed
|
|
110
|
+
: to the query as external variables. Parameters are specified in an XML
|
|
111
|
+
: fragment with the following structure: <parameters><param name="param-name1"
|
|
112
|
+
: value="param-value1"/></parameters> Jobs submitted via this function are
|
|
113
|
+
: transitory and will be lost on a server restart. To ensure the persistence
|
|
114
|
+
: of scheduled tasks add them to the conf.xml file.
|
|
115
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
116
|
+
: @param $cron-expression A cron expression. Please see the scheduler documentation.
|
|
117
|
+
: @param $job-name The name of the job.
|
|
118
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
119
|
+
:)
|
|
120
|
+
declare function scheduler:schedule-xquery-cron-job(
|
|
121
|
+
$xquery-resource as xs:string,
|
|
122
|
+
$cron-expression as xs:string,
|
|
123
|
+
$job-name as xs:string,
|
|
124
|
+
$job-parameters as element()?
|
|
125
|
+
) as item()* external;
|
|
126
|
+
|
|
127
|
+
(:~
|
|
128
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the Cron
|
|
129
|
+
: expression. XQuery job's will be launched under the guest account initially,
|
|
130
|
+
: although the running XQuery may switch permissions through calls to
|
|
131
|
+
: xmldb:login(). The job will be registered using the job name. The job
|
|
132
|
+
: parameters argument can be used to specify parameters for the job, which
|
|
133
|
+
: will be passed to the query as external variables. Parameters are specified
|
|
134
|
+
: in an XML fragment with the following structure: <parameters><param
|
|
135
|
+
: name="param-name1" value="param-value1"/></parameters> Jobs submitted via
|
|
136
|
+
: this function are transitory and will be lost on a server restart. To ensure
|
|
137
|
+
: the persistence of scheduled tasks add them to the conf.xml file.
|
|
138
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
139
|
+
: @param $cron-expression A cron expression. Please see the scheduler documentation.
|
|
140
|
+
: @param $job-name The name of the job.
|
|
141
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
142
|
+
: @param $unschedule Specifies whether to unschedule this job if an XPathException is raised, default is true.
|
|
143
|
+
:)
|
|
144
|
+
declare function scheduler:schedule-xquery-cron-job(
|
|
145
|
+
$xquery-resource as xs:string,
|
|
146
|
+
$cron-expression as xs:string,
|
|
147
|
+
$job-name as xs:string,
|
|
148
|
+
$job-parameters as element()?,
|
|
149
|
+
$unschedule as xs:boolean
|
|
150
|
+
) as item()* external;
|
|
151
|
+
|
|
152
|
+
(:~
|
|
153
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the
|
|
154
|
+
: period. XQuery job's will be launched under the guest account initially,
|
|
155
|
+
: although the running XQuery may switch permissions through calls to
|
|
156
|
+
: xmldb:login(). The job will be registered using the job name. The job
|
|
157
|
+
: parameters argument can be used to specify parameters for the job, which
|
|
158
|
+
: will be passed to the query as external variables. Parameters are specified
|
|
159
|
+
: in an XML fragment with the following structure: <parameters><param
|
|
160
|
+
: name="param-name1" value="param-value1"/></parameters> , Given the delay
|
|
161
|
+
: passed and the repeat value. Jobs submitted via this function are transitory
|
|
162
|
+
: and will be lost on a server restart. To ensure the persistence of scheduled
|
|
163
|
+
: tasks add them to the conf.xml file.
|
|
164
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
165
|
+
: @param $period Time in milliseconds between execution of the job
|
|
166
|
+
: @param $job-name The name of the job.
|
|
167
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
168
|
+
: @param $delay Can be used with a period in milliseconds to delay the start of a job.
|
|
169
|
+
: @param $repeat Number of times to repeat the job after the initial execution. A value of -1 means repeat forever.
|
|
170
|
+
:)
|
|
171
|
+
declare function scheduler:schedule-xquery-periodic-job(
|
|
172
|
+
$xquery-resource as xs:string,
|
|
173
|
+
$period as xs:integer,
|
|
174
|
+
$job-name as xs:string,
|
|
175
|
+
$job-parameters as element()?,
|
|
176
|
+
$delay as xs:integer,
|
|
177
|
+
$repeat as xs:integer
|
|
178
|
+
) as item()* external;
|
|
179
|
+
|
|
180
|
+
(:~
|
|
181
|
+
: Schedules the named XQuery resource (e.g. /db/foo.xql) according to the
|
|
182
|
+
: period. XQuery job's will be launched under the guest account initially,
|
|
183
|
+
: although the running XQuery may switch permissions through calls to
|
|
184
|
+
: xmldb:login(). The job will be registered using the job name. The job
|
|
185
|
+
: parameters argument can be used to specify parameters for the job, which
|
|
186
|
+
: will be passed to the query as external variables. Parameters are specified
|
|
187
|
+
: in an XML fragment with the following structure: <parameters><param
|
|
188
|
+
: name="param-name1" value="param-value1"/></parameters> , Given the delay
|
|
189
|
+
: passed and the repeat value. Jobs submitted via this function are transitory
|
|
190
|
+
: and will be lost on a server restart. To ensure the persistence of scheduled
|
|
191
|
+
: tasks add them to the conf.xml file.
|
|
192
|
+
: @param $xquery-resource The path to the XQuery resource
|
|
193
|
+
: @param $period Time in milliseconds between execution of the job
|
|
194
|
+
: @param $job-name The name of the job.
|
|
195
|
+
: @param $job-parameters XML fragment with the following structure: <parameters><param name="param-name1" value="param-value1"/></parameters>
|
|
196
|
+
: @param $delay Can be used with a period in milliseconds to delay the start of a job.
|
|
197
|
+
: @param $repeat Number of times to repeat the job after the initial execution. A value of -1 means repeat forever.
|
|
198
|
+
: @param $unschedule Specifies whether to unschedule this job if an XPathException is raised, default is true.
|
|
199
|
+
:)
|
|
200
|
+
declare function scheduler:schedule-xquery-periodic-job(
|
|
201
|
+
$xquery-resource as xs:string,
|
|
202
|
+
$period as xs:integer,
|
|
203
|
+
$job-name as xs:string,
|
|
204
|
+
$job-parameters as element()?,
|
|
205
|
+
$delay as xs:integer,
|
|
206
|
+
$repeat as xs:integer,
|
|
207
|
+
$unschedule as xs:boolean
|
|
208
|
+
) as item()* external;
|
|
@@ -57,15 +57,21 @@ declare function system:enable-tracing($enable as xs:boolean) as empty-sequence(
|
|
|
57
57
|
declare function system:enable-tracing($enable as xs:boolean, $tracelog as xs:boolean) as empty-sequence() external;
|
|
58
58
|
|
|
59
59
|
(:~
|
|
60
|
+
: @param $dir This is an absolute path to where the backup will be written. Must be writeable by the eXist process.
|
|
61
|
+
: @param $incremental Flag to do incremental export.
|
|
62
|
+
: @param $zip Flag to do export to zip file.
|
|
60
63
|
: @return the export results
|
|
61
64
|
:)
|
|
62
|
-
declare function system:export() as node() external;
|
|
65
|
+
declare function system:export($dir as xs:string, $incremental as xs:boolean?, $zip as xs:boolean?) as node() external;
|
|
63
66
|
|
|
64
67
|
(:~
|
|
65
68
|
: Messagers from exporter reroute to logs.
|
|
69
|
+
: @param $dir This is an absolute path to where the backup will be written. Must be writeable by the eXist process.
|
|
70
|
+
: @param $incremental Flag to do incremental export.
|
|
71
|
+
: @param $zip Flag to do export to zip file.
|
|
66
72
|
: @return the export results
|
|
67
73
|
:)
|
|
68
|
-
declare function system:export-silently() as xs:boolean external;
|
|
74
|
+
declare function system:export-silently($dir as xs:string, $incremental as xs:boolean?, $zip as xs:boolean?) as xs:boolean external;
|
|
69
75
|
|
|
70
76
|
(:~
|
|
71
77
|
: A pseudo-function to execute a function as a different user. The first
|
|
@@ -187,17 +193,29 @@ declare function system:get-uptime() as xs:dayTimeDuration external;
|
|
|
187
193
|
:)
|
|
188
194
|
declare function system:get-version() as xs:string external;
|
|
189
195
|
|
|
190
|
-
|
|
196
|
+
(:~
|
|
197
|
+
: @param $admin-pass The password for the admin user
|
|
198
|
+
: @param $new-admin-pass Set the admin password to this new password.
|
|
199
|
+
:)
|
|
200
|
+
declare function system:import($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?) as item()* external;
|
|
191
201
|
|
|
192
202
|
(:~
|
|
193
203
|
: Messagers from exporter reroute to logs.
|
|
204
|
+
: @param $admin-pass The password for the admin user
|
|
205
|
+
: @param $new-admin-pass Set the admin password to this new password.
|
|
206
|
+
:)
|
|
207
|
+
declare function system:import-silently($dir-or-file as xs:string, $admin-pass as xs:string?, $new-admin-pass as xs:string?) as item()* external;
|
|
208
|
+
|
|
209
|
+
(:~
|
|
210
|
+
: Kill a running XQuey (dba role only).
|
|
194
211
|
:)
|
|
195
|
-
declare function system:
|
|
212
|
+
declare function system:kill-running-xquery($xquery-id as xs:integer) as empty-sequence() external;
|
|
196
213
|
|
|
197
214
|
(:~
|
|
198
215
|
: Kill a running XQuey (dba role only).
|
|
216
|
+
: @param $wait-time The wait time in milliseconds before terminating the XQuery
|
|
199
217
|
:)
|
|
200
|
-
declare function system:kill-running-xquery() as empty-sequence() external;
|
|
218
|
+
declare function system:kill-running-xquery($xquery-id as xs:integer, $wait-time as xs:long) as empty-sequence() external;
|
|
201
219
|
|
|
202
220
|
(:~
|
|
203
221
|
: Restore the database or a section of the database (admin user only).
|
|
@@ -14,8 +14,10 @@ declare function util:absolute-resource-id($node-or-path as item()) as xs:intege
|
|
|
14
14
|
|
|
15
15
|
(:~
|
|
16
16
|
: Converts the number $number from base $base to xs:integer.
|
|
17
|
+
: @param $number The number to convert
|
|
18
|
+
: @param $base The base of $number
|
|
17
19
|
:)
|
|
18
|
-
declare function util:base-to-integer() as item()* external;
|
|
20
|
+
declare function util:base-to-integer($number as item(), $base as xs:integer) as item()* external;
|
|
19
21
|
|
|
20
22
|
(:~
|
|
21
23
|
: Decode the given Base64 encoded string back to clear text
|
|
@@ -409,8 +411,10 @@ declare function util:expand($node as node()*, $serialization-parameters as xs:s
|
|
|
409
411
|
: name and arity, an error is thrown. Please note: the arguments to this
|
|
410
412
|
: function have to be literals or need to be resolvable at compile time at
|
|
411
413
|
: least.
|
|
414
|
+
: @param $name The name of the function
|
|
415
|
+
: @param $arity The arity of the function
|
|
412
416
|
:)
|
|
413
|
-
declare function util:function() as item()* external;
|
|
417
|
+
declare function util:function($name as xs:QName, $arity as xs:integer) as item()* external;
|
|
414
418
|
|
|
415
419
|
(:~
|
|
416
420
|
: Serializes an XML fragment or a sequence of nodes between two elements
|
|
@@ -442,9 +446,10 @@ declare function util:get-fragment-between(
|
|
|
442
446
|
(:~
|
|
443
447
|
: Returns a short description of the module identified by the namespace URI.
|
|
444
448
|
: @deprecated Use inspect:inspect-module-uri#1 instead!
|
|
449
|
+
: @param $namespace-uri The namespace URI of the module
|
|
445
450
|
: @return the description of the active function module identified by the namespace URI
|
|
446
451
|
:)
|
|
447
|
-
declare function util:get-module-description() as xs:string+ external;
|
|
452
|
+
declare function util:get-module-description($namespace-uri as xs:string) as xs:string+ external;
|
|
448
453
|
|
|
449
454
|
(:~
|
|
450
455
|
: Returns an XML fragment providing additional information about the module
|
|
@@ -453,6 +458,15 @@ declare function util:get-module-description() as xs:string+ external;
|
|
|
453
458
|
:)
|
|
454
459
|
declare function util:get-module-info() as element() external;
|
|
455
460
|
|
|
461
|
+
(:~
|
|
462
|
+
: Returns an XML fragment providing additional information about the module
|
|
463
|
+
: identified by the namespace URI.
|
|
464
|
+
: @deprecated Use inspect:inspect-module-uri#1 instead!
|
|
465
|
+
: @param $namespace-uri The namespace URI of the module
|
|
466
|
+
: @return the description of the active function module identified by the namespace URI
|
|
467
|
+
:)
|
|
468
|
+
declare function util:get-module-info($namespace-uri as xs:string) as element() external;
|
|
469
|
+
|
|
456
470
|
(:~
|
|
457
471
|
: Gets the value of a serialization option as set with 'declare option'.
|
|
458
472
|
: @param $name The serialization option name
|
|
@@ -478,8 +492,18 @@ declare function util:get-sequence-type($sequence-type as xs:anyType*) as xs:str
|
|
|
478
492
|
|
|
479
493
|
(:~
|
|
480
494
|
: Calculates a hashcode from a string based on a specified algorithm.
|
|
495
|
+
: @param $message The string to generate the hashcode from
|
|
496
|
+
: @param $algorithm The algorithm used to generate the hashcode
|
|
497
|
+
:)
|
|
498
|
+
declare function util:hash($message as item(), $algorithm as xs:string) as item()* external;
|
|
499
|
+
|
|
500
|
+
(:~
|
|
501
|
+
: Calculates a hashcode from a string based on a specified algorithm.
|
|
502
|
+
: @param $message The string to generate the hashcode from
|
|
503
|
+
: @param $algorithm The algorithm used to generate the hashcode
|
|
504
|
+
: @param $base64flag The flag that specifies whether to return the result as Base64 encoded
|
|
481
505
|
:)
|
|
482
|
-
declare function util:hash() as item()* external;
|
|
506
|
+
declare function util:hash($message as item(), $algorithm as xs:string, $base64flag as xs:boolean) as item()* external;
|
|
483
507
|
|
|
484
508
|
(:~
|
|
485
509
|
: Dynamically imports an XQuery module into the current context. The
|
|
@@ -498,13 +522,33 @@ declare function util:import-module(
|
|
|
498
522
|
|
|
499
523
|
(:~
|
|
500
524
|
: Return the number of documents for an indexed value.
|
|
525
|
+
: @param $nodes The nodes whose content is indexed
|
|
526
|
+
: @param $value The indexed value to search for
|
|
501
527
|
:)
|
|
502
|
-
declare function util:index-key-documents() as item()* external;
|
|
528
|
+
declare function util:index-key-documents($nodes as node()*, $value as xs:anyAtomicType) as item()* external;
|
|
529
|
+
|
|
530
|
+
(:~
|
|
531
|
+
: Return the number of documents for an indexed value.
|
|
532
|
+
: @param $nodes The nodes whose content is indexed
|
|
533
|
+
: @param $value The indexed value to search for
|
|
534
|
+
: @param $index The index in which the search is made
|
|
535
|
+
:)
|
|
536
|
+
declare function util:index-key-documents($nodes as node()*, $value as xs:anyAtomicType, $index as xs:string) as item()* external;
|
|
503
537
|
|
|
504
538
|
(:~
|
|
505
539
|
: Return the number of occurrences for an indexed value.
|
|
540
|
+
: @param $nodes The nodes whose content is indexed
|
|
541
|
+
: @param $value The indexed value to search for
|
|
542
|
+
:)
|
|
543
|
+
declare function util:index-key-occurrences($nodes as node()*, $value as xs:anyAtomicType) as item()* external;
|
|
544
|
+
|
|
545
|
+
(:~
|
|
546
|
+
: Return the number of occurrences for an indexed value.
|
|
547
|
+
: @param $nodes The nodes whose content is indexed
|
|
548
|
+
: @param $value The indexed value to search for
|
|
549
|
+
: @param $index The index in which the search is made
|
|
506
550
|
:)
|
|
507
|
-
declare function util:index-key-occurrences() as item()* external;
|
|
551
|
+
declare function util:index-key-occurrences($nodes as node()*, $value as xs:anyAtomicType, $index as xs:string) as item()* external;
|
|
508
552
|
|
|
509
553
|
(:~
|
|
510
554
|
: Can be used to query existing range indexes defined on a set of nodes. All
|
|
@@ -589,8 +633,10 @@ declare function util:int-to-octal($int as xs:int) as xs:string external;
|
|
|
589
633
|
(:~
|
|
590
634
|
: Converts the xs:integer $number (unsigned) into base $base as xs:string.
|
|
591
635
|
: Bases 2, 8, and 16 are supported.
|
|
636
|
+
: @param $number The number to convert
|
|
637
|
+
: @param $base The base of $number
|
|
592
638
|
:)
|
|
593
|
-
declare function util:integer-to-base() as item()* external;
|
|
639
|
+
declare function util:integer-to-base($number as xs:integer, $base as xs:integer) as item()* external;
|
|
594
640
|
|
|
595
641
|
(:~
|
|
596
642
|
: Checks if the resource identified by $binary-resource is a binary resource.
|
|
@@ -602,16 +648,18 @@ declare function util:is-binary-doc($binary-resource as xs:string?) as xs:boolea
|
|
|
602
648
|
(:~
|
|
603
649
|
: Returns a Boolean value if the module statically mapped to a source location
|
|
604
650
|
: in the configuration file.
|
|
651
|
+
: @param $namespace-uri The namespace URI of the module
|
|
605
652
|
: @return true if the namespace URI is mapped as an active function module
|
|
606
653
|
:)
|
|
607
|
-
declare function util:is-module-mapped() as xs:boolean external;
|
|
654
|
+
declare function util:is-module-mapped($namespace-uri as xs:string) as xs:boolean external;
|
|
608
655
|
|
|
609
656
|
(:~
|
|
610
657
|
: Returns a Boolean value if the module identified by the namespace URI is
|
|
611
658
|
: registered.
|
|
659
|
+
: @param $namespace-uri The namespace URI of the module
|
|
612
660
|
: @return true if the namespace URI is registered as an active function module
|
|
613
661
|
:)
|
|
614
|
-
declare function util:is-module-registered() as xs:boolean external;
|
|
662
|
+
declare function util:is-module-registered($namespace-uri as xs:string) as xs:boolean external;
|
|
615
663
|
|
|
616
664
|
(:~
|
|
617
665
|
: Retrieves the line number of the expression
|
|
@@ -668,12 +716,41 @@ declare function util:list-functions() as function(*)* external;
|
|
|
668
716
|
:)
|
|
669
717
|
declare function util:list-functions($namespace-uri as xs:string) as function(*)* external;
|
|
670
718
|
|
|
719
|
+
(:~
|
|
720
|
+
: Logs the message to the current logger.
|
|
721
|
+
: @param $priority The logging priority: 'error', 'warn', 'debug', 'info', 'trace'
|
|
722
|
+
: @param $message The message to log
|
|
723
|
+
:)
|
|
724
|
+
declare function util:log($priority as xs:string, $message as item()*) as empty-sequence() external;
|
|
725
|
+
|
|
726
|
+
(:~
|
|
727
|
+
: Logs the message to the named logger
|
|
728
|
+
: @param $priority The logging priority: 'error', 'warn', 'debug', 'info', 'trace'
|
|
729
|
+
: @param $logger-name The name of the logger, eg: my.app.log
|
|
730
|
+
: @param $message The message to log
|
|
731
|
+
:)
|
|
732
|
+
declare function util:log-app($priority as xs:string, $logger-name as xs:string, $message as item()*) as empty-sequence() external;
|
|
733
|
+
|
|
734
|
+
(:~
|
|
735
|
+
: Logs the message to System.err.
|
|
736
|
+
: @param $message The message to log
|
|
737
|
+
:)
|
|
738
|
+
declare function util:log-system-err($message as item()*) as empty-sequence() external;
|
|
739
|
+
|
|
740
|
+
(:~
|
|
741
|
+
: Logs the message to System.out.
|
|
742
|
+
: @param $message The message to log
|
|
743
|
+
:)
|
|
744
|
+
declare function util:log-system-out($message as item()*) as empty-sequence() external;
|
|
745
|
+
|
|
671
746
|
(:~
|
|
672
747
|
: Map the module to a source location. This function is only available to the
|
|
673
748
|
: DBA role.
|
|
749
|
+
: @param $namespace-uri The namespace URI of the module
|
|
750
|
+
: @param $location-uri The location URI of the module
|
|
674
751
|
: @return Returns an empty sequence
|
|
675
752
|
:)
|
|
676
|
-
declare function util:map-module() as empty-sequence() external;
|
|
753
|
+
declare function util:map-module($namespace-uri as xs:string, $location-uri as xs:string) as empty-sequence() external;
|
|
677
754
|
|
|
678
755
|
(:~
|
|
679
756
|
: Returns a sequence containing the namespace URIs of all XQuery modules which
|
|
@@ -722,8 +799,9 @@ declare function util:octal-to-int($octal as xs:string) as xs:int external;
|
|
|
722
799
|
: be well-formed XML. It will be passed through the Neko HTML parser to make
|
|
723
800
|
: it well-formed. An empty sequence is returned if the argument is an empty
|
|
724
801
|
: string or sequence.
|
|
802
|
+
: @param $to-be-parsed The string to be parsed
|
|
725
803
|
:)
|
|
726
|
-
declare function util:parse-html() as item()* external;
|
|
804
|
+
declare function util:parse-html($to-be-parsed as xs:string?) as item()* external;
|
|
727
805
|
|
|
728
806
|
(:~
|
|
729
807
|
: Can be used to query existing qname indexes defined on a set of nodes.
|
|
@@ -865,9 +943,10 @@ declare function util:unescape-uri($escaped-string as xs:string, $encoding as xs
|
|
|
865
943
|
(:~
|
|
866
944
|
: Remove relation between module namespace and source location. This function
|
|
867
945
|
: is only available to the DBA role.
|
|
946
|
+
: @param $namespace-uri The namespace URI of the module
|
|
868
947
|
: @return Returns an empty sequence
|
|
869
948
|
:)
|
|
870
|
-
declare function util:unmap-module() as empty-sequence() external;
|
|
949
|
+
declare function util:unmap-module($namespace-uri as xs:string) as empty-sequence() external;
|
|
871
950
|
|
|
872
951
|
(:~
|
|
873
952
|
: Generate a version 4 (random) universally unique identifier (UUID) string,
|
|
@@ -285,8 +285,19 @@ declare function xmldb:match-collection($regexp as xs:string) as xs:string* exte
|
|
|
285
285
|
(:~
|
|
286
286
|
: Moves the collection $source-collection-uri into the collection
|
|
287
287
|
: $target-collection-uri.
|
|
288
|
+
: @param $source-collection-uri The source collection URI
|
|
289
|
+
: @param $target-collection-uri The target collection URI
|
|
290
|
+
:)
|
|
291
|
+
declare function xmldb:move($source-collection-uri as xs:string, $target-collection-uri as xs:string) as empty-sequence() external;
|
|
292
|
+
|
|
293
|
+
(:~
|
|
294
|
+
: Moves the resource $resource from the collection $source-collection-uri into
|
|
295
|
+
: collection $target-collection-uri.
|
|
296
|
+
: @param $source-collection-uri The source collection URI
|
|
297
|
+
: @param $target-collection-uri The target collection URI
|
|
298
|
+
: @param $resource The resource
|
|
288
299
|
:)
|
|
289
|
-
declare function xmldb:move() as empty-sequence() external;
|
|
300
|
+
declare function xmldb:move($source-collection-uri as xs:string, $target-collection-uri as xs:string, $resource as xs:string) as empty-sequence() external;
|
|
290
301
|
|
|
291
302
|
(:~
|
|
292
303
|
: Registers an XMLDB driver class with the XMLDB Database Manager. This is
|