orange-orm 4.7.0-beta.1 → 4.7.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.browser.mjs +896 -170
- package/dist/index.mjs +41 -63
- package/package.json +1 -1
- package/src/bunPg/newDatabase.js +2 -5
- package/src/bunPg/pool/newPgPool.js +1 -0
- package/src/bunSqlite/newDatabase.js +2 -5
- package/src/bunSqlite/pool/newGenericPool.js +1 -0
- package/src/client/index.js +5 -0
- package/src/d1/newDatabase.js +2 -5
- package/src/d1/pool/newGenericPool.js +1 -0
- package/src/index.d.ts +1 -1
- package/src/indexBrowser.js +9 -0
- package/src/map.d.ts +1 -0
- package/src/mssql/newDatabase.js +2 -5
- package/src/mssql/pool/newGenericPool.js +1 -0
- package/src/mySql/newDatabase.js +2 -5
- package/src/mySql/pool/newGenericPool.js +1 -0
- package/src/nodeSqlite/newDatabase.js +2 -5
- package/src/nodeSqlite/pool/newGenericPool.js +1 -0
- package/src/oracle/newDatabase.js +2 -5
- package/src/oracle/pool/newGenericPool.js +1 -0
- package/src/pg/newDatabase.js +2 -5
- package/src/pg/pool/newPgPool.js +1 -0
- package/src/pglite/newDatabase.js +2 -5
- package/src/pglite/newTransaction.js +1 -3
- package/src/pglite/pool/newPgPool.js +1 -0
- package/src/sap/newDatabase.js +2 -5
- package/src/sqlite3/newDatabase.js +2 -5
- package/src/sqlite3/pool/newGenericPool.js +1 -0
- package/src/tedious/newDatabase.js +2 -5
- package/src/tedious/pool/newGenericPool.js +1 -0
package/README.md
CHANGED
|
@@ -286,6 +286,10 @@ npm install sqlite3
|
|
|
286
286
|
```javascript
|
|
287
287
|
import map from './map';
|
|
288
288
|
const db = map.sqlite('demo.db');
|
|
289
|
+
// … use the database …
|
|
290
|
+
|
|
291
|
+
// IMPORTANT for serverless functions:
|
|
292
|
+
await db.close(); // closes the client connection
|
|
289
293
|
```
|
|
290
294
|
__With connection pool__
|
|
291
295
|
```bash
|
|
@@ -294,7 +298,14 @@ npm install sqlite3
|
|
|
294
298
|
```javascript
|
|
295
299
|
import map from './map';
|
|
296
300
|
const db = map.sqlite('demo.db', { size: 10 });
|
|
301
|
+
// … use the pool …
|
|
302
|
+
|
|
303
|
+
// IMPORTANT for serverless functions:
|
|
304
|
+
await pool.close(); // closes all pooled connections
|
|
297
305
|
```
|
|
306
|
+
__Why close ?__
|
|
307
|
+
In serverless environments (e.g. AWS Lambda, Vercel, Cloudflare Workers) execution contexts are frequently frozen and resumed. Explicitly closing the client or pool ensures that file handles are released promptly and prevents “database locked” errors between invocations.
|
|
308
|
+
|
|
298
309
|
__From the browser__
|
|
299
310
|
You can securely use Orange from the browser by utilizing the Express plugin, which serves to safeguard sensitive database credentials from exposure at the client level. This technique bypasses the need to transmit raw SQL queries directly from the client to the server. Instead, it logs method calls initiated by the client, which are later replayed and authenticated on the server. This not only reinforces security by preventing the disclosure of raw SQL queries on the client side but also facilitates a smoother operation. Essentially, this method mirrors a traditional REST API, augmented with advanced TypeScript tooling for enhanced functionality. You can read more about it in the section called [In the browser](#user-content-in-the-browser)
|
|
300
311
|
<sub>📄 server.ts</sub>
|