@nattyjs/orm 0.0.1-beta.2 → 0.0.1-beta.21
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 +11 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +11 -7
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -370,6 +370,7 @@ class SqlConnection extends DbConnection {
|
|
|
370
370
|
}
|
|
371
371
|
return records;
|
|
372
372
|
} catch (ex) {
|
|
373
|
+
throw ex;
|
|
373
374
|
}
|
|
374
375
|
}
|
|
375
376
|
async runNestedObjectQueries(outputInfo, relationProps, config) {
|
|
@@ -443,20 +444,23 @@ class SqlConnection extends DbConnection {
|
|
|
443
444
|
else
|
|
444
445
|
request.input(param.name, param.value);
|
|
445
446
|
}
|
|
446
|
-
const resolveQuery = (resolve) => (error, raw) => {
|
|
447
|
+
const resolveQuery = (resolve, errorResolver) => (error, raw) => {
|
|
447
448
|
if (error)
|
|
448
|
-
|
|
449
|
+
errorResolver(error);
|
|
449
450
|
resolve(raw);
|
|
450
451
|
};
|
|
452
|
+
const catchFn = (ex) => {
|
|
453
|
+
throw ex;
|
|
454
|
+
};
|
|
451
455
|
if (queryInfo.query) {
|
|
452
456
|
const raw = await new Promise((resolve, error) => {
|
|
453
|
-
request.query(queryInfo.query, resolveQuery(resolve));
|
|
454
|
-
});
|
|
457
|
+
request.query(queryInfo.query, resolveQuery(resolve, error));
|
|
458
|
+
}).catch(catchFn);
|
|
455
459
|
return raw;
|
|
456
460
|
} else if (queryInfo.sp) {
|
|
457
461
|
const raw = await new Promise((resolve, error) => {
|
|
458
|
-
request.execute(queryInfo.sp, resolveQuery(resolve));
|
|
459
|
-
});
|
|
462
|
+
request.execute(queryInfo.sp, resolveQuery(resolve, error));
|
|
463
|
+
}).catch(catchFn);
|
|
460
464
|
return raw;
|
|
461
465
|
}
|
|
462
466
|
}
|
|
@@ -649,6 +653,7 @@ class DbContext {
|
|
|
649
653
|
}
|
|
650
654
|
}
|
|
651
655
|
|
|
656
|
+
exports.DbConnectionContext = DbConnectionContext;
|
|
652
657
|
exports.DbContext = DbContext;
|
|
653
658
|
exports.DbSet = DbSet;
|
|
654
659
|
exports.StoreProc = StoreProc;
|
package/dist/index.d.ts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -354,6 +354,7 @@ class SqlConnection extends DbConnection {
|
|
|
354
354
|
}
|
|
355
355
|
return records;
|
|
356
356
|
} catch (ex) {
|
|
357
|
+
throw ex;
|
|
357
358
|
}
|
|
358
359
|
}
|
|
359
360
|
async runNestedObjectQueries(outputInfo, relationProps, config) {
|
|
@@ -427,20 +428,23 @@ class SqlConnection extends DbConnection {
|
|
|
427
428
|
else
|
|
428
429
|
request.input(param.name, param.value);
|
|
429
430
|
}
|
|
430
|
-
const resolveQuery = (resolve) => (error, raw) => {
|
|
431
|
+
const resolveQuery = (resolve, errorResolver) => (error, raw) => {
|
|
431
432
|
if (error)
|
|
432
|
-
|
|
433
|
+
errorResolver(error);
|
|
433
434
|
resolve(raw);
|
|
434
435
|
};
|
|
436
|
+
const catchFn = (ex) => {
|
|
437
|
+
throw ex;
|
|
438
|
+
};
|
|
435
439
|
if (queryInfo.query) {
|
|
436
440
|
const raw = await new Promise((resolve, error) => {
|
|
437
|
-
request.query(queryInfo.query, resolveQuery(resolve));
|
|
438
|
-
});
|
|
441
|
+
request.query(queryInfo.query, resolveQuery(resolve, error));
|
|
442
|
+
}).catch(catchFn);
|
|
439
443
|
return raw;
|
|
440
444
|
} else if (queryInfo.sp) {
|
|
441
445
|
const raw = await new Promise((resolve, error) => {
|
|
442
|
-
request.execute(queryInfo.sp, resolveQuery(resolve));
|
|
443
|
-
});
|
|
446
|
+
request.execute(queryInfo.sp, resolveQuery(resolve, error));
|
|
447
|
+
}).catch(catchFn);
|
|
444
448
|
return raw;
|
|
445
449
|
}
|
|
446
450
|
}
|
|
@@ -633,4 +637,4 @@ class DbContext {
|
|
|
633
637
|
}
|
|
634
638
|
}
|
|
635
639
|
|
|
636
|
-
export { DbContext, DbSet, StoreProc };
|
|
640
|
+
export { DbConnectionContext, DbContext, DbSet, StoreProc };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nattyjs/orm",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.21",
|
|
4
4
|
"description": "",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"mssql": "^9.1.1",
|
|
21
|
-
"@nattyjs/core": "0.0.1-beta.
|
|
22
|
-
"@nattyjs/common": "0.0.1-beta.
|
|
23
|
-
"@nattyjs/entity": "0.0.1-beta.
|
|
24
|
-
"@nattyjs/types": "0.0.1-beta.
|
|
21
|
+
"@nattyjs/core": "0.0.1-beta.21",
|
|
22
|
+
"@nattyjs/common": "0.0.1-beta.21",
|
|
23
|
+
"@nattyjs/entity": "0.0.1-beta.21",
|
|
24
|
+
"@nattyjs/types": "0.0.1-beta.21"
|
|
25
25
|
}
|
|
26
26
|
}
|