@mikro-orm/oracledb 7.0.2-dev.9 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,145 +1,162 @@
1
- import { CheckConstraintViolationException, ExceptionConverter, InvalidFieldNameException, NonUniqueFieldNameException, NotNullConstraintViolationException, SyntaxErrorException, TableExistsException, TableNotFoundException, UniqueConstraintViolationException, DatabaseObjectNotFoundException, ForeignKeyConstraintViolationException, ReadOnlyException, ConnectionException, DeadlockException, LockWaitTimeoutException, } from '@mikro-orm/core';
1
+ import {
2
+ CheckConstraintViolationException,
3
+ ExceptionConverter,
4
+ InvalidFieldNameException,
5
+ NonUniqueFieldNameException,
6
+ NotNullConstraintViolationException,
7
+ SyntaxErrorException,
8
+ TableExistsException,
9
+ TableNotFoundException,
10
+ UniqueConstraintViolationException,
11
+ DatabaseObjectNotFoundException,
12
+ ForeignKeyConstraintViolationException,
13
+ ReadOnlyException,
14
+ ConnectionException,
15
+ DeadlockException,
16
+ LockWaitTimeoutException,
17
+ } from '@mikro-orm/core';
2
18
  /* v8 ignore start */
19
+ /** Converts Oracle native errors into typed MikroORM driver exceptions. */
3
20
  export class OracleExceptionConverter extends ExceptionConverter {
4
- /**
5
- * @link https://docs.oracle.com/cd/B28359_01/server.111/b28278/toc.htm
6
- */
7
- convertException(exception) {
8
- switch (exception.errorNum) {
9
- case 1: // ORA-00001: unique constraint (string.string) violated
10
- return new UniqueConstraintViolationException(exception);
11
- case 54: // ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
12
- return new LockWaitTimeoutException(exception);
13
- case 18: // ORA-00018: maximum number of sessions exceeded
14
- case 19: // ORA-00019: maximum number of session licenses exceeded
15
- case 20: // ORA-00020: maximum number of processes (string) exceeded
16
- case 22: // ORA-00022: invalid session ID; access denied
17
- case 107: // ORA-00107: failed to connect to ORACLE listener process
18
- case 1017: // ORA-01017: invalid username/password; logon denied
19
- case 2010: // ORA-02010: missing host connect string
20
- case 3113: // ORA-03113: end-of-file on communication channel
21
- case 3135: // ORA-03135: connection lost contact
22
- case 12154: // ORA-12154: TNS:could not resolve service name
23
- case 12198: // ORA-12198: TNS:could not find path to destination
24
- case 12203: // ORA-12203: TNS:unable to connect to destination
25
- case 12500: // ORA-12500: TNS:listener failed to start a dedicated server process
26
- case 12504: // ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
27
- case 12505: // ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
28
- case 12511: // ORA-12511: TNS:service handler found but it is not accepting connections
29
- case 12513: // ORA-12513: TNS:service handler found but it has registered for a different protocol
30
- case 12514: // ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
31
- case 12533: // ORA-12533: TNS:illegal ADDRESS parameters
32
- case 12545: // ORA-12545: TNS:name lookup failure
33
- case 12560: // ORA-12560: TNS:protocol adapter error
34
- case 12537: // ORA-12537: TNS:connection closed
35
- return new ConnectionException(exception);
36
- case 28: // ORA-00028: your session has been killed
37
- return new ConnectionException(exception);
38
- case 60: // ORA-00060: deadlock detected while waiting for resource
39
- return new DeadlockException(exception);
40
- case 904: // ORA-00904: invalid column name
41
- return new InvalidFieldNameException(exception);
42
- case 918: // ORA-00918: column ambiguously defined
43
- case 957: // ORA-00957: duplicate column name
44
- case 960: // ORA-00960: ambiguous column naming in select list
45
- return new NonUniqueFieldNameException(exception);
46
- case 900: // ORA-00900: invalid SQL statement
47
- case 901: // ORA-00901: invalid CREATE command
48
- case 902: // ORA-00902: invalid datatype
49
- case 905: // ORA-00905: missing keyword
50
- case 906: // ORA-00906: missing left parenthesis
51
- case 907: // ORA-00907: missing right parenthesis
52
- case 908: // ORA-00908: missing NULL keyword
53
- case 909: // ORA-00909: invalid number of arguments
54
- case 910: // ORA-00910: specified length too long for its datatype
55
- case 911: // ORA-00911: invalid character
56
- case 912: // ORA-00912: input parameter too long
57
- case 913: // ORA-00913: too many values
58
- case 914: // ORA-00914: missing ADD keyword
59
- case 917: // ORA-00917: missing comma
60
- case 919: // ORA-00919: invalid function
61
- case 920: // ORA-00920: invalid relational operator
62
- case 921: // ORA-00921: unexpected end of SQL command
63
- case 922: // ORA-00922: missing or invalid option
64
- case 923: // ORA-00923: FROM keyword not found where expected
65
- case 924: // ORA-00924: missing BY keyword
66
- case 925: // ORA-00925: missing INTO keyword
67
- case 926: // ORA-00926: missing VALUES keyword
68
- case 927: // ORA-00927: missing equal sign
69
- case 928: // ORA-00928: missing SELECT keyword
70
- case 929: // ORA-00929: missing period
71
- case 930: // ORA-00930: missing asterisk
72
- case 931: // ORA-00931: missing identifier
73
- case 932: // ORA-00932: inconsistent datatypes
74
- case 933: // ORA-00933: SQL command not properly ended
75
- case 934: // ORA-00934: group function is not allowed here
76
- case 935: // ORA-00935: group function is nested too deeply
77
- case 936: // ORA-00936: missing expression
78
- case 937: // ORA-00937: not a single-group group function
79
- case 938: // ORA-00938: not enough arguments for function
80
- case 939: // ORA-00939: too many arguments for function
81
- case 940: // ORA-00940: invalid ALTER command
82
- case 941: // ORA-00941: missing cluster name
83
- case 946: // ORA-00946: missing TO keyword
84
- case 947: // ORA-00947: not enough values
85
- case 950: // ORA-00950: invalid DROP option
86
- case 952: // ORA-00952: missing GROUP keyword
87
- case 954: // ORA-00954: missing IDENTIFIED keyword
88
- case 956: // ORA-00956: missing or invalid auditing option
89
- case 962: // ORA-00962: too many group-by or order-by expressions
90
- case 964: // ORA-00964: table name not in FROM list
91
- case 965: // ORA-00965: column aliases not allowed for "*"
92
- case 966: // ORA-00966: missing TABLE keyword
93
- case 967: // ORA-00967: missing WHERE keyword
94
- case 968: // ORA-00968: missing INDEX keyword
95
- case 969: // ORA-00969: missing ON keyword
96
- case 970: // ORA-00970: missing WITH keyword
97
- case 971: // ORA-00971: missing SET keyword
98
- case 972: // ORA-00972: identifier is too long
99
- case 974: // ORA-00974: invalid PCTFREE value percentage
100
- case 975: // ORA-00975: date + date not allowed
101
- case 976: // ORA-00976: LEVEL, PRIOR, or ROWNUM not allowed here
102
- case 977: // ORA-00977: duplicate auditing option
103
- case 978: // ORA-00978: nested group function without GROUP BY
104
- case 979: // ORA-00979: not a GROUP BY expression
105
- case 980: // ORA-00980: synonym translation is no longer valid
106
- case 981: // ORA-00981: cannot mix table and system auditing options
107
- case 982: // ORA-00982: missing plus sign
108
- case 984: // ORA-00984: column not allowed here
109
- case 985: // ORA-00985: invalid program name
110
- case 986: // ORA-00986: missing or invalid group names(s)
111
- case 987: // ORA-00987: missing or invalid username(s)
112
- case 988: // ORA-00988: missing or invalid password(s)
113
- case 989: // ORA-00989: too many passwords for usernames given
114
- case 990: // ORA-00990: missing or invalid privilege
115
- case 992: // ORA-00992: invalid format for REVOKE command
116
- case 993: // ORA-00993: missing GRANT keyword
117
- case 994: // ORA-00994: missing OPTION keyword
118
- case 995: // ORA-00995: missing or invalid synonym identifier
119
- case 996: // ORA-00996: the concatenate operator is ||, not |
120
- case 997: // ORA-00997: illegal use of LONG datatype
121
- case 998: // ORA-00998: must name this expression with a column alias
122
- return new SyntaxErrorException(exception);
123
- case 953: // ORA-00953: invalid index name
124
- case 999: // ORA-00999: invalid view name
125
- case 4063: // ORA-04063: <object> has errors
126
- return new DatabaseObjectNotFoundException(exception);
127
- case 2291: // ORA-02291: integrity constraint violated - parent key not found
128
- case 2292: // ORA-02292: integrity constraint violated - child record found
129
- return new ForeignKeyConstraintViolationException(exception);
130
- case 903: // ORA-00903: invalid table name
131
- case 942: // ORA-00942: table or view does not exist
132
- return new TableNotFoundException(exception);
133
- case 955: // ORA-00955: name is already used by an existing object
134
- return new TableExistsException(exception);
135
- case 1400: // ORA-01400: cannot insert null into
136
- return new NotNullConstraintViolationException(exception);
137
- case 2290: // ORA-02290: check constraint violated
138
- return new CheckConstraintViolationException(exception);
139
- case 16000: // ORA-16000 Database open for read only access
140
- return new ReadOnlyException(exception);
141
- }
142
- return super.convertException(exception);
21
+ /**
22
+ * @link https://docs.oracle.com/cd/B28359_01/server.111/b28278/toc.htm
23
+ */
24
+ convertException(exception) {
25
+ switch (exception.errorNum) {
26
+ case 1: // ORA-00001: unique constraint (string.string) violated
27
+ return new UniqueConstraintViolationException(exception);
28
+ case 54: // ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired
29
+ return new LockWaitTimeoutException(exception);
30
+ case 18: // ORA-00018: maximum number of sessions exceeded
31
+ case 19: // ORA-00019: maximum number of session licenses exceeded
32
+ case 20: // ORA-00020: maximum number of processes (string) exceeded
33
+ case 22: // ORA-00022: invalid session ID; access denied
34
+ case 107: // ORA-00107: failed to connect to ORACLE listener process
35
+ case 1017: // ORA-01017: invalid username/password; logon denied
36
+ case 2010: // ORA-02010: missing host connect string
37
+ case 3113: // ORA-03113: end-of-file on communication channel
38
+ case 3135: // ORA-03135: connection lost contact
39
+ case 12154: // ORA-12154: TNS:could not resolve service name
40
+ case 12198: // ORA-12198: TNS:could not find path to destination
41
+ case 12203: // ORA-12203: TNS:unable to connect to destination
42
+ case 12500: // ORA-12500: TNS:listener failed to start a dedicated server process
43
+ case 12504: // ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
44
+ case 12505: // ORA-12505: TNS:listener does not currently know of SID given in connect descriptor
45
+ case 12511: // ORA-12511: TNS:service handler found but it is not accepting connections
46
+ case 12513: // ORA-12513: TNS:service handler found but it has registered for a different protocol
47
+ case 12514: // ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
48
+ case 12533: // ORA-12533: TNS:illegal ADDRESS parameters
49
+ case 12545: // ORA-12545: TNS:name lookup failure
50
+ case 12560: // ORA-12560: TNS:protocol adapter error
51
+ case 12537: // ORA-12537: TNS:connection closed
52
+ return new ConnectionException(exception);
53
+ case 28: // ORA-00028: your session has been killed
54
+ return new ConnectionException(exception);
55
+ case 60: // ORA-00060: deadlock detected while waiting for resource
56
+ return new DeadlockException(exception);
57
+ case 904: // ORA-00904: invalid column name
58
+ return new InvalidFieldNameException(exception);
59
+ case 918: // ORA-00918: column ambiguously defined
60
+ case 957: // ORA-00957: duplicate column name
61
+ case 960: // ORA-00960: ambiguous column naming in select list
62
+ return new NonUniqueFieldNameException(exception);
63
+ case 900: // ORA-00900: invalid SQL statement
64
+ case 901: // ORA-00901: invalid CREATE command
65
+ case 902: // ORA-00902: invalid datatype
66
+ case 905: // ORA-00905: missing keyword
67
+ case 906: // ORA-00906: missing left parenthesis
68
+ case 907: // ORA-00907: missing right parenthesis
69
+ case 908: // ORA-00908: missing NULL keyword
70
+ case 909: // ORA-00909: invalid number of arguments
71
+ case 910: // ORA-00910: specified length too long for its datatype
72
+ case 911: // ORA-00911: invalid character
73
+ case 912: // ORA-00912: input parameter too long
74
+ case 913: // ORA-00913: too many values
75
+ case 914: // ORA-00914: missing ADD keyword
76
+ case 917: // ORA-00917: missing comma
77
+ case 919: // ORA-00919: invalid function
78
+ case 920: // ORA-00920: invalid relational operator
79
+ case 921: // ORA-00921: unexpected end of SQL command
80
+ case 922: // ORA-00922: missing or invalid option
81
+ case 923: // ORA-00923: FROM keyword not found where expected
82
+ case 924: // ORA-00924: missing BY keyword
83
+ case 925: // ORA-00925: missing INTO keyword
84
+ case 926: // ORA-00926: missing VALUES keyword
85
+ case 927: // ORA-00927: missing equal sign
86
+ case 928: // ORA-00928: missing SELECT keyword
87
+ case 929: // ORA-00929: missing period
88
+ case 930: // ORA-00930: missing asterisk
89
+ case 931: // ORA-00931: missing identifier
90
+ case 932: // ORA-00932: inconsistent datatypes
91
+ case 933: // ORA-00933: SQL command not properly ended
92
+ case 934: // ORA-00934: group function is not allowed here
93
+ case 935: // ORA-00935: group function is nested too deeply
94
+ case 936: // ORA-00936: missing expression
95
+ case 937: // ORA-00937: not a single-group group function
96
+ case 938: // ORA-00938: not enough arguments for function
97
+ case 939: // ORA-00939: too many arguments for function
98
+ case 940: // ORA-00940: invalid ALTER command
99
+ case 941: // ORA-00941: missing cluster name
100
+ case 946: // ORA-00946: missing TO keyword
101
+ case 947: // ORA-00947: not enough values
102
+ case 950: // ORA-00950: invalid DROP option
103
+ case 952: // ORA-00952: missing GROUP keyword
104
+ case 954: // ORA-00954: missing IDENTIFIED keyword
105
+ case 956: // ORA-00956: missing or invalid auditing option
106
+ case 962: // ORA-00962: too many group-by or order-by expressions
107
+ case 964: // ORA-00964: table name not in FROM list
108
+ case 965: // ORA-00965: column aliases not allowed for "*"
109
+ case 966: // ORA-00966: missing TABLE keyword
110
+ case 967: // ORA-00967: missing WHERE keyword
111
+ case 968: // ORA-00968: missing INDEX keyword
112
+ case 969: // ORA-00969: missing ON keyword
113
+ case 970: // ORA-00970: missing WITH keyword
114
+ case 971: // ORA-00971: missing SET keyword
115
+ case 972: // ORA-00972: identifier is too long
116
+ case 974: // ORA-00974: invalid PCTFREE value percentage
117
+ case 975: // ORA-00975: date + date not allowed
118
+ case 976: // ORA-00976: LEVEL, PRIOR, or ROWNUM not allowed here
119
+ case 977: // ORA-00977: duplicate auditing option
120
+ case 978: // ORA-00978: nested group function without GROUP BY
121
+ case 979: // ORA-00979: not a GROUP BY expression
122
+ case 980: // ORA-00980: synonym translation is no longer valid
123
+ case 981: // ORA-00981: cannot mix table and system auditing options
124
+ case 982: // ORA-00982: missing plus sign
125
+ case 984: // ORA-00984: column not allowed here
126
+ case 985: // ORA-00985: invalid program name
127
+ case 986: // ORA-00986: missing or invalid group names(s)
128
+ case 987: // ORA-00987: missing or invalid username(s)
129
+ case 988: // ORA-00988: missing or invalid password(s)
130
+ case 989: // ORA-00989: too many passwords for usernames given
131
+ case 990: // ORA-00990: missing or invalid privilege
132
+ case 992: // ORA-00992: invalid format for REVOKE command
133
+ case 993: // ORA-00993: missing GRANT keyword
134
+ case 994: // ORA-00994: missing OPTION keyword
135
+ case 995: // ORA-00995: missing or invalid synonym identifier
136
+ case 996: // ORA-00996: the concatenate operator is ||, not |
137
+ case 997: // ORA-00997: illegal use of LONG datatype
138
+ case 998: // ORA-00998: must name this expression with a column alias
139
+ return new SyntaxErrorException(exception);
140
+ case 953: // ORA-00953: invalid index name
141
+ case 999: // ORA-00999: invalid view name
142
+ case 4063: // ORA-04063: <object> has errors
143
+ return new DatabaseObjectNotFoundException(exception);
144
+ case 2291: // ORA-02291: integrity constraint violated - parent key not found
145
+ case 2292: // ORA-02292: integrity constraint violated - child record found
146
+ return new ForeignKeyConstraintViolationException(exception);
147
+ case 903: // ORA-00903: invalid table name
148
+ case 942: // ORA-00942: table or view does not exist
149
+ return new TableNotFoundException(exception);
150
+ case 955: // ORA-00955: name is already used by an existing object
151
+ return new TableExistsException(exception);
152
+ case 1400: // ORA-01400: cannot insert null into
153
+ return new NotNullConstraintViolationException(exception);
154
+ case 2290: // ORA-02290: check constraint violated
155
+ return new CheckConstraintViolationException(exception);
156
+ case 16000: // ORA-16000 Database open for read only access
157
+ return new ReadOnlyException(exception);
143
158
  }
159
+ return super.convertException(exception);
160
+ }
144
161
  }
145
162
  /* v8 ignore stop */
@@ -1,18 +1,58 @@
1
- import { MikroORM, type Options, type IDatabaseDriver, type EntityManager, type EntityManagerType, type EntityClass, type AnyEntity, type EntitySchema } from '@mikro-orm/core';
1
+ import {
2
+ MikroORM,
3
+ type Options,
4
+ type IDatabaseDriver,
5
+ type EntityManager,
6
+ type EntityManagerType,
7
+ type EntityClass,
8
+ type AnyEntity,
9
+ type EntitySchema,
10
+ } from '@mikro-orm/core';
2
11
  import type { SqlEntityManager } from '@mikro-orm/sql';
3
12
  import { OracleDriver } from './OracleDriver.js';
4
- export type OracleOptions<EM extends SqlEntityManager<OracleDriver> = SqlEntityManager<OracleDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> = Partial<Options<OracleDriver, EM, Entities>>;
5
- export declare function defineOracleConfig<EM extends SqlEntityManager<OracleDriver> = SqlEntityManager<OracleDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<OracleDriver, EM, Entities>>): OracleOptions<EM, Entities>;
13
+ /** Configuration options for the Oracle driver. */
14
+ export type OracleOptions<
15
+ EM extends SqlEntityManager<OracleDriver> = SqlEntityManager<OracleDriver>,
16
+ Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
17
+ | string
18
+ | EntityClass<AnyEntity>
19
+ | EntitySchema
20
+ )[],
21
+ > = Partial<Options<OracleDriver, EM, Entities>>;
22
+ /** Creates a type-safe configuration object for the Oracle driver. */
23
+ export declare function defineOracleConfig<
24
+ EM extends SqlEntityManager<OracleDriver> = SqlEntityManager<OracleDriver>,
25
+ Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
26
+ | string
27
+ | EntityClass<AnyEntity>
28
+ | EntitySchema
29
+ )[],
30
+ >(options: Partial<Options<OracleDriver, EM, Entities>>): OracleOptions<EM, Entities>;
6
31
  /**
7
32
  * @inheritDoc
8
33
  */
