Dictionary Views Related to MLE Modules
The Data Dictionary includes details about JavaScript and WebAssembly (Wasm) modules.
USER_SOURCE
Each JavaScript module’s source code is externalized using the [USER | ALL | DBA | CDB]_SOURCE dictionary views.
Modules created with references to the file system using the BFILE operator show the code at the time of the module’s creation.
For more information about *_SOURCE, see Oracle AI Database Reference.
Wasm modules are always compiled into a binary format and therefore, they do not appear in [USER | ALL | DBA | CDB]_SOURCE.
Example: Externalize JavaScript Module Source Code
SELECT
line,
text
FROM
USER_SOURCE
WHERE
name = 'PO_MODULE';
Example output:
LINE TEXT
----- -------------------------------------------------------------
1 /**
2 * calculate the value of a given line item. Factored out of the public
3 * function to allow for currency conversions in a later step
4 * @param {number} unitPrice - the price of a single article
5 * @param {number} quantity - the quantity of articles ordered
6 * @returns {number} the monetary value of the line item
7 */
8 function lineItemValue(unitPrice, quantity) {
9 return unitPrice * quantity;
10 }
11
12
13 /**
14 * get the value of all line items in an order
15 * @param {array} lineItems - all the line items in a purchase order
16 * @returns {number} the total value of all line items in a purchase order
17 */
18 export function orderValue(lineItems) {
19
20 return lineItems
21 .map( x => lineItemValue(x.Part.UnitPrice, x.Quantity) )
22 .reduce(
23 (accumulator, currentValue) => accumulator + currentValue, 0
24 );
25 }
USER_MLE_MODULES
Metadata pertaining to JavaScript MLE modules are found in [USER | ALL | DBA | CDB]_MLE_MODULES.
Any JSON metadata specified, version information, as well as language, name, and owner can be found in this view.
For more information about *_MLE_MODULES, see Oracle AI Database Reference.
Example: Find MLE Modules Defined in a Schema
SELECT
module_name,
version,
json_serialize(metadata pretty) metadata,
language_name
FROM
user_mle_modules
/
Example output:
MODULE_NAME VERSION METADATA LANGUAGE_NAME
-------------- ---------- --------------------------------------------------------- ---------------
MODULE1 JAVASCRIPT
MODULE2 JAVASCRIPT
PHOTON JAVASCRIPT
PHOTON_WASM { WASM
"name" : "photon",
"version" : "0.3.3",
"source" : "https://silvia-odwyer.github.io/photon/"
}
PHOTON_DEMO 0.3.3 JAVASCRIPT