@memberjunction/data-context-server 4.3.1 → 5.0.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/package.json +4 -4
- package/README.md +0 -59
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/data-context-server",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"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.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"typescript": "^5.9.3"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@memberjunction/core": "
|
|
24
|
-
"@memberjunction/data-context": "
|
|
25
|
-
"@memberjunction/global": "
|
|
23
|
+
"@memberjunction/core": "5.0.0",
|
|
24
|
+
"@memberjunction/data-context": "5.0.0",
|
|
25
|
+
"@memberjunction/global": "5.0.0",
|
|
26
26
|
"mssql": "^12.2.0"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
package/README.md
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# @memberjunction/data-context-server
|
|
2
|
-
|
|
3
|
-
Server-side implementation of the MemberJunction Data Context system. Provides SQL-based data loading for `DataContextItem` objects using direct database connections.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The `@memberjunction/data-context-server` package extends the base `DataContextItem` class from `@memberjunction/data-context` with a server-side implementation that executes SQL queries directly against SQL Server using `mssql` connection pools. This is the server counterpart to the client-side GraphQL-based data context loading.
|
|
8
|
-
|
|
9
|
-
```mermaid
|
|
10
|
-
graph TD
|
|
11
|
-
A["DataContextItemServer"] -->|extends| B["DataContextItem<br/>(data-context package)"]
|
|
12
|
-
A -->|uses| C["mssql ConnectionPool"]
|
|
13
|
-
C --> D["SQL Server"]
|
|
14
|
-
|
|
15
|
-
E["Server-Side Code<br/>(MJAPI, Actions, etc.)"] --> A
|
|
16
|
-
F["Client-Side Code<br/>(Angular, React)"] --> G["DataContextItemClient<br/>(GraphQL-based)"]
|
|
17
|
-
|
|
18
|
-
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
19
|
-
style B fill:#7c5295,stroke:#563a6b,color:#fff
|
|
20
|
-
style C fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
21
|
-
style D fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
22
|
-
style E fill:#b8762f,stroke:#8a5722,color:#fff
|
|
23
|
-
style G fill:#b8762f,stroke:#8a5722,color:#fff
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Installation
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
npm install @memberjunction/data-context-server
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## How It Works
|
|
33
|
-
|
|
34
|
-
The package registers `DataContextItemServer` as a subclass of `DataContextItem` using MemberJunction's `@RegisterClass` decorator. When server-side code creates a `DataContextItem`, the class factory automatically returns the server implementation that uses direct SQL execution rather than GraphQL.
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
import '@memberjunction/data-context-server';
|
|
38
|
-
// DataContextItem instances now use direct SQL execution on the server
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
The `LoadFromSQL` method:
|
|
42
|
-
1. Receives a SQL Server `ConnectionPool` as the data source
|
|
43
|
-
2. Creates a new `Request` from the pool
|
|
44
|
-
3. Executes the `DataContextItem.SQL` query directly
|
|
45
|
-
4. Stores the resulting recordset in `DataContextItem.Data`
|
|
46
|
-
5. Returns success/failure with error details on `DataLoadingError`
|
|
47
|
-
|
|
48
|
-
## Dependencies
|
|
49
|
-
|
|
50
|
-
| Package | Purpose |
|
|
51
|
-
|---------|---------|
|
|
52
|
-
| `@memberjunction/core` | UserInfo, LogError utilities |
|
|
53
|
-
| `@memberjunction/global` | RegisterClass decorator |
|
|
54
|
-
| `@memberjunction/data-context` | Base DataContextItem class |
|
|
55
|
-
| `mssql` | SQL Server connectivity |
|
|
56
|
-
|
|
57
|
-
## License
|
|
58
|
-
|
|
59
|
-
ISC
|