├── .gitignore ├── .npmignore ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── THIRD_PARTY_LICENSES.txt ├── declarations ├── mle-encode-base64 │ ├── LICENSE.txt │ ├── README.md │ ├── mle-encode-base64.d.ts │ └── package.json ├── mle-js-bindings │ ├── LICENSE.txt │ ├── README.md │ ├── mle-js-bindings.d.ts │ └── package.json ├── mle-js-encodings │ ├── LICENSE.txt │ ├── README.md │ ├── decoder.d.ts │ ├── encoder.d.ts │ ├── index.d.ts │ └── package.json ├── mle-js-fetch │ ├── LICENSE.txt │ ├── README.md │ ├── body.d.ts │ ├── common.d.ts │ ├── fetch.d.ts │ ├── headers.d.ts │ ├── index.d.ts │ ├── package.json │ ├── request.d.ts │ └── response.d.ts ├── mle-js-oracledb │ ├── LICENSE.txt │ ├── README.md │ ├── api.d.ts │ ├── index.d.ts │ ├── mle-js-oracledb-common.d.ts │ ├── package.json │ └── soda-api.d.ts ├── mle-js-plsql-ffi │ ├── LICENSE.txt │ ├── README.md │ ├── args.d.ts │ ├── call-error.d.ts │ ├── index.d.ts │ ├── package.json │ ├── resolvers.d.ts │ └── subprogram-api.d.ts ├── mle-js-plsqltypes │ ├── LICENSE.txt │ ├── README.md │ ├── mle-js-plsqltypes.d.ts │ └── package.json └── mle-js │ ├── LICENSE.txt │ ├── README.md │ ├── mle-js.d.ts │ └── package.json ├── index.d.ts ├── package-lock.json ├── package.json ├── test ├── LICENSE.txt ├── README.md ├── mle-js-tests.ts ├── package-lock.json └── package.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | * 2 | !index.d.ts 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to this repository 2 | 3 | We welcome your contributions! There are multiple ways to contribute. 4 | 5 | ## Opening issues 6 | 7 | For bugs or enhancement requests, please file a GitHub issue unless it's 8 | security related. When filing a bug remember that the better written the bug is, 9 | the more likely it is to be fixed. If you think you've found a security 10 | vulnerability, do not raise a GitHub issue and follow the instructions in our 11 | [security policy](./SECURITY.md). 12 | 13 | ## Contributing code 14 | 15 | We welcome your code contributions. Before submitting code via a pull request, 16 | you will need to have signed the [Oracle Contributor Agreement][OCA] (OCA) and 17 | your commits need to include the following line using the name and e-mail 18 | address you used to sign the OCA: 19 | 20 | ```text 21 | Signed-off-by: Your Name 22 | ``` 23 | 24 | This can be automatically added to pull requests by committing with `--sign-off` 25 | or `-s`, e.g. 26 | 27 | ```text 28 | git commit --signoff 29 | ``` 30 | 31 | Only pull requests from committers that can be verified as having signed the OCA 32 | can be accepted. 33 | 34 | ## Pull request process 35 | 36 | 1. Ensure there is an issue created to track and discuss the fix or enhancement 37 | you intend to submit. 38 | 1. Fork this repository 39 | 1. Create a branch in your fork to implement the changes. We recommend using 40 | the issue number as part of your branch name, e.g. `1234-fixes` 41 | 1. Ensure that any documentation is updated with the changes that are required 42 | by your change. 43 | 1. Ensure that any samples are updated if the base image has been changed. 44 | 1. Submit the pull request. *Do not leave the pull request blank*. Explain exactly 45 | what your changes are meant to do and provide simple steps on how to validate 46 | your changes. Ensure that you reference the issue you created as well. 47 | 1. We will assign the pull request to 2-3 people for review before it is merged. 48 | 49 | ## Code of conduct 50 | 51 | Follow the [Golden Rule](https://en.wikipedia.org/wiki/Golden_Rule). If you'd 52 | like more specific guidelines, see the [Contributor Covenant Code of Conduct][COC]. 53 | 54 | [OCA]: https://oca.opensource.oracle.com 55 | [COC]: https://www.contributor-covenant.org/version/1/4/code-of-conduct/ 56 | 57 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2024, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MLE Modules 2 | 3 | Oracle's Multilingual Engine (MLE), powered by GraalVM, enables [JavaScript execution in Oracle Database][1]. Oracle's JavaScript implementation ships with a number of essential JavaScript modules. 4 | 5 | This repository contains documentation and interface definitions (in the form of TypeScript declarations) for those predefined modules. While the documentation consists of human-readable, linked pages, the TypeScript declaration files are typically consumed by an IDE. Developers using Oracle's SQL Developer Extension for Visual Studio Code for example benefit from a better developer experience thanks to code-completion, and Typescript checks. 6 | 7 | The following JavaScript modules are currently available with Oracle's latest database release: 8 | 9 | - MLE SQL Driver: [mle-js-oracledb][mle-js-oracledb] 10 | - MLE Bindings: [mle-js-bindings][mle-js-bindings] 11 | - MLE PL/SQL Types: [mle-js-plsqltypes][mle-js-plsqltypes] 12 | - MLE Fetch API polyfill: [mle-js-fetch][mle-js-fetch] 13 | - MLE Base64 Encoding: [mle-encode-base64][mle-encode-base64] 14 | - MLE Encodings: [mle-js-encodings][mle-js-encodings] 15 | - MLE Foreign Function Interface (FFI): [mle-js-plsql-ffi][mle-js-plsql-ffi] 16 | 17 | Apart from the modules shipping with the database listed above, you can optionally install modules from community repositories into the database after carefully vetting them with the relevant teams in your organisation. 18 | 19 | ## Installation 20 | 21 | This section details the both the installing and how to use the supplied typescript declarations in your Project. 22 | 23 | You need access to an Oracle Database 23ai system running either on Linux x86-64 or aarch64 to make use of the JavaScript modules provided in Oracle Database Multilingual Engine (MLE). Developers wishing to experiment with MLE can choose from cloud solutions such as Oracle's Always-Free Autonomous Database (Serverless) [see this blog article][2] or use the container images available from [container-registry.oracle.com](https://container-registry.oracle.com/ords/ocr/ba/database/free). You can find more details [described in this blog post][5]. 24 | 25 | The following sections describe how to use the Typescript declarations with your project. 26 | 27 | ### All-In-One Installation (recommended) 28 | 29 | You can install all relevant module declarations including the declarations of all global symbols (`Polyglot`, `console`, `session`, `soda`, `oracledb`, `OracleNumber`, etc.) in one bundle named `@types/mle-js` by using Node Package Manager (NPM) or a comparable tool: 30 | ```sh 31 | npm install --saveDev "https://github.com/oracle-samples/mle-modules#main" 32 | ``` 33 | 34 | ### Installing Individual Modules 35 | 36 | If you only need declarations of a particular module, you may also install declarations individually: 37 | 38 | ```sh 39 | npm --saveDev install mle-js-oracledb 40 | npm --saveDev install mle-js-bindings 41 | npm --saveDev install mle-js-plsqltypes 42 | npm --saveDev install mle-js-fetch 43 | npm --saveDev install mle-encode-base64 44 | npm --saveDev install mle-js-encodings 45 | npm --saveDev install mle-js-plsql-ffi 46 | ``` 47 | 48 | ## Documentation 49 | 50 | The following sections cover each declaration file's content, the module it documents, and what you can expect when referencing them in your code. 51 | 52 | ### All-In-One bundle for MLE modules (mle-js) 53 | 54 | This bundle contains all relevant declarations of predefined JavaScript modules that ship with the database plus the declarations of all global symbols. Most users should start with this file 55 | 56 | [Continue reading...][mle-js] 57 | 58 | ### MLE SQL Driver (mle-js-oracledb) 59 | 60 | You use the SQL Driver to interact with the database. You can perform any operation with the MLE SQL Driver that you would SQL and PL/SQL for. If you prefer a more JavaScript-like experience working with the Database API [see PL/SQL Packages and Types Reference][6] you should also have a look at the Foreign Function Interface (FFI) below. 61 | 62 | [Continue reading...][mle-js-oracledb] 63 | 64 | ### MLE Bindings for Oracle Database `DBMS_MLE` (mle-js-bindings) 65 | 66 | The MLE Bindings module can be used to exchange values between PL/SQL and JavaScript and is mostly used for Dynamic MLE Execution based on `DBMS_MLE`. 67 | The module also takes care of converting values from PL/SQL types to JavaScript types and vice-versa automatically as required. 68 | 69 | [Continue reading...][mle-js-bindings] 70 | 71 | ### MLE PL/SQL Types (mle-js-plsqltypes) 72 | 73 | MLE allows importing SQL values from PL/SQL as well as fetching them from a SQL statement. 74 | 75 | By default, SQL values are converted to JavaScript values during that process, e.g. an Oracle `NUMBER` is implicitly converted to a JavaScript `number`. 76 | Sometimes it is required to have JavaScript values that behave exactly as if they were SQL values. 77 | The `mle-js-plsqltypes` module contains JavaScript APIs for such JavaScript objects that wrap PL/SQL objects. 78 | 79 | [Continue reading...][mle-js-plsqltypes] 80 | 81 | ### MLE Fetch API polyfill (mle-js-fetch) 82 | 83 | MLE offers the following functionality to fetch and upload resources asynchronously across the network: fetch, Headers, Request, Response. 84 | In order to make the Fetch API available, it needs to be imported first. 85 | 86 | [Continue reading...][mle-js-fetch] 87 | 88 | ### MLE functions to work with base64 encoded data (mle-encode-base64) 89 | 90 | This module contains code to work with base64-encoded data. 91 | 92 | [Continue reading...][mle-encode-base64] 93 | 94 | ### MLE text encoding API (mle-js-encodings) 95 | 96 | This module is a partial implementation of the Encoding API. 97 | By default, TextDecoder and TextEncoder are available in the global namespace and can be used directly. 98 | 99 | [Continue reading...][mle-js-encodings] 100 | 101 | ### MLE Foreign Function Interface (FFI): API for calling PL/SQL functionality directly (mle-js-plsql-ffi) 102 | 103 | This module offers a simple, straight-forward way for interacting with PL/SQL code from within JavaScript. 104 | 105 | [Continue reading...][mle-js-plsql-ffi] 106 | 107 | ### Version Mapping 108 | 109 | The following table shows which version of module documentation and declarations work with which version of Oracle Database: 110 | 111 | | Oracle Database | Declarations | Documentation | 112 | | ---------------- | ------------ | ------------- | 113 | | 23ai | [@types/mle-js@23.8.0][mle-js-types-238] for Oracle 23.8
[mle-js@23.7.0][mle-js-types-237] for Oracle 23.7
[mle-js@23.6.0][mle-js-types-236] for Oracle 23.6
[mle-js@23.5.0][mle-js-types-235] for Oracle 23.5
[mle-js@23.4.0][mle-js-types-234] for Oracle 23.4
[mle-js@23.3.0][mle-js-types-233] for Oracle 23.3
[mle-js@23.2.0][mle-js-types-232] for Oracle 23.2 - Free | **[mle-js (23ai)][mle-js]**
[mle-js-oracledb (23ai)][mle-js-oracledb]
[mle-js-bindings (23ai)][mle-js-bindings]
[mle-js-plsqltypes (23ai)][mle-js-plsqltypes]
[mle-js-fetch (23ai)][mle-js-fetch]
[mle-encode-base64 (23ai)][mle-encode-base64]
[mle-js-encodings (23ai)][mle-js-encodings]
[mle-js-plsql-ffi (23ai)][mle-js-plsql-ffi]| 114 | | 21c | [mle-js@21.3.1][mle-js-types-213] | [mle-js-oracledb (21c)][mle-js-oracledb-21c]
[mle-js-bindings (21c)][mle-js-bindings-21c]
[mle-js-plsqltypes (21c)][mle-js-plsqltypes-21c] | 115 | 116 | ## Examples 117 | 118 | This section describes how to use the Typescript declarations with MLE/JavaScript as well as some interactive, ad-hoc JavaScript execution. 119 | 120 | ### Typescript 121 | 122 | Using the Typescript declarations you can create an MLE module as follows. 123 | 124 | ```typescript 125 | interface ISessionMetaData { 126 | username: string; 127 | oracleVersion: string; 128 | } 129 | 130 | /** 131 | * A simple JavaScript function fetches the username and database 132 | * release using the MLE JavaScript SQL driver. 133 | * 134 | * @returns an instance of ISessionMetaData 135 | */ 136 | export function sessionAndDBInfo(): ISessionMetaData { 137 | // instantiate the session meta data 138 | const mySession: ISessionMetaData = { 139 | username: "unknown", 140 | oracleVersion: "unknown", 141 | }; 142 | 143 | let sql = `select 144 | user`; 145 | 146 | let result = session.execute(sql, [], { outFormat: oracledb.OUT_FORMAT_OBJECT }); 147 | 148 | if (result.rows?.length === 1) { 149 | mySession.username = result.rows[0].USER; 150 | } 151 | 152 | sql = `select 153 | version_full 154 | from 155 | product_component_version`; 156 | 157 | result = session.execute(sql, [], { outFormat: oracledb.OUT_FORMAT_OBJECT }); 158 | 159 | if (result.rows?.length === 1) { 160 | mySession.oracleVersion = result.rows[0].VERSION_FULL; 161 | } 162 | 163 | return mySession; 164 | } 165 | ``` 166 | 167 | In the next step you need to transpile the Typescript code to JavaScript. The resulting file can be imported to the Oracle database. [SQL Command Line](https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/) provides a nice way to do that 168 | 169 | ``` 170 | $ sql /nolog 171 | 172 | SQLcl: Release 24.3 Production on Wed Jan 15 14:16:01 2025 173 | 174 | Copyright (c) 1982, 2025, Oracle. All rights reserved. 175 | 176 | SQL> connect app_user@localhost:5432/freepdb1 177 | Password? (**********?) *********** 178 | 179 | Connected. 180 | 181 | SQL> mle create-module -filename ./dist/demo.js -module-name demo_module 182 | MLE Module demo_module created 183 | ``` 184 | 185 | ### Ad-hoc execution 186 | 187 | The following snippet can be run in SQLcl, SQL*Plus, and Oracle SQL Developer Extension for Visual Studio Code. The invocation of the SQL code differs from the Typescript example by using the objects stored in the global scope. 188 | 189 | ```sql 190 | set serveroutput on; 191 | declare 192 | l_ctx dbms_mle.context_handle_t; 193 | l_source_code clob; 194 | begin 195 | -- Create execution context for MLE execution and provide an environment_ 196 | l_ctx := dbms_mle.create_context(); 197 | 198 | -- using q-quotes to avoid problems with unwanted string termination 199 | l_source_code := 200 | q'~ 201 | const result = session.execute( 202 | `select 'hello, world'`, 203 | [], 204 | { 205 | outFormat: oracledb.OUT_FORMAT_ARRAY 206 | } 207 | ); 208 | 209 | const message = result.rows[0][0]; 210 | console.log(message); 211 | ~'; 212 | dbms_mle.eval( 213 | context_handle => l_ctx, 214 | language_id => 'JAVASCRIPT', 215 | source => l_source_code 216 | ); 217 | 218 | dbms_mle.drop_context(l_ctx); 219 | exception 220 | when others then 221 | dbms_mle.drop_context(l_ctx); 222 | raise; 223 | end; 224 | / 225 | ``` 226 | 227 | ## Building and deploying larger JavaScript projects 228 | 229 | If you plan to use database-side JavaScript at a larger scale, we highly recommend to read our blog post on [Linting MLE JavaScript Modules in Continuous Integration Pipelines][4]. 230 | 231 | ## Changelog 232 | 233 | - **Oracle 23.8** 234 | - The all-in-one bundle package is now available also under the `@types` scope as `@types/mle-js` through installation directly from GitHub. 235 | - Added testing for TypeScript declarations and fixed a number of type bugs and inconsistencies. 236 | - **Oracle 23.7** 237 | - MLE Foreign Function Interface (FFI) for calling PL/SQL functionality directly from JavaScript: 238 | [mle-js-plsql-ffi](https://oracle-samples.github.io/mle-modules/docs/mle-js-plsql-ffi/23ai/) 239 | - support for setting the [fetchTypeHandler](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/classes/api.Parameters.html#fetchTypeHandler) 240 | in `mle-js-oracledb` / `session.execute` for custom handler functions during result fetching 241 | - **Oracle 23.6** 242 | - improved documentation for OracleNumber 243 | [infix operators](https://oracle-samples.github.io/mle-modules/docs/mle-js-plsqltypes/23ai/classes/OracleNumber.html). 244 | - **Oracle 23.5** 245 | - support for 246 | [sql-template-tag](https://www.npmjs.com/package/sql-template-tag#oracledb) 247 | in SQL execution in `mle-js-oracledb` / `session.execute` by allowing the 248 | first argument to be of new type 249 | [IExecuteArgs](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/interfaces/api.IExecuteArgs.html) 250 | - **Oracle 23.4 (first release of Oracle 23ai)** 251 | - support for VECTOR type (INT8ARRAY, FLOAT32ARRAY, FLOAT64, DB_TYPE_VECTOR) in 252 | [mle-js-oracledb](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/modules/api.html) 253 | and 254 | [mle-js-bindings](https://oracle-samples.github.io/mle-modules/docs/mle-js-bindings/23ai/enums/JSTypes.html) 255 | including new 256 | [vectorDimensions](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/interfaces/api.IMetaData.html#vectorDimensions) 257 | and 258 | [vectorFormat](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/interfaces/api.IMetaData.html#vectorFormat) 259 | meta data properties 260 | - support for binding collection types, including new properties 261 | [elementTypeClass](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/classes/api.IDbObjectClass.html#elementTypeClass) 262 | and 263 | [packageName](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/classes/api.IDbObjectClass.html#packageName) 264 | of `DBObjectClass` and 265 | [maxArraySize](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/interfaces/api.IBindObjectValue.html#maxArraySize) 266 | of bind definitions in `mle-js-oracledb`. 267 | - support for 268 | [keepInStmtCache](https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai/interfaces/api.IExecuteOptions.html#keepInStmtCache) 269 | option in SQL execution in `mle-js-oracledb` / `session.execute` 270 | 271 | ## Help 272 | 273 | If you have questions or change requests about MLE, please [create a ticket](./CONTRIBUTING.md) or contact [Oracle Support](https://support.oracle.com). Users of [Oracle Database 23ai Free](https://www.oracle.com/database/free/) can refer to the [Database Free forum](https://forums.oracle.com/ords/apexds/domain/dev-community/category/oracle-database-free). 274 | 275 | ## Contributing 276 | 277 | This project welcomes contributions from the community. 278 | Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md). 279 | 280 | ## Security 281 | 282 | Please consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process. 283 | 284 | ## License 285 | 286 | Copyright (c) 2022, 2025, Oracle and/or its affiliates. 287 | 288 | Released under the Universal Permissive License v1.0 as shown at . 289 | 290 | [mle-js]: https://oracle-samples.github.io/mle-modules/docs/mle-js/23ai "mle-js 23ai" 291 | [mle-js-oracledb]: https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/23ai "mle-js-oracledb 23ai" 292 | [mle-js-bindings]: https://oracle-samples.github.io/mle-modules/docs/mle-js-bindings/23ai "mle-js-bindings 23ai" 293 | [mle-js-plsqltypes]: https://oracle-samples.github.io/mle-modules/docs/mle-js-plsqltypes/23ai "mle-js-plsqltypes 23ai" 294 | [mle-js-fetch]: https://oracle-samples.github.io/mle-modules/docs/mle-js-fetch/23ai "mle-js-fetch 23ai" 295 | [mle-encode-base64]: https://oracle-samples.github.io/mle-modules/docs/mle-encode-base64/23ai "mle-encode-base64 23ai" 296 | [mle-js-encodings]: https://oracle-samples.github.io/mle-modules/docs/mle-js-encodings/23ai "mle-js-encodings 23ai" 297 | [mle-js-plsql-ffi]: https://oracle-samples.github.io/mle-modules/docs/mle-js-plsql-ffi/23ai "mle-js-plsql-ffi 23ai" 298 | [mle-js-oracledb-21c]: https://oracle-samples.github.io/mle-modules/docs/mle-js-oracledb/21c "mle-js-oracledb 21c" 299 | [mle-js-bindings-21c]: https://oracle-samples.github.io/mle-modules/docs/mle-js-bindings/21c "mle-js-bindings 21c" 300 | [mle-js-plsqltypes-21c]: https://oracle-samples.github.io/mle-modules/docs/mle-js-plsqltypes/21c "mle-js-plsqltypes 21c" 301 | [mle-js-types-238]: https://www.npmjs.com/package/mle-js/v/23.8.0 "mle-js@23.8.0" 302 | [mle-js-types-237]: https://www.npmjs.com/package/mle-js/v/23.7.0 "mle-js@23.7.0" 303 | [mle-js-types-236]: https://www.npmjs.com/package/mle-js/v/23.6.0 "mle-js@23.6.0" 304 | [mle-js-types-235]: https://www.npmjs.com/package/mle-js/v/23.5.0 "mle-js@23.5.0" 305 | [mle-js-types-234]: https://www.npmjs.com/package/mle-js/v/23.4.0 "mle-js@23.4.0" 306 | [mle-js-types-233]: https://www.npmjs.com/package/mle-js/v/23.3.0 "mle-js@23.3.0" 307 | [mle-js-types-232]: https://www.npmjs.com/package/mle-js/v/23.2.0 "mle-js@23.2.0" 308 | [mle-js-types-213]: https://www.npmjs.com/package/mle-js/v/21.3.1 "mle-js@21.3.1" 309 | [1]: https://docs.oracle.com/en/database/oracle/oracle-database/23/mlejs/index.html#Oracle%C2%AE-Database "Oracle Database JavaScript Developer's Guide" 310 | [2]: https://blogs.oracle.com/apex/post/mle-and-the-future-of-server-side-programming-in-oracle-apex "MLE and the Future of Server-Side Programming in Oracle APEX" 311 | [3]: https://docs.oracle.com/en/database/oracle/oracle-database "Oracle Database" 312 | [4]: https://blogs.oracle.com/developers/post/linting-mle-javascript-modules-in-continuous-integration-pipelines "JavaScript CI/CD blog" 313 | [5]: https://blogs.oracle.com/developers/post/fastpath-to-developing-with-oracle-application-express-and-multilingual-engine "Fast-path to developing with Oracle Application Express and Multilingual Engine" 314 | [6]: https://docs.oracle.com/en/database/oracle/oracle-database/23/arpls/index.html "Oracle Database PL/SQL Packages and Types Reference" 315 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting security vulnerabilities 2 | 3 | Oracle values the independent security research community and believes that 4 | responsible disclosure of security vulnerabilities helps us ensure the security 5 | and privacy of all our users. 6 | 7 | Please do NOT raise a GitHub Issue to report a security vulnerability. If you 8 | believe you have found a security vulnerability, please submit a report to 9 | [secalert_us@oracle.com][1] preferably with a proof of concept. Please review 10 | some additional information on [how to report security vulnerabilities to Oracle][2]. 11 | We encourage people who contact Oracle Security to use email encryption using 12 | [our encryption key][3]. 13 | 14 | We ask that you do not use other channels or contact the project maintainers 15 | directly. 16 | 17 | Non-vulnerability related security issues including ideas for new or improved 18 | security features are welcome on GitHub Issues. 19 | 20 | ## Security updates, alerts and bulletins 21 | 22 | Security updates will be released on a regular cadence. Many of our projects 23 | will typically release security fixes in conjunction with the 24 | Oracle Critical Patch Update program. Additional 25 | information, including past advisories, is available on our [security alerts][4] 26 | page. 27 | 28 | ## Security-related information 29 | 30 | We will provide security related information such as a threat model, considerations 31 | for secure use, or any known security issues in our documentation. Please note 32 | that labs and sample code are intended to demonstrate a concept and may not be 33 | sufficiently hardened for production use. 34 | 35 | [1]: mailto:secalert_us@oracle.com 36 | [2]: https://www.oracle.com/corporate/security-practices/assurance/vulnerability/reporting.html 37 | [3]: https://www.oracle.com/security-alerts/encryptionkey.html 38 | [4]: https://www.oracle.com/security-alerts/ 39 | -------------------------------------------------------------------------------- /THIRD_PARTY_LICENSES.txt: -------------------------------------------------------------------------------- 1 | Third Party Attributions for Code 2 | 3 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 4 | TypeDoc 0.23.28 TypeDoc Contributors 5 | (https://github.com/TypeStrong/typedoc/graphs/contributors) 6 | Apache 2.0 7 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 8 | 9 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 10 | Lunr.js 2.3.9 Oliver Nightingale 11 | (https://github.com/olivernn/lunr.js) 12 | MIT 13 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 14 | 15 | Apache License 16 | 17 | Version 2.0, January 2004 18 | 19 | http://www.apache.org/licenses/ 20 | 21 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 22 | 23 | 1. Definitions. 24 | 25 | "License" shall mean the terms and conditions for use, reproduction, and 26 | distribution as defined by Sections 1 through 9 of this document. 27 | 28 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 29 | owner that is granting the License. 30 | 31 | "Legal Entity" shall mean the union of the acting entity and all other entities 32 | that control, are controlled by, or are under common control with that entity. 33 | For the purposes of this definition, "control" means (i) the power, direct or 34 | indirect, to cause the direction or management of such entity, whether by 35 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 36 | outstanding shares, or (iii) beneficial ownership of such entity. 37 | 38 | "You" (or "Your") shall mean an individual or Legal Entity exercising 39 | permissions granted by this License. 40 | 41 | "Source" form shall mean the preferred form for making modifications, including 42 | but not limited to software source code, documentation source, and 43 | configuration files. 44 | 45 | "Object" form shall mean any form resulting from mechanical transformation or 46 | translation of a Source form, including but not limited to compiled object 47 | code, generated documentation, and conversions to other media types. 48 | 49 | "Work" shall mean the work of authorship, whether in Source or Object form, 50 | made available under the License, as indicated by a copyright notice that is 51 | included in or attached to the work (an example is provided in the Appendix 52 | below). 53 | 54 | "Derivative Works" shall mean any work, whether in Source or Object form, that 55 | is based on (or derived from) the Work and for which the editorial revisions, 56 | annotations, elaborations, or other modifications represent, as a whole, an 57 | original work of authorship. For the purposes of this License, Derivative Works 58 | shall not include works that remain separable from, or merely link (or bind by 59 | name) to the interfaces of, the Work and Derivative Works thereof. 60 | 61 | "Contribution" shall mean any work of authorship, including the original 62 | version of the Work and any modifications or additions to that Work or 63 | Derivative Works thereof, that is intentionally submitted to Licensor for 64 | inclusion in the Work by the copyright owner or by an individual or Legal 65 | Entity authorized to submit on behalf of the copyright owner. For the purposes 66 | of this definition, "submitted" means any form of electronic, verbal, or 67 | written communication sent to the Licensor or its representatives, including 68 | but not limited to communication on electronic mailing lists, source code 69 | control systems, and issue tracking systems that are managed by, or on behalf 70 | of, the Licensor for the purpose of discussing and improving the Work, but 71 | excluding communication that is conspicuously marked or otherwise designated in 72 | writing by the copyright owner as "Not a Contribution." 73 | 74 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 75 | of whom a Contribution has been received by Licensor and subsequently 76 | incorporated within the Work. 77 | 78 | 2. Grant of Copyright License. Subject to the terms and conditions of this 79 | License, each Contributor hereby grants to You a perpetual, worldwide, 80 | non-exclusive, no-charge, royalty-free, irrevocable copyright license to 81 | reproduce, prepare Derivative Works of, publicly display, publicly perform, 82 | sublicense, and distribute the Work and such Derivative Works in Source or 83 | Object form. 84 | 85 | 3. Grant of Patent License. Subject to the terms and conditions of this 86 | License, each Contributor hereby grants to You a perpetual, worldwide, 87 | non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this 88 | section) patent license to make, have made, use, offer to sell, sell, import, 89 | and otherwise transfer the Work, where such license applies only to those 90 | patent claims licensable by such Contributor that are necessarily infringed by 91 | their Contribution(s) alone or by combination of their Contribution(s) with the 92 | Work to which such Contribution(s) was submitted. If You institute patent 93 | litigation against any entity (including a cross-claim or counterclaim in a 94 | lawsuit) alleging that the Work or a Contribution incorporated within the Work 95 | constitutes direct or contributory patent infringement, then any patent 96 | licenses granted to You under this License for that Work shall terminate as of 97 | the date such litigation is filed. 98 | 99 | 4. Redistribution. You may reproduce and distribute copies of the Work or 100 | Derivative Works thereof in any medium, with or without modifications, and in 101 | Source or Object form, provided that You meet the following conditions: 102 | 103 | You must give any other recipients of the Work or Derivative Works a copy of 104 | this License; and 105 | 106 | You must cause any modified files to carry prominent notices stating that You 107 | changed the files; and 108 | 109 | You must retain, in the Source form of any Derivative Works that You 110 | distribute, all copyright, patent, trademark, and attribution notices from the 111 | Source form of the Work, excluding those notices that do not pertain to any 112 | part of the Derivative Works; and 113 | 114 | If the Work includes a "NOTICE" text file as part of its distribution, then any 115 | Derivative Works that You distribute must include a readable copy of the 116 | attribution notices contained within such NOTICE file, excluding those notices 117 | that do not pertain to any part of the Derivative Works, in at least one of the 118 | following places: within a NOTICE text file distributed as part of the 119 | Derivative Works; within the Source form or documentation, if provided along 120 | with the Derivative Works; or, within a display generated by the Derivative 121 | Works, if and wherever such third-party notices normally appear. The contents 122 | of the NOTICE file are for informational purposes only and do not modify the 123 | License. You may add Your own attribution notices within Derivative Works that 124 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 125 | provided that such additional attribution notices cannot be construed as 126 | modifying the License. You may add Your own copyright statement to Your 127 | modifications and may provide additional or different license terms and 128 | conditions for use, reproduction, or distribution of Your modifications, or for 129 | any such Derivative Works as a whole, provided Your use, reproduction, and 130 | distribution of the Work otherwise complies with the conditions stated in this 131 | License. 132 | 133 | 5. Submission of Contributions. Unless You explicitly state otherwise, any 134 | Contribution intentionally submitted for inclusion in the Work by You to the 135 | Licensor shall be under the terms and conditions of this License, without any 136 | additional terms or conditions. Notwithstanding the above, nothing herein shall 137 | supersede or modify the terms of any separate license agreement you may have 138 | executed with Licensor regarding such Contributions. 139 | 140 | 6. Trademarks. This License does not grant permission to use the trade names, 141 | trademarks, service marks, or product names of the Licensor, except as required 142 | for reasonable and customary use in describing the origin of the Work and 143 | reproducing the content of the NOTICE file. 144 | 145 | 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in 146 | writing, Licensor provides the Work (and each Contributor provides its 147 | Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 148 | KIND, either express or implied, including, without limitation, any warranties 149 | or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any risks 152 | associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, whether in 155 | tort (including negligence), contract, or otherwise, unless required by 156 | applicable law (such as deliberate and grossly negligent acts) or agreed to in 157 | writing, shall any Contributor be liable to You for damages, including any 158 | direct, indirect, special, incidental, or consequential damages of any 159 | character arising as a result of this License or out of the use or inability to 160 | use the Work (including but not limited to damages for loss of goodwill, work 161 | stoppage, computer failure or malfunction, or any and all other commercial 162 | damages or losses), even if such Contributor has been advised of the 163 | possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing the Work or 166 | Derivative Works thereof, You may choose to offer, and charge a fee for, 167 | acceptance of support, warranty, indemnity, or other liability obligations 168 | and/or rights consistent with this License. However, in accepting such 169 | obligations, You may act only on Your own behalf and on Your sole 170 | responsibility, not on behalf of any other Contributor, and only if You agree 171 | to indemnify, defend, and hold each Contributor harmless for any liability 172 | incurred by, or claims asserted against, such Contributor by reason of your 173 | accepting any such warranty or additional liability. 174 | 175 | END OF TERMS AND CONDITIONS 176 | 177 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 178 | 179 | MIT License 180 | 181 | Copyright (C) 2013 by Oliver Nightingale 182 | 183 | Permission is hereby granted, free of charge, to any person obtaining a copy 184 | of this software and associated documentation files (the "Software"), to deal 185 | in the Software without restriction, including without limitation the rights 186 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 187 | copies of the Software, and to permit persons to whom the Software is 188 | furnished to do so, subject to the following conditions: 189 | 190 | The above copyright notice and this permission notice shall be included in 191 | all copies or substantial portions of the Software. 192 | 193 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 194 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 195 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 196 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 197 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 198 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 199 | THE SOFTWARE. 200 | -------------------------------------------------------------------------------- /declarations/mle-encode-base64/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | -------------------------------------------------------------------------------- /declarations/mle-encode-base64/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-encode-base64/mle-encode-base64.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | /** 39 | * Encode a string or a byte buffer into base64. 40 | 41 | * The function converts the characters to bytes as if they were ASCII encoded. 42 | * Convert the data to an ArrayBuffer first if you need to convert strings with 43 | * characters outside the ASCII alphabet. 44 | * 45 | * @throws Error if the input string contains a character outside of ASCII 46 | * @return a string with base64-encoded data 47 | * 48 | * @since Oracle 23.3 49 | */ 50 | export declare function encode(input: string | ArrayBuffer | Uint8Array): string; 51 | /** 52 | * Decode a base64 encoded string. 53 | * 54 | * @throws Error if the input contains characters outside base64 alphabet or is otherwise invalid. 55 | * @return a byte array with the decoded data. 56 | * 57 | * @since Oracle 23.3 58 | */ 59 | export declare function decode(input: string): ArrayBuffer; 60 | -------------------------------------------------------------------------------- /declarations/mle-encode-base64/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-encode-base64", 3 | "description": "MLE functions to work with base64 encoded data", 4 | "types": "mle-encode-base64.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js-bindings/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /declarations/mle-js-bindings/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-js-bindings/mle-js-bindings.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2019, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | export declare enum JSTypes { 39 | /** Type String */ 40 | STRING = 0, 41 | /** Type Number */ 42 | NUMBER = 1, 43 | /** Type Date */ 44 | DATE = 2, 45 | /** Type Boolean */ 46 | BOOLEAN = 3, 47 | /** 48 | * In 21c, indices 4 and 5 had been used for BLOB and CLOB which do, however, 49 | * not make sense for mle-js-oracledb and have therefore been removed in 23ai. 50 | */ 51 | /** Type Object */ 52 | OBJECT = 6, 53 | /** UINT8ARRAY */ 54 | UINT8ARRAY = 7, 55 | /** Type OracleNumber */ 56 | ORACLE_NUMBER = 8, 57 | /** Type OracleDate */ 58 | ORACLE_DATE = 9, 59 | /** Type OracleTimeStamp */ 60 | ORACLE_TIMESTAMP = 10, 61 | /** Type OracleTimeStampTZ */ 62 | ORACLE_TIMESTAMP_TZ = 11, 63 | /** Type OracleIntervalYearToMonth */ 64 | ORACLE_INTERVAL_YM = 12, 65 | /** Type OracleIntervalDayToSecond */ 66 | ORACLE_INTERVAL_DS = 13, 67 | /** Type OracleCLOB */ 68 | ORACLE_CLOB = 14, 69 | /** Type OracleBLOB */ 70 | ORACLE_BLOB = 15, 71 | /** Type DbTypeJson */ 72 | DB_TYPE_JSON = 16, 73 | /** 74 | * Type Int8Array 75 | * 76 | * @since Oracle 23.4 77 | */ 78 | INT8ARRAY = 17, 79 | /** 80 | * Type Float32Array 81 | * 82 | * @since Oracle 23.4 83 | */ 84 | FLOAT32ARRAY = 18, 85 | /** 86 | * Type Float64Array 87 | * 88 | * @since Oracle 23.4 89 | */ 90 | FLOAT64ARRAY = 19 91 | } 92 | /** 93 | * Import a value exported from PL/SQL into the current context 94 | * 95 | * Import the value, identified by the given name, that was previously exported 96 | * from PL/SQL. 97 | * The desired result type can be specified explicitly with the jstype parameter. 98 | * If no result type is specified, the default PL/SQL-to-JavaScript mapping is 99 | * used to determine the result type implicitly. 100 | * 101 | * @param name Name of the property to be retrieved. Cannot be null, undefined or empty. 102 | * @param jstype JavaScript type of the result. 103 | * @return a JavaScript value of the desired type. Returns undefined if the 104 | * property does not exist. 105 | * @throws an exception (Invalid property name) if name is null, undefined or empty. 106 | */ 107 | export declare function importValue(name: string, jstype?: JSTypes): any; 108 | /** 109 | * Export a value to PL/SQL 110 | * 111 | * Export the given value to PL/SQL. 112 | * The exported value can be imported into PL/SQL using the given name. 113 | * 114 | * @param name Name of the property to be exported. Cannot be null, undefined or empty. 115 | * @param value Value of the property to be exported. 116 | * @throws an exception (Invalid property name) if name is null, undefined or empty. 117 | */ 118 | export declare function exportValue(name: string, value: any): void; 119 | -------------------------------------------------------------------------------- /declarations/mle-js-bindings/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-bindings", 3 | "description": "MLE Bindings for Oracle Database DBMS_MLE", 4 | "types": "mle-js-bindings.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js-encodings/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | -------------------------------------------------------------------------------- /declarations/mle-js-encodings/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-js-encodings/decoder.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2023, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | interface TextDecoderCommon { 39 | readonly encoding: string; 40 | readonly fatal: boolean; 41 | readonly ignoreBOM: boolean; 42 | } 43 | /** 44 | * Options given to the constructor of TextDecoder. 45 | */ 46 | export type TextDecoderOptions = { 47 | /** 48 | * Controls the error mode of the decoder. 49 | * If set to true an exception is thrown on invalid byte sequences. 50 | * Otherwise, the replacement code point will be used. 51 | * Default: false. 52 | */ 53 | fatal?: boolean; 54 | /** 55 | * Controls whether the BOM (Byte Order Mark) should be checked. 56 | * If set to true the BOM will not be checked/removed. 57 | * Default: false. 58 | */ 59 | ignoreBOM?: boolean; 60 | }; 61 | /** 62 | * Options given to decode. 63 | */ 64 | export type TextDecodeOptions = { 65 | /** 66 | * Controls whether the IO queue should be flushed between calls. 67 | * If set to true the corresponding TextDecoder instance may retain state from the previous call. 68 | * Used for decoding text in chunks. 69 | * Default: false. 70 | */ 71 | stream?: boolean; 72 | }; 73 | export type AllowSharedBufferSource = ArrayBuffer | SharedArrayBuffer | ArrayBufferView; 74 | /** 75 | * TextDecoder represents a decoder for specific text encoding, such UTF-8, UTF-16, etc. 76 | * A decoder takes as input bytes and returns as output code points. 77 | */ 78 | export declare class TextDecoder implements TextDecoderCommon { 79 | #private; 80 | /** 81 | * The name of the decoder that will be used. 82 | */ 83 | readonly encoding: string; 84 | /** 85 | * Error mode can be either be 'replacement' (replace code point) or 'fatal' (throw exception), 86 | */ 87 | readonly fatal: boolean; 88 | /** 89 | * Whether the byte order mark will be ignored. 90 | */ 91 | readonly ignoreBOM: boolean; 92 | /** 93 | * Create a new TextDecoder instance. 94 | * Currently, the following encodings are supported: utf-8, utf-16be, 95 | * utf-16le, utf-16 (alias to utf-16le). 96 | * @param label the name of the encoding to be used when decoding. Default: 'utf-8'. 97 | * @param options the decoder options (an object with properties fatal and ignoreBOM). 98 | */ 99 | constructor(label?: string, options?: TextDecoderOptions); 100 | /** 101 | * Decodes the given bytes with the method given in encoding. 102 | * @param input the bytes to decode, given as an ArrayBuffer or ArrayBufferView. 103 | * @param options object with the stream property. stream specifies whether data will follow in subsequent calls. 104 | * Should be set to true if processing data in chunks. 105 | */ 106 | decode(input?: AllowSharedBufferSource, options?: TextDecodeOptions): string; 107 | } 108 | export {}; 109 | -------------------------------------------------------------------------------- /declarations/mle-js-encodings/encoder.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2023, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | interface TextEncoderCommon { 39 | readonly encoding: string; 40 | } 41 | /** 42 | * The object returned by encodeInto. 43 | * It reports on the progress of the encoder. 44 | */ 45 | export type TextEncoderEncodeIntoResult = { 46 | /** The number of UTF-16 *code points* that were read. */ 47 | read: number; 48 | /** The number of bytes written to the given buffer. */ 49 | written: number; 50 | }; 51 | /** 52 | * TextEncoder takes code points and returns UTF-8 bytes. 53 | */ 54 | export declare class TextEncoder implements TextEncoderCommon { 55 | /** 56 | * Always returns 'utf-8'. 57 | */ 58 | readonly encoding = "utf-8"; 59 | /** 60 | * Create a new instance of TextEncoder. 61 | */ 62 | constructor(); 63 | /** 64 | * Encode the given string into a byte array. 65 | * 66 | * @param input the string to encode. 67 | */ 68 | encode(input?: string): Uint8Array; 69 | /** 70 | * Encode the given string and store the results in the given buffer. 71 | * 72 | * @param input the string to encode. 73 | * @param destination the buffer where the encoded string should be stored. 74 | * @returns an object describing the progress made in this call (code points read and bytes written). 75 | */ 76 | encodeInto(input: string, destination: Uint8Array): TextEncoderEncodeIntoResult; 77 | } 78 | export {}; 79 | -------------------------------------------------------------------------------- /declarations/mle-js-encodings/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2023, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { TextEncoder } from './encoder'; 39 | import { TextDecoder } from './decoder'; 40 | export { TextEncoder, TextDecoder }; 41 | -------------------------------------------------------------------------------- /declarations/mle-js-encodings/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-encodings", 3 | "description": "MLE text encoding API", 4 | "types": "index.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js-fetch/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2022, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/body.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { IBufferWrapper } from './common'; 39 | /** 40 | * Type alias for the types the body can be 41 | * 42 | * @since Oracle 23.3 43 | */ 44 | export type BodyType = IBufferWrapper | ArrayBuffer | string | null; 45 | export declare class Body { 46 | #private; 47 | /** 48 | * Check if the contents of the body have been consumed. 49 | */ 50 | get bodyUsed(): boolean; 51 | /** 52 | * Retrieve the contents of the body. 53 | */ 54 | get body(): BodyType; 55 | constructor(body?: BodyType | Body); 56 | /** 57 | * Consume the contents of the body as JSON. 58 | */ 59 | json(): Promise; 60 | /** 61 | * Consume the contents of the body as text. 62 | */ 63 | text(): Promise; 64 | arrayBuffer(): Promise; 65 | /** 66 | * Unsupported operation (keep protected until implemented) 67 | */ 68 | protected blob(): void; 69 | /** 70 | * Unsupported operation (keep protected until implemented) 71 | */ 72 | protected formData(): void; 73 | protected _cloneBodyContent(): BodyType; 74 | } 75 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/common.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2023, 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | /** 39 | * Interface to represent types that provide a view into an ArrayBuffer e.g. DataView 40 | * 41 | * @since Oracle 23.3 42 | */ 43 | export interface IBufferWrapper { 44 | buffer: ArrayBuffer; 45 | } 46 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/fetch.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { RequestInit, RequestInfo } from './request'; 39 | import { Response } from './response'; 40 | /** 41 | * Make a request to the specified resource. 42 | * 43 | * If there is a field line that is longer than 8192 bytes in the response 44 | * received, a TypeError is thrown. 45 | * 46 | * @param input a path to the resource or a {@link Request} object that configures the retrieval 47 | * @param init additional configuration for the retrieval 48 | * @returns a {@link Response} that contains the result of resource retrieval 49 | */ 50 | export declare function fetch(input: RequestInfo, init?: RequestInit): Promise; 51 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/headers.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | export type HeadersInit = string[][] | Record | Headers; 39 | export declare class Headers { 40 | #private; 41 | /** 42 | * Create a new instance given initial header values. 43 | * @param init initial header values 44 | */ 45 | constructor(init?: HeadersInit); 46 | /** 47 | * Retrieve a list of header values 48 | * @param key the name of the header 49 | * @returns a comma-separated list of values 50 | */ 51 | get(key: string): string | null; 52 | /** 53 | * Set or override the header value 54 | * Both the key and the value have a limit of 32767 bytes 55 | * @param key the name of the header 56 | * @param value the new value 57 | */ 58 | set(key: string, value: string): void; 59 | /** 60 | * Add a value to the list corresponding to a header 61 | * @param key the name of the header 62 | * @param value the value to add 63 | */ 64 | append(key: string, value: string): void; 65 | /** 66 | * Check if a value of a header has been set 67 | * @param name the name of the header 68 | * @returns true if the header has been set, false otherwise 69 | */ 70 | has(name: string): boolean; 71 | /** 72 | * Remove all values for a header 73 | * @param name the name of the header 74 | */ 75 | delete(name: string): void; 76 | keys(): Generator; 77 | values(): Generator; 78 | entries(): Generator<[string, string | null]>; 79 | forEach(func: (value: unknown, key: unknown, object: unknown) => void, thisValue?: unknown): void; 80 | } 81 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { fetch } from './fetch'; 39 | import { Headers } from './headers'; 40 | import { Request } from './request'; 41 | import { Response } from './response'; 42 | export { fetch, Headers, Request, Response }; 43 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-fetch", 3 | "description": "MLE Fetch API polyfill", 4 | "types": "index.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js-fetch/request.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { Body, BodyType } from './body'; 39 | import { Headers, HeadersInit } from './headers'; 40 | export type RequestInfo = Request | string; 41 | export interface RequestInit { 42 | method?: string; 43 | body?: BodyType; 44 | headers?: HeadersInit; 45 | credentials?: string; 46 | } 47 | /** 48 | * Configures the way a resource is retrieved. 49 | */ 50 | export declare class Request extends Body { 51 | readonly method: string; 52 | readonly url: string | null; 53 | readonly headers: Headers; 54 | credentials: string; 55 | /** 56 | * Create a new retrieval request. 57 | * 58 | * @param input a path to the resource to retrieve or a {@link Request} object to copy 59 | * @param init additional configuration of the retrieval 60 | */ 61 | constructor(input: RequestInfo, init?: RequestInit); 62 | /** 63 | * Create a deep copy of this request. 64 | */ 65 | clone(): Request; 66 | } 67 | -------------------------------------------------------------------------------- /declarations/mle-js-fetch/response.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { Body, BodyType } from './body'; 39 | import { Headers } from './headers'; 40 | export type ResponseType = 'basic' | 'cors' | 'default' | 'error' | 'opaque' | 'opaqueredirect'; 41 | export interface ResponseInit { 42 | status?: number; 43 | statusText?: string; 44 | headers?: Headers; 45 | } 46 | /** 47 | * The result of a resource retrieval. 48 | */ 49 | export declare class Response extends Body { 50 | #private; 51 | readonly url: string | null; 52 | readonly statusText: string; 53 | readonly headers: Headers; 54 | /** 55 | * Create a new retrieval result 56 | * 57 | * @param body the body of the result 58 | * @param init additional metadata on the result of the retrieval 59 | */ 60 | constructor(body?: BodyType, init?: ResponseInit); 61 | /** 62 | * Create a new response that represents a network error. 63 | */ 64 | static error(): Response; 65 | /** 66 | * Create a new response, whose body is JSON-encoded data 67 | * @param data JSON-encoded body of the response 68 | * @param init additional response metadata 69 | */ 70 | static json(data: any, init?: ResponseInit): Response; 71 | /** 72 | * Get the {@link ResponseType} type of the response. 73 | */ 74 | get type(): ResponseType; 75 | /** 76 | * Get the HTTP status code, e.g. 200 77 | */ 78 | get status(): number; 79 | /** 80 | * Check if this response is a result of a successful request. 81 | */ 82 | get ok(): boolean; 83 | /** 84 | * Create a deep copy of this response. 85 | */ 86 | clone(): Response; 87 | } 88 | -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/api.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2019, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { ISodaDatabase } from './soda-api'; 39 | /** 40 | * Custom class for errors thrown by {@link execute}() or {@link executeMany}(). 41 | */ 42 | export interface IError extends Error { 43 | /** 44 | * The Oracle error number. This value is undefined for non-Oracle errors. 45 | */ 46 | errorNum?: number; 47 | /** 48 | * The character offset into the SQL text that resulted in the Oracle 49 | * error. The value may be 0 in non-SQL contexts. This value is undefined 50 | * for non-Oracle errors. 51 | */ 52 | offset?: number; 53 | } 54 | /** 55 | * Interface for representing entries in {@link IFetchInfo}. See 56 | * https://github.com/oracle/node-oracledb/blob/v3.1.0/doc/api.md#propexecfetchinfo 57 | * for further information. 58 | */ 59 | export interface IFetchInfoColumnSpec { 60 | /** 61 | * The JavaScript data type to be fetched. One of the mle-js-oracledb JS 62 | * Type Constants. 63 | */ 64 | type: JsType; 65 | } 66 | /** 67 | * Interface for representing {@link fetchInfo} in {@link execute}(). 68 | */ 69 | export interface IFetchInfo { 70 | [columnName: string]: IFetchInfoColumnSpec; 71 | } 72 | /** 73 | * Interface for options used in {@link execute}(). 74 | */ 75 | export interface IExecuteOptions { 76 | /** 77 | * Overrides parameters.{@link extendedMetaData}. 78 | */ 79 | extendedMetaData?: boolean; 80 | /** 81 | * Overrides parameters.{@link fetchArraySize}. 82 | */ 83 | fetchArraySize?: number; 84 | /** 85 | * Object defining how query column data should be represented in 86 | * JavaScript. It can be used in conjunction with, or instead of, the global 87 | * settings parameters.{@link fetchAsString}, parameters.{@link 88 | * fetchAsPlsqlWrapper}, and parameters.{@link fetchAsUint8Array}. See 89 | * https://github.com/oracle/node-oracledb/blob/v3.1.0/doc/api.md#--42634-fetchinfo 90 | * for further information. 91 | */ 92 | fetchInfo?: IFetchInfo; 93 | /** 94 | * Overrides parameters.{@link maxRows}. 95 | */ 96 | maxRows?: number; 97 | /** 98 | * Overrides parameters.{@link outFormat}. 99 | */ 100 | outFormat?: OutFormatType; 101 | /** 102 | * Determines whether query results should be returned as a {@link 103 | * IResultSet} object or directly. The default is false. 104 | */ 105 | resultSet?: boolean; 106 | /** 107 | * When keepInStmtCache is true, and statement caching is enabled, 108 | * then the statement will be added to the cache if it is not already present. 109 | * This helps the performance of re-executed statements. 110 | * 111 | * The default value is true. 112 | * 113 | * @since Oracle 23.4 114 | */ 115 | keepInStmtCache?: boolean; 116 | /** 117 | * Overrides parameters.{@link fetchTypeHandler}. 118 | * 119 | * @since Oracle 23.7 120 | */ 121 | fetchTypeHandler?: FetchTypeHandler; 122 | } 123 | /** 124 | * Interface for representing an entry in {@link IObjectBindDefs} or {@link ArrayBindDefs}. 125 | */ 126 | export interface IBindDef { 127 | /** 128 | * The direction of the bind. One of the Execute Bind Direction Constants 129 | * {@link BIND_IN}, {@link BIND_INOUT}, or {@link BIND_OUT}. The default is 130 | * {@link BIND_IN}. 131 | */ 132 | dir: number; 133 | /** 134 | * The maximum number of bytes that an OUT or INOUT bind variable of type 135 | * {@link STRING} or {@link UINT8ARRAY} can use to get data. The default 136 | * value is 200. The maximum limit depends on the database type. When 137 | * binding INOUT, maxSize refers to the size of the returned value. 138 | * The input value can be smaller or bigger. For IN binds, maxSize is 139 | * ignored. When data is being returned from the database, maxSize must be 140 | * at least the size of the longest value. If maxSize is too small, an error 141 | * gets thrown. 142 | */ 143 | maxSize?: number; 144 | /** 145 | * The JavaScript data type to be bound. One of the mle-js-oracledb JS 146 | * Constants; when binding ADTs, a type descriptor or the fully-qualified 147 | * name (FQN) of the type is also accepted. 148 | * With IN or INOUT binds the type can be explicitly set with 149 | * type or it will default to the type of the input data value. With OUT 150 | * binds, the type defaults to {@link STRING} whenever type is not 151 | * specified. 152 | */ 153 | type: JsType | string | IDbObjectClass; 154 | } 155 | /** 156 | * Interface for Object BindDefs. 157 | */ 158 | export interface IObjectBindDefs { 159 | [bindName: string]: IBindDef; 160 | } 161 | /** 162 | * Interface for Array BindDefs. 163 | */ 164 | export type ArrayBindDefs = IBindDef[]; 165 | /** 166 | * Interface for BindDefs which are either Array- or Object BindDefs. 167 | */ 168 | export type ExecuteManyBindDefs = IObjectBindDefs | ArrayBindDefs; 169 | /** 170 | * Interface for the options used in {@link executeMany}(). 171 | */ 172 | export interface IExecuteManyOptions { 173 | /** 174 | * The bindDefs object defines the bind variable types, sizes and 175 | * directions. This object is optional, but makes execution more efficient 176 | * if set explicitly. 177 | * 178 | * It must be an array (see {@link ArrayBindDefs}) or an object (see 179 | * {@link IObjectBindDefs}), depending on the structure of the binds 180 | * parameter. 181 | * 182 | * Each value in the bindDefs array or object must be an object containing 183 | * the keys dir, maxSize, and type for each bind variable, similar to how 184 | * {@link execute} bind parameters are defined (see {@link IBindDef}). 185 | */ 186 | bindDefs?: ExecuteManyBindDefs; 187 | dmlRowCounts?: boolean; 188 | /** 189 | * When keepInStmtCache is true, and statement caching is enabled, 190 | * then the statement will be added to the cache if it is not already present. 191 | * This helps the performance of re-executed statements. 192 | * 193 | * The default value is true. 194 | * 195 | * @since Oracle 23.4 196 | */ 197 | keepInStmtCache?: boolean; 198 | } 199 | /** 200 | * Interface representing metadata as used in {@link IResultSet}s and statement info. 201 | */ 202 | export interface IMetaData { 203 | /** 204 | * The column name follows Oracle’s standard name-casing rules. It will commonly be uppercase 205 | * since most applications create tables using unquoted, case-insensitive names. 206 | */ 207 | name: string; 208 | /** 209 | * One of the mle-js-oracledb JS Type Constants. 210 | */ 211 | fetchType?: JsType; 212 | /** 213 | * One of the mle-js-oracledb Database Type Constants, see {@link DbType}. 214 | */ 215 | dbType?: number; 216 | /** 217 | * The class associated with the database type. 218 | * This is only set if the database type is an object type. 219 | * 220 | * @since Oracle 23.7 221 | */ 222 | dbTypeClass?: IDbObjectClass; 223 | /** 224 | * Database byte size. This is only set for {@link DB_TYPE_VARCHAR}, {@link 225 | * DB_TYPE_CHAR} and {@link DB_TYPE_RAW} column types. 226 | */ 227 | byteSize?: number; 228 | /** 229 | * Set only for {@link DB_TYPE_NUMBER}, {@link DB_TYPE_TIMESTAMP}, {@link 230 | * DB_TYPE_TIMESTAMP_TZ} and {@link DB_TYPE_TIMESTAMP_LTZ} columns. 231 | */ 232 | precision?: number; 233 | /** 234 | * Set only for {@link DB_TYPE_NUMBER} columns. 235 | */ 236 | scale?: number; 237 | /** 238 | * Indicates whether NULL values are permitted for this column. 239 | */ 240 | nullable?: boolean; 241 | /** 242 | * Name of the database type, such as “NUMBER” or “VARCHAR2”. 243 | */ 244 | dbTypeName?: string; 245 | /** 246 | * Number of Dimensions in vector. 247 | * 248 | * @since Oracle 23.4 249 | */ 250 | vectorDimensions?: number; 251 | /** 252 | * Storage type of elements in vector. 253 | * 254 | * @since Oracle 23.4 255 | */ 256 | vectorFormat?: number; 257 | } 258 | /** 259 | * Interface for representing result sets as returned by {@link execute}(). 260 | */ 261 | export declare abstract class IResultSet { 262 | /** 263 | * Contains an array of objects with metadata about the query. 264 | * 265 | * Each column's name is always given. If {@link extendedMetaData} is true, 266 | * additional information is included. 267 | */ 268 | readonly metaData: IMetaData[]; 269 | /** 270 | * Closes a result set. 271 | * 272 | * Applications must always call this at the end of fetch or when no more rows are needed. 273 | * 274 | * It must also be called if no rows will ever be fetched from the result set. 275 | */ 276 | abstract close(): any; 277 | /** 278 | * This call fetches one row of the result set as an object or an array of 279 | * column values, depending on the value of outFormat. 280 | * 281 | * At the end of fetching, the result set must be freed by calling {@link close}(). 282 | * 283 | * Performance of getRow() can be tuned by adjusting the value of 284 | * {@link fetchArraySize}. 285 | */ 286 | abstract getRow(): any; 287 | /** 288 | * This call fetches numRows rows of the result set as an object or an array of 289 | * column values, depending on the value of outFormat. 290 | * 291 | * @param numRows specifies the number of rows to be returned. 292 | * the default value of numRows is 0 and it returns all rows. 293 | * 294 | * At the end of fetching, the result set must be freed by calling {@link close}(). 295 | * 296 | * Performance of getRows() can be tuned by adjusting the value of 297 | * {@link fetchArraySize}. 298 | */ 299 | abstract getRows(numRows: number): any[]; 300 | /** 301 | * Convenience function for getting an iterator of this IResultSet. 302 | * 303 | * This is equivalent to calling rs[Symbol.iterator](). 304 | * 305 | * @returns an iterator over the rows of this IResultSet. 306 | * 307 | * @throws {@link IError} if the result set has already been closed 308 | * @throws {@link IError} if the result set is already being iterated over 309 | */ 310 | abstract iterator(): IterableIterator; 311 | /** 312 | * This function defines the default iterator for a result set that can be 313 | * used to iterate over its rows. Using the default iterator, a result set 314 | * can be iterated over using the for..of construct. 315 | * 316 | * @throws {@link IError} if the result set has already been closed 317 | * @throws {@link IError} if the result set is already being iterated over 318 | * 319 | */ 320 | abstract [Symbol.iterator](): IterableIterator; 321 | } 322 | /** 323 | * Interface for the result of {@link execute}(). 324 | */ 325 | export interface IExecuteReturn { 326 | /** 327 | * For SELECT statements, this contains an array of objects describing 328 | * details of columns for the select list. For non queries, this property is 329 | * undefined. 330 | */ 331 | metaData?: IMetaData[]; 332 | /** 333 | * This contains the output values of OUT and IN OUT binds. If bindParams is 334 | * passed as an array, then outBinds is returned as an array. If bindParams 335 | * is passed as an object, then outBinds is returned as an object. If there 336 | * are no OUT or IN OUT binds, the value is undefined. 337 | */ 338 | outBinds?: Record | any[] | any; 339 | /** 340 | * For SELECT statements when the {@link resultSet} option is true, use the 341 | * resultSet object to fetch rows. See {@link IResultSet}. 342 | * 343 | * When using this option, resultSet.{@link close}() must be called when the 344 | * result set is no longer needed. This is true whether or not rows have 345 | * been fetched. 346 | */ 347 | resultSet?: IResultSet; 348 | /** 349 | * For SELECT statements using direct fetches, rows contains an array of 350 | * fetched rows. It will be NULL if there is an error or the SQL statement 351 | * was not a SELECT statement. By default, the rows are in an array of 352 | * objects, but this can be changed to arrays of column value arrays by 353 | * setting outFormat to oracledb.{@link OUT_FORMAT_ARRAY}. If a single row 354 | * is fetched, then rows is an array that contains one single object. 355 | * 356 | * The number of rows returned is limited by parameters.{@link maxRows} or 357 | * the {@link maxRows} option in an {@link execute}() call. If maxRows is 0, 358 | * then the number of rows is limited by memory constraints. 359 | */ 360 | rows?: any[]; 361 | /** 362 | * For DML statements (including SELECT FOR UPDATE) this contains the number 363 | * of rows affected, for example the number of rows inserted. For non-DML 364 | * statements such as queries and PL/SQL statements, rowsAffected is 365 | * undefined. 366 | */ 367 | rowsAffected?: number; 368 | } 369 | /** 370 | * Interface for the result of {@link executeMany}(). 371 | */ 372 | export interface IExecuteManyReturn { 373 | /** 374 | * This contains the value of any returned IN OUT or OUT binds. It is an 375 | * array of arrays, or an array of objects, depending on the {@link binds} 376 | * parameters structure. The length of the array will correspond to the 377 | * length of the array passed as the binds parameter. It will be present 378 | * only if there is at least one OUT bind variable identified. 379 | */ 380 | outBinds?: (Record | any[] | any)[]; 381 | /** 382 | * This is an integer identifying the total number of database rows affected 383 | * by the processing of all records of the binds parameter. It is only 384 | * present if a DML statement was executed. 385 | */ 386 | rowsAffected?: number; 387 | } 388 | /** 389 | * Interface for object binds in {@link execute}(). 390 | */ 391 | export interface IBindObjectValue extends IBindDef { 392 | /** 393 | * The number of array elements to be allocated for a PL/SQL Collection 394 | * INDEX BY associative array OUT or IN OUT array bind variable. For IN 395 | * binds, the value of maxArraySize is ignored. 396 | * 397 | * @since Oracle 23.4 398 | */ 399 | maxArraySize?: number; 400 | /** 401 | * The input value or variable to be used for an IN or INOUT bind variable. 402 | */ 403 | val: any; 404 | } 405 | /** 406 | * Interface for a single bind parameter as used in {@link execute}(). Can 407 | * either be a bind object or a scalar value. 408 | */ 409 | export type BindValue = IBindObjectValue | object | number | string | boolean | null | undefined; 410 | /** 411 | * Interface for object binds (also called "named binds"). 412 | */ 413 | export interface INamedBinds { 414 | [bindName: string]: BindValue; 415 | } 416 | /** 417 | * Interface for array binds. 418 | */ 419 | export type PosBinds = BindValue[]; 420 | /** 421 | * Interface for the collection of bind parameters in {@link execute}(). Can 422 | * either be an object ({@link INamedBinds}) or an array ({@link PosBinds}) of 423 | * values. 424 | */ 425 | export type BindParameters = INamedBinds | PosBinds; 426 | /** 427 | * Interface for the result of {@link getStatementInfo}(). 428 | */ 429 | export interface IStatementInfo { 430 | /** 431 | * Array of strings corresponding to the unique names of the bind variables 432 | * used in the SQL statement. 433 | */ 434 | bindNames: string[]; 435 | /** 436 | * Array containing properties equivalent to those in {@link 437 | * extendedMetaData} on {@link execute}(). This property exists only for 438 | * queries. 439 | */ 440 | metaData?: IMetaData[]; 441 | /** 442 | * Integer corresponding to one of the mle-js-oracledb SQL Statement Type 443 | * Constants, e.g. {@link STMT_TYPE_SELECT}. 444 | */ 445 | statementType: number; 446 | } 447 | /** 448 | * Interface for the connection object obtained by {@link defaultConnection}. 449 | */ 450 | export declare abstract class IConnection { 451 | /** 452 | * This read-only property gives a numeric representation of the Oracle 453 | * database version which is useful in comparisons. For version a.b.c.d.e, 454 | * this property gives the number: 455 | * (100000000 * a) + (1000000 * b) + (10000 * c) + (100 * d) + e 456 | */ 457 | readonly oracleServerVersion: number; 458 | /** 459 | * This read-only property gives a string representation of the Oracle 460 | * database version which is useful for display. 461 | */ 462 | readonly oracleServerVersionString: string; 463 | /** 464 | * This read-only property always returns 0 and exists for consistency with 465 | * node-oracledb. 466 | */ 467 | readonly stmtCacheSize: number; 468 | /** 469 | * This call commits the current transaction in progress. 470 | */ 471 | abstract commit(): void; 472 | /** 473 | * This call executes a single SQL or PL/SQL statement. 474 | * 475 | * The statement to be executed may contain IN binds, OUT or IN OUT bind 476 | * values or variables, which are bound using either an object or an array. 477 | * 478 | * The function returns a result object, containing any fetched rows, the 479 | * values of any OUT and IN OUT bind variables, and the number of rows 480 | * affected by the execution of DML statements, see {@link IExecuteReturn}. 481 | * 482 | * See 483 | * https://node-oracledb.readthedocs.io/en/v6.4.0/api_manual/connection.html#connection.execute 484 | * for more details. 485 | * 486 | * @param sql This parameter can either be a string or an object. 487 | * If the parameter is a string, then it is the SQL statement to be executed. 488 | * The statement may contain bind parameters. 489 | * 490 | * If the parameter is an object (possible since Oracle 23.5), 491 | * it conforms to the {@link IExecuteArgs} interface 492 | * and contains the SQL statement to be executed and the bind values. 493 | * 494 | * @param bindParams needed if there are bind parameters in the SQL 495 | * statement, see {@link BindParameters}. 496 | * @param options an optional parameter to execute() that may be used to 497 | * control statement execution. 498 | */ 499 | abstract execute(sql: string): IExecuteReturn; 500 | /** 501 | * @since Oracle 23.5 502 | */ 503 | abstract execute(sql: IExecuteArgs, options?: IExecuteOptions): IExecuteReturn; 504 | abstract execute(sql: string, bindParams: BindParameters, options?: IExecuteOptions): IExecuteReturn; 505 | /** 506 | * This method allows sets of data values to be bound to one DML or PL/SQL 507 | * statement for execution. It is like calling {@link execute}() multiple 508 | * times but requires fewer context switches. This is an efficient way to 509 | * handle batch changes, for example when inserting or updating multiple 510 | * rows. The method cannot be used for queries. 511 | * 512 | * The executeMany() method supports IN, IN OUT and OUT binds for most data 513 | * types. 514 | * 515 | * The version of this function that accepts a number of iterations must 516 | * be used when no bind parameters are required or when all bind parameters 517 | * are OUT binds. 518 | * 519 | * See 520 | * https://github.com/oracle/node-oracledb/blob/v3.1.0/doc/api.md#-427-connectionexecutemany 521 | * for more details. 522 | * 523 | * @param sql SQL or PL/SQL statement that executeMany() executes. 524 | * @param binds contains the values or variables to be bound to the executed 525 | * statement. It must be an array of arrays ({@link ArrayBindDefs}) or an 526 | * array of objects whose keys match the bind variable names in the SQL 527 | * statement ({@link IObjectBindDefs}). Each sub-array or sub-object must 528 | * contain values for the bind variables used in the SQL statement. At least 529 | * one such record must be specified. 530 | * 531 | * If a record contains fewer values than expected, NULL values will be 532 | * used. For bind by position, empty values can be specified using syntax 533 | * like [a,,c,d]. 534 | * 535 | * By default, the direction of binds is {@link BIND_IN}. The first data 536 | * record determines the number of bind variables, each bind variable's data 537 | * type, and its name (when binding by name). If a variable in the first 538 | * record contains a null, this value is ignored and a subsequent record is 539 | * used to determine that variable's characteristics. If all values in all 540 | * records for a particular bind variable are null, the type of that bind is 541 | * {@link STRING} with a maximum size of 1. 542 | * 543 | * The maximum sizes of strings and Uint8Arrays are determined by scanning 544 | * all records in the bind data. 545 | * 546 | * If a {@link bindDefs} property is used in options, no data scanning 547 | * occurs. This property explicitly specifies the characteristics of each 548 | * bind variable. 549 | * @param numIterations number of times the SQL statement should be 550 | * executed. It can be used instead of the binds parameter. 551 | * @param options The options parameter is optional. It can contain the 552 | * properties specified in {@link IExecuteManyOptions}. 553 | */ 554 | abstract executeMany(sql: string, binds: BindParameters[], options?: IExecuteManyOptions): IExecuteManyReturn; 555 | abstract executeMany(sql: string, numIterations: number, options?: IExecuteManyOptions): IExecuteManyReturn; 556 | /** 557 | * Parses a SQL statement and returns information about it. This is most 558 | * useful for finding column names of queries, and for finding the names of 559 | * bind variables used. 560 | * 561 | * This method performs a call to the SQL layer of the database, so 562 | * unnecessary calls should be avoided for performance reasons. 563 | * 564 | * The information is provided by lower-level APIs that have some 565 | * limitations. Some uncommon statements will return the statement type as 566 | * {@link STMT_TYPE_UNKNOWN}. DDL statements are not parsed, so the syntax 567 | * errors in them will not be reported. The direction and types of bind 568 | * variables cannot be determined. 569 | * 570 | * @param sql SQL statement to parse. 571 | */ 572 | abstract getStatementInfo(sql: string): IStatementInfo; 573 | /** 574 | * This call rolls back the current transaction in progress. 575 | */ 576 | abstract rollback(): void; 577 | /** 578 | * Returns a parent SodaDatabase object. 579 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#getsodadatabase 580 | * @return a new SodaDatabase object. 581 | */ 582 | abstract getSodaDatabase(): ISodaDatabase; 583 | /** 584 | * Returns a DbObject prototype object representing the named Oracle Database object or collection. 585 | * @param className The name of the Oracle object or collection. 586 | * 587 | * @since Oracle 23.3 588 | */ 589 | abstract getDbObjectClass(className: string): IDbObjectClass; 590 | } 591 | /** 592 | * Interface for representing {@link execute} 's argument. 593 | * 594 | * @since Oracle 23.5 595 | */ 596 | export interface IExecuteArgs { 597 | /** 598 | * The sql text of the statement to be executed. 599 | */ 600 | statement: string; 601 | /** 602 | * An array that contains bind values. 603 | */ 604 | values: []; 605 | } 606 | /** 607 | * Interface for representing a DbObject attribute. 608 | * 609 | * @since Oracle 23.3 610 | */ 611 | export interface IDbObjectAttributes { 612 | /** 613 | * the value of one of the Oracle Database Type Constants, 614 | * such as 2010 for oracledb.DB_TYPE_NUMBER and 2023 for oracledb.DB_TYPE_OBJECT. 615 | */ 616 | type: number; 617 | /** 618 | * a string corresponding to the type, such as “VARCHAR2” or “NUMBER”. 619 | * When the attribute is a DbObject, it will contain the name of the object. 620 | */ 621 | typeName: string; 622 | /** 623 | * set if the value of type is a DbObject. It is the DbObject class for the attribute. 624 | */ 625 | typeClass?: IDbObjectClass; 626 | } 627 | /** 628 | * Interface for representing the named Oracle Database object or collection. 629 | * 630 | * @since Oracle 23.3 631 | */ 632 | export declare abstract class IDbObjectClass { 633 | /** 634 | * List of attributes corresponding to the Oracle Database object attributes. 635 | * The name of each attribute follows normal Oracle casing semantics. 636 | */ 637 | attributes?: Record; 638 | /** 639 | * When dbObject.isCollection is true, this will have a value corresponding 640 | * to one of the Oracle Database Type Constants. 641 | */ 642 | readonly elementType?: number; 643 | /** 644 | * When dbObject.isCollection is true and the elements in the collection 645 | * refer to database objects, this property provides the type class 646 | * information of the elements. 647 | * 648 | * @since Oracle 23.4 649 | */ 650 | readonly elementTypeClass?: IDbObjectClass; 651 | /** 652 | * When dbObject.isCollection is true, this will have the name of the 653 | * element type, such as “VARCHAR2” or “NUMBER”. 654 | */ 655 | readonly elementTypeName?: string; 656 | /** 657 | * Fully qualified name of the Oracle Database object or collection. 658 | */ 659 | readonly fqn?: string; 660 | /** 661 | * True if the Oracle object is a collection, false otherwise. 662 | */ 663 | readonly isCollection?: boolean; 664 | /** 665 | * Name of the Oracle Database object or collection. 666 | */ 667 | readonly name?: string; 668 | /** 669 | * Schema owning the Oracle Database object or collection. 670 | */ 671 | readonly schema?: string; 672 | /** 673 | * String which identifies the name of the package, if the type refers to a 674 | * PL/SQL type. Otherwise, it returns undefined. 675 | * 676 | * @since Oracle 23.4 677 | */ 678 | readonly packageName?: string; 679 | /** 680 | * When dbObject.isCollection is true, this will have the number 681 | * of elements in the collection. It is undefined for non-collections. 682 | */ 683 | readonly length?: number; 684 | /** 685 | * These methods can be used on Oracle Database collections, identifiable 686 | * when dbObject.isCollection is true. When collections are fetched from the database, 687 | * altered, and then passed back to the database, it may be more efficient to use these methods 688 | * directly on the retrieved DbObject than it is to convert that DbObject to and from a JavaScript object. 689 | */ 690 | /** 691 | * Adds the given value to the end of the collection. 692 | */ 693 | abstract append?(value: any): void; 694 | /** 695 | * Deletes the value from the collection at the given index. 696 | */ 697 | abstract deleteElement?(index: number): void; 698 | /** 699 | * Returns the value associated with the given index. 700 | */ 701 | abstract getElement?(index: number): any; 702 | /** 703 | * Returns the first index for later use to obtain the value. 704 | */ 705 | abstract getFirstIndex?(): number; 706 | /** 707 | * Returns a JavaScript array containing the ‘index’ keys. 708 | */ 709 | abstract getKeys?(): number[]; 710 | /** 711 | * Obtains the last index for later use to obtain a value. 712 | */ 713 | abstract getLastIndex?(): number; 714 | /** 715 | * Returns the next index value for later use to obtain a value. 716 | */ 717 | abstract getNextIndex?(index: number): any; 718 | /** 719 | * Returns the previous index for later use to obtain the value. 720 | */ 721 | abstract getPrevIndex?(index: number): any; 722 | /** 723 | * Returns true if an element exists in the collection at the given index. 724 | * Returns false otherwise. 725 | */ 726 | abstract hasElement?(index: number): boolean; 727 | /** 728 | * To set the given value at the position of the given index. 729 | */ 730 | abstract setElement?(index: number, value: any): void; 731 | /** 732 | * Returns an array of element values as a JavaScript array in key order. 733 | */ 734 | abstract getValues?(): any[]; 735 | /** 736 | * @param count : Trims the specified number of elements from the end of the collection. 737 | */ 738 | abstract trim?(count: number): IDbObjectClass; 739 | } 740 | /** 741 | * Type for mle-js-oracledb Query OutFormat Constants. 742 | */ 743 | export type OutFormatType = number; 744 | /** 745 | * Fetch each row as array of column values 746 | * This constant is deprecated. Use OUT_FORMAT_ARRAY instead. 747 | */ 748 | export declare const ARRAY: OutFormatType; 749 | /** 750 | * Fetch each row as array of column values. 751 | */ 752 | export declare const OUT_FORMAT_ARRAY: OutFormatType; 753 | /** 754 | * Fetch each row as an object 755 | * This constant is deprecated. Use OUT_FORMAT_OBJECT instead. 756 | */ 757 | export declare const OBJECT: OutFormatType; 758 | /** 759 | * Fetch each row as an object of column values. 760 | */ 761 | export declare const OUT_FORMAT_OBJECT: OutFormatType; 762 | /** 763 | * Type for mle-js-oracledb JavaScript Type Constants. Such constants can be 764 | * used in OUT binds as well as fetchInfo to specify what JavaScript type a 765 | * database value should be converted to. Some of those types can also be used 766 | * in {@link fetchAsString}, {@link fetchAsUint8Array}, and 767 | * {@link fetchAsPlsqlWrapper}. 768 | * 769 | * In addition to the standard JavaScript types that node-oracledb offers, 770 | * mle-js-oracledb also offers a number of so-called PL/SQL wrapper types which 771 | * are JavaScript types with the exact same semantics as the corresponding 772 | * Oracle SQL or PL/SQL types (see mle-js-plsqltypes). The JavaScript constants 773 | * for those types all start with ORACLE_, e.g. ORACLE_NUMBER is the constant 774 | * to be used if a database value should be retrieved as OracleNumber rather 775 | * than a native JavaScript number. 776 | */ 777 | export type JsType = number; 778 | /** 779 | * Used with fetchInfo to reset the fetch type to the database type 780 | */ 781 | export declare const DEFAULT: JsType; 782 | /** 783 | * Bind as JavaScript String type. 784 | */ 785 | export declare const STRING: JsType; 786 | /** 787 | * Bind as JavaScript number type. 788 | */ 789 | export declare const NUMBER: JsType; 790 | /** 791 | * Bind as JavaScript date type. 792 | */ 793 | export declare const DATE: JsType; 794 | /** 795 | * Bind a NUMBER to an OracleNumber object. 796 | */ 797 | export declare const ORACLE_NUMBER: JsType; 798 | /** 799 | * Bind a DATE to an OracleDate object. 800 | */ 801 | export declare const ORACLE_DATE: JsType; 802 | /** 803 | * Bind a BLOB to an OracleBLOB object. 804 | */ 805 | export declare const ORACLE_BLOB: JsType; 806 | /** 807 | * Bind a CLOB to an OracleCLOB object. 808 | */ 809 | export declare const ORACLE_CLOB: JsType; 810 | /** 811 | * Bind an INTERVAL DAY TO SECOND to an OracleIntervalDayToSecond object. 812 | */ 813 | export declare const ORACLE_INTERVAL_DS: JsType; 814 | /** 815 | * Bind an INTERVAL YEAR TO MONTH to an OracleIntervalYearToMonth object. 816 | */ 817 | export declare const ORACLE_INTERVAL_YM: JsType; 818 | /** 819 | * Bind an NCLOB to an OracleNCLOB object. 820 | */ 821 | export declare const ORACLE_NCLOB: JsType; 822 | /** 823 | * Bind a RAW, LONG RAW or BLOB to a Uint8Array typed array. 824 | */ 825 | export declare const UINT8ARRAY: JsType; 826 | /** 827 | * Bind a TIMESTAMP to an OracleTimestamp object. 828 | */ 829 | export declare const ORACLE_TIMESTAMP: JsType; 830 | /** 831 | * Bind a TIMESTAMP WITH TIME ZONE or TIMESTAMP WITH LOCAL TIME ZONE to an OracleTimestampTZ object. 832 | */ 833 | export declare const ORACLE_TIMESTAMP_TZ: JsType; 834 | /** 835 | * Bind a VECTOR(*, int8) to Int8Array 836 | * @since Oracle 23.4 837 | */ 838 | export declare const INT8ARRAY: JsType; 839 | /** 840 | * Bind a VECTOR(*, float32) to Float32Array 841 | * @since Oracle 23.4 842 | */ 843 | export declare const FLOAT32ARRAY: JsType; 844 | /** 845 | * Bind a VECTOR(*, float64) to Float64Array 846 | * @since Oracle 23.4 847 | */ 848 | export declare const FLOAT64ARRAY: JsType; 849 | /** 850 | * Type for mle-js-oracledb Database Type Constants. Such constants can be used 851 | * in IN binds to specify what database type a JavaScript value should be 852 | * converted to and are also what is used in query metadata. In addition, some 853 | * of these types can also be used in OUT binds if a corresponding 854 | * {@link JsType} does not exist, e.g. {@link DB_TYPE_BOOLEAN}, 855 | * {@link DB_TYPE_JSON}, {@link DB_TYPE_NCLOB}. 856 | */ 857 | export type DbType = number; 858 | /** 859 | * VARCHAR2 860 | */ 861 | export declare const DB_TYPE_VARCHAR: DbType; 862 | /** 863 | * NUMBER or FLOAT 864 | */ 865 | export declare const DB_TYPE_NUMBER: DbType; 866 | /** 867 | * LONG 868 | */ 869 | export declare const DB_TYPE_LONG: DbType; 870 | /** 871 | * DATE 872 | */ 873 | export declare const DB_TYPE_DATE: DbType; 874 | /** 875 | * RAW 876 | */ 877 | export declare const DB_TYPE_RAW: DbType; 878 | /** 879 | * LONG RAW 880 | */ 881 | export declare const DB_TYPE_LONG_RAW: DbType; 882 | /** 883 | * CHAR 884 | */ 885 | export declare const DB_TYPE_CHAR: DbType; 886 | /** 887 | * BINARY_FLOAT 888 | */ 889 | export declare const DB_TYPE_BINARY_FLOAT: DbType; 890 | /** 891 | * BINARY_DOUBLE 892 | */ 893 | export declare const DB_TYPE_BINARY_DOUBLE: DbType; 894 | /** 895 | * BINARY_INTEGER 896 | */ 897 | export declare const DB_TYPE_BINARY_INTEGER: DbType; 898 | /** 899 | * ROWID 900 | */ 901 | export declare const DB_TYPE_ROWID: DbType; 902 | /** 903 | * CLOB 904 | */ 905 | export declare const DB_TYPE_CLOB: DbType; 906 | /** 907 | * BLOB 908 | */ 909 | export declare const DB_TYPE_BLOB: DbType; 910 | /** 911 | * TIMESTAMP 912 | */ 913 | export declare const DB_TYPE_TIMESTAMP: DbType; 914 | /** 915 | * TIMESTAMP WITH TIME ZONE 916 | */ 917 | export declare const DB_TYPE_TIMESTAMP_TZ: DbType; 918 | /** 919 | * INTERVAL YEAR TO MONTH 920 | */ 921 | export declare const DB_TYPE_INTERVAL_YM: DbType; 922 | /** 923 | * INTERVAL DAY TO SECOND 924 | */ 925 | export declare const DB_TYPE_INTERVAL_DS: DbType; 926 | /** 927 | * UROWID 928 | */ 929 | export declare const DB_TYPE_UROWID: DbType; 930 | /** 931 | * BOOLEAN 932 | */ 933 | export declare const DB_TYPE_BOOLEAN: DbType; 934 | /** 935 | * TIMESTAMP WITH LOCAL TIME ZONE 936 | */ 937 | export declare const DB_TYPE_TIMESTAMP_LTZ: DbType; 938 | /** 939 | * NVARCHAR 940 | */ 941 | export declare const DB_TYPE_NVARCHAR: DbType; 942 | /** 943 | * NCHAR 944 | */ 945 | export declare const DB_TYPE_NCHAR: DbType; 946 | /** 947 | * NCLOB 948 | */ 949 | export declare const DB_TYPE_NCLOB: DbType; 950 | /** 951 | * Bind as JSON. This constant can also be used in {@link fetchAsString} to 952 | * express that JSON column values should be fetched as JS string rather than JS 953 | * object. 954 | */ 955 | export declare const DB_TYPE_JSON: DbType; 956 | /** 957 | * ADT 958 | * 959 | * @since Oracle 23.3 960 | */ 961 | export declare const DB_TYPE_OBJECT: DbType; 962 | /** 963 | * VECTOR 964 | * @since Oracle 23.4 965 | */ 966 | export declare const DB_TYPE_VECTOR: DbType; 967 | /** 968 | * Direction for IN binds 969 | */ 970 | export declare const BIND_IN = 3001; 971 | /** 972 | * Direction for INOUT binds 973 | */ 974 | export declare const BIND_INOUT = 3002; 975 | /** 976 | * Direction for OUT binds 977 | */ 978 | export declare const BIND_OUT = 3003; 979 | /** 980 | * Unknown statement type 981 | */ 982 | export declare const STMT_TYPE_UNKNOWN = 0; 983 | /** 984 | * SELECT 985 | */ 986 | export declare const STMT_TYPE_SELECT = 1; 987 | /** 988 | * UPDATE 989 | */ 990 | export declare const STMT_TYPE_UPDATE = 2; 991 | /** 992 | * DELETE 993 | */ 994 | export declare const STMT_TYPE_DELETE = 3; 995 | /** 996 | * INSERT 997 | */ 998 | export declare const STMT_TYPE_INSERT = 4; 999 | /** 1000 | * CREATE 1001 | */ 1002 | export declare const STMT_TYPE_CREATE = 5; 1003 | /** 1004 | * DROP 1005 | */ 1006 | export declare const STMT_TYPE_DROP = 6; 1007 | /** 1008 | * ALTER 1009 | */ 1010 | export declare const STMT_TYPE_ALTER = 7; 1011 | /** 1012 | * BEGIN 1013 | */ 1014 | export declare const STMT_TYPE_BEGIN = 8; 1015 | /** 1016 | * DECLARE 1017 | */ 1018 | export declare const STMT_TYPE_DECLARE = 9; 1019 | /** 1020 | * CALL 1021 | */ 1022 | export declare const STMT_TYPE_CALL = 10; 1023 | /** 1024 | * EXPLAIN PLAN 1025 | */ 1026 | export declare const STMT_TYPE_EXPLAIN_PLAN = 15; 1027 | /** 1028 | * MERGE 1029 | */ 1030 | export declare const STMT_TYPE_MERGE = 16; 1031 | /** 1032 | * ROLLBACK 1033 | */ 1034 | export declare const STMT_TYPE_ROLLBACK = 17; 1035 | /** 1036 | * COMMIT 1037 | */ 1038 | export declare const STMT_TYPE_COMMIT = 21; 1039 | /** 1040 | * SODA_COLL_MAP_MODE 1041 | */ 1042 | export declare const SODA_COLL_MAP_MODE = 5001; 1043 | /** 1044 | * Type for converter 1045 | * 1046 | * @since Oracle 23.7 1047 | */ 1048 | export type Converter = (v: any) => object | string | number | boolean; 1049 | /** 1050 | * Type for fetch type handler 1051 | * 1052 | * @since Oracle 23.7 1053 | */ 1054 | export type FetchTypeHandler = (metaData?: IMetaData) => null | { 1055 | type: number; 1056 | converter: Converter; 1057 | } | { 1058 | type: number; 1059 | } | { 1060 | converter: Converter; 1061 | }; 1062 | /** 1063 | * Class for representing global mle-js-oracledb properties. 1064 | */ 1065 | export declare class Parameters { 1066 | #private; 1067 | get maxRows(): number; 1068 | /** 1069 | * The maximum number of rows that are fetched by a query with 1070 | * connection.{@link execute}() when not using an {@link IResultSet}. Rows 1071 | * beyond this limit are not fetched from the database. A value of 0 means 1072 | * there is no limit. 1073 | * 1074 | * The default value is 0, meaning unlimited. 1075 | * 1076 | * This property may be overridden in an {@link execute}() call. 1077 | * 1078 | * To improve database efficiency, SQL queries should use a row limiting clause 1079 | * like OFFSET / FETCH or equivalent. The maxRows property can be used to stop 1080 | * badly coded queries from returning unexpectedly large numbers of rows. 1081 | * 1082 | * When the number of query rows is relatively big, or cannot be predicted, it 1083 | * is recommended to use an {@link IResultSet}. This allows applications to 1084 | * process rows in smaller chunks or individually, preventing the PGA limits 1085 | * from being exceeded or query results being unexpectedly truncated by a 1086 | * maxRows limit. 1087 | */ 1088 | set maxRows(value: number); 1089 | get outFormat(): OutFormatType; 1090 | /** 1091 | * The format of query rows fetched when using connection.{@link execute}(). 1092 | * It affects both IResultSet and non-IResultSet queries. This can be either 1093 | * of the constants {@link OUT_FORMAT_ARRAY} or {@link OUT_FORMAT_OBJECT}. The 1094 | * default value is {@link OUT_FORMAT_ARRAY} when requiring the module 1095 | * "mle-js-oracledb" (in Oracle 21c). Oracle 23ai introduces and encourages the 1096 | * use of ECMAScript imports (import oracledb from "mle-js-oracledb") and if 1097 | * those are used, the default value is {@link OUT_FORMAT_OBJECT}. 1098 | * 1099 | * If specified as {@link OUT_FORMAT_ARRAY}, each row is fetched as an array of column 1100 | * values. 1101 | * 1102 | * If specified as {@link OUT_FORMAT_OBJECT}, each row is fetched as a JavaScript object. 1103 | * The object has a property for each column name, with the property value set 1104 | * to the respective column value. The property name follows Oracle's standard 1105 | * name-casing rules. It will commonly be uppercase since most applications 1106 | * create tables using unquoted, case-insensitive names. 1107 | * 1108 | * This property may be overridden in an {@link execute}() call. 1109 | */ 1110 | set outFormat(value: OutFormatType); 1111 | get fetchArraySize(): number; 1112 | /** 1113 | * This property sets the size of an internal buffer used for fetching query 1114 | * rows from Oracle Database. Changing it may affect query performance but 1115 | * does not affect how many rows are returned to the application. 1116 | * 1117 | * The default value is 10. The maximum allowed value is 1000, any value 1118 | * greater than that will silently be limited to 1000. 1119 | * 1120 | * The property is used during the default direct fetches and during 1121 | * {@link IResultSet}.{@link getRow}() and {@link getRows}() calls. 1122 | * 1123 | * Increasing this value reduces the number of context switches, but increases 1124 | * memory usage for each data fetch. For queries that return a large number of 1125 | * rows, higher values of fetchArraySize may give better performance. For 1126 | * queries that only return a few rows, reduce the value of fetchArraySize to 1127 | * minimize the amount of memory management during data fetches. Note that as 1128 | * mle-js-oracledb is co-located with the database, large values are unlikely 1129 | * to yield significant benefit. 1130 | * 1131 | * For direct fetches (those using {@link resultSet}: false), the 1132 | * internal buffer size will be based on the lesser of maxRows and 1133 | * fetchArraySize. 1134 | */ 1135 | set fetchArraySize(value: number); 1136 | get extendedMetaData(): boolean; 1137 | /** 1138 | * Determines whether additional metadata is available for queries. 1139 | * 1140 | * The default value is false. With this value, the result.{@link metaData} 1141 | * and result.{@link resultSet}.{@link metaData} objects only include column 1142 | * names. 1143 | * 1144 | * This property may be overridden in an execute() call. 1145 | */ 1146 | set extendedMetaData(value: boolean); 1147 | get fetchAsString(): JsType[]; 1148 | /** 1149 | * An array of mle-js-oracledb JS Type values. The valid types are {@link 1150 | * DATE}, {@link NUMBER}, {@link UINT8ARRAY}, {@link ORACLE_CLOB}, and 1151 | * {@link DB_TYPE_JSON}. When any column having one of the specified types 1152 | * is queried with {@link execute}(), the column data is returned as a 1153 | * string instead of the default representation. 1154 | * 1155 | * By default in mle-js-oracledb, all columns are returned as native types 1156 | * or as OracleClob/OracleBlob wrapper types, in the case of CLOB and BLOB 1157 | * types. 1158 | * 1159 | * This property helps avoid situations where using JavaScript types can lead 1160 | * to numeric precision loss, or where date conversion is unwanted. See 1161 | * https://github.com/oracle/node-oracledb/blob/v3.1.0/doc/api.md#-1316-query-result-type-mapping 1162 | * for more discussion. 1163 | * 1164 | * For raw data returned as a string, Oracle returns the data as a 1165 | * hex-encoded string. For dates and numbers returned as a string, the 1166 | * maximum length of a string created by this mapping is 200 bytes. Strings 1167 | * created for CLOB columns will generally be limited by memory restrictions. 1168 | * 1169 | * Individual query columns in {@link execute}() calls can override the 1170 | * fetchAsString global property by using {@link fetchInfo}. 1171 | */ 1172 | set fetchAsString(value: JsType[]); 1173 | get fetchAsUint8Array(): JsType[]; 1174 | /** 1175 | * An array of mle-js-oracledb JS Type values. Currently, the only valid type 1176 | * is {@link ORACLE_BLOB}. When a BLOB column is queried with {@link 1177 | * execute}(), the column data is returned as a Uint8Array instead of the 1178 | * default representation. 1179 | * 1180 | * By default in mle-js-oracledb, all columns are returned as native types 1181 | * or as OracleClob/OracleBlob wrapper types, in the case of CLOB and BLOB 1182 | * types. 1183 | * 1184 | * Individual query columns in {@link execute}() calls can override the 1185 | * fetchAsUint8Array global property by using {@link fetchInfo}. 1186 | */ 1187 | set fetchAsUint8Array(value: JsType[]); 1188 | get fetchAsPlsqlWrapper(): JsType[]; 1189 | /** 1190 | * An array of mle-js-oracledb JS Type values. The valid types are {@link 1191 | * DATE}, {@link NUMBER}, and {@link STRING}. When any column having one of 1192 | * the specified types is queried with {@link execute}(), the column data is 1193 | * returned as a PL/SQL wrapper type instead of the default representation. 1194 | * 1195 | * By default in mle-js-oracledb, all columns are returned as native types 1196 | * or as OracleClob/OracleBlob wrapper types, in the case of CLOB and BLOB 1197 | * types. 1198 | * 1199 | * For types that are set in both properties ({@link fetchAsString} and 1200 | * fetchAsPlsqlWrapper), i.e. {@link DATE} and {@link NUMBER}, the {@link 1201 | * fetchAsString} property has precedence over the fetchAsPlsqlWrapper 1202 | * property. 1203 | * 1204 | * Individual query columns in {@link execute}() calls can override the 1205 | * fetchAsPlsqlWrapper global property by using {@link fetchInfo}. 1206 | */ 1207 | set fetchAsPlsqlWrapper(value: JsType[]); 1208 | get fetchTypeHandler(): FetchTypeHandler; 1209 | /** 1210 | * This property is a function that allows applications to examine and modify queried column data 1211 | * before it is returned to the user. This function is called once for each column that is being 1212 | * fetched with a single object argument containing the following attributes: 1213 | * 1214 | * annotations: The object representing the annotations. 1215 | * maxSize: The maximum size in bytes. This is only set if dbType is oracledb.DB_TYPE_VARCHAR, oracledb.DB_TYPE_CHAR, or oracledb.DB_TYPE_RAW. 1216 | * dbType: The database type, that is, one of the Oracle Database Type Objects. 1217 | * dbTypeName: The name of the database type, such as "NUMBER" or "VARCHAR2". 1218 | * dbTypeClass: The class associated with the database type. This is only set if dbType is oracledb.DB_TYPE_OBJECT. 1219 | * name: The name of the column. 1220 | * nullable: Indicates whether NULL values are permitted for this column. 1221 | * precision: Set only when the dbType is oracledb.DB_TYPE_NUMBER. 1222 | * scale: Set only when the dbType is oracledb.DB_TYPE_NUMBER. 1223 | * 1224 | * By default, this property is "undefined", that is, it is not set. 1225 | * The function is expected to return either nothing or an object containing: 1226 | * the type attribute 1227 | * or the converter attribute 1228 | * or both the type and converter attributes. 1229 | * The converter function is a function which can be used with fetch type handlers to change the returned data. 1230 | * This function accepts the value that will be returned by connection.execute() for a particular row and column 1231 | * and returns the value that will actually be returned by connection.execute(). 1232 | * This property can be overridden by the fetchTypeHandler option in execute(). 1233 | * 1234 | * @since Oracle 23.7 1235 | */ 1236 | set fetchTypeHandler(value: FetchTypeHandler); 1237 | } 1238 | -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2022, 2023, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { OracleDb } from './mle-js-oracledb-common'; 39 | export { OracleDb } from './mle-js-oracledb-common'; 40 | export declare const oracledb: OracleDb; 41 | export default oracledb; 42 | -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/mle-js-oracledb-common.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2017, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { Parameters, IConnection, IResultSet, OutFormatType, JsType, FetchTypeHandler } from './api'; 39 | import { ISodaCollection, ISodaDatabase, ISodaDocument, ISodaDocumentCursor, ISodaOperation } from './soda-api'; 40 | export declare class OracleDb { 41 | #private; 42 | OUT_FORMAT_ARRAY: number; 43 | ARRAY: number; 44 | OUT_FORMAT_OBJECT: number; 45 | OBJECT: number; 46 | DEFAULT: number; 47 | STRING: number; 48 | NUMBER: number; 49 | DATE: number; 50 | ORACLE_NUMBER: number; 51 | ORACLE_DATE: number; 52 | ORACLE_BLOB: number; 53 | ORACLE_CLOB: number; 54 | ORACLE_INTERVAL_DS: number; 55 | ORACLE_INTERVAL_YM: number; 56 | ORACLE_TIMESTAMP: number; 57 | ORACLE_TIMESTAMP_TZ: number; 58 | UINT8ARRAY: number; 59 | /** 60 | * @since Oracle 23.4 61 | */ 62 | INT8ARRAY: number; 63 | /** 64 | * @since Oracle 23.4 65 | */ 66 | FLOAT32ARRAY: number; 67 | /** 68 | * @since Oracle 23.4 69 | */ 70 | FLOAT64ARRAY: number; 71 | DB_TYPE_VARCHAR: number; 72 | DB_TYPE_NUMBER: number; 73 | DB_TYPE_LONG: number; 74 | DB_TYPE_DATE: number; 75 | DB_TYPE_RAW: number; 76 | DB_TYPE_LONG_RAW: number; 77 | DB_TYPE_CHAR: number; 78 | DB_TYPE_BINARY_FLOAT: number; 79 | DB_TYPE_BINARY_DOUBLE: number; 80 | DB_TYPE_BINARY_INTEGER: number; 81 | DB_TYPE_ROWID: number; 82 | DB_TYPE_UROWID: number; 83 | DB_TYPE_BOOLEAN: number; 84 | DB_TYPE_CLOB: number; 85 | DB_TYPE_BLOB: number; 86 | DB_TYPE_TIMESTAMP: number; 87 | DB_TYPE_TIMESTAMP_TZ: number; 88 | DB_TYPE_TIMESTAMP_LTZ: number; 89 | DB_TYPE_NVARCHAR: number; 90 | DB_TYPE_NCHAR: number; 91 | DB_TYPE_NCLOB: number; 92 | DB_TYPE_JSON: number; 93 | /** 94 | * @since Oracle 23.3 95 | */ 96 | DB_TYPE_OBJECT: number; 97 | /** 98 | * @since Oracle 23.4 99 | */ 100 | DB_TYPE_VECTOR: number; 101 | DB_TYPE_INTERVAL_YM: number; 102 | DB_TYPE_INTERVAL_DS: number; 103 | BIND_IN: number; 104 | BIND_INOUT: number; 105 | BIND_OUT: number; 106 | STMT_TYPE_UNKNOWN: number; 107 | STMT_TYPE_SELECT: number; 108 | STMT_TYPE_UPDATE: number; 109 | STMT_TYPE_DELETE: number; 110 | STMT_TYPE_INSERT: number; 111 | STMT_TYPE_CREATE: number; 112 | STMT_TYPE_DROP: number; 113 | STMT_TYPE_ALTER: number; 114 | STMT_TYPE_BEGIN: number; 115 | STMT_TYPE_DECLARE: number; 116 | STMT_TYPE_CALL: number; 117 | STMT_TYPE_EXPLAIN_PLAN: number; 118 | STMT_TYPE_MERGE: number; 119 | STMT_TYPE_ROLLBACK: number; 120 | STMT_TYPE_COMMIT: number; 121 | SODA_COLL_MAP_MODE: number; 122 | parameters: Parameters; 123 | SodaCollection: typeof ISodaCollection; 124 | SodaDatabase: typeof ISodaDatabase; 125 | SodaDocument: typeof ISodaDocument; 126 | SodaDocumentCursor: typeof ISodaDocumentCursor; 127 | SodaOperation: typeof ISodaOperation; 128 | OracleDb: typeof OracleDb; 129 | Connection: typeof IConnection; 130 | ResultSet: typeof IResultSet; 131 | /** 132 | * Construct a new OracleDb object for connecting and querying Oracle Database. 133 | * 134 | * @param useArrayFormat if set to true, {@link OUT_FORMAT_ARRAY} will be 135 | * used as the default out format for SQL results, otherwise 136 | * {@link OUT_FORMAT_OBJECT} will be used. 137 | */ 138 | constructor(useArrayFormat?: boolean); 139 | get outFormat(): OutFormatType; 140 | set outFormat(value: OutFormatType); 141 | get extendedMetaData(): boolean; 142 | set extendedMetaData(value: boolean); 143 | get fetchArraySize(): number; 144 | set fetchArraySize(value: number); 145 | get fetchAsPlsqlWrapper(): JsType[]; 146 | set fetchAsPlsqlWrapper(value: JsType[]); 147 | get fetchAsString(): JsType[]; 148 | set fetchAsString(value: JsType[]); 149 | get maxRows(): number; 150 | set maxRows(value: number); 151 | /** 152 | * @since Oracle 23.7 153 | */ 154 | get fetchTypeHandler(): FetchTypeHandler; 155 | /** 156 | * @since Oracle 23.7 157 | */ 158 | set fetchTypeHandler(value: FetchTypeHandler); 159 | /** 160 | * Returns the default connection object for executing SQL queries in the Oracle 161 | * Database using mle-js-oracledb. Note that with MLE, because JavaScript is 162 | * executed directly in the database, there is no need to establish a specific 163 | * connection, which is why the default connection object should be used. 164 | * 165 | * @returns default connection object for executing SQL queries with mle-js-oracledb. 166 | */ 167 | defaultConnection(): IConnection; 168 | } 169 | -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-oracledb", 3 | "description": "MLE SQL Driver", 4 | "types": "index.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js-oracledb/soda-api.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2021, 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | /** 39 | * SODA API for MLE. This is compatible with node-oracledb 5.0.0. 40 | */ 41 | /** 42 | * SodaDatabase.createCollection() options. The metadata must conform to the 43 | * JSON object layout specified in the Oracle Database 44 | * "SODA Collection Metadata Components (Reference)" documentation. 45 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbcreatecollectionoptions 46 | * @see https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/adsdi/soda-collection-metadata-components-reference.html 47 | */ 48 | export interface ICreateCollectionOptions { 49 | metaData?: Record; 50 | mode?: number; 51 | } 52 | /** 53 | * SodaDatabase.createDocument() options. 54 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbcreatedocumentoptions 55 | */ 56 | export interface ICreateDocumentOptions { 57 | key?: string; 58 | mediaType?: string; 59 | } 60 | /** 61 | * SodaDatabase.getCollectionNames() options. 62 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbgetcollectionnamesoptions 63 | */ 64 | export interface IGetCollectionNameOptions { 65 | limit?: number; 66 | startsWith?: string; 67 | } 68 | /** 69 | * SodaCollection.dropIndex() options. 70 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacolldropindexoptions 71 | */ 72 | export interface IDropIndexOptions { 73 | force?: boolean; 74 | } 75 | /** 76 | * SodaCollection.drop() return value. 77 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacolldropcallback 78 | */ 79 | export interface IDropResult { 80 | dropped: boolean; 81 | } 82 | /** 83 | * SodaCollection.dropIndex() result. 84 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacolldropindexcb 85 | */ 86 | export interface IDropIndexResult { 87 | dropped: boolean; 88 | } 89 | /** 90 | * SodaOperation.count() result. 91 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclasscount 92 | */ 93 | export interface ICountResult { 94 | count: number; 95 | } 96 | /** 97 | * SodaOperation.remove() result. 98 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassremove 99 | */ 100 | export interface IRemoveResult { 101 | count: number; 102 | } 103 | /** 104 | * SodaOperation.replace() result. 105 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassreplaceone 106 | */ 107 | export interface IReplaceResult { 108 | replaced: boolean; 109 | } 110 | /** 111 | * SODA database access class. SodaDatabase is the top level object for 112 | * SODA operations. A 'SODA database' is an abstraction, allowing access to SODA 113 | * collections in that 'SODA database', which then allow access to documents in 114 | * those collections. 115 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadatabaseclass 116 | */ 117 | export declare abstract class ISodaDatabase { 118 | /** 119 | * Creates a SODA collection of the given name. 120 | * If a collection with the same name already exists, 121 | * then that existing collection is opened without error. 122 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbcreatecollection 123 | * @param collectionName name of the collection to be created. 124 | * @param options the options that specify the collection, see 125 | * CreateCollectionOptions. 126 | * @return a new SodaCollection object. 127 | */ 128 | abstract createCollection(collectionName: string, options?: ICreateCollectionOptions): ISodaCollection; 129 | /** 130 | * Constructs a proto SodaDocument object usable for SODA insert and replace 131 | * methods. SodaDocument attributes like createdOn will not be defined, and 132 | * neither will attributes valid in options but not specified. The document 133 | * will not be stored in the database until an insert or replace method is 134 | * called. 135 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbcreatedocument 136 | * @param content the document content. 137 | * @param options the options that specify the document, see 138 | * CreateDocumentOptions. 139 | * @return a new SodaDocument object. 140 | */ 141 | abstract createDocument(content: string | Uint8Array | Record, options?: ICreateDocumentOptions): ISodaDocument; 142 | /** 143 | * Gets an array of collection names in alphabetical order. 144 | * Returns names that start with the given string, and all subsequent names, 145 | * in alphabetic order. 146 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbgetcollectionnames 147 | * @param options see GetCollectionNameOptions. 148 | * @return an array of matching collection names. 149 | */ 150 | abstract getCollectionNames(options?: IGetCollectionNameOptions): Array; 151 | /** 152 | * Opens an existing SodaCollection of the given name. 153 | * The collection can then be used to access documents. 154 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadbopencollection 155 | * @param collectionName the name of the collection to open. 156 | * @return a new SodaCollection object if the collection exists. 157 | * If the requested collection does not exist undefined will be 158 | * returned. 159 | */ 160 | abstract openCollection(collectionName: string): ISodaCollection; 161 | } 162 | /** 163 | * SODA collection class. A SODA collection is a set of SodaDocuments. 164 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollectionclass 165 | */ 166 | export declare abstract class ISodaCollection { 167 | /** 168 | * Name of the collection. 169 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollectionproperties 170 | */ 171 | abstract get name(): string; 172 | /** 173 | * Metadata for the collection. The metadata will conform to the JSON object 174 | * layout specified in the Oracle Database 175 | * "SODA Collection Metadata Components (Reference)" documentation. 176 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollectionproperties 177 | * @see https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/adsdi/soda-collection-metadata-components-reference.html 178 | */ 179 | abstract get metaData(): Record; 180 | /** 181 | * Creates an index on a SODA collection to improve the performance of SODA 182 | * query-by-examples (QBE) or to enable text searches. Different index types 183 | * can be created as long as the indexSpec parameter conforms to the 184 | * JSON object layout specified in the Oracle Database "SODA Index 185 | * Specifications (Reference)" documentation. 186 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollcreateindex 187 | * @see https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/adsdi/soda-index-specifications-reference.html 188 | * @param indexSpec index specification, 189 | * see "SODA Index Specifications (Reference)" 190 | * @throws an exception if the index creation fails. 191 | */ 192 | abstract createIndex(indexSpec: Record): void; 193 | /** 194 | * Drops the current collection. 195 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacolldrop 196 | * @return a DropResult containing a dropped value of true if the drop 197 | * operation succeeded or false if the collection does not exist. 198 | * @throws an exception if the collection drop fails. 199 | */ 200 | abstract drop(): IDropResult; 201 | /** 202 | * Drops the specified index. 203 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacolldropindex 204 | * @param indexName the name of the index to drop 205 | * @param options an optional force flag may be specified 206 | * @return a DropIndexResult containing a dropped value of true if the 207 | * drop index operation succeeded or false if the index doesn't exist. 208 | * @throws an exception if the index drop fails. 209 | */ 210 | abstract dropIndex(indexName: string, options?: IDropIndexOptions): IDropIndexResult; 211 | /** 212 | * Locates and orders a set of SODA documents for retrieval, replacement, or 213 | * removal with non-terminal and terminal methods, see SodaOperation for 214 | * details. 215 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollfind 216 | * @return a SodaOperation object which is used via method chaining 217 | */ 218 | abstract find(): ISodaOperation; 219 | /** 220 | * Infers the schema of a collection of JSON documents. 221 | * The data guide is represented as JSON content in a SodaDocument. 222 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollgetdataguide 223 | * @return a new SodaDocument containing the inferred schema. 224 | * @throws an exception if the schema inference fails. 225 | */ 226 | abstract getDataGuide(): ISodaDocument; 227 | /** 228 | * Inserts an array of Objects or SodaDocuments into the collection. 229 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollinsertmany 230 | * @param docs an array of Objects or SodaDocuments to be inserted into the 231 | * collection. 232 | * @throws an exception if a document insertion fails. The offset attribute on 233 | * the Error object will contain the number of documents that were 234 | * successfully inserted. Subsequent documents in the input array will not be 235 | * inserted. 236 | */ 237 | abstract insertMany(docs: Array | ISodaDocument>): void; 238 | /** 239 | * Inserts an array of Objects or SodaDocuuments into the collection and 240 | * returns the documents which contain all SodaDocument components except for 241 | * content, for performance reasons. 242 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollinsertmanyandget 243 | * @param docs an array of Objects or SodaDocuments to be inserted into the 244 | * collection. 245 | * @return an array of inserted SodaDocuments. 246 | * @throws an exception if a document insertion fails. The offset attribute on 247 | * the Error object will contain the number of documents that were 248 | * successfully inserted. Subsequent documents in the input array will not be 249 | * inserted. 250 | */ 251 | abstract insertManyAndGet(docs: Array | ISodaDocument>): Array; 252 | /** 253 | * Inserts a given document to the collection. The input document can be 254 | * either a JavaScript object representing the data content, or it can be an 255 | * existing SodaDocument. 256 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollinsertone 257 | * @param doc an Object or SodaDocument to insert into the collection. 258 | * @throws an exception if insertion fails. 259 | */ 260 | abstract insertOne(doc: Record | ISodaDocument): void; 261 | /** 262 | * Inserts a document in a collection and returns the result document that 263 | * contains all SodaDocument components except for content, for performance 264 | * reasons. 265 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodacollinsertoneandget 266 | * @param doc the Object or SodaDoc to insert into the collection. 267 | * @return the inserted SodaDocument. 268 | * @throws an exception if insertion fails. 269 | */ 270 | abstract insertOneAndGet(doc: Record | ISodaDocument): ISodaDocument; 271 | /** 272 | * This method behaves like sodaCollection.insertOne() with the exception that 273 | * if a document with the same key already exists, then it is updated instead. 274 | * The collection must use client-assigned keys, which is why save() 275 | * accepts only a SodaDocument, unlike insertOne(). If the collection is not 276 | * configured with client-assigned keys, then the behavior is exactly the 277 | * same as sodaCollection.insertOne(). 278 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#user-content-sodacollsave 279 | * @param doc the document to save. 280 | */ 281 | abstract save(doc: ISodaDocument): void; 282 | /** 283 | * This method behaves like sodaCollection.insertOneAndGet() with the 284 | * exception that if a document with the same key already exists, then it is 285 | * updated instead. The collection must use client-assigned keys, which 286 | * is why saveAndGet() accepts only a SodaDocument, unlike insertOneAndGet(). 287 | * If the collection is not configured with client-assigned keys, then the 288 | * behavior is exactly the same as sodaCollection.insertOneAndGet(). 289 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#user-content-sodacollsaveandget 290 | * @param doc the document to save. 291 | * @return the saved document. 292 | */ 293 | abstract saveAndGet(doc: ISodaDocument): ISodaDocument; 294 | /** 295 | * This method truncates a collection, removing all documents. The collection 296 | * will not be deleted. 297 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#user-content-sodacolltruncate 298 | * @throws an exception if truncation fails. 299 | */ 300 | abstract truncate(): any; 301 | } 302 | /** 303 | * SODA find operation class. This class is used to search and retrieve SODA 304 | * documents from a SodaCollection. It provides non-terminal search condition 305 | * operations and terminal SodaDocument retrieval operations. 306 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclass 307 | */ 308 | export declare abstract class ISodaOperation { 309 | /** 310 | * Non-terminals. 311 | */ 312 | /** 313 | * Sets the size of an internal buffer used for fetching documents from a 314 | * collection with the terminal SodaOperation methods getCursor() and 315 | * getDocuments(). 316 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassfetcharraysize 317 | * @param size the buffer size to use. 318 | * @return the SodaOperation object. 319 | */ 320 | abstract fetchArraySize(size: number): ISodaOperation; 321 | /** 322 | * Sets a filter specification for the operation, allowing for complex 323 | * document queries and ordering of JSON documents. 324 | * @see https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/adsdi/overview-soda-filter-specifications-qbes.html 325 | * @see https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/adsdi/soda-filter-specifications-reference.html 326 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassfilter 327 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaqbesearches 328 | * @param filter the filter specification to use. 329 | * @return the SodaOperation object. 330 | */ 331 | abstract filter(filter: Record): ISodaOperation; 332 | /** 333 | * Sets the key value to be used to match a document for the operation. 334 | * Any previous calls made to this method or keys() will be ignored. 335 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclasskey 336 | * @param key the search key to use. 337 | * @return the SodaOperation object. 338 | */ 339 | abstract key(key: string): ISodaOperation; 340 | /** 341 | * Sets the keys to be used to match multiple documents for the operation. 342 | * Any previous calls made to this method or key() will be ignored. 343 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclasskeys 344 | * @param keys the search keys to use. 345 | * @return the SodaOperation object. 346 | */ 347 | abstract keys(keys: Array): ISodaOperation; 348 | /** 349 | * Sets the maximum number of documents that a terminal method will apply to. 350 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclasslimit 351 | * @param n the maximum number of documents to return. Must be greater than 0. 352 | * @return the SodaOperation object. 353 | */ 354 | abstract limit(n: number): ISodaOperation; 355 | /** 356 | * Sets the number of documents that will be skipped before the terminal 357 | * method is applied. n must be greater than or equal to 0. 358 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationskip 359 | * @param n the number of documents to skip. 360 | * @return the SodaOperation object. 361 | */ 362 | abstract skip(n: number): ISodaOperation; 363 | /** 364 | * Sets the document version that retrieved documents must have. 365 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassversion 366 | * @param value the version of retrieved documents. 367 | * @return the SodaOperation object. 368 | */ 369 | abstract version(value: string): ISodaOperation; 370 | /** 371 | * Terminals. 372 | */ 373 | /** 374 | * Returns the number of documents matching the given SodaOperation query 375 | * criteria. If skip() or limit() are set, then an exception will be thrown. 376 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclasscount 377 | * @return a result object with a count field containing the number of 378 | * matching documents. 379 | * @throws an exception if skip() or limit() are set. 380 | */ 381 | abstract count(): ICountResult; 382 | /** 383 | * Returns a SodaDocumentCursor for documents that match the SodaOperation 384 | * query criteria. 385 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassgetcursor 386 | * @return a cursor that can be used to iterate over the matched documents. 387 | */ 388 | abstract getCursor(): ISodaDocumentCursor; 389 | /** 390 | * Gets an array of SodaDocuments matching the SodaOperation query criteria. 391 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#-824123-sodaoperationgetdocuments 392 | * @return an array of documents, empty if none match. 393 | */ 394 | abstract getDocuments(): Array; 395 | /** 396 | * Obtains one document matching the SodaOperation query criteria. 397 | * If more than one document is matched, then only the first is returned. 398 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassgetone 399 | * @return the first matching document, or undefined if none match. 400 | */ 401 | abstract getOne(): ISodaDocument; 402 | /** 403 | * Removes a set of documents matching the SodaOperation query criteria. 404 | * If skip() or limit() are set they are ignored. 405 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassremove 406 | * @return a result object with a count field containing the number of 407 | * removed documents. 408 | */ 409 | abstract remove(): IRemoveResult; 410 | /** 411 | * Replaces a document in a collection. The input document can be either a 412 | * JavaScript object representing the data content, or it can be an existing 413 | * SodaDocument. The key() non-terminal must be used when using replaceOne(). 414 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassreplaceone 415 | * @param newDoc the new content or SodaDocument. 416 | * @return a result object with a boolean replaced field which will be 417 | * true if the document was replaced successfully and false otherwise. 418 | */ 419 | abstract replaceOne(newDoc: Record | ISodaDocument): IReplaceResult; 420 | /** 421 | * Replaces a document in a collection and return the result document which 422 | * contains all SodaDocument components except for the content. 423 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodaoperationclassreplaceoneandget 424 | * @param newDoc the new content or SodaDocument. 425 | * @return The updated SodaDocument if replacement was successful, otherwise 426 | * undefined. 427 | */ 428 | abstract replaceOneAndGet(newDoc: Record | ISodaDocument): ISodaDocument; 429 | } 430 | /** 431 | * SODA document cursor class. 432 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadocumentcursorclass 433 | * A SodaDocumentCursor is used to walk through a set of SODA documents returned 434 | * from a find() or getCursor() method. 435 | */ 436 | export declare abstract class ISodaDocumentCursor { 437 | /** 438 | * Close the cursor. 439 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadoccursorclose 440 | */ 441 | abstract close(): void; 442 | /** 443 | * Returns the next SodaDocument in the cursor returned by a find(). 444 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadoccursorgetnext 445 | * @return the next document, or undefined when there are no further 446 | * documents. 447 | */ 448 | abstract getNext(): ISodaDocument; 449 | } 450 | /** 451 | * SODA document class. SodaDocuments represents the document for SODA read and 452 | * write operations. 453 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadocumentclass 454 | */ 455 | export declare abstract class ISodaDocument { 456 | /** 457 | * SODA document properties. 458 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadocumentproperties 459 | */ 460 | /** 461 | * The creation time of the document as a string in the UTC time zone using an 462 | * ISO8601 format. By default, SODA sets this automatically. 463 | */ 464 | readonly createdOn: string; 465 | /** 466 | * A unique key value for this document. By default, SODA automatically 467 | * generates the key. 468 | */ 469 | readonly key: string; 470 | /** 471 | * Last modified time of the document as a string in the UTC time zone using 472 | * an ISO8601 format. By default, SODA sets this automatically. 473 | */ 474 | readonly lastModified: string; 475 | /** 476 | * An arbitrary string value designating the content media type. The 477 | * recommendation when creating documents is to use a MIME type for the media 478 | * type. By default this property will be 'application/json'. 479 | */ 480 | readonly mediaType: string; 481 | /** 482 | * Version of the document. By default, SODA automatically updates the version 483 | * each time the document is changed. 484 | */ 485 | readonly version: string; 486 | /** 487 | * Return the document content as an object. 488 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadocgetcontent 489 | * @return the document content as an object. 490 | * @throws an exception if the document content is not JSON and cannot be 491 | * converted to an object. 492 | */ 493 | abstract getContent(): Record; 494 | /** 495 | * Return JSON document content as a string. If the document encoding is 496 | * unknown, UTF-8 will be used. 497 | * @see https://github.com/oracle/node-oracledb/blob/v5.0.0/doc/api.md#sodadocgetcontentasstring 498 | * @return the document content as a string. 499 | */ 500 | abstract getContentAsString(): string; 501 | } 502 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/args.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2024, 2025, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | /** 39 | * Argument description. 40 | */ 41 | export type ArgInfo = { 42 | /** 43 | * The value of the argument. 44 | */ 45 | val?: any; 46 | /** 47 | * The maximum number of bytes an argument with OUT values can take up. 48 | * Default: 200. 49 | */ 50 | maxSize?: number; 51 | /** 52 | * The argument direction. In almost all cases this is not necessary and the 53 | * direction chosen by the FFI should be used. 54 | * Accepted values: 55 | * - oracledb.BIND_IN 56 | * - oracledb.BIND_OUT 57 | * - oracledb.BIND_INOUT. 58 | */ 59 | dir?: number; 60 | /** 61 | * If the type chosen by FFI needs to be changed this property can be used. 62 | * This property needs to be set to either an oracledb type constant or to 63 | * the name of the database type in case of a user defined named type (e.g. 64 | * record or object). 65 | * This can be useful to ensure no precision loss when e.g. retrieving 66 | * a number (by specifying the oracledb.ORACLE_NUMBER override). 67 | * It can also be useful to specify the correct overload if the FFI cannot 68 | * determine the correct subprogram to use in a package. 69 | * @remarks 70 | * Named types are case sensitive. 71 | */ 72 | type?: number | string; 73 | /** 74 | * The number of array elements to be allocated for a PL/SQL INDEX BY associative array. 75 | * @remarks 76 | * Needed for all OUT associative array arguments. 77 | * INDEX BY VARCHAR2 associative arrays are **not** supported. 78 | */ 79 | maxArraySize?: number; 80 | }; 81 | /** 82 | * This interface represents an argument for a PL/SQL call. 83 | * It can act as a value holder for arguments that have an OUT value. 84 | * It can also act as an extra information store about the given values. 85 | * This could be the type, maxSize, direction or maxArraySize. 86 | */ 87 | export interface DBArgument { 88 | /** 89 | * The JavaScript value of the PL/SQL argument. 90 | */ 91 | val: any; 92 | } 93 | /** 94 | * Create a new argument, to be used in a subsequent PL/SQL call. 95 | * @param info optional argument description. 96 | * @returns the JavaScript representation of a PL/SQL argument. 97 | */ 98 | export declare function arg(info?: ArgInfo): DBArgument; 99 | /** 100 | * Create a new argument with the given value. 101 | * @param value the value of the argument. 102 | * @param info optional argument description. 103 | * @returns the JavaScript representation of a PL/SQL argument. 104 | * @remarks 105 | * If info contains a val property it will be ignored. 106 | */ 107 | export declare function argOf(value: any, info?: ArgInfo): DBArgument; 108 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/call-error.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | /** 39 | * This class represents a PL/SQL exception that occurred during the execution 40 | * of a PL/SQL subprogram. 41 | * @extends Error 42 | */ 43 | export declare class CallError extends Error { 44 | #private; 45 | /** 46 | * The Error type returned by the FFI if an issue occurs. 47 | * @param code the Oracle error code 48 | * @param msg the error message 49 | * @private 50 | */ 51 | constructor(code: number, msg: string); 52 | /** 53 | * Returns true if this CallError is the given PL/SQL exception. 54 | * @param errorCode the Oracle error code of the exception. 55 | * @returns whether this instance represents the given PL/SQL exception. 56 | */ 57 | is(errorCode: number): boolean; 58 | } 59 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/index.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { DBArgument, arg, argOf } from './args'; 39 | import { CallError } from './call-error'; 40 | import { resolvePackage, resolveFunction, resolveProcedure } from './resolvers'; 41 | export type { DBArgument }; 42 | export { arg, argOf, CallError, resolvePackage, resolveFunction, resolveProcedure, }; 43 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-plsql-ffi", 3 | "description": "MLE Foreign Function Interface (FFI): API for calling PL/SQL functionality directly", 4 | "types": "index.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/resolvers.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | import { DBSubprogram } from './subprogram-api'; 39 | /** 40 | * @categoryDescription Resolve Functions 41 | * These functions resolve PL/SQL objects by name. 42 | * The name can optionally contain the schema divided by a dot e.g. SCOTT.THING. 43 | * If the schema is not given the usual PL/SQL name resolution rules apply. 44 | * @module 45 | */ 46 | /** 47 | * Resolve a PL/SQL package by name. 48 | * 49 | * @returns a representation of the given package that can be used to interact 50 | * with the PL/SQL package. 51 | * 52 | * @category Resolve Functions 53 | * 54 | * @example 55 | * ```ts 56 | * // Get the JS represenation. 57 | * const dbmsRandom = resolvePackage('DBMS_RANDOM'); 58 | * 59 | * // Use the representation. 60 | * dbmsRandom.seed(42); 61 | * console.log(dbmsRandom.normal()); 62 | * ``` 63 | */ 64 | export declare function resolvePackage(name: string): any; 65 | /** 66 | * Resolve a PL/SQL top-level function by name. 67 | * 68 | * @returns a JavaScript function that will execute the PL/SQL function when 69 | * called and returns the PL/SQL return value. 70 | * 71 | * @category Resolve Functions 72 | * 73 | * @remarks 74 | * Similarly to the SQL driver this package has to deal with translating types 75 | * between PL/SQL and JavaScript. Some PL/SQL types can be translated into 76 | * multiple JavaScript types, so the return type can be overridden. 77 | * 78 | * @example 79 | * ```ts 80 | * // Resolve top-level function. 81 | * const exampleFunc = resolveFunction('my_func'); 82 | * // Execute the PL/SQL function simply by calling the JS function. 83 | * const numberResult = exampleFunc(42); 84 | * // Override the return type of the function. 85 | * const oracleNumberResult = exampleFunc.returns(oracledb.ORACLE_NUMBER)(42); 86 | * ``` 87 | */ 88 | export declare function resolveFunction(name: string): DBSubprogram; 89 | /** 90 | * Resolve a PL/SQL top-level procedure. 91 | * 92 | * @returns a JavaScript function that will execute the given PL/SQL procedure 93 | * when called. 94 | * 95 | * @category Resolve Functions 96 | * 97 | * @example 98 | * ```ts 99 | * // Resolve the procedure 100 | * const exampleProcedure = resolveProcedure('my_procedure'); 101 | * exampleProcedure(42, 23); 102 | * ``` 103 | */ 104 | export declare function resolveProcedure(name: string): DBSubprogram; 105 | -------------------------------------------------------------------------------- /declarations/mle-js-plsql-ffi/subprogram-api.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2024, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | /** 39 | * Return type override options. 40 | */ 41 | export type ReturnInfo = { 42 | /** 43 | * The same as {@link ArgInfo.maxSize}. 44 | */ 45 | maxSize?: number; 46 | /** 47 | * The same as {@link ArgInfo.type}. 48 | */ 49 | type?: number | string; 50 | /** 51 | * The same as {@link ArgInfo.maxArraySize}. 52 | */ 53 | maxArraySize?: number; 54 | }; 55 | /** 56 | * JavaScript representation of a PL/SQL subprogram. 57 | */ 58 | export interface DBSubprogram { 59 | (...arg: any[]): any; 60 | /** 61 | * Override the return type of the subprogram. 62 | * If the subprogram being represented is a procedure this has no effect. 63 | * @param dbType the database type. This needs to be either an oracledb 64 | * type constant or a string containing the name of a user defined database 65 | * type (only for named types like records and objects). 66 | * If more info needs to be specified {@link ReturnInfo} can be used. 67 | * @remarks 68 | * Type names are case-sensitive. 69 | */ 70 | overrideReturnType(dbType: number | string | ReturnInfo): DBSubprogram; 71 | } 72 | -------------------------------------------------------------------------------- /declarations/mle-js-plsqltypes/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /declarations/mle-js-plsqltypes/README.md: -------------------------------------------------------------------------------- 1 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 2 | -------------------------------------------------------------------------------- /declarations/mle-js-plsqltypes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-plsqltypes", 3 | "description": "MLE PL/SQL Types", 4 | "types": "mle-js-plsqltypes.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /declarations/mle-js/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2025, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /declarations/mle-js/README.md: -------------------------------------------------------------------------------- 1 | Note that using this package is deprecated and that instead you should just install `@types/mle-js` like this: 2 | ```sh 3 | npm install --saveDev "https://github.com/oracle-samples/mle-modules#main" 4 | ``` 5 | 6 | Please consult the installation instructions and documentation on https://oracle-samples.github.io/mle-modules. 7 | -------------------------------------------------------------------------------- /declarations/mle-js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js", 3 | "description": "Bundle of all declarations of pre-defined JavaScript modules that ship with Oracle Database", 4 | "types": "mle-js.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues" 14 | } -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/mle-js", 3 | "version": "23.8.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@types/mle-js", 9 | "version": "23.8.0", 10 | "license": "UPL-1.0", 11 | "devDependencies": { 12 | "typescript": "^5.8.3" 13 | } 14 | }, 15 | "node_modules/typescript": { 16 | "version": "5.8.3", 17 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", 18 | "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", 19 | "dev": true, 20 | "license": "Apache-2.0", 21 | "bin": { 22 | "tsc": "bin/tsc", 23 | "tsserver": "bin/tsserver" 24 | }, 25 | "engines": { 26 | "node": ">=14.17" 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@types/mle-js", 3 | "description": "TypeScript definitions for Bundle of all declarations of pre-defined JavaScript modules that ship with Oracle Database", 4 | "types": "index.d.ts", 5 | "author": "Oracle", 6 | "version": "23.8.0", 7 | "license": "UPL-1.0", 8 | "homepage": "https://oracle-samples.github.io/mle-modules", 9 | "repository": { 10 | "type": "git", 11 | "url": "git://github.com/oracle-samples/mle-modules.git" 12 | }, 13 | "bugs": "https://github.com/oracle-samples/mle-modules/issues", 14 | "devDependencies": { 15 | "typescript": "^5.8.3" 16 | }, 17 | "scripts": { 18 | "test": "./node_modules/typescript/bin/tsc" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /test/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017, 2024, Oracle and/or its affiliates. 2 | 3 | The Universal Permissive License (UPL), Version 1.0 4 | 5 | Subject to the condition set forth below, permission is hereby granted to any 6 | person obtaining a copy of this software, associated documentation and/or data 7 | (collectively the "Software"), free of charge and under any and all copyright 8 | rights in the Software, and any and all patent rights owned or freely 9 | licensable by each licensor hereunder covering either (i) the unmodified 10 | Software as contributed to or provided by such licensor, or (ii) the Larger 11 | Works (as defined below), to deal in both 12 | 13 | (a) the Software, and 14 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 15 | one is included with the Software (each a "Larger Work" to which the Software 16 | is contributed by such licensors), 17 | 18 | without restriction, including without limitation the rights to copy, create 19 | derivative works of, display, perform, and distribute the Software and make, 20 | use, sell, offer for sale, import, export, have made, and have sold the 21 | Software and the Larger Work(s), and to sublicense the foregoing rights on 22 | either these or other terms. 23 | 24 | This license is subject to the following condition: 25 | The above copyright notice and either this complete permission notice or at 26 | a minimum a reference to the UPL must be included in all copies or 27 | substantial portions of the Software. 28 | 29 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 30 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 31 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 32 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 33 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 34 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 35 | SOFTWARE. 36 | 37 | -------------------------------------------------------------------------------- /test/README.md: -------------------------------------------------------------------------------- 1 | ```bash 2 | npm ci 3 | npm run test 4 | ``` 5 | -------------------------------------------------------------------------------- /test/mle-js-tests.ts: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright (c) 2025, 2025, Oracle and/or its affiliates. 3 | 4 | The Universal Permissive License (UPL), Version 1.0 5 | 6 | Subject to the condition set forth below, permission is hereby granted to any 7 | person obtaining a copy of this software, associated documentation and/or data 8 | (collectively the "Software"), free of charge and under any and all copyright 9 | rights in the Software, and any and all patent rights owned or freely 10 | licensable by each licensor hereunder covering either (i) the unmodified 11 | Software as contributed to or provided by such licensor, or (ii) the Larger 12 | Works (as defined below), to deal in both 13 | 14 | (a) the Software, and 15 | (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if 16 | one is included with the Software (each a "Larger Work" to which the Software 17 | is contributed by such licensors), 18 | 19 | without restriction, including without limitation the rights to copy, create 20 | derivative works of, display, perform, and distribute the Software and make, 21 | use, sell, offer for sale, import, export, have made, and have sold the 22 | Software and the Larger Work(s), and to sublicense the foregoing rights on 23 | either these or other terms. 24 | 25 | This license is subject to the following condition: 26 | The above copyright notice and either this complete permission notice or at 27 | a minimum a reference to the UPL must be included in all copies or 28 | substantial portions of the Software. 29 | 30 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 31 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 32 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 33 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 34 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 35 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 36 | SOFTWARE. 37 | */ 38 | 39 | import { decode as base64decode, encode as base64encode } from "mle-encode-base64"; 40 | import bindings from "mle-js-bindings"; 41 | 42 | function oracleDBTest(): number | undefined { 43 | oracledb.outFormat = oracledb.OUT_FORMAT_ARRAY; 44 | const odb = new oracledb.OracleDb(false); 45 | return odb.defaultConnection().execute("SELECT 42").rowsAffected; 46 | } 47 | 48 | function sessionTest() { 49 | const res = session.execute("SELECT 42"); 50 | if (res.rows) { 51 | for (let row of res.rows) { 52 | console.log(JSON.stringify(row)); 53 | } 54 | } 55 | } 56 | 57 | function sodaTest(): string { 58 | return soda.createCollection("myCollection").getDataGuide().createdOn; 59 | } 60 | 61 | function numberTest(): OracleNumber { 62 | return OracleNumber.pi.mul(new OracleNumber(42)); 63 | } 64 | 65 | function blobTest(): OracleBlob { 66 | return OracleBlob.createTemporary(true); 67 | } 68 | 69 | function clobTest(): OracleClob { 70 | return OracleClob.createTemporary(true); 71 | } 72 | 73 | function dateTest(): OracleDate { 74 | const d1: OracleDate = OracleDate.fromString("24-OCT-19"); 75 | const d2: OracleDate = OracleDate.sysDate(); 76 | if (OracleDate.compare(d1, d2) > 0) { 77 | return d1; 78 | } else { 79 | return d2; 80 | } 81 | } 82 | 83 | function timestampTZTest(): OracleTimestampTZ { 84 | return OracleTimestampTZ.fromString("2020-01-09 17:01:32.341 US/Pacific"); 85 | } 86 | 87 | function timestampTest(): OracleTimestamp { 88 | return OracleTimestamp.fromString("2020-01-09 17:01:32.341", "YYYY-MM-DD HH24:MI:SS.FF"); 89 | } 90 | 91 | // tests fetch, Response, Request and Headers 92 | async function fetchTest(): Promise { 93 | const url = "http://www.example.com/helloWorld"; 94 | 95 | const headers: Headers = new Headers({ 96 | accept: "application/json", 97 | "Content-Type": "text/plain", 98 | }); 99 | 100 | const request: Request = new Request(url, { 101 | headers: headers, 102 | method: "GET", 103 | }); 104 | 105 | const result: Response = await fetch(request); 106 | if (result.body) { 107 | return result.json(); 108 | } else { 109 | return "['no-body']"; 110 | } 111 | } 112 | 113 | function testIntervalDayToSecond(): OracleIntervalDayToSecond { 114 | const i1: OracleIntervalDayToSecond = OracleIntervalDayToSecond.fromNumber(42); 115 | const i2: OracleIntervalDayToSecond = OracleIntervalDayToSecond.fromString("+00 02:00:13"); 116 | return i1.add(i2); 117 | } 118 | 119 | function testIntervalYearToMonth(): OracleIntervalYearToMonth { 120 | const i1: OracleIntervalYearToMonth = OracleIntervalYearToMonth.fromNumber(7); 121 | const i2: OracleIntervalYearToMonth = OracleIntervalYearToMonth.fromString("+01-10"); 122 | return i1.add(i2); 123 | } 124 | 125 | function testTextEncoder(): Uint8Array { 126 | return new TextEncoder().encode("Hello World!"); 127 | } 128 | 129 | function testTextDecoderAndEncoder(): string { 130 | return new TextDecoder().decode(testTextEncoder()); 131 | } 132 | 133 | function testJsonId(): JsonId { 134 | return new JsonId([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]); 135 | } 136 | 137 | function testPkg() { 138 | const myPkg = plsffi.resolvePackage("my_schema.my_pkg"); 139 | 140 | // Call a procedure 141 | myPkg.my_proc(23, 42, "Hello World!"); 142 | 143 | // Call a function 144 | const myVal = myPkg.my_function("foo", "bar"); 145 | 146 | // Read a variable/constant 147 | const myVar = myPkg.my_attribute; 148 | 149 | // Write variable 150 | myPkg.my_variable = 2; 151 | } 152 | 153 | function testSubprograms() { 154 | // Resolve top-level function 155 | const exampleFunc = plsffi.resolveFunction("my_func"); 156 | 157 | // Execute the PL/SQL function and use default conversion to JavaScript number 158 | const numberResult = exampleFunc(42); 159 | 160 | // Execute the PL/SQL function and convert to JavaScript OracleNumber 161 | const oracleNumberResult = exampleFunc.overrideReturnType(oracledb.ORACLE_NUMBER)(42); 162 | 163 | const exampleProcedure = plsffi.resolveProcedure("my_procedure"); 164 | exampleProcedure(42, 23); 165 | } 166 | 167 | function testArgs() { 168 | // Resolve top-level procedure 169 | const myProc = plsffi.resolveProcedure("my_procedure_inout"); 170 | 171 | // Prepare (IN) OUT parameters 172 | const myArg3 = plsffi.argOf("baz"); 173 | const myArg4 = plsffi.arg(); 174 | 175 | // Call procedure with positional arguments 176 | myProc("foo", "bar", myArg3, myArg4); 177 | 178 | // Call procedure with named arguments 179 | myProc({ 180 | arg1: "foo", 181 | arg2: "bar", 182 | arg3: myArg3, 183 | arg4: myArg4, 184 | }); 185 | 186 | // Resulting Outbind values are retrieved from .val 187 | console.log(myArg3.val, myArg4.val); 188 | } 189 | 190 | function testPlsFFI() { 191 | testPkg(); 192 | testSubprograms(); 193 | testArgs(); 194 | } 195 | 196 | function asciiBytesToString(bytesBuffer: ArrayBuffer) { 197 | let charCodes = new Uint8Array(bytesBuffer); 198 | let result = ""; 199 | 200 | charCodes.forEach((char) => { 201 | result += String.fromCharCode(char); 202 | }); 203 | return result; 204 | } 205 | 206 | function testBase64Encoding() { 207 | const testInput = "hello"; 208 | const encoded = base64encode(testInput); 209 | console.log("encoded: " + encoded); 210 | const decodedBytes = base64decode(encoded); 211 | console.log("decoded into an ArrayBuffer?: " + (decodedBytes instanceof ArrayBuffer)); 212 | const stringFromBytes = asciiBytesToString(decodedBytes); 213 | console.log("string from decoded: " + stringFromBytes); 214 | } 215 | 216 | function testPlsqlTypesDoc() { 217 | const query = "SELECT 9007199254740992 AS n FROM dual"; 218 | const options = { fetchInfo: { N: { type: oracledb.ORACLE_NUMBER } } }; 219 | const result = session.execute(query, [], options); 220 | if (result.rows) { 221 | console.log(result.rows[0].N.add(new OracleNumber(7))); 222 | } 223 | 224 | const timestamp = OracleTimestamp.fromString("2012-05-19", "YYYY-MM-DD"); 225 | console.log("Timestamp: ", timestamp); 226 | const interval = new OracleIntervalDayToSecond(5, 2, 33, 55, 0); 227 | console.log("TimeStamp + Interval: ", timestamp.addInterval(interval)); 228 | } 229 | 230 | function testBindingsDoc() { 231 | const param1 = bindings.importValue("param1"); 232 | const result = param1 + 7; 233 | bindings.exportValue("result", result); 234 | const param1AsString = bindings.importValue("param1", bindings.JSTypes.STRING); 235 | } 236 | 237 | function testSqlDriverDocs() { 238 | var rows = session.execute("SELECT EMPNO, ENAME FROM SCOTT.EMP").rows; 239 | if (rows) { 240 | for (var row of rows) { 241 | const empno = row.EMPNO; 242 | const ename = row.ENAME; 243 | // ... 244 | } 245 | } 246 | 247 | var rows = session.execute("SELECT EMPNO, ENAME FROM SCOTT.EMP", [], { 248 | outFormat: oracledb.OUT_FORMAT_ARRAY, 249 | }).rows; 250 | if (rows) { 251 | for (var row of rows) { 252 | const empno = row.EMPNO; 253 | const ename = row.ENAME; 254 | // ... 255 | } 256 | } 257 | 258 | var rows = session.execute("SELECT :bind1, :bind2, :bind3", [42, "foo", true]).rows; 259 | 260 | var result = session.execute("SELECT :foo, :bar", { 261 | foo: 42, 262 | bar: "foo", 263 | }); 264 | 265 | var result = session.execute("SELECT :foo", { 266 | foo: { 267 | val: 42, 268 | dir: oracledb.BIND_IN, 269 | type: oracledb.NUMBER, 270 | }, 271 | }); 272 | 273 | var result = session.execute("BEGIN :a := 'foo'; :b := 42; END;", { 274 | a: { dir: oracledb.BIND_OUT, type: oracledb.STRING }, 275 | b: { dir: oracledb.BIND_OUT, type: oracledb.NUMBER }, 276 | }); 277 | 278 | var result = session.execute("SELECT EMPNO, HIREDATE FROM SCOTT.EMP", [], { 279 | fetchInfo: { 280 | "EMPNO": { type: oracledb.STRING }, // return the number as a string 281 | "HIREDATE": { type: oracledb.STRING }, // return the date as a string 282 | }, 283 | }); 284 | 285 | var rs = session.execute("SELECT * FROM EMP"); 286 | if (rs.metaData) { 287 | for (var md of rs.metaData) { 288 | var columnName = md.name; 289 | var columnDBType = md.dbType; // ORACLE Database Type, e.g. oracledb.DB_TYPE_NUMBER 290 | var columnFetchType = md.fetchType; // JavaScript Type which will be fetched, e.g. oracledb.STRING 291 | var isNullable = md.nullable; 292 | // ... 293 | } 294 | } 295 | 296 | try { 297 | var rows = session.execute("SELECT * FROM").rows; 298 | if (rows) { 299 | // never reached 300 | // ... 301 | } 302 | } catch (err: any) { 303 | return err.errorNum + " " + err.message; 304 | } 305 | 306 | var result = session.execute("insert into emp values (7999, 'Hello', 'World', 7839, '18-DEC-85', 2500, 0, 30)"); 307 | var rowsInserted = result.rowsAffected; 308 | } 309 | 310 | function testFetchTypeHandler() { 311 | const myFetchTypeHandler = function() { 312 | return {converter: (val: any) => val.toString()}; 313 | }; 314 | 315 | oracledb.fetchTypeHandler = myFetchTypeHandler; 316 | 317 | const sql = `select 1+1`; 318 | const result = session.execute(sql, [], { 319 | outFormat: oracledb.ARRAY 320 | }); 321 | 322 | if (result.rows) { 323 | console.assert(result.rows[0][0] === '2', `${result.rows[0][0]} does not equal "2"`); 324 | console.log(result.rows[0][0]); 325 | } 326 | 327 | const myFetchTypeHandler2 = function(metaData: any) { 328 | if (metaData.dbType == oracledb.DB_TYPE_NUMBER) { 329 | return { 330 | converter: (val: string) => val + val, 331 | type: oracledb.STRING 332 | }; 333 | } else { 334 | return null; 335 | } 336 | }; 337 | 338 | session.execute(sql, [], { 339 | outFormat: oracledb.ARRAY, 340 | fetchTypeHandler: myFetchTypeHandler2 341 | }); 342 | } 343 | 344 | async function mainTest() { 345 | oracleDBTest(); 346 | sessionTest(); 347 | sodaTest(); 348 | numberTest(); 349 | blobTest(); 350 | clobTest(); 351 | dateTest(); 352 | timestampTZTest(); 353 | timestampTest(); 354 | fetchTest(); 355 | testIntervalDayToSecond(); 356 | testIntervalYearToMonth(); 357 | testTextDecoderAndEncoder(); 358 | testJsonId(); 359 | testPlsFFI(); 360 | testBase64Encoding(); 361 | testPlsqlTypesDoc(); 362 | testBindingsDoc(); 363 | testSqlDriverDocs(); 364 | testFetchTypeHandler(); 365 | } 366 | 367 | mainTest(); 368 | -------------------------------------------------------------------------------- /test/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-tests", 3 | "version": "23.8.0", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "mle-js-tests", 9 | "version": "23.8.0", 10 | "license": "UPL-1.0", 11 | "devDependencies": { 12 | "@types/mle-js": "file:.." 13 | } 14 | }, 15 | "..": { 16 | "version": "23.8.0", 17 | "dev": true, 18 | "license": "UPL-1.0" 19 | }, 20 | "node_modules/@types/mle-js": { 21 | "resolved": "..", 22 | "link": true 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mle-js-tests", 3 | "description": "Testing typings for mle-js", 4 | "author": "Oracle", 5 | "version": "23.8.0", 6 | "license": "UPL-1.0", 7 | "devDependencies": { 8 | "@types/mle-js": "file:.." 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "Node16", 5 | "lib": ["es6", "es2017", "es2021"], 6 | "types": [], 7 | "noEmit": true, 8 | "noImplicitAny": true, 9 | "noImplicitThis": true, 10 | "strictNullChecks": true, 11 | "strictFunctionTypes": true, 12 | "forceConsistentCasingInFileNames": true 13 | }, 14 | "files": [ 15 | "test/mle-js-tests.ts", 16 | "index.d.ts" 17 | ] 18 | } 19 | --------------------------------------------------------------------------------