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

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