@native-systems/utility 1.0.0

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.
@@ -0,0 +1,768 @@
1
+ 'use strict';
2
+
3
+ var common = require('@nestjs/common');
4
+
5
+ var PostgresError = /*#__PURE__*/ (function (PostgresError) {
6
+ PostgresError['SUCCESSFUL_COMPLETION'] = '00000';
7
+ PostgresError['WARNING'] = '01000';
8
+ PostgresError['WARNING_DYNAMIC_RESULT_SETS_RETURNED'] = '0100C';
9
+ PostgresError['WARNING_IMPLICIT_ZERO_BIT_PADDING'] = '01008';
10
+ PostgresError['WARNING_NULL_VALUE_ELIMINATED_IN_SET_FUNCTION'] = '01003';
11
+ PostgresError['WARNING_PRIVILEGE_NOT_GRANTED'] = '01007';
12
+ PostgresError['WARNING_PRIVILEGE_NOT_REVOKED'] = '01006';
13
+ PostgresError['WARNING_STRING_DATA_RIGHT_TRUNCATION'] = '01004';
14
+ PostgresError['WARNING_DEPRECATED_FEATURE'] = '01P01';
15
+ PostgresError['NO_DATA'] = '02000';
16
+ PostgresError['NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED'] = '02001';
17
+ PostgresError['SQL_STATEMENT_NOT_YET_COMPLETE'] = '03000';
18
+ PostgresError['CONNECTION_EXCEPTION'] = '08000';
19
+ PostgresError['CONNECTION_DOES_NOT_EXIST'] = '08003';
20
+ PostgresError['CONNECTION_FAILURE'] = '08006';
21
+ PostgresError['SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION'] = '08001';
22
+ PostgresError['SQLSERVER_REJECTED_ESTABLISHMENT_OF_SQLCONNECTION'] = '08004';
23
+ PostgresError['TRANSACTION_RESOLUTION_UNKNOWN'] = '08007';
24
+ PostgresError['PROTOCOL_VIOLATION'] = '08P01';
25
+ PostgresError['TRIGGERED_ACTION_EXCEPTION'] = '09000';
26
+ PostgresError['FEATURE_NOT_SUPPORTED'] = '0A000';
27
+ PostgresError['INVALID_TRANSACTION_INITIATION'] = '0B000';
28
+ PostgresError['LOCATOR_EXCEPTION'] = '0F000';
29
+ PostgresError['L_E_INVALID_SPECIFICATION'] = '0F001';
30
+ PostgresError['INVALID_GRANTOR'] = '0L000';
31
+ PostgresError['INVALID_GRANT_OPERATION'] = '0LP01';
32
+ PostgresError['INVALID_ROLE_SPECIFICATION'] = '0P000';
33
+ PostgresError['DIAGNOSTICS_EXCEPTION'] = '0Z000';
34
+ PostgresError['STACKED_DIAGNOSTICS_ACCESSED_WITHOUT_ACTIVE_HANDLER'] =
35
+ '0Z002';
36
+ PostgresError['INVALID_ARGUMENT_FOR_XQUERY'] = '10608';
37
+ PostgresError['CASE_NOT_FOUND'] = '20000';
38
+ PostgresError['CARDINALITY_VIOLATION'] = '21000';
39
+ PostgresError['DATA_EXCEPTION'] = '22000';
40
+ PostgresError['ARRAY_ELEMENT_ERROR'] = '2202E';
41
+ PostgresError['ARRAY_SUBSCRIPT_ERROR'] = '2202E';
42
+ PostgresError['CHARACTER_NOT_IN_REPERTOIRE'] = '22021';
43
+ PostgresError['DATETIME_FIELD_OVERFLOW'] = '22008';
44
+ PostgresError['DATETIME_VALUE_OUT_OF_RANGE'] = '22008';
45
+ PostgresError['DIVISION_BY_ZERO'] = '22012';
46
+ PostgresError['ERROR_IN_ASSIGNMENT'] = '22005';
47
+ PostgresError['ESCAPE_CHARACTER_CONFLICT'] = '2200B';
48
+ PostgresError['INDICATOR_OVERFLOW'] = '22022';
49
+ PostgresError['INTERVAL_FIELD_OVERFLOW'] = '22015';
50
+ PostgresError['INVALID_ARGUMENT_FOR_LOG'] = '2201E';
51
+ PostgresError['INVALID_ARGUMENT_FOR_NTILE'] = '22014';
52
+ PostgresError['INVALID_ARGUMENT_FOR_NTH_VALUE'] = '22016';
53
+ PostgresError['INVALID_ARGUMENT_FOR_POWER_FUNCTION'] = '2201F';
54
+ PostgresError['INVALID_ARGUMENT_FOR_WIDTH_BUCKET_FUNCTION'] = '2201G';
55
+ PostgresError['INVALID_CHARACTER_VALUE_FOR_CAST'] = '22018';
56
+ PostgresError['INVALID_DATETIME_FORMAT'] = '22007';
57
+ PostgresError['INVALID_ESCAPE_CHARACTER'] = '22019';
58
+ PostgresError['INVALID_ESCAPE_OCTET'] = '2200D';
59
+ PostgresError['INVALID_ESCAPE_SEQUENCE'] = '22025';
60
+ PostgresError['NONSTANDARD_USE_OF_ESCAPE_CHARACTER'] = '22P06';
61
+ PostgresError['INVALID_INDICATOR_PARAMETER_VALUE'] = '22010';
62
+ PostgresError['INVALID_PARAMETER_VALUE'] = '22023';
63
+ PostgresError['INVALID_PRECEDING_OR_FOLLOWING_SIZE'] = '22013';
64
+ PostgresError['INVALID_REGULAR_EXPRESSION'] = '2201B';
65
+ PostgresError['INVALID_ROW_COUNT_IN_LIMIT_CLAUSE'] = '2201W';
66
+ PostgresError['INVALID_ROW_COUNT_IN_RESULT_OFFSET_CLAUSE'] = '2201X';
67
+ PostgresError['INVALID_TABLESAMPLE_ARGUMENT'] = '2202H';
68
+ PostgresError['INVALID_TABLESAMPLE_REPEAT'] = '2202G';
69
+ PostgresError['INVALID_TIME_ZONE_DISPLACEMENT_VALUE'] = '22009';
70
+ PostgresError['INVALID_USE_OF_ESCAPE_CHARACTER'] = '2200C';
71
+ PostgresError['MOST_SPECIFIC_TYPE_MISMATCH'] = '2200G';
72
+ PostgresError['NULL_VALUE_NOT_ALLOWED'] = '22004';
73
+ PostgresError['NULL_VALUE_NO_INDICATOR_PARAMETER'] = '22002';
74
+ PostgresError['NUMERIC_VALUE_OUT_OF_RANGE'] = '22003';
75
+ PostgresError['SEQUENCE_GENERATOR_LIMIT_EXCEEDED'] = '2200H';
76
+ PostgresError['STRING_DATA_LENGTH_MISMATCH'] = '22026';
77
+ PostgresError['STRING_DATA_RIGHT_TRUNCATION'] = '22001';
78
+ PostgresError['SUBSTRING_ERROR'] = '22011';
79
+ PostgresError['TRIM_ERROR'] = '22027';
80
+ PostgresError['UNTERMINATED_C_STRING'] = '22024';
81
+ PostgresError['ZERO_LENGTH_CHARACTER_STRING'] = '2200F';
82
+ PostgresError['FLOATING_POINT_EXCEPTION'] = '22P01';
83
+ PostgresError['INVALID_TEXT_REPRESENTATION'] = '22P02';
84
+ PostgresError['INVALID_BINARY_REPRESENTATION'] = '22P03';
85
+ PostgresError['BAD_COPY_FILE_FORMAT'] = '22P04';
86
+ PostgresError['UNTRANSLATABLE_CHARACTER'] = '22P05';
87
+ PostgresError['NOT_AN_XML_DOCUMENT'] = '2200L';
88
+ PostgresError['INVALID_XML_DOCUMENT'] = '2200M';
89
+ PostgresError['INVALID_XML_CONTENT'] = '2200N';
90
+ PostgresError['INVALID_XML_COMMENT'] = '2200S';
91
+ PostgresError['INVALID_XML_PROCESSING_INSTRUCTION'] = '2200T';
92
+ PostgresError['DUPLICATE_JSON_OBJECT_KEY_VALUE'] = '22030';
93
+ PostgresError['INVALID_ARGUMENT_FOR_SQL_JSON_DATETIME_FUNCTION'] = '22031';
94
+ PostgresError['INVALID_JSON_TEXT'] = '22032';
95
+ PostgresError['INVALID_SQL_JSON_SUBSCRIPT'] = '22033';
96
+ PostgresError['MORE_THAN_ONE_SQL_JSON_ITEM'] = '22034';
97
+ PostgresError['NO_SQL_JSON_ITEM'] = '22035';
98
+ PostgresError['NON_NUMERIC_SQL_JSON_ITEM'] = '22036';
99
+ PostgresError['NON_UNIQUE_KEYS_IN_A_JSON_OBJECT'] = '22037';
100
+ PostgresError['SINGLETON_SQL_JSON_ITEM_REQUIRED'] = '22038';
101
+ PostgresError['SQL_JSON_ARRAY_NOT_FOUND'] = '22039';
102
+ PostgresError['SQL_JSON_MEMBER_NOT_FOUND'] = '2203A';
103
+ PostgresError['SQL_JSON_NUMBER_NOT_FOUND'] = '2203B';
104
+ PostgresError['SQL_JSON_OBJECT_NOT_FOUND'] = '2203C';
105
+ PostgresError['TOO_MANY_JSON_ARRAY_ELEMENTS'] = '2203D';
106
+ PostgresError['TOO_MANY_JSON_OBJECT_MEMBERS'] = '2203E';
107
+ PostgresError['SQL_JSON_SCALAR_REQUIRED'] = '2203F';
108
+ PostgresError['SQL_JSON_ITEM_CANNOT_BE_CAST_TO_TARGET_TYPE'] = '2203G';
109
+ PostgresError['INTEGRITY_CONSTRAINT_VIOLATION'] = '23000';
110
+ PostgresError['RESTRICT_VIOLATION'] = '23001';
111
+ PostgresError['NOT_NULL_VIOLATION'] = '23502';
112
+ PostgresError['FOREIGN_KEY_VIOLATION'] = '23503';
113
+ PostgresError['UNIQUE_VIOLATION'] = '23505';
114
+ PostgresError['CHECK_VIOLATION'] = '23514';
115
+ PostgresError['EXCLUSION_VIOLATION'] = '23P01';
116
+ PostgresError['INVALID_CURSOR_STATE'] = '24000';
117
+ PostgresError['INVALID_TRANSACTION_STATE'] = '25000';
118
+ PostgresError['ACTIVE_SQL_TRANSACTION'] = '25001';
119
+ PostgresError['BRANCH_TRANSACTION_ALREADY_ACTIVE'] = '25002';
120
+ PostgresError['HELD_CURSOR_REQUIRES_SAME_ISOLATION_LEVEL'] = '25008';
121
+ PostgresError['INAPPROPRIATE_ACCESS_MODE_FOR_BRANCH_TRANSACTION'] = '25003';
122
+ PostgresError['INAPPROPRIATE_ISOLATION_LEVEL_FOR_BRANCH_TRANSACTION'] =
123
+ '25004';
124
+ PostgresError['NO_ACTIVE_SQL_TRANSACTION_FOR_BRANCH_TRANSACTION'] = '25005';
125
+ PostgresError['READ_ONLY_SQL_TRANSACTION'] = '25006';
126
+ PostgresError['SCHEMA_AND_DATA_STATEMENT_MIXING_NOT_SUPPORTED'] = '25007';
127
+ PostgresError['NO_ACTIVE_SQL_TRANSACTION'] = '25P01';
128
+ PostgresError['IN_FAILED_SQL_TRANSACTION'] = '25P02';
129
+ PostgresError['IDLE_IN_TRANSACTION_SESSION_TIMEOUT'] = '25P03';
130
+ PostgresError['TRANSACTION_TIMEOUT'] = '25P04';
131
+ PostgresError['INVALID_SQL_STATEMENT_NAME'] = '26000';
132
+ PostgresError['TRIGGERED_DATA_CHANGE_VIOLATION'] = '27000';
133
+ PostgresError['INVALID_AUTHORIZATION_SPECIFICATION'] = '28000';
134
+ PostgresError['INVALID_PASSWORD'] = '28P01';
135
+ PostgresError['DEPENDENT_PRIVILEGE_DESCRIPTORS_STILL_EXIST'] = '2B000';
136
+ PostgresError['DEPENDENT_OBJECTS_STILL_EXIST'] = '2BP01';
137
+ PostgresError['INVALID_TRANSACTION_TERMINATION'] = '2D000';
138
+ PostgresError['SQL_ROUTINE_EXCEPTION'] = '2F000';
139
+ PostgresError['S_R_E_FUNCTION_EXECUTED_NO_RETURN_STATEMENT'] = '2F005';
140
+ PostgresError['S_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED'] = '2F002';
141
+ PostgresError['S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED'] = '2F003';
142
+ PostgresError['S_R_E_READING_SQL_DATA_NOT_PERMITTED'] = '2F004';
143
+ PostgresError['INVALID_CURSOR_NAME'] = '34000';
144
+ PostgresError['EXTERNAL_ROUTINE_EXCEPTION'] = '38000';
145
+ PostgresError['E_R_E_CONTAINING_SQL_NOT_PERMITTED'] = '38001';
146
+ PostgresError['E_R_E_MODIFYING_SQL_DATA_NOT_PERMITTED'] = '38002';
147
+ PostgresError['E_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED'] = '38003';
148
+ PostgresError['E_R_E_READING_SQL_DATA_NOT_PERMITTED'] = '38004';
149
+ PostgresError['EXTERNAL_ROUTINE_INVOCATION_EXCEPTION'] = '39000';
150
+ PostgresError['E_R_I_E_INVALID_SQLSTATE_RETURNED'] = '39001';
151
+ PostgresError['E_R_I_E_NULL_VALUE_NOT_ALLOWED'] = '39004';
152
+ PostgresError['E_R_I_E_TRIGGER_PROTOCOL_VIOLATED'] = '39P01';
153
+ PostgresError['E_R_I_E_SRF_PROTOCOL_VIOLATED'] = '39P02';
154
+ PostgresError['E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED'] = '39P03';
155
+ PostgresError['SAVEPOINT_EXCEPTION'] = '3B000';
156
+ PostgresError['S_E_INVALID_SPECIFICATION'] = '3B001';
157
+ PostgresError['INVALID_CATALOG_NAME'] = '3D000';
158
+ PostgresError['INVALID_SCHEMA_NAME'] = '3F000';
159
+ PostgresError['TRANSACTION_ROLLBACK'] = '40000';
160
+ PostgresError['T_R_INTEGRITY_CONSTRAINT_VIOLATION'] = '40002';
161
+ PostgresError['T_R_SERIALIZATION_FAILURE'] = '40001';
162
+ PostgresError['T_R_STATEMENT_COMPLETION_UNKNOWN'] = '40003';
163
+ PostgresError['T_R_DEADLOCK_DETECTED'] = '40P01';
164
+ PostgresError['SYNTAX_ERROR_OR_ACCESS_RULE_VIOLATION'] = '42000';
165
+ PostgresError['SYNTAX_ERROR'] = '42601';
166
+ PostgresError['INSUFFICIENT_PRIVILEGE'] = '42501';
167
+ PostgresError['CANNOT_COERCE'] = '42846';
168
+ PostgresError['GROUPING_ERROR'] = '42803';
169
+ PostgresError['WINDOWING_ERROR'] = '42P20';
170
+ PostgresError['INVALID_RECURSION'] = '42P19';
171
+ PostgresError['INVALID_FOREIGN_KEY'] = '42830';
172
+ PostgresError['INVALID_NAME'] = '42602';
173
+ PostgresError['NAME_TOO_LONG'] = '42622';
174
+ PostgresError['RESERVED_NAME'] = '42939';
175
+ PostgresError['DATATYPE_MISMATCH'] = '42804';
176
+ PostgresError['INDETERMINATE_DATATYPE'] = '42P18';
177
+ PostgresError['COLLATION_MISMATCH'] = '42P21';
178
+ PostgresError['INDETERMINATE_COLLATION'] = '42P22';
179
+ PostgresError['WRONG_OBJECT_TYPE'] = '42809';
180
+ PostgresError['GENERATED_ALWAYS'] = '428C9';
181
+ PostgresError['UNDEFINED_COLUMN'] = '42703';
182
+ PostgresError['UNDEFINED_CURSOR'] = '34000';
183
+ PostgresError['UNDEFINED_DATABASE'] = '3D000';
184
+ PostgresError['UNDEFINED_FUNCTION'] = '42883';
185
+ PostgresError['UNDEFINED_PSTATEMENT'] = '26000';
186
+ PostgresError['UNDEFINED_SCHEMA'] = '3F000';
187
+ PostgresError['UNDEFINED_TABLE'] = '42P01';
188
+ PostgresError['UNDEFINED_PARAMETER'] = '42P02';
189
+ PostgresError['UNDEFINED_OBJECT'] = '42704';
190
+ PostgresError['DUPLICATE_COLUMN'] = '42701';
191
+ PostgresError['DUPLICATE_CURSOR'] = '42P03';
192
+ PostgresError['DUPLICATE_DATABASE'] = '42P04';
193
+ PostgresError['DUPLICATE_FUNCTION'] = '42723';
194
+ PostgresError['DUPLICATE_PSTATEMENT'] = '42P05';
195
+ PostgresError['DUPLICATE_SCHEMA'] = '42P06';
196
+ PostgresError['DUPLICATE_TABLE'] = '42P07';
197
+ PostgresError['DUPLICATE_ALIAS'] = '42712';
198
+ PostgresError['DUPLICATE_OBJECT'] = '42710';
199
+ PostgresError['AMBIGUOUS_COLUMN'] = '42702';
200
+ PostgresError['AMBIGUOUS_FUNCTION'] = '42725';
201
+ PostgresError['AMBIGUOUS_PARAMETER'] = '42P08';
202
+ PostgresError['AMBIGUOUS_ALIAS'] = '42P09';
203
+ PostgresError['INVALID_COLUMN_REFERENCE'] = '42P10';
204
+ PostgresError['INVALID_COLUMN_DEFINITION'] = '42611';
205
+ PostgresError['INVALID_CURSOR_DEFINITION'] = '42P11';
206
+ PostgresError['INVALID_DATABASE_DEFINITION'] = '42P12';
207
+ PostgresError['INVALID_FUNCTION_DEFINITION'] = '42P13';
208
+ PostgresError['INVALID_PSTATEMENT_DEFINITION'] = '42P14';
209
+ PostgresError['INVALID_SCHEMA_DEFINITION'] = '42P15';
210
+ PostgresError['INVALID_TABLE_DEFINITION'] = '42P16';
211
+ PostgresError['INVALID_OBJECT_DEFINITION'] = '42P17';
212
+ PostgresError['WITH_CHECK_OPTION_VIOLATION'] = '44000';
213
+ PostgresError['INSUFFICIENT_RESOURCES'] = '53000';
214
+ PostgresError['DISK_FULL'] = '53100';
215
+ PostgresError['OUT_OF_MEMORY'] = '53200';
216
+ PostgresError['TOO_MANY_CONNECTIONS'] = '53300';
217
+ PostgresError['CONFIGURATION_LIMIT_EXCEEDED'] = '53400';
218
+ PostgresError['PROGRAM_LIMIT_EXCEEDED'] = '54000';
219
+ PostgresError['STATEMENT_TOO_COMPLEX'] = '54001';
220
+ PostgresError['TOO_MANY_COLUMNS'] = '54011';
221
+ PostgresError['TOO_MANY_ARGUMENTS'] = '54023';
222
+ PostgresError['OBJECT_NOT_IN_PREREQUISITE_STATE'] = '55000';
223
+ PostgresError['OBJECT_IN_USE'] = '55006';
224
+ PostgresError['CANT_CHANGE_RUNTIME_PARAM'] = '55P02';
225
+ PostgresError['LOCK_NOT_AVAILABLE'] = '55P03';
226
+ PostgresError['UNSAFE_NEW_ENUM_VALUE_USAGE'] = '55P04';
227
+ PostgresError['OPERATOR_INTERVENTION'] = '57000';
228
+ PostgresError['QUERY_CANCELED'] = '57014';
229
+ PostgresError['ADMIN_SHUTDOWN'] = '57P01';
230
+ PostgresError['CRASH_SHUTDOWN'] = '57P02';
231
+ PostgresError['CANNOT_CONNECT_NOW'] = '57P03';
232
+ PostgresError['DATABASE_DROPPED'] = '57P04';
233
+ PostgresError['IDLE_SESSION_TIMEOUT'] = '57P05';
234
+ PostgresError['SYSTEM_ERROR'] = '58000';
235
+ PostgresError['IO_ERROR'] = '58030';
236
+ PostgresError['UNDEFINED_FILE'] = '58P01';
237
+ PostgresError['DUPLICATE_FILE'] = '58P02';
238
+ PostgresError['FILE_NAME_TOO_LONG'] = '58P03';
239
+ PostgresError['CONFIG_FILE_ERROR'] = 'F0000';
240
+ PostgresError['LOCK_FILE_EXISTS'] = 'F0001';
241
+ PostgresError['FDW_ERROR'] = 'HV000';
242
+ PostgresError['FDW_COLUMN_NAME_NOT_FOUND'] = 'HV005';
243
+ PostgresError['FDW_DYNAMIC_PARAMETER_VALUE_NEEDED'] = 'HV002';
244
+ PostgresError['FDW_FUNCTION_SEQUENCE_ERROR'] = 'HV010';
245
+ PostgresError['FDW_INCONSISTENT_DESCRIPTOR_INFORMATION'] = 'HV021';
246
+ PostgresError['FDW_INVALID_ATTRIBUTE_VALUE'] = 'HV024';
247
+ PostgresError['FDW_INVALID_COLUMN_NAME'] = 'HV007';
248
+ PostgresError['FDW_INVALID_COLUMN_NUMBER'] = 'HV008';
249
+ PostgresError['FDW_INVALID_DATA_TYPE'] = 'HV004';
250
+ PostgresError['FDW_INVALID_DATA_TYPE_DESCRIPTORS'] = 'HV006';
251
+ PostgresError['FDW_INVALID_DESCRIPTOR_FIELD_IDENTIFIER'] = 'HV091';
252
+ PostgresError['FDW_INVALID_HANDLE'] = 'HV00B';
253
+ PostgresError['FDW_INVALID_OPTION_INDEX'] = 'HV00C';
254
+ PostgresError['FDW_INVALID_OPTION_NAME'] = 'HV00D';
255
+ PostgresError['FDW_INVALID_STRING_LENGTH_OR_BUFFER_LENGTH'] = 'HV090';
256
+ PostgresError['FDW_INVALID_STRING_FORMAT'] = 'HV00A';
257
+ PostgresError['FDW_INVALID_USE_OF_NULL_POINTER'] = 'HV009';
258
+ PostgresError['FDW_TOO_MANY_HANDLES'] = 'HV014';
259
+ PostgresError['FDW_OUT_OF_MEMORY'] = 'HV001';
260
+ PostgresError['FDW_NO_SCHEMAS'] = 'HV00P';
261
+ PostgresError['FDW_OPTION_NAME_NOT_FOUND'] = 'HV00J';
262
+ PostgresError['FDW_REPLY_HANDLE'] = 'HV00K';
263
+ PostgresError['FDW_SCHEMA_NOT_FOUND'] = 'HV00Q';
264
+ PostgresError['FDW_TABLE_NOT_FOUND'] = 'HV00R';
265
+ PostgresError['FDW_UNABLE_TO_CREATE_EXECUTION'] = 'HV00L';
266
+ PostgresError['FDW_UNABLE_TO_CREATE_REPLY'] = 'HV00M';
267
+ PostgresError['FDW_UNABLE_TO_ESTABLISH_CONNECTION'] = 'HV00N';
268
+ PostgresError['PLPGSQL_ERROR'] = 'P0000';
269
+ PostgresError['RAISE_EXCEPTION'] = 'P0001';
270
+ PostgresError['NO_DATA_FOUND'] = 'P0002';
271
+ PostgresError['TOO_MANY_ROWS'] = 'P0003';
272
+ PostgresError['ASSERT_FAILURE'] = 'P0004';
273
+ PostgresError['INTERNAL_ERROR'] = 'XX000';
274
+ PostgresError['DATA_CORRUPTED'] = 'XX001';
275
+ PostgresError['INDEX_CORRUPTED'] = 'XX002';
276
+ PostgresError['UNDEFINED_CODE'] = '-1';
277
+ return PostgresError;
278
+ })({});
279
+
280
+ function _assert_this_initialized$1(self) {
281
+ if (self === void 0) {
282
+ throw new ReferenceError(
283
+ "this hasn't been initialised - super() hasn't been called"
284
+ );
285
+ }
286
+ return self;
287
+ }
288
+ function _call_super$1(_this, derived, args) {
289
+ derived = _get_prototype_of$1(derived);
290
+ return _possible_constructor_return$1(
291
+ _this,
292
+ _is_native_reflect_construct$1()
293
+ ? Reflect.construct(
294
+ derived,
295
+ args || [],
296
+ _get_prototype_of$1(_this).constructor
297
+ )
298
+ : derived.apply(_this, args)
299
+ );
300
+ }
301
+ function _class_call_check$2(instance, Constructor) {
302
+ if (!(instance instanceof Constructor)) {
303
+ throw new TypeError('Cannot call a class as a function');
304
+ }
305
+ }
306
+ function _construct$1(Parent, args, Class) {
307
+ if (_is_native_reflect_construct$1()) {
308
+ _construct$1 = Reflect.construct;
309
+ } else {
310
+ _construct$1 = function construct(Parent, args, Class) {
311
+ var a = [null];
312
+ a.push.apply(a, args);
313
+ var Constructor = Function.bind.apply(Parent, a);
314
+ var instance = new Constructor();
315
+ if (Class) _set_prototype_of$1(instance, Class.prototype);
316
+ return instance;
317
+ };
318
+ }
319
+ return _construct$1.apply(null, arguments);
320
+ }
321
+ function _define_property$1(obj, key, value) {
322
+ if (key in obj) {
323
+ Object.defineProperty(obj, key, {
324
+ value: value,
325
+ enumerable: true,
326
+ configurable: true,
327
+ writable: true,
328
+ });
329
+ } else {
330
+ obj[key] = value;
331
+ }
332
+ return obj;
333
+ }
334
+ function _get_prototype_of$1(o) {
335
+ _get_prototype_of$1 = Object.setPrototypeOf
336
+ ? Object.getPrototypeOf
337
+ : function getPrototypeOf(o) {
338
+ return o.__proto__ || Object.getPrototypeOf(o);
339
+ };
340
+ return _get_prototype_of$1(o);
341
+ }
342
+ function _inherits$1(subClass, superClass) {
343
+ if (typeof superClass !== 'function' && superClass !== null) {
344
+ throw new TypeError('Super expression must either be null or a function');
345
+ }
346
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
347
+ constructor: {
348
+ value: subClass,
349
+ writable: true,
350
+ configurable: true,
351
+ },
352
+ });
353
+ if (superClass) _set_prototype_of$1(subClass, superClass);
354
+ }
355
+ function _is_native_function$1(fn) {
356
+ return Function.toString.call(fn).indexOf('[native code]') !== -1;
357
+ }
358
+ function _possible_constructor_return$1(self, call) {
359
+ if (call && (_type_of$1(call) === 'object' || typeof call === 'function')) {
360
+ return call;
361
+ }
362
+ return _assert_this_initialized$1(self);
363
+ }
364
+ function _set_prototype_of$1(o, p) {
365
+ _set_prototype_of$1 =
366
+ Object.setPrototypeOf ||
367
+ function setPrototypeOf(o, p) {
368
+ o.__proto__ = p;
369
+ return o;
370
+ };
371
+ return _set_prototype_of$1(o, p);
372
+ }
373
+ function _type_of$1(obj) {
374
+ '@swc/helpers - typeof';
375
+ return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
376
+ ? 'symbol'
377
+ : typeof obj;
378
+ }
379
+ function _wrap_native_super$1(Class) {
380
+ var _cache = typeof Map === 'function' ? new Map() : undefined;
381
+ _wrap_native_super$1 = function wrapNativeSuper(Class) {
382
+ if (Class === null || !_is_native_function$1(Class)) return Class;
383
+ if (typeof Class !== 'function') {
384
+ throw new TypeError('Super expression must either be null or a function');
385
+ }
386
+ if (typeof _cache !== 'undefined') {
387
+ if (_cache.has(Class)) return _cache.get(Class);
388
+ _cache.set(Class, Wrapper);
389
+ }
390
+ function Wrapper() {
391
+ return _construct$1(
392
+ Class,
393
+ arguments,
394
+ _get_prototype_of$1(this).constructor
395
+ );
396
+ }
397
+ Wrapper.prototype = Object.create(Class.prototype, {
398
+ constructor: {
399
+ value: Wrapper,
400
+ enumerable: false,
401
+ writable: true,
402
+ configurable: true,
403
+ },
404
+ });
405
+ return _set_prototype_of$1(Wrapper, Class);
406
+ };
407
+ return _wrap_native_super$1(Class);
408
+ }
409
+ function _is_native_reflect_construct$1() {
410
+ try {
411
+ var result = !Boolean.prototype.valueOf.call(
412
+ Reflect.construct(Boolean, [], function () {})
413
+ );
414
+ } catch (_) {}
415
+ return (_is_native_reflect_construct$1 = function () {
416
+ return !!result;
417
+ })();
418
+ }
419
+ var NativeException = /*#__PURE__*/ (function (Error1) {
420
+ _inherits$1(NativeException, Error1);
421
+ function NativeException(code, message) {
422
+ _class_call_check$2(this, NativeException);
423
+ var _this;
424
+ (_this = _call_super$1(this, NativeException, [message])),
425
+ _define_property$1(_this, 'code', void 0);
426
+ _this.name = 'ShophubError';
427
+ _this.code = code;
428
+ return _this;
429
+ }
430
+ return NativeException;
431
+ })(_wrap_native_super$1(Error));
432
+
433
+ function _assert_this_initialized(self) {
434
+ if (self === void 0) {
435
+ throw new ReferenceError(
436
+ "this hasn't been initialised - super() hasn't been called"
437
+ );
438
+ }
439
+ return self;
440
+ }
441
+ function _call_super(_this, derived, args) {
442
+ derived = _get_prototype_of(derived);
443
+ return _possible_constructor_return(
444
+ _this,
445
+ _is_native_reflect_construct()
446
+ ? Reflect.construct(
447
+ derived,
448
+ args || [],
449
+ _get_prototype_of(_this).constructor
450
+ )
451
+ : derived.apply(_this, args)
452
+ );
453
+ }
454
+ function _class_call_check$1(instance, Constructor) {
455
+ if (!(instance instanceof Constructor)) {
456
+ throw new TypeError('Cannot call a class as a function');
457
+ }
458
+ }
459
+ function _construct(Parent, args, Class) {
460
+ if (_is_native_reflect_construct()) {
461
+ _construct = Reflect.construct;
462
+ } else {
463
+ _construct = function construct(Parent, args, Class) {
464
+ var a = [null];
465
+ a.push.apply(a, args);
466
+ var Constructor = Function.bind.apply(Parent, a);
467
+ var instance = new Constructor();
468
+ if (Class) _set_prototype_of(instance, Class.prototype);
469
+ return instance;
470
+ };
471
+ }
472
+ return _construct.apply(null, arguments);
473
+ }
474
+ function _defineProperties$1(target, props) {
475
+ for (var i = 0; i < props.length; i++) {
476
+ var descriptor = props[i];
477
+ descriptor.enumerable = descriptor.enumerable || false;
478
+ descriptor.configurable = true;
479
+ if ('value' in descriptor) descriptor.writable = true;
480
+ Object.defineProperty(target, descriptor.key, descriptor);
481
+ }
482
+ }
483
+ function _create_class$1(Constructor, protoProps, staticProps) {
484
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
485
+ return Constructor;
486
+ }
487
+ function _define_property(obj, key, value) {
488
+ if (key in obj) {
489
+ Object.defineProperty(obj, key, {
490
+ value: value,
491
+ enumerable: true,
492
+ configurable: true,
493
+ writable: true,
494
+ });
495
+ } else {
496
+ obj[key] = value;
497
+ }
498
+ return obj;
499
+ }
500
+ function _get_prototype_of(o) {
501
+ _get_prototype_of = Object.setPrototypeOf
502
+ ? Object.getPrototypeOf
503
+ : function getPrototypeOf(o) {
504
+ return o.__proto__ || Object.getPrototypeOf(o);
505
+ };
506
+ return _get_prototype_of(o);
507
+ }
508
+ function _inherits(subClass, superClass) {
509
+ if (typeof superClass !== 'function' && superClass !== null) {
510
+ throw new TypeError('Super expression must either be null or a function');
511
+ }
512
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
513
+ constructor: {
514
+ value: subClass,
515
+ writable: true,
516
+ configurable: true,
517
+ },
518
+ });
519
+ if (superClass) _set_prototype_of(subClass, superClass);
520
+ }
521
+ function _is_native_function(fn) {
522
+ return Function.toString.call(fn).indexOf('[native code]') !== -1;
523
+ }
524
+ function _possible_constructor_return(self, call) {
525
+ if (call && (_type_of(call) === 'object' || typeof call === 'function')) {
526
+ return call;
527
+ }
528
+ return _assert_this_initialized(self);
529
+ }
530
+ function _set_prototype_of(o, p) {
531
+ _set_prototype_of =
532
+ Object.setPrototypeOf ||
533
+ function setPrototypeOf(o, p) {
534
+ o.__proto__ = p;
535
+ return o;
536
+ };
537
+ return _set_prototype_of(o, p);
538
+ }
539
+ function _type_of(obj) {
540
+ '@swc/helpers - typeof';
541
+ return obj && typeof Symbol !== 'undefined' && obj.constructor === Symbol
542
+ ? 'symbol'
543
+ : typeof obj;
544
+ }
545
+ function _wrap_native_super(Class) {
546
+ var _cache = typeof Map === 'function' ? new Map() : undefined;
547
+ _wrap_native_super = function wrapNativeSuper(Class) {
548
+ if (Class === null || !_is_native_function(Class)) return Class;
549
+ if (typeof Class !== 'function') {
550
+ throw new TypeError('Super expression must either be null or a function');
551
+ }
552
+ if (typeof _cache !== 'undefined') {
553
+ if (_cache.has(Class)) return _cache.get(Class);
554
+ _cache.set(Class, Wrapper);
555
+ }
556
+ function Wrapper() {
557
+ return _construct(Class, arguments, _get_prototype_of(this).constructor);
558
+ }
559
+ Wrapper.prototype = Object.create(Class.prototype, {
560
+ constructor: {
561
+ value: Wrapper,
562
+ enumerable: false,
563
+ writable: true,
564
+ configurable: true,
565
+ },
566
+ });
567
+ return _set_prototype_of(Wrapper, Class);
568
+ };
569
+ return _wrap_native_super(Class);
570
+ }
571
+ function _is_native_reflect_construct() {
572
+ try {
573
+ var result = !Boolean.prototype.valueOf.call(
574
+ Reflect.construct(Boolean, [], function () {})
575
+ );
576
+ } catch (_) {}
577
+ return (_is_native_reflect_construct = function () {
578
+ return !!result;
579
+ })();
580
+ }
581
+ var PgException = /*#__PURE__*/ (function (Error1) {
582
+ _inherits(PgException, Error1);
583
+ function PgException(err, message, specific) {
584
+ _class_call_check$1(this, PgException);
585
+ var _this;
586
+ (_this = _call_super(this, PgException, [message])),
587
+ _define_property(_this, 'err', void 0),
588
+ _define_property(_this, 'specific', void 0);
589
+ _this.name = 'PgError';
590
+ _this.err = err;
591
+ _this.specific = specific;
592
+ return _this;
593
+ }
594
+ _create_class$1(PgException, [
595
+ {
596
+ key: 'getStatus',
597
+ value: function getStatus() {
598
+ var _this_err;
599
+ var _this_err_code;
600
+ return (_this_err_code =
601
+ (_this_err = this.err) === null || _this_err === void 0
602
+ ? void 0
603
+ : _this_err.code) !== null && _this_err_code !== void 0
604
+ ? _this_err_code
605
+ : PostgresError.UNDEFINED_CODE;
606
+ },
607
+ },
608
+ {
609
+ key: 'getSpecificMessage',
610
+ value: function getSpecificMessage(status) {
611
+ if (this.specific && this.specific[status.toString()]) {
612
+ return this.specific[status.toString()];
613
+ }
614
+ return null;
615
+ },
616
+ },
617
+ ]);
618
+ return PgException;
619
+ })(_wrap_native_super(Error));
620
+
621
+ var statusMap = {
622
+ 100: 'Continue',
623
+ 101: 'Switching Protocols',
624
+ 102: 'Processing',
625
+ 103: 'Early Hints',
626
+ 200: 'OK',
627
+ 201: 'Created',
628
+ 202: 'Accepted',
629
+ 203: 'Non-Authoritative Information',
630
+ 204: 'No Content',
631
+ 205: 'Reset Content',
632
+ 206: 'Partial Content',
633
+ 300: 'Multiple Choices',
634
+ 301: 'Moved Permanently',
635
+ 302: 'Found',
636
+ 303: 'See Other',
637
+ 304: 'Not Modified',
638
+ 307: 'Temporary Redirect',
639
+ 308: 'Permanent Redirect',
640
+ 400: 'Bad Request',
641
+ 401: 'Unauthorized',
642
+ 402: 'Payment Required',
643
+ 403: 'Forbidden',
644
+ 404: 'Not Found',
645
+ 405: 'Method Not Allowed',
646
+ 406: 'Not Acceptable',
647
+ 407: 'Proxy Authentication Required',
648
+ 408: 'Request Timeout',
649
+ 409: 'Conflict',
650
+ 410: 'Gone',
651
+ 411: 'Length Required',
652
+ 412: 'Precondition Failed',
653
+ 413: 'Payload Too Large',
654
+ 414: 'URI Too Long',
655
+ 415: 'Unsupported Media Type',
656
+ 416: 'Requested Range Not Satisfiable',
657
+ 417: 'Expectation Failed',
658
+ 418: "I'm a Teapot",
659
+ 421: 'Misdirected Request',
660
+ 422: 'Unprocessable Entity',
661
+ 424: 'Failed Dependency',
662
+ 428: 'Precondition Required',
663
+ 429: 'Too Many Requests',
664
+ 500: 'Internal Server Error',
665
+ 501: 'Not Implemented',
666
+ 502: 'Bad Gateway',
667
+ 503: 'Service Unavailable',
668
+ 504: 'Gateway Timeout',
669
+ 505: 'HTTP Version Not Supported',
670
+ };
671
+ function getHttpStatusText(statusCode) {
672
+ var statusText = statusMap[statusCode];
673
+ if (!statusText) {
674
+ return 'Error';
675
+ }
676
+ return statusText;
677
+ }
678
+
679
+ function _class_call_check(instance, Constructor) {
680
+ if (!(instance instanceof Constructor)) {
681
+ throw new TypeError('Cannot call a class as a function');
682
+ }
683
+ }
684
+ function _defineProperties(target, props) {
685
+ for (var i = 0; i < props.length; i++) {
686
+ var descriptor = props[i];
687
+ descriptor.enumerable = descriptor.enumerable || false;
688
+ descriptor.configurable = true;
689
+ if ('value' in descriptor) descriptor.writable = true;
690
+ Object.defineProperty(target, descriptor.key, descriptor);
691
+ }
692
+ }
693
+ function _create_class(Constructor, protoProps, staticProps) {
694
+ if (staticProps) _defineProperties(Constructor, staticProps);
695
+ return Constructor;
696
+ }
697
+ function _instanceof(left, right) {
698
+ if (
699
+ right != null &&
700
+ typeof Symbol !== 'undefined' &&
701
+ right[Symbol.hasInstance]
702
+ ) {
703
+ return !!right[Symbol.hasInstance](left);
704
+ } else {
705
+ return left instanceof right;
706
+ }
707
+ }
708
+ var Exceptions = /*#__PURE__*/ (function () {
709
+ function Exceptions() {
710
+ _class_call_check(this, Exceptions);
711
+ }
712
+ _create_class(Exceptions, null, [
713
+ {
714
+ key: 'transformPgError',
715
+ value: function transformPgError(error) {
716
+ var httpStatus;
717
+ var errMsg = null;
718
+ switch (error.getStatus()) {
719
+ case PostgresError.FOREIGN_KEY_VIOLATION:
720
+ httpStatus = common.HttpStatus.NOT_FOUND;
721
+ errMsg = error.getSpecificMessage(
722
+ PostgresError.FOREIGN_KEY_VIOLATION
723
+ );
724
+ break;
725
+ case PostgresError.UNIQUE_VIOLATION:
726
+ httpStatus = common.HttpStatus.CONFLICT;
727
+ errMsg = error.getSpecificMessage(PostgresError.UNIQUE_VIOLATION);
728
+ break;
729
+ case PostgresError.INVALID_TEXT_REPRESENTATION:
730
+ httpStatus = common.HttpStatus.BAD_REQUEST;
731
+ errMsg = error.getSpecificMessage(
732
+ PostgresError.INVALID_TEXT_REPRESENTATION
733
+ );
734
+ break;
735
+ default:
736
+ httpStatus = common.HttpStatus.INTERNAL_SERVER_ERROR;
737
+ }
738
+ return new NativeException(
739
+ httpStatus,
740
+ errMsg !== null && errMsg !== void 0 ? errMsg : error.message
741
+ );
742
+ },
743
+ },
744
+ {
745
+ key: 'toHttpException',
746
+ value: function toHttpException(error) {
747
+ var _error = error;
748
+ if (_instanceof(_error, PgException)) {
749
+ _error = this.transformPgError(_error);
750
+ }
751
+ return new common.HttpException(
752
+ {
753
+ status: _error.code,
754
+ message: _error.message,
755
+ error: getHttpStatusText(_error.code),
756
+ },
757
+ _error.code
758
+ );
759
+ },
760
+ },
761
+ ]);
762
+ return Exceptions;
763
+ })();
764
+
765
+ exports.Exceptions = Exceptions;
766
+ exports.NativeException = NativeException;
767
+ exports.PgException = PgException;
768
+ exports.PostgresError = PostgresError;