@thisisagile/easy-mssql 17.26.1 → 17.26.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.
@@ -0,0 +1,19 @@
1
+ // src/SqlServerProvider.ts
2
+ import { asString, Exception, meta, reject, resolve } from "@thisisagile/easy";
3
+ import { ConnectionPool } from "mssql";
4
+ var SqlServerProvider = class {
5
+ constructor(db, pool) {
6
+ this.db = db;
7
+ this.pool = pool;
8
+ }
9
+ execute = (q) => {
10
+ this.pool = this.pool ?? new ConnectionPool(asString(this.db.options?.connectionString));
11
+ return resolve(this.pool).then((p) => p.connected || p.connecting ? p : p.connect()).then((p) => p.request()).then((r) => r.query(q.toString())).catch((e) => reject(Exception.CouldNotExecute(this.db).because(e)));
12
+ };
13
+ query = (q) => this.execute(q).then((r) => meta(r.recordset).values());
14
+ command = (q) => this.execute(q).then((r) => r.rowsAffected[0]);
15
+ };
16
+ export {
17
+ SqlServerProvider
18
+ };
19
+ //# sourceMappingURL=SqlServerProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/SqlServerProvider.ts"],"sourcesContent":["import { asString, Database, Exception, Json, List, meta, Query, QueryProvider, reject, resolve } from '@thisisagile/easy';\nimport { ConnectionPool, IResult } from 'mssql';\n\nexport class SqlServerProvider implements QueryProvider {\n constructor(readonly db: Database, private pool?: ConnectionPool) {}\n\n execute = (q: Query): Promise<IResult<Json>> => {\n this.pool = this.pool ?? new ConnectionPool(asString(this.db.options?.connectionString));\n return resolve(this.pool)\n .then(p => (p.connected || p.connecting ? p : p.connect()))\n .then(p => p.request())\n .then(r => r.query(q.toString()))\n .catch(e => reject(Exception.CouldNotExecute(this.db).because(e)));\n };\n\n query = (q: Query): Promise<List<Json>> => this.execute(q).then(r => meta(r.recordset).values());\n command = (q: Query): Promise<number> => this.execute(q).then(r => r.rowsAffected[0]);\n}\n"],"mappings":";AAAA,SAAS,UAAoB,WAAuB,MAA4B,QAAQ,eAAe;AACvG,SAAS,sBAA+B;AAEjC,IAAM,oBAAN,MAAiD;AAAA,EACtD,YAAqB,IAAsB,MAAuB;AAA7C;AAAsB;AAAA,EAAwB;AAAA,EAEnE,UAAU,CAAC,MAAqC;AAC9C,SAAK,OAAO,KAAK,QAAQ,IAAI,eAAe,SAAS,KAAK,GAAG,SAAS,gBAAgB,CAAC;AACvF,WAAO,QAAQ,KAAK,IAAI,EACrB,KAAK,OAAM,EAAE,aAAa,EAAE,aAAa,IAAI,EAAE,QAAQ,CAAE,EACzD,KAAK,OAAK,EAAE,QAAQ,CAAC,EACrB,KAAK,OAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC/B,MAAM,OAAK,OAAO,UAAU,gBAAgB,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AAAA,EACrE;AAAA,EAEA,QAAQ,CAAC,MAAkC,KAAK,QAAQ,CAAC,EAAE,KAAK,OAAK,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;AAAA,EAC/F,UAAU,CAAC,MAA8B,KAAK,QAAQ,CAAC,EAAE,KAAK,OAAK,EAAE,aAAa,CAAC,CAAC;AACtF;","names":[]}
package/dist/index.mjs CHANGED
@@ -1,19 +1,2 @@
1
- // src/SqlServerProvider.ts
2
- import { asString, Exception, meta, reject, resolve } from "@thisisagile/easy";
3
- import { ConnectionPool } from "mssql";
4
- var SqlServerProvider = class {
5
- constructor(db, pool) {
6
- this.db = db;
7
- this.pool = pool;
8
- }
9
- execute = (q) => {
10
- this.pool = this.pool ?? new ConnectionPool(asString(this.db.options?.connectionString));
11
- return resolve(this.pool).then((p) => p.connected || p.connecting ? p : p.connect()).then((p) => p.request()).then((r) => r.query(q.toString())).catch((e) => reject(Exception.CouldNotExecute(this.db).because(e)));
12
- };
13
- query = (q) => this.execute(q).then((r) => meta(r.recordset).values());
14
- command = (q) => this.execute(q).then((r) => r.rowsAffected[0]);
15
- };
16
- export {
17
- SqlServerProvider
18
- };
1
+ export * from "./SqlServerProvider";
19
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/SqlServerProvider.ts"],"sourcesContent":["import { asString, Database, Exception, Json, List, meta, Query, QueryProvider, reject, resolve } from '@thisisagile/easy';\nimport { ConnectionPool, IResult } from 'mssql';\n\nexport class SqlServerProvider implements QueryProvider {\n constructor(readonly db: Database, private pool?: ConnectionPool) {}\n\n execute = (q: Query): Promise<IResult<Json>> => {\n this.pool = this.pool ?? new ConnectionPool(asString(this.db.options?.connectionString));\n return resolve(this.pool)\n .then(p => (p.connected || p.connecting ? p : p.connect()))\n .then(p => p.request())\n .then(r => r.query(q.toString()))\n .catch(e => reject(Exception.CouldNotExecute(this.db).because(e)));\n };\n\n query = (q: Query): Promise<List<Json>> => this.execute(q).then(r => meta(r.recordset).values());\n command = (q: Query): Promise<number> => this.execute(q).then(r => r.rowsAffected[0]);\n}\n"],"mappings":";AAAA,SAAS,UAAoB,WAAuB,MAA4B,QAAQ,eAAe;AACvG,SAAS,sBAA+B;AAEjC,IAAM,oBAAN,MAAiD;AAAA,EACtD,YAAqB,IAAsB,MAAuB;AAA7C;AAAsB;AAAA,EAAwB;AAAA,EAEnE,UAAU,CAAC,MAAqC;AAC9C,SAAK,OAAO,KAAK,QAAQ,IAAI,eAAe,SAAS,KAAK,GAAG,SAAS,gBAAgB,CAAC;AACvF,WAAO,QAAQ,KAAK,IAAI,EACrB,KAAK,OAAM,EAAE,aAAa,EAAE,aAAa,IAAI,EAAE,QAAQ,CAAE,EACzD,KAAK,OAAK,EAAE,QAAQ,CAAC,EACrB,KAAK,OAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,EAC/B,MAAM,OAAK,OAAO,UAAU,gBAAgB,KAAK,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;AAAA,EACrE;AAAA,EAEA,QAAQ,CAAC,MAAkC,KAAK,QAAQ,CAAC,EAAE,KAAK,OAAK,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;AAAA,EAC/F,UAAU,CAAC,MAA8B,KAAK,QAAQ,CAAC,EAAE,KAAK,OAAK,EAAE,aAAa,CAAC,CAAC;AACtF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from './SqlServerProvider';\n"],"mappings":"AAAA,cAAc;","names":[]}
package/package.json CHANGED
@@ -1,21 +1,12 @@
1
1
  {
2
2
  "name": "@thisisagile/easy-mssql",
3
- "version": "17.26.1",
3
+ "version": "17.26.2",
4
4
  "description": "Add support for microsoft sql server",
5
5
  "author": "Sander Hoogendoorn",
6
6
  "license": "MIT",
7
- "main": "./dist/index.js",
8
- "module": "./dist/index.mjs",
9
- "types": "./dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "node": "./dist/index.js",
14
- "import": "./dist/index.mjs",
15
- "require": "./dist/index.js"
16
- },
17
- "./package.json": "./package.json"
18
- },
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.mjs",
9
+ "types": "dist/index.d.ts",
19
10
  "repository": {
20
11
  "type": "git",
21
12
  "url": "git@github.com:thisisagile/easy.git"
@@ -46,7 +37,7 @@
46
37
  "@thisisagile/easy-test": "*"
47
38
  },
48
39
  "dependencies": {
49
- "@thisisagile/easy": "^17.26.1",
40
+ "@thisisagile/easy": "^17.26.2",
50
41
  "@types/mssql": "^8.1.2",
51
42
  "mssql": "^9.1.1"
52
43
  }