9
- export declare class OracleMikroORM<EM extends SqlEntityManager<OracleDriver> = SqlEntityManager<OracleDriver>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]> extends MikroORM<OracleDriver, EM, Entities> {
10
- /**
11
- * @inheritDoc
12
- */
13
- static init<D extends IDatabaseDriver = OracleDriver, EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>, Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (string | EntityClass<AnyEntity> | EntitySchema)[]>(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
14
- /**
15
- * @inheritDoc
16
- */
17
- constructor(options: Partial<Options<OracleDriver, EM, Entities>>);
34
+ export declare class OracleMikroORM<
35
+ EM extends SqlEntityManager<OracleDriver> = SqlEntityManager<OracleDriver>,
36
+ Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
37
+ | string
38
+ | EntityClass<AnyEntity>
39
+ | EntitySchema
40
+ )[],
41
+ > extends MikroORM<OracleDriver, EM, Entities> {
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ static init<
46
+ D extends IDatabaseDriver = OracleDriver,
47
+ EM extends EntityManager<D> = D[typeof EntityManagerType] & EntityManager<D>,
48
+ Entities extends (string | EntityClass<AnyEntity> | EntitySchema)[] = (
49
+ | string
50
+ | EntityClass<AnyEntity>
51
+ | EntitySchema
52
+ )[],
53
+ >(options: Partial<Options<D, EM, Entities>>): Promise<MikroORM<D, EM, Entities>>;
54
+ /**
55
+ * @inheritDoc
56
+ */
57
+ constructor(options: Partial<Options<OracleDriver, EM, Entities>>);
18
58
  }
package/OracleMikroORM.js CHANGED
@@ -1,22 +1,23 @@
1
- import { defineConfig, MikroORM, } from '@mikro-orm/core';
1
+ import { defineConfig, MikroORM } from '@mikro-orm/core';
2
2
  import { OracleDriver } from './OracleDriver.js';
3
+ /** Creates a type-safe configuration object for the Oracle driver. */
3
4
  export function defineOracleConfig(options) {
4
- return defineConfig({ driver: OracleDriver, ...options });
5
+ return defineConfig({ driver: OracleDriver, ...options });
5
6
  }
6
7
  /**
7
8
  * @inheritDoc
8
9
  */
9
10
  export class OracleMikroORM extends MikroORM {
10
- /**
11
- * @inheritDoc
12
- */
13
- static async init(options) {
14
- return super.init(defineOracleConfig(options));
15
- }
16
- /**
17
- * @inheritDoc
18
- */
19
- constructor(options) {
20
- super(defineOracleConfig(options));
21
- }
11
+ /**
12
+ * @inheritDoc
13
+ */
14
+ static async init(options) {
15
+ return super.init(defineOracleConfig(options));
16
+ }
17
+ /**
18
+ * @inheritDoc
19
+ */
20
+ constructor(options) {
21
+ super(defineOracleConfig(options));
22
+ }
22
23
  }