@memberjunction/data-context-server 2.47.0 → 2.49.0

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.d.ts CHANGED
@@ -3,7 +3,7 @@ import { DataContextItem } from "@memberjunction/data-context";
3
3
  export declare class DataContextItemServer extends DataContextItem {
4
4
  /**
5
5
  * Server-Side only method to load the data context item from a SQL statement
6
- * @param dataSource - The data source to load the data context item from (this implementation uses TypeORM's DataSource object)
6
+ * @param dataSource - The data source to load the data context item from (this implementation uses mssql ConnectionPool object)
7
7
  * @param contextUser - The user that is requesting the data context
8
8
  */
9
9
  protected LoadFromSQL(dataSource: any, contextUser?: UserInfo): Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,qBACa,qBAAsB,SAAQ,eAAe;IACtD;;;;OAIG;cACsB,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CAalG;AAED;;GAEG;AACH,wBAAgB,0BAA0B,SAGzC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,qBACa,qBAAsB,SAAQ,eAAe;IACtD;;;;OAIG;cACsB,WAAW,CAAC,UAAU,EAAE,GAAG,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC;CAclG;AAED;;GAEG;AACH,wBAAgB,0BAA0B,SAGzC"}
package/dist/index.js CHANGED
@@ -1,26 +1,51 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
2
18
  var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
19
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
20
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
21
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
22
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
23
  };
24
+ var __importStar = (this && this.__importStar) || function (mod) {
25
+ if (mod && mod.__esModule) return mod;
26
+ var result = {};
27
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
28
+ __setModuleDefault(result, mod);
29
+ return result;
30
+ };
8
31
  Object.defineProperty(exports, "__esModule", { value: true });
9
32
  exports.LoadDataContextItemsServer = exports.DataContextItemServer = void 0;
10
33
  const global_1 = require("@memberjunction/global");
11
34
  const core_1 = require("@memberjunction/core");
12
35
  const data_context_1 = require("@memberjunction/data-context");
36
+ const sql = __importStar(require("mssql"));
13
37
  let DataContextItemServer = class DataContextItemServer extends data_context_1.DataContextItem {
14
38
  /**
15
39
  * Server-Side only method to load the data context item from a SQL statement
16
- * @param dataSource - The data source to load the data context item from (this implementation uses TypeORM's DataSource object)
40
+ * @param dataSource - The data source to load the data context item from (this implementation uses mssql ConnectionPool object)
17
41
  * @param contextUser - The user that is requesting the data context
18
42
  */
19
43
  async LoadFromSQL(dataSource, contextUser) {
20
44
  try {
21
- const ds = dataSource;
22
- const result = await ds.query(this.SQL);
23
- this.Data = result;
45
+ const pool = dataSource;
46
+ const request = new sql.Request(pool);
47
+ const result = await request.query(this.SQL);
48
+ this.Data = result.recordset;
24
49
  return true; // if we get here the above query didn't fail by throwing an exception which would get caught below
25
50
  }
26
51
  catch (e) {
@@ -32,7 +57,7 @@ let DataContextItemServer = class DataContextItemServer extends data_context_1.D
32
57
  };
33
58
  exports.DataContextItemServer = DataContextItemServer;
34
59
  exports.DataContextItemServer = DataContextItemServer = __decorate([
35
- (0, global_1.RegisterClass)(data_context_1.DataContextItem, undefined, 2) // higher priority for this class
60
+ (0, global_1.RegisterClass)(data_context_1.DataContextItem, undefined, undefined, true)
36
61
  ], DataContextItemServer);
37
62
  /**
38
63
  * Call this function after you import this package to ensure that the DataContextItemServer class is not tree shaken out of the final build
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,mDAAuD;AACvD,+CAA0D;AAC1D,+DAA+D;AAIxD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,8BAAe;IACtD;;;;OAIG;IACgB,KAAK,CAAC,WAAW,CAAC,UAAe,EAAE,WAAsB;QACxE,IAAI,CAAC;YACD,MAAM,EAAE,GAAG,UAAwB,CAAC;YACpC,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACxC,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC;YACnB,OAAO,IAAI,CAAC,CAAC,mGAAmG;QACpH,CAAC;Q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AAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;YACrG,IAAA,eAAQ,EAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAChC,OAAO,KAAK,CAAC;QACjB,CAAC;IACL,CAAC;CACJ,CAAA;AApBY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAa,EAAC,8BAAe,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC;GAC9C,qBAAqB,CAoBjC;AAED;;GAEG;AACH,SAAgB,0BAA0B;IACtC,4JAA4J;IAC5J,8EAA8E;AAClF,CAAC;AAHD,gEAGC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/data-context-server",
3
- "version": "2.47.0",
3
+ "version": "2.49.0",
4
4
  "description": "This library provides a server-side implementation of the DataContextItem class from @memberjunction/data-context that can handle the server-side only use case of loading data into a context using raw SQL statements.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,8 +19,8 @@
19
19
  "typescript": "^5.4.5"
20
20
  },
21
21
  "dependencies": {
22
- "@memberjunction/data-context": "2.47.0",
23
- "@memberjunction/global": "2.47.0",
24
- "typeorm": "^0.3.20"
22
+ "@memberjunction/data-context": "2.49.0",
23
+ "@memberjunction/global": "2.49.0",
24
+ "mssql": "^11.0.1"
25
25
  }
26
26
  }