@nestjs-kitchen/connextion-postgres 2.0.2 → 2.0.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/dist/types.d.ts CHANGED
@@ -1,12 +1,9 @@
1
- import { PoolConfig, PoolClient } from 'pg';
2
-
3
- type ALSQueryType = Error | true;
4
- interface ALSType {
1
+ import type { PoolClient, PoolConfig } from 'pg';
2
+ export type ALSQueryType = Error | true;
3
+ export interface ALSType {
5
4
  client: Promise<PoolClient>;
6
5
  queries: Promise<ALSQueryType>[];
7
6
  }
8
- type PostgresInstanceOptions = PoolConfig & {
7
+ export type PostgresInstanceOptions = PoolConfig & {
9
8
  debug?: boolean | ((data: Record<any, any>) => void);
10
9
  };
11
-
12
- export type { ALSQueryType, ALSType, PostgresInstanceOptions };
package/dist/types.js CHANGED
@@ -1,15 +1,2 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var types_exports = {};
15
- module.exports = __toCommonJS(types_exports);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/utils.d.ts CHANGED
@@ -1,16 +1,15 @@
1
- import { Submittable, PoolClient } from 'pg';
2
-
3
- declare const isSubmittable: (val: any) => val is Submittable;
4
- declare const isObject: (val: any) => val is object;
5
- declare const normalizeStrings: (strs?: string[]) => string[];
6
- declare const plainPromise: <T>(promise: Promise<T> | T) => Promise<[T, undefined] | [undefined, any]>;
7
- declare const truncateString: (str: string, maxLength: number) => string;
8
- declare const printTable: (logData: Record<string, any>) => string;
9
- declare const getCurrentDateStr: () => string;
10
- declare const formatArray: (arr?: any) => string;
11
- declare const extraceQueryTextAndValues: (...rest: any[]) => [text: string, values: any[]];
12
- declare const createDebugLogger: (defaultLogger: (...rest: any) => void, customFormater?: Boolean | ((data: Record<any, any>) => void)) => (data: Record<any, any>) => void;
13
- declare const debugFactroy: (name: string, queryId: string, logger: (data: Record<any, any>) => void) => {
1
+ import { type PoolClient, type Submittable } from 'pg';
2
+ export declare const isSubmittable: (val: any) => val is Submittable;
3
+ export declare const isObject: (val: any) => val is object;
4
+ export declare const normalizeStrings: (strs?: string[]) => string[];
5
+ export declare const plainPromise: <T>(promise: Promise<T> | T) => Promise<[T, undefined] | [undefined, any]>;
6
+ export declare const truncateString: (str: string, maxLength: number) => string;
7
+ export declare const printTable: (logData: Record<string, any>) => string;
8
+ export declare const getCurrentDateStr: () => string;
9
+ export declare const formatArray: (arr?: any) => string;
10
+ export declare const extraceQueryTextAndValues: (...rest: any[]) => [text: string, values: any[]];
11
+ export declare const createDebugLogger: (defaultLogger: (...rest: any) => void, customFormater?: Boolean | ((data: Record<any, any>) => void)) => (data: Record<any, any>) => void;
12
+ export declare const debugFactroy: (name: string, queryId: string, logger: (data: Record<any, any>) => void) => {
14
13
  pool: {
15
14
  connect: <T extends () => Promise<PoolClient>>(callback: T) => () => Promise<PoolClient>;
16
15
  };
@@ -19,13 +18,11 @@ declare const debugFactroy: (name: string, queryId: string, logger: (data: Recor
19
18
  release: <T extends (...rest: unknown[]) => void>(callback: T) => (...rest: Parameters<T>) => void;
20
19
  };
21
20
  };
22
- declare const copyMethodMetadata: (from: any, to: any) => void;
23
- declare const getTransactionMetdata: (target: any) => any;
24
- declare const setTransactionMetdata: (target: any) => void;
25
- declare const withResolvers: <T>() => {
21
+ export declare const copyMethodMetadata: (from: any, to: any) => void;
22
+ export declare const getTransactionMetdata: (target: any) => any;
23
+ export declare const setTransactionMetdata: (target: any) => void;
24
+ export declare const withResolvers: <T>() => {
26
25
  promise: Promise<T>;
27
26
  resolve: (value: T | PromiseLike<T>) => void;
28
27
  reject: (reason?: any) => void;
29
28
  };
30
-
31
- export { copyMethodMetadata, createDebugLogger, debugFactroy, extraceQueryTextAndValues, formatArray, getCurrentDateStr, getTransactionMetdata, isObject, isSubmittable, normalizeStrings, plainPromise, printTable, setTransactionMetdata, truncateString, withResolvers };
package/dist/utils.js CHANGED
@@ -1,278 +1,230 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
4
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.withResolvers = exports.setTransactionMetdata = exports.getTransactionMetdata = exports.copyMethodMetadata = exports.debugFactroy = exports.createDebugLogger = exports.extraceQueryTextAndValues = exports.formatArray = exports.getCurrentDateStr = exports.printTable = exports.truncateString = exports.plainPromise = exports.normalizeStrings = exports.isObject = exports.isSubmittable = void 0;
7
+ const dayjs_1 = __importDefault(require("dayjs"));
8
+ const constants_1 = require("./constants");
9
+ const isSubmittable = (val) => {
10
+ return val && typeof val.submit === 'function';
19
11
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var utils_exports = {};
30
- __export(utils_exports, {
31
- copyMethodMetadata: () => copyMethodMetadata,
32
- createDebugLogger: () => createDebugLogger,
33
- debugFactroy: () => debugFactroy,
34
- extraceQueryTextAndValues: () => extraceQueryTextAndValues,
35
- formatArray: () => formatArray,
36
- getCurrentDateStr: () => getCurrentDateStr,
37
- getTransactionMetdata: () => getTransactionMetdata,
38
- isObject: () => isObject,
39
- isSubmittable: () => isSubmittable,
40
- normalizeStrings: () => normalizeStrings,
41
- plainPromise: () => plainPromise,
42
- printTable: () => printTable,
43
- setTransactionMetdata: () => setTransactionMetdata,
44
- truncateString: () => truncateString,
45
- withResolvers: () => withResolvers
46
- });
47
- module.exports = __toCommonJS(utils_exports);
48
- var import_dayjs = __toESM(require("dayjs"));
49
- var import_constants = require("./constants");
50
- const isSubmittable = /* @__PURE__ */ __name((val) => {
51
- return val && typeof val.submit === "function";
52
- }, "isSubmittable");
53
- const isObject = /* @__PURE__ */ __name((val) => {
54
- return Object.prototype.toString.call(val) === "[object Object]";
55
- }, "isObject");
56
- const normalizeStrings = /* @__PURE__ */ __name((strs) => {
57
- if (!strs) {
58
- return [];
59
- }
60
- return Array.from(new Set(strs.filter(Boolean).map((ele) => ele.trim())));
61
- }, "normalizeStrings");
62
- const plainPromise = /* @__PURE__ */ __name(async (promise) => {
63
- let result = void 0;
64
- let err = void 0;
65
- try {
66
- result = await promise;
67
- } catch (error) {
68
- err = error;
69
- }
70
- return [
71
- result,
72
- err
73
- ];
74
- }, "plainPromise");
75
- const truncateString = /* @__PURE__ */ __name((str, maxLength) => {
76
- if (str.length <= maxLength) {
77
- return str;
78
- }
79
- const truncatedLength = maxLength - 3;
80
- if (truncatedLength <= 0) {
81
- return "...";
82
- }
83
- return str.slice(0, truncatedLength) + "...";
84
- }, "truncateString");
85
- const printTable = /* @__PURE__ */ __name((logData) => {
86
- const maxKeyLength = import_constants.MAX_LENGTH / 3;
87
- const maxValueLength = import_constants.MAX_LENGTH;
88
- const separatorTop = "\u2500".repeat(maxKeyLength + 2) + "\u252C" + "\u2500".repeat(maxValueLength + 2);
89
- const separatorBottom = "\u2500".repeat(maxKeyLength + 2) + "\u2534" + "\u2500".repeat(maxValueLength + 2);
90
- const lines = [
91
- `\u250C${separatorTop}\u2510`,
92
- ...Object.entries(logData).filter(([_, value]) => value).map(([key, value]) => `\u2502 ${key.padEnd(maxKeyLength)} \u2502 ${truncateString(String(value), import_constants.MAX_LENGTH).padEnd(maxValueLength)} \u2502`),
93
- `\u2514${separatorBottom}\u2518`
94
- ];
95
- return lines.join("\n");
96
- }, "printTable");
97
- const getCurrentDateStr = /* @__PURE__ */ __name(() => {
98
- return (0, import_dayjs.default)().format(import_constants.DATE_FORMAT);
99
- }, "getCurrentDateStr");
100
- const formatArray = /* @__PURE__ */ __name((arr) => {
101
- return Array.isArray(arr) ? `[${arr.map(String).join(", ")}]` : "null";
102
- }, "formatArray");
103
- const extraceQueryTextAndValues = /* @__PURE__ */ __name((...rest) => {
104
- const [arg0, arg1] = rest;
105
- if (arg0 && (isSubmittable(arg0) || isObject(arg0))) {
106
- return [
107
- arg0.text,
108
- arg1 ?? arg0.values
12
+ exports.isSubmittable = isSubmittable;
13
+ const isObject = (val) => {
14
+ return Object.prototype.toString.call(val) === '[object Object]';
15
+ };
16
+ exports.isObject = isObject;
17
+ const normalizeStrings = (strs) => {
18
+ if (!strs) {
19
+ return [];
20
+ }
21
+ return Array.from(new Set(strs.filter(Boolean).map((ele) => ele.trim())));
22
+ };
23
+ exports.normalizeStrings = normalizeStrings;
24
+ const plainPromise = async (promise) => {
25
+ let result = undefined;
26
+ let err = undefined;
27
+ try {
28
+ result = await promise;
29
+ }
30
+ catch (error) {
31
+ err = error;
32
+ }
33
+ return [result, err];
34
+ };
35
+ exports.plainPromise = plainPromise;
36
+ const truncateString = (str, maxLength) => {
37
+ if (str.length <= maxLength) {
38
+ return str;
39
+ }
40
+ const truncatedLength = maxLength - 3;
41
+ if (truncatedLength <= 0) {
42
+ return '...';
43
+ }
44
+ return str.slice(0, truncatedLength) + '...';
45
+ };
46
+ exports.truncateString = truncateString;
47
+ const printTable = (logData) => {
48
+ const maxKeyLength = constants_1.MAX_LENGTH / 3;
49
+ const maxValueLength = constants_1.MAX_LENGTH;
50
+ const separatorTop = '─'.repeat(maxKeyLength + 2) + '┬' + '─'.repeat(maxValueLength + 2);
51
+ const separatorBottom = '─'.repeat(maxKeyLength + 2) + '┴' + '─'.repeat(maxValueLength + 2);
52
+ const lines = [
53
+ `┌${separatorTop}┐`,
54
+ ...Object.entries(logData)
55
+ .filter(([_, value]) => value)
56
+ .map(([key, value]) => `│ ${key.padEnd(maxKeyLength)} │ ${(0, exports.truncateString)(String(value), constants_1.MAX_LENGTH).padEnd(maxValueLength)} │`),
57
+ `└${separatorBottom}┘`
109
58
  ];
110
- }
111
- return [
112
- arg0,
113
- arg1
114
- ];
115
- }, "extraceQueryTextAndValues");
116
- const createDebugLogger = /* @__PURE__ */ __name((defaultLogger, customFormater) => {
117
- if (typeof customFormater === "function") {
59
+ return lines.join('\n');
60
+ };
61
+ exports.printTable = printTable;
62
+ const getCurrentDateStr = () => {
63
+ return (0, dayjs_1.default)().format(constants_1.DATE_FORMAT);
64
+ };
65
+ exports.getCurrentDateStr = getCurrentDateStr;
66
+ const formatArray = (arr) => {
67
+ return Array.isArray(arr) ? `[${arr.map(String).join(', ')}]` : 'null';
68
+ };
69
+ exports.formatArray = formatArray;
70
+ const extraceQueryTextAndValues = (...rest) => {
71
+ const [arg0, arg1] = rest;
72
+ if (arg0 && ((0, exports.isSubmittable)(arg0) || (0, exports.isObject)(arg0))) {
73
+ return [arg0.text, arg1 ?? arg0.values];
74
+ }
75
+ return [arg0, arg1];
76
+ };
77
+ exports.extraceQueryTextAndValues = extraceQueryTextAndValues;
78
+ const createDebugLogger = (defaultLogger, customFormater) => {
79
+ if (typeof customFormater === 'function') {
80
+ return (data) => {
81
+ defaultLogger(customFormater(data));
82
+ };
83
+ }
118
84
  return (data) => {
119
- defaultLogger(customFormater(data));
85
+ const firstLine = `Executing Postgres command\n`;
86
+ defaultLogger(firstLine + (0, exports.printTable)(data));
120
87
  };
121
- }
122
- return (data) => {
123
- const firstLine = `Executing Postgres command
124
- `;
125
- defaultLogger(firstLine + printTable(data));
126
- };
127
- }, "createDebugLogger");
128
- const debugFactroy = /* @__PURE__ */ __name((name, queryId, logger) => {
129
- return {
130
- pool: {
131
- connect: /* @__PURE__ */ __name((callback) => {
132
- return async () => {
133
- const startOn = getCurrentDateStr();
134
- let err = void 0;
135
- try {
136
- return await callback();
137
- } catch (error) {
138
- err = error;
139
- throw err;
140
- } finally {
141
- logger({
142
- Instance: name,
143
- Client: queryId,
144
- Type: "Request new client",
145
- "Started On": startOn,
146
- "Ended On": getCurrentDateStr(),
147
- Status: err ? "Failed" : "Successful",
148
- Error: err
149
- });
150
- }
151
- };
152
- }, "connect")
153
- },
154
- client: {
155
- query: /* @__PURE__ */ __name((callback) => {
156
- return async (...rest) => {
157
- const [text, values] = extraceQueryTextAndValues(...rest);
158
- const submittable = isSubmittable(rest[0]);
159
- const startOn = getCurrentDateStr();
160
- let err = void 0;
161
- if (submittable) {
162
- rest[0].on("end", () => {
163
- logger({
164
- Instance: name,
165
- Client: queryId,
166
- Type: "Submittable",
167
- Text: text,
168
- Values: formatArray(values),
169
- "Started On": startOn,
170
- "Ended On": getCurrentDateStr(),
171
- Status: "Successful"
172
- });
173
- });
174
- rest[0].on("error", (err2) => {
175
- logger({
176
- Instance: name,
177
- Client: queryId,
178
- Type: "Submittable",
179
- Text: text,
180
- Values: formatArray(values),
181
- "Started On": startOn,
182
- "Ended On": getCurrentDateStr(),
183
- Status: "Failed",
184
- Error: err2
185
- });
186
- });
187
- }
188
- try {
189
- return await callback(...rest);
190
- } catch (error) {
191
- err = error;
192
- throw err;
193
- } finally {
194
- if (!submittable) {
195
- logger({
196
- Instance: name,
197
- Client: queryId,
198
- Type: "Query",
199
- Text: text,
200
- Values: formatArray(values),
201
- "Started On": startOn,
202
- "Ended On": getCurrentDateStr(),
203
- Status: err ? "Failed" : "Successful",
204
- Error: err
205
- });
88
+ };
89
+ exports.createDebugLogger = createDebugLogger;
90
+ const debugFactroy = (name, queryId, logger) => {
91
+ return {
92
+ pool: {
93
+ connect: (callback) => {
94
+ return async () => {
95
+ const startOn = (0, exports.getCurrentDateStr)();
96
+ let err = undefined;
97
+ try {
98
+ return await callback();
99
+ }
100
+ catch (error) {
101
+ err = error;
102
+ throw err;
103
+ }
104
+ finally {
105
+ logger({
106
+ Instance: name,
107
+ Client: queryId,
108
+ Type: 'Request new client',
109
+ 'Started On': startOn,
110
+ 'Ended On': (0, exports.getCurrentDateStr)(),
111
+ Status: err ? 'Failed' : 'Successful',
112
+ Error: err
113
+ });
114
+ }
115
+ };
206
116
  }
207
- }
208
- };
209
- }, "query"),
210
- release: /* @__PURE__ */ __name((callback) => {
211
- return (...rest) => {
212
- const startOn = getCurrentDateStr();
213
- let err = void 0;
214
- try {
215
- return callback(...rest);
216
- } catch (error) {
217
- err = error;
218
- throw err;
219
- } finally {
220
- logger({
221
- Instance: name,
222
- Client: queryId,
223
- Type: "Release client",
224
- "Started On": startOn,
225
- "Ended On": getCurrentDateStr(),
226
- Status: err ? "Failed" : "Successful",
227
- Error: err
228
- });
229
- }
230
- };
231
- }, "release")
232
- }
233
- };
234
- }, "debugFactroy");
235
- const copyMethodMetadata = /* @__PURE__ */ __name((from, to) => {
236
- const metadataKeys = Reflect.getMetadataKeys(from);
237
- metadataKeys.map((key) => {
238
- const value = Reflect.getMetadata(key, from);
239
- Reflect.defineMetadata(key, value, to);
240
- });
241
- }, "copyMethodMetadata");
242
- const getTransactionMetdata = /* @__PURE__ */ __name((target) => {
243
- return Reflect.getMetadata(import_constants.TRANSACTION_META, target);
244
- }, "getTransactionMetdata");
245
- const setTransactionMetdata = /* @__PURE__ */ __name((target) => {
246
- return Reflect.defineMetadata(import_constants.TRANSACTION_META, true, target);
247
- }, "setTransactionMetdata");
248
- const withResolvers = /* @__PURE__ */ __name(() => {
249
- let resolve;
250
- let reject;
251
- const promise = new Promise((res, rej) => {
252
- resolve = res;
253
- reject = rej;
254
- });
255
- return {
256
- promise,
257
- resolve,
258
- reject
259
- };
260
- }, "withResolvers");
261
- // Annotate the CommonJS export names for ESM import in node:
262
- 0 && (module.exports = {
263
- copyMethodMetadata,
264
- createDebugLogger,
265
- debugFactroy,
266
- extraceQueryTextAndValues,
267
- formatArray,
268
- getCurrentDateStr,
269
- getTransactionMetdata,
270
- isObject,
271
- isSubmittable,
272
- normalizeStrings,
273
- plainPromise,
274
- printTable,
275
- setTransactionMetdata,
276
- truncateString,
277
- withResolvers
278
- });
117
+ },
118
+ client: {
119
+ query: (callback) => {
120
+ return async (...rest) => {
121
+ const [text, values] = (0, exports.extraceQueryTextAndValues)(...rest);
122
+ const submittable = (0, exports.isSubmittable)(rest[0]);
123
+ const startOn = (0, exports.getCurrentDateStr)();
124
+ let err = undefined;
125
+ if (submittable) {
126
+ rest[0].on('end', () => {
127
+ logger({
128
+ Instance: name,
129
+ Client: queryId,
130
+ Type: 'Submittable',
131
+ Text: text,
132
+ Values: (0, exports.formatArray)(values),
133
+ 'Started On': startOn,
134
+ 'Ended On': (0, exports.getCurrentDateStr)(),
135
+ Status: 'Successful'
136
+ });
137
+ });
138
+ rest[0].on('error', (err) => {
139
+ logger({
140
+ Instance: name,
141
+ Client: queryId,
142
+ Type: 'Submittable',
143
+ Text: text,
144
+ Values: (0, exports.formatArray)(values),
145
+ 'Started On': startOn,
146
+ 'Ended On': (0, exports.getCurrentDateStr)(),
147
+ Status: 'Failed',
148
+ Error: err
149
+ });
150
+ });
151
+ }
152
+ try {
153
+ return await callback(...rest);
154
+ }
155
+ catch (error) {
156
+ err = error;
157
+ throw err;
158
+ }
159
+ finally {
160
+ if (!submittable) {
161
+ logger({
162
+ Instance: name,
163
+ Client: queryId,
164
+ Type: 'Query',
165
+ Text: text,
166
+ Values: (0, exports.formatArray)(values),
167
+ 'Started On': startOn,
168
+ 'Ended On': (0, exports.getCurrentDateStr)(),
169
+ Status: err ? 'Failed' : 'Successful',
170
+ Error: err
171
+ });
172
+ }
173
+ }
174
+ };
175
+ },
176
+ release: (callback) => {
177
+ return (...rest) => {
178
+ const startOn = (0, exports.getCurrentDateStr)();
179
+ let err = undefined;
180
+ try {
181
+ return callback(...rest);
182
+ }
183
+ catch (error) {
184
+ err = error;
185
+ throw err;
186
+ }
187
+ finally {
188
+ logger({
189
+ Instance: name,
190
+ Client: queryId,
191
+ Type: 'Release client',
192
+ 'Started On': startOn,
193
+ 'Ended On': (0, exports.getCurrentDateStr)(),
194
+ Status: err ? 'Failed' : 'Successful',
195
+ Error: err
196
+ });
197
+ }
198
+ };
199
+ }
200
+ }
201
+ };
202
+ };
203
+ exports.debugFactroy = debugFactroy;
204
+ // Ref: https://github.com/Papooch/nestjs-cls/blob/main/packages/core/src/utils/copy-method-metadata.ts#L10
205
+ const copyMethodMetadata = (from, to) => {
206
+ const metadataKeys = Reflect.getMetadataKeys(from);
207
+ metadataKeys.map((key) => {
208
+ const value = Reflect.getMetadata(key, from);
209
+ Reflect.defineMetadata(key, value, to);
210
+ });
211
+ };
212
+ exports.copyMethodMetadata = copyMethodMetadata;
213
+ const getTransactionMetdata = (target) => {
214
+ return Reflect.getMetadata(constants_1.TRANSACTION_META, target);
215
+ };
216
+ exports.getTransactionMetdata = getTransactionMetdata;
217
+ const setTransactionMetdata = (target) => {
218
+ return Reflect.defineMetadata(constants_1.TRANSACTION_META, true, target);
219
+ };
220
+ exports.setTransactionMetdata = setTransactionMetdata;
221
+ const withResolvers = () => {
222
+ let resolve;
223
+ let reject;
224
+ const promise = new Promise((res, rej) => {
225
+ resolve = res;
226
+ reject = rej;
227
+ });
228
+ return { promise, resolve: resolve, reject: reject };
229
+ };
230
+ exports.withResolvers = withResolvers;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nestjs-kitchen/connextion-postgres",
3
3
  "private": false,
4
4
  "description": "A flexible module to provide node-postgres interface in NextJS.",
5
- "version": "2.0.2",
5
+ "version": "2.0.4",
6
6
  "homepage": "https://github.com/yikenman/nestjs-kitchen",
7
7
  "repository": "https://github.com/yikenman/nestjs-kitchen",
8
8
  "author": "yikenman",
@@ -26,12 +26,13 @@
26
26
  "@types/jest": "^29.5.14",
27
27
  "@types/node": "^22.13.9",
28
28
  "jest": "^29.7.0",
29
- "ts-jest": "^29.2.6",
29
+ "rimraf": "^6.0.1",
30
+ "ts-jest": "^29.3.0",
30
31
  "ts-node": "^10.9.2",
31
32
  "tsconfig-paths": "^4.2.0",
32
33
  "tsup": "^8.4.0",
33
34
  "typescript": "^5.8.2",
34
- "@nestjs-kitchen/connextion": "2.0.2"
35
+ "@nestjs-kitchen/connextion": "2.0.4"
35
36
  },
36
37
  "engines": {
37
38
  "node": ">=20.13.0"
@@ -51,11 +52,11 @@
51
52
  "@types/pg": "^8.11.10",
52
53
  "pg": "^8.13.1",
53
54
  "reflect-metadata": "^0.2.2",
54
- "@nestjs-kitchen/connextion": "2.0.2"
55
+ "@nestjs-kitchen/connextion": "2.0.4"
55
56
  },
56
57
  "scripts": {
57
- "build": "tsup",
58
- "dev": "tsup --watch",
58
+ "build": "rimraf dist && tsc -p tsconfig.build.json",
59
+ "dev": "rimraf dist && tsc -p tsconfig.build.json --watch",
59
60
  "test": "jest",
60
61
  "test:ci": "jest --coverage",
61
62
  "test:cov": "jest --coverage",