@gustavo-valsechi/node 1.0.34 → 1.0.36
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/index.js +15 -7
- package/dist/index.mjs +15 -7
- package/dist/src/router/index.js +2 -2
- package/dist/src/router/index.mjs +2 -2
- package/dist/src/schemas/index.d.mts +2 -2
- package/dist/src/schemas/index.d.ts +2 -2
- package/dist/src/schemas/index.js +2 -2
- package/dist/src/schemas/index.mjs +2 -2
- package/dist/src/server/index.js +2 -2
- package/dist/src/server/index.mjs +2 -2
- package/dist/src/services/index.js +13 -5
- package/dist/src/services/index.mjs +13 -5
- package/dist/src/tools/index.js +2 -2
- package/dist/src/tools/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -191,8 +191,8 @@ var parse = (json) => {
|
|
|
191
191
|
return json;
|
|
192
192
|
};
|
|
193
193
|
var OptionsSchema = import_zod2.z.object({
|
|
194
|
-
take: import_zod2.z.
|
|
195
|
-
page: import_zod2.z.
|
|
194
|
+
take: import_zod2.z.number().max(200).default(20),
|
|
195
|
+
page: import_zod2.z.number().default(0),
|
|
196
196
|
select: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
197
197
|
relations: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
198
198
|
where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -320,20 +320,26 @@ var TenantService = class {
|
|
|
320
320
|
this.idTenant = idTenant;
|
|
321
321
|
}
|
|
322
322
|
async getTenantQueryRunner() {
|
|
323
|
-
var _a;
|
|
324
|
-
if (this.runner
|
|
323
|
+
var _a, _b;
|
|
324
|
+
if (this.runner && !this.runner.isReleased) {
|
|
325
|
+
await this.runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
326
|
+
return this.runner;
|
|
327
|
+
}
|
|
328
|
+
if ((_a = this.runner) == null ? void 0 : _a.isReleased) {
|
|
329
|
+
this.runner = void 0;
|
|
330
|
+
}
|
|
325
331
|
const runner = this.db.createQueryRunner();
|
|
326
332
|
await runner.connect();
|
|
327
333
|
const result = await runner.query(`
|
|
328
334
|
SELECT EXISTS (
|
|
329
335
|
SELECT 1
|
|
330
336
|
FROM information_schema.schemata
|
|
331
|
-
WHERE schema_name =
|
|
337
|
+
WHERE schema_name = $1
|
|
332
338
|
) AS "exists"
|
|
333
|
-
|
|
339
|
+
`, [this.idTenant]);
|
|
334
340
|
await runner.query(`CREATE SCHEMA IF NOT EXISTS "${this.idTenant}"`);
|
|
335
341
|
await runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
336
|
-
if (!((
|
|
342
|
+
if (!((_b = result == null ? void 0 : result[0]) == null ? void 0 : _b.exists)) await runner.query(this.migrations);
|
|
337
343
|
this.runner = runner;
|
|
338
344
|
return runner;
|
|
339
345
|
}
|
|
@@ -349,6 +355,8 @@ var TenantService = class {
|
|
|
349
355
|
await this.getTenantQueryRunner();
|
|
350
356
|
await ((_a = this.runner) == null ? void 0 : _a.query("SET search_path TO public"));
|
|
351
357
|
await ((_b = this.runner) == null ? void 0 : _b.release());
|
|
358
|
+
this.runner = void 0;
|
|
359
|
+
this.repository = void 0;
|
|
352
360
|
}
|
|
353
361
|
};
|
|
354
362
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/index.mjs
CHANGED
|
@@ -160,8 +160,8 @@ var parse = (json) => {
|
|
|
160
160
|
return json;
|
|
161
161
|
};
|
|
162
162
|
var OptionsSchema = z.object({
|
|
163
|
-
take: z.
|
|
164
|
-
page: z.
|
|
163
|
+
take: z.number().max(200).default(20),
|
|
164
|
+
page: z.number().default(0),
|
|
165
165
|
select: z.array(z.string()).optional(),
|
|
166
166
|
relations: z.array(z.string()).optional(),
|
|
167
167
|
where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -289,20 +289,26 @@ var TenantService = class {
|
|
|
289
289
|
this.idTenant = idTenant;
|
|
290
290
|
}
|
|
291
291
|
async getTenantQueryRunner() {
|
|
292
|
-
var _a;
|
|
293
|
-
if (this.runner
|
|
292
|
+
var _a, _b;
|
|
293
|
+
if (this.runner && !this.runner.isReleased) {
|
|
294
|
+
await this.runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
295
|
+
return this.runner;
|
|
296
|
+
}
|
|
297
|
+
if ((_a = this.runner) == null ? void 0 : _a.isReleased) {
|
|
298
|
+
this.runner = void 0;
|
|
299
|
+
}
|
|
294
300
|
const runner = this.db.createQueryRunner();
|
|
295
301
|
await runner.connect();
|
|
296
302
|
const result = await runner.query(`
|
|
297
303
|
SELECT EXISTS (
|
|
298
304
|
SELECT 1
|
|
299
305
|
FROM information_schema.schemata
|
|
300
|
-
WHERE schema_name =
|
|
306
|
+
WHERE schema_name = $1
|
|
301
307
|
) AS "exists"
|
|
302
|
-
|
|
308
|
+
`, [this.idTenant]);
|
|
303
309
|
await runner.query(`CREATE SCHEMA IF NOT EXISTS "${this.idTenant}"`);
|
|
304
310
|
await runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
305
|
-
if (!((
|
|
311
|
+
if (!((_b = result == null ? void 0 : result[0]) == null ? void 0 : _b.exists)) await runner.query(this.migrations);
|
|
306
312
|
this.runner = runner;
|
|
307
313
|
return runner;
|
|
308
314
|
}
|
|
@@ -318,6 +324,8 @@ var TenantService = class {
|
|
|
318
324
|
await this.getTenantQueryRunner();
|
|
319
325
|
await ((_a = this.runner) == null ? void 0 : _a.query("SET search_path TO public"));
|
|
320
326
|
await ((_b = this.runner) == null ? void 0 : _b.release());
|
|
327
|
+
this.runner = void 0;
|
|
328
|
+
this.repository = void 0;
|
|
321
329
|
}
|
|
322
330
|
};
|
|
323
331
|
export {
|
package/dist/src/router/index.js
CHANGED
|
@@ -144,8 +144,8 @@ var parse = (json) => {
|
|
|
144
144
|
return json;
|
|
145
145
|
};
|
|
146
146
|
var OptionsSchema = import_zod2.z.object({
|
|
147
|
-
take: import_zod2.z.
|
|
148
|
-
page: import_zod2.z.
|
|
147
|
+
take: import_zod2.z.number().max(200).default(20),
|
|
148
|
+
page: import_zod2.z.number().default(0),
|
|
149
149
|
select: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
150
150
|
relations: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
151
151
|
where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -118,8 +118,8 @@ var parse = (json) => {
|
|
|
118
118
|
return json;
|
|
119
119
|
};
|
|
120
120
|
var OptionsSchema = z.object({
|
|
121
|
-
take: z.
|
|
122
|
-
page: z.
|
|
121
|
+
take: z.number().max(200).default(20),
|
|
122
|
+
page: z.number().default(0),
|
|
123
123
|
select: z.array(z.string()).optional(),
|
|
124
124
|
relations: z.array(z.string()).optional(),
|
|
125
125
|
where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
declare const OptionsSchema: z.ZodObject<{
|
|
4
|
-
take: z.
|
|
5
|
-
page: z.
|
|
4
|
+
take: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
6
6
|
select: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
7
|
relations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
8
|
where: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<any, any>>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
declare const OptionsSchema: z.ZodObject<{
|
|
4
|
-
take: z.
|
|
5
|
-
page: z.
|
|
4
|
+
take: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
6
6
|
select: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
7
7
|
relations: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
8
|
where: z.ZodOptional<z.ZodPipe<z.ZodAny, z.ZodTransform<any, any>>>;
|
|
@@ -121,8 +121,8 @@ var parse = (json) => {
|
|
|
121
121
|
return json;
|
|
122
122
|
};
|
|
123
123
|
var OptionsSchema = import_zod.z.object({
|
|
124
|
-
take: import_zod.z.
|
|
125
|
-
page: import_zod.z.
|
|
124
|
+
take: import_zod.z.number().max(200).default(20),
|
|
125
|
+
page: import_zod.z.number().default(0),
|
|
126
126
|
select: import_zod.z.array(import_zod.z.string()).optional(),
|
|
127
127
|
relations: import_zod.z.array(import_zod.z.string()).optional(),
|
|
128
128
|
where: import_zod.z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -96,8 +96,8 @@ var parse = (json) => {
|
|
|
96
96
|
return json;
|
|
97
97
|
};
|
|
98
98
|
var OptionsSchema = z.object({
|
|
99
|
-
take: z.
|
|
100
|
-
page: z.
|
|
99
|
+
take: z.number().max(200).default(20),
|
|
100
|
+
page: z.number().default(0),
|
|
101
101
|
select: z.array(z.string()).optional(),
|
|
102
102
|
relations: z.array(z.string()).optional(),
|
|
103
103
|
where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
package/dist/src/server/index.js
CHANGED
|
@@ -145,8 +145,8 @@ var parse = (json) => {
|
|
|
145
145
|
return json;
|
|
146
146
|
};
|
|
147
147
|
var OptionsSchema = import_zod2.z.object({
|
|
148
|
-
take: import_zod2.z.
|
|
149
|
-
page: import_zod2.z.
|
|
148
|
+
take: import_zod2.z.number().max(200).default(20),
|
|
149
|
+
page: import_zod2.z.number().default(0),
|
|
150
150
|
select: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
151
151
|
relations: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
152
152
|
where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -121,8 +121,8 @@ var parse = (json) => {
|
|
|
121
121
|
return json;
|
|
122
122
|
};
|
|
123
123
|
var OptionsSchema = z.object({
|
|
124
|
-
take: z.
|
|
125
|
-
page: z.
|
|
124
|
+
take: z.number().max(200).default(20),
|
|
125
|
+
page: z.number().default(0),
|
|
126
126
|
select: z.array(z.string()).optional(),
|
|
127
127
|
relations: z.array(z.string()).optional(),
|
|
128
128
|
where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
|
@@ -33,20 +33,26 @@ var TenantService = class {
|
|
|
33
33
|
this.idTenant = idTenant;
|
|
34
34
|
}
|
|
35
35
|
async getTenantQueryRunner() {
|
|
36
|
-
var _a;
|
|
37
|
-
if (this.runner
|
|
36
|
+
var _a, _b;
|
|
37
|
+
if (this.runner && !this.runner.isReleased) {
|
|
38
|
+
await this.runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
39
|
+
return this.runner;
|
|
40
|
+
}
|
|
41
|
+
if ((_a = this.runner) == null ? void 0 : _a.isReleased) {
|
|
42
|
+
this.runner = void 0;
|
|
43
|
+
}
|
|
38
44
|
const runner = this.db.createQueryRunner();
|
|
39
45
|
await runner.connect();
|
|
40
46
|
const result = await runner.query(`
|
|
41
47
|
SELECT EXISTS (
|
|
42
48
|
SELECT 1
|
|
43
49
|
FROM information_schema.schemata
|
|
44
|
-
WHERE schema_name =
|
|
50
|
+
WHERE schema_name = $1
|
|
45
51
|
) AS "exists"
|
|
46
|
-
|
|
52
|
+
`, [this.idTenant]);
|
|
47
53
|
await runner.query(`CREATE SCHEMA IF NOT EXISTS "${this.idTenant}"`);
|
|
48
54
|
await runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
49
|
-
if (!((
|
|
55
|
+
if (!((_b = result == null ? void 0 : result[0]) == null ? void 0 : _b.exists)) await runner.query(this.migrations);
|
|
50
56
|
this.runner = runner;
|
|
51
57
|
return runner;
|
|
52
58
|
}
|
|
@@ -62,6 +68,8 @@ var TenantService = class {
|
|
|
62
68
|
await this.getTenantQueryRunner();
|
|
63
69
|
await ((_a = this.runner) == null ? void 0 : _a.query("SET search_path TO public"));
|
|
64
70
|
await ((_b = this.runner) == null ? void 0 : _b.release());
|
|
71
|
+
this.runner = void 0;
|
|
72
|
+
this.repository = void 0;
|
|
65
73
|
}
|
|
66
74
|
};
|
|
67
75
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -7,20 +7,26 @@ var TenantService = class {
|
|
|
7
7
|
this.idTenant = idTenant;
|
|
8
8
|
}
|
|
9
9
|
async getTenantQueryRunner() {
|
|
10
|
-
var _a;
|
|
11
|
-
if (this.runner
|
|
10
|
+
var _a, _b;
|
|
11
|
+
if (this.runner && !this.runner.isReleased) {
|
|
12
|
+
await this.runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
13
|
+
return this.runner;
|
|
14
|
+
}
|
|
15
|
+
if ((_a = this.runner) == null ? void 0 : _a.isReleased) {
|
|
16
|
+
this.runner = void 0;
|
|
17
|
+
}
|
|
12
18
|
const runner = this.db.createQueryRunner();
|
|
13
19
|
await runner.connect();
|
|
14
20
|
const result = await runner.query(`
|
|
15
21
|
SELECT EXISTS (
|
|
16
22
|
SELECT 1
|
|
17
23
|
FROM information_schema.schemata
|
|
18
|
-
WHERE schema_name =
|
|
24
|
+
WHERE schema_name = $1
|
|
19
25
|
) AS "exists"
|
|
20
|
-
|
|
26
|
+
`, [this.idTenant]);
|
|
21
27
|
await runner.query(`CREATE SCHEMA IF NOT EXISTS "${this.idTenant}"`);
|
|
22
28
|
await runner.query(`SET search_path TO "${this.idTenant}"`);
|
|
23
|
-
if (!((
|
|
29
|
+
if (!((_b = result == null ? void 0 : result[0]) == null ? void 0 : _b.exists)) await runner.query(this.migrations);
|
|
24
30
|
this.runner = runner;
|
|
25
31
|
return runner;
|
|
26
32
|
}
|
|
@@ -36,6 +42,8 @@ var TenantService = class {
|
|
|
36
42
|
await this.getTenantQueryRunner();
|
|
37
43
|
await ((_a = this.runner) == null ? void 0 : _a.query("SET search_path TO public"));
|
|
38
44
|
await ((_b = this.runner) == null ? void 0 : _b.release());
|
|
45
|
+
this.runner = void 0;
|
|
46
|
+
this.repository = void 0;
|
|
39
47
|
}
|
|
40
48
|
};
|
|
41
49
|
export {
|
package/dist/src/tools/index.js
CHANGED
|
@@ -149,8 +149,8 @@ var parse = (json) => {
|
|
|
149
149
|
return json;
|
|
150
150
|
};
|
|
151
151
|
var OptionsSchema = import_zod2.z.object({
|
|
152
|
-
take: import_zod2.z.
|
|
153
|
-
page: import_zod2.z.
|
|
152
|
+
take: import_zod2.z.number().max(200).default(20),
|
|
153
|
+
page: import_zod2.z.number().default(0),
|
|
154
154
|
select: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
155
155
|
relations: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
156
156
|
where: import_zod2.z.any().transform((value) => refactorWhere(parse(value))).optional(),
|
package/dist/src/tools/index.mjs
CHANGED
|
@@ -125,8 +125,8 @@ var parse = (json) => {
|
|
|
125
125
|
return json;
|
|
126
126
|
};
|
|
127
127
|
var OptionsSchema = z.object({
|
|
128
|
-
take: z.
|
|
129
|
-
page: z.
|
|
128
|
+
take: z.number().max(200).default(20),
|
|
129
|
+
page: z.number().default(0),
|
|
130
130
|
select: z.array(z.string()).optional(),
|
|
131
131
|
relations: z.array(z.string()).optional(),
|
|
132
132
|
where: z.any().transform((value) => refactorWhere(parse(value))).optional(),
|