@pi-r/oracle 0.5.2 → 0.5.4

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2023 Wit Studio
1
+ Copyright 2024 An Pham
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
4
 
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @pi-r/oracle
2
2
 
3
- PEP 402 - Forever Vivy
3
+ PEP 402 - Forever
4
4
 
5
5
  ## LICENSE
6
6
 
package/client/index.js CHANGED
@@ -43,11 +43,13 @@ function removePoolProperties(credential) {
43
43
  return credential;
44
44
  }
45
45
  function getPoolKey(credential) {
46
+ var _a;
46
47
  if (credential.connectString && (credential.user && credential.password || credential.externalAuth)) {
47
- return credential.connectString + '_' + (credential.externalAuth ? 'external' : credential.user + '_' + credential.password) + '_' + (credential.edition || '') + '_' + (credential.tag ? credential.tag + '#' + (credential.matchAny ? '1' : '0') : '') + '_' + (credential.privilege ?? '') + '_' + Db.asString(credential.shardingKey) + '_' + Db.asString(credential.superShardingKey);
48
+ return credential.connectString + '_' + (credential.externalAuth ? 'external' : credential.user + '_' + credential.password) + '_' + (credential.edition || '') + '_' + (credential.tag ? credential.tag + '#' + (credential.matchAny ? '1' : '0') : '') + '_' + ((_a = credential.privilege) !== null && _a !== void 0 ? _a : '') + '_' + Db.asString(credential.shardingKey) + '_' + Db.asString(credential.superShardingKey);
48
49
  }
49
50
  }
50
51
  async function setCredential(item) {
52
+ var _a, _b, _c, _d, _e, _f;
51
53
  let credential = this.getCredential(item), hostname, port, username, database;
52
54
  if (credential) {
53
55
  ({ hostname, port, username } = (0, util_1.parseServerAuth)(credential));
@@ -130,22 +132,22 @@ async function setCredential(item) {
130
132
  if (config) {
131
133
  const { min, max, idle, queue_max, queue_idle, timeout } = config;
132
134
  if (min >= 0) {
133
- credential.poolMin ?? (credential.poolMin = min);
135
+ (_a = credential.poolMin) !== null && _a !== void 0 ? _a : (credential.poolMin = min);
134
136
  }
135
137
  if (max > 0) {
136
- credential.poolMax ?? (credential.poolMax = max);
138
+ (_b = credential.poolMax) !== null && _b !== void 0 ? _b : (credential.poolMax = max);
137
139
  }
138
140
  if (idle >= 0) {
139
- credential.poolTimeout ?? (credential.poolTimeout = idle / 1000);
141
+ (_c = credential.poolTimeout) !== null && _c !== void 0 ? _c : (credential.poolTimeout = idle / 1000);
140
142
  }
141
143
  if (queue_max >= 0) {
142
- credential.queueMax ?? (credential.queueMax = queue_max);
144
+ (_d = credential.queueMax) !== null && _d !== void 0 ? _d : (credential.queueMax = queue_max);
143
145
  }
144
146
  if (queue_idle >= 0) {
145
- credential.queueTimeout ?? (credential.queueTimeout = queue_idle);
147
+ (_e = credential.queueTimeout) !== null && _e !== void 0 ? _e : (credential.queueTimeout = queue_idle);
146
148
  }
147
149
  if (timeout >= 0) {
148
- credential.connectTimeout ?? (credential.connectTimeout = idle / 1000);
150
+ (_f = credential.connectTimeout) !== null && _f !== void 0 ? _f : (credential.connectTimeout = idle / 1000);
149
151
  }
150
152
  }
151
153
  new OraclePool(await oracledb.createPool(credential), poolKey, username && password ? { username, password } : undefined).add(item).parent = POOL_STATE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-r/oracle",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Oracle client driver for E-mc.",
5
5
  "main": "client/index.js",
6
6
  "types": "client/index.d.ts",
@@ -21,8 +21,8 @@
21
21
  "license": "MIT",
22
22
  "homepage": "https://github.com/anpham6/pi-r#readme",
23
23
  "dependencies": {
24
- "@e-mc/db": "^0.7.2",
25
- "@e-mc/types": "^0.7.2",
26
- "oracledb": "^6.3.0"
24
+ "@e-mc/db": "^0.7.5",
25
+ "@e-mc/types": "^0.7.5",
26
+ "oracledb": "^6.4.0"
27
27
  }
28
28
  }
package/types/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { DbDataSource } from '@e-mc/types/lib/squared';
2
2
 
3
3
  import type { ExecuteAction, ServerAuth } from '@e-mc/types/lib/db';
4
4
 
5
+ // @ts-ignore
5
6
  import type { BindParameters, ConnectionAttributes, ExecuteOptions, PoolAttributes } from 'oracledb';
6
7
 
7
8
  export interface OracleDataSource extends DbDataSource<string, ExecuteOptions, unknown, string | OracleCredential, string>, ExecuteAction<BindParameters> {