zormz 1.1.1 → 1.1.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.
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +7 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -163,21 +163,21 @@ function getRed() {
|
|
|
163
163
|
return conexion1;
|
|
164
164
|
}
|
|
165
165
|
function defineTable(tableName, columns) {
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
const fn = () => tableName;
|
|
167
|
+
const proxy = new Proxy(fn, {
|
|
168
|
+
get(_target, prop) {
|
|
168
169
|
if (prop === "name") return tableName;
|
|
169
170
|
if (prop === "toString") return () => tableName;
|
|
170
171
|
if (prop === "valueOf") return () => tableName;
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
return "";
|
|
172
|
+
const col = columns[prop];
|
|
173
|
+
if (col !== void 0) return `${tableName}.${col}`;
|
|
174
|
+
return fn[prop];
|
|
176
175
|
},
|
|
177
176
|
apply() {
|
|
178
177
|
return tableName;
|
|
179
178
|
}
|
|
180
179
|
});
|
|
180
|
+
return proxy;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
// conection/middleware/delete.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -31,6 +31,7 @@ declare class BDconnection {
|
|
|
31
31
|
*/
|
|
32
32
|
declare function getConexion(bd: connectionDB, datos: connecionLocal | connecionRed): void;
|
|
33
33
|
declare function getRed(): BDconnection;
|
|
34
|
+
type ColumnsMap = Record<string, string>;
|
|
34
35
|
/**
|
|
35
36
|
*
|
|
36
37
|
* @param {string} tableName
|
|
@@ -43,7 +44,9 @@ declare function getRed(): BDconnection;
|
|
|
43
44
|
* });
|
|
44
45
|
* @returns
|
|
45
46
|
*/
|
|
46
|
-
declare function defineTable<T extends
|
|
47
|
+
declare function defineTable<T extends ColumnsMap>(tableName: string, columns: T): T & (() => string) & {
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
47
50
|
|
|
48
51
|
declare class DeleteR {
|
|
49
52
|
#private;
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ declare class BDconnection {
|
|
|
31
31
|
*/
|
|
32
32
|
declare function getConexion(bd: connectionDB, datos: connecionLocal | connecionRed): void;
|
|
33
33
|
declare function getRed(): BDconnection;
|
|
34
|
+
type ColumnsMap = Record<string, string>;
|
|
34
35
|
/**
|
|
35
36
|
*
|
|
36
37
|
* @param {string} tableName
|
|
@@ -43,7 +44,9 @@ declare function getRed(): BDconnection;
|
|
|
43
44
|
* });
|
|
44
45
|
* @returns
|
|
45
46
|
*/
|
|
46
|
-
declare function defineTable<T extends
|
|
47
|
+
declare function defineTable<T extends ColumnsMap>(tableName: string, columns: T): T & (() => string) & {
|
|
48
|
+
name: string;
|
|
49
|
+
};
|
|
47
50
|
|
|
48
51
|
declare class DeleteR {
|
|
49
52
|
#private;
|
package/dist/index.js
CHANGED
|
@@ -110,21 +110,21 @@ function getRed() {
|
|
|
110
110
|
return conexion1;
|
|
111
111
|
}
|
|
112
112
|
function defineTable(tableName, columns) {
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
const fn = () => tableName;
|
|
114
|
+
const proxy = new Proxy(fn, {
|
|
115
|
+
get(_target, prop) {
|
|
115
116
|
if (prop === "name") return tableName;
|
|
116
117
|
if (prop === "toString") return () => tableName;
|
|
117
118
|
if (prop === "valueOf") return () => tableName;
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
return "";
|
|
119
|
+
const col = columns[prop];
|
|
120
|
+
if (col !== void 0) return `${tableName}.${col}`;
|
|
121
|
+
return fn[prop];
|
|
123
122
|
},
|
|
124
123
|
apply() {
|
|
125
124
|
return tableName;
|
|
126
125
|
}
|
|
127
126
|
});
|
|
127
|
+
return proxy;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// conection/middleware/delete.ts
|