@memberjunction/core 1.0.4 → 1.0.7-next.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/generic/baseEntity.js +2 -2
- package/package.json +24 -24
- package/readme.md +107 -107
|
@@ -487,8 +487,8 @@ class BaseEntity {
|
|
|
487
487
|
return bAllowed;
|
|
488
488
|
}
|
|
489
489
|
ThrowPermissionError(u, type, additionalInfoMessage) {
|
|
490
|
-
throw new Error(`User: ${u.Name} (ID: ${u.ID}, Email: ${u.Email})
|
|
491
|
-
Does NOT have permission to ${entityInfo_1.EntityPermissionType[type]} ${this.EntityInfo.Name} records.
|
|
490
|
+
throw new Error(`User: ${u.Name} (ID: ${u.ID}, Email: ${u.Email})
|
|
491
|
+
Does NOT have permission to ${entityInfo_1.EntityPermissionType[type]} ${this.EntityInfo.Name} records.
|
|
492
492
|
If you believe this is an error, please contact your system administrator.${additionalInfoMessage ? '\nAdditional Information: ' + additionalInfoMessage : ''}}`);
|
|
493
493
|
}
|
|
494
494
|
/**
|
package/package.json
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@memberjunction/core",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "MemberJunction: Core Library including Metadata, Application, Entity Retrieval and Manipulation, and Utilities",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"/dist"
|
|
9
|
-
],
|
|
10
|
-
"scripts": {
|
|
11
|
-
"start": "ts-node-dev src/index.ts",
|
|
12
|
-
"build": "tsc",
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
-
},
|
|
15
|
-
"author": "MemberJunction.com",
|
|
16
|
-
"license": "ISC",
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"ts-node-dev": "^2.0.0",
|
|
19
|
-
"typescript": "^5.3.3"
|
|
20
|
-
},
|
|
21
|
-
"dependencies": {
|
|
22
|
-
"@memberjunction/global": "^1.0.
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@memberjunction/core",
|
|
3
|
+
"version": "1.0.7-next.0",
|
|
4
|
+
"description": "MemberJunction: Core Library including Metadata, Application, Entity Retrieval and Manipulation, and Utilities",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "ts-node-dev src/index.ts",
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
14
|
+
},
|
|
15
|
+
"author": "MemberJunction.com",
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"ts-node-dev": "^2.0.0",
|
|
19
|
+
"typescript": "^5.3.3"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@memberjunction/global": "^1.0.7-next.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
package/readme.md
CHANGED
|
@@ -1,107 +1,107 @@
|
|
|
1
|
-
# @memberjunction/core
|
|
2
|
-
|
|
3
|
-
The `@memberjunction/core` library provides a comprehensive interface for accessing and managing metadata within MemberJunction, along with facilities for working with entities, applications, and various other aspects central to the MemberJunction ecosystem. This library primarily exports a `Metadata` class which acts as the gateway to many functionalities.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @memberjunction/core
|
|
9
|
-
|
|
10
|
-
```markdown
|
|
11
|
-
## Usage
|
|
12
|
-
|
|
13
|
-
### Importing the Library
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
import { Metadata } from '@memberjunction/core';
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
### Working with the Metadata Class
|
|
20
|
-
|
|
21
|
-
The `Metadata` class is a crucial part of this library, providing access to a wide array of metadata, instantiating derived classes of `BaseEntity` for record access and manipulation, and more.
|
|
22
|
-
|
|
23
|
-
#### Instantiating the Metadata Class
|
|
24
|
-
|
|
25
|
-
```javascript
|
|
26
|
-
const md = new Metadata();
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
#### Refreshing Cached Metadata
|
|
30
|
-
|
|
31
|
-
```javascript
|
|
32
|
-
await md.Refresh();
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
#### Getting Applications, Entities, and Other Info
|
|
36
|
-
|
|
37
|
-
```javascript
|
|
38
|
-
const applications = md.Applications;
|
|
39
|
-
const entities = md.Entities;
|
|
40
|
-
const currentUser = md.CurrentUser;
|
|
41
|
-
// ... and so on for other properties
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### Helper Functions
|
|
45
|
-
|
|
46
|
-
```javascript
|
|
47
|
-
// Get Entity ID from name
|
|
48
|
-
const entityId = md.EntityIDFromName('EntityName');
|
|
49
|
-
|
|
50
|
-
// Get Entity name from ID
|
|
51
|
-
const entityName = md.EntityNameFromID(1);
|
|
52
|
-
|
|
53
|
-
// ... and other helper functions as defined in the class
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### Working with Datasets
|
|
57
|
-
|
|
58
|
-
```javascript
|
|
59
|
-
// Example: Getting a dataset by name
|
|
60
|
-
const dataset = await md.GetDatasetByName('DatasetName');
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
This is a brief overview of how to interact with the `Metadata` class. The methods and properties provided by the `Metadata` class serve as a bridge to access and manage data in a structured and coherent manner within the MemberJunction ecosystem.
|
|
64
|
-
|
|
65
|
-
## RunView and RunViewParams
|
|
66
|
-
|
|
67
|
-
The `@memberjunction/core` library also provides a mechanism for running either a stored or dynamic view through the `RunView` class. The parameters for running these views are specified through the `RunViewParams` type.
|
|
68
|
-
|
|
69
|
-
### Importing Necessary Classes and Types
|
|
70
|
-
|
|
71
|
-
```javascript
|
|
72
|
-
import { RunView, RunViewParams } from '@memberjunction/core';
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### Using RunViewParams
|
|
76
|
-
|
|
77
|
-
`RunViewParams` is a type that helps in specifying the parameters required to run a view. The fields in `RunViewParams` allow you to specify whether you want to run a stored or dynamic view, and provide additional filters, sorting, and other options. Here's an example of how you might create a `RunViewParams` object:
|
|
78
|
-
|
|
79
|
-
```javascript
|
|
80
|
-
const params: RunViewParams = {
|
|
81
|
-
ViewName: 'MyView',
|
|
82
|
-
ExtraFilter: 'Age > 25',
|
|
83
|
-
OrderBy: 'LastName ASC',
|
|
84
|
-
Fields: ['FirstName', 'LastName'],
|
|
85
|
-
UserSearchString: 'Smith'
|
|
86
|
-
// ... other optional properties as needed
|
|
87
|
-
};
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### Using the RunView Class
|
|
91
|
-
|
|
92
|
-
The `RunView` class provides a method to run a view based on the provided parameters.
|
|
93
|
-
|
|
94
|
-
#### Instantiating the RunView Class
|
|
95
|
-
|
|
96
|
-
```javascript
|
|
97
|
-
const rv = new RunView();
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
#### Running a View
|
|
101
|
-
|
|
102
|
-
```javascript
|
|
103
|
-
const result = await rv.RunView(params);
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
In this example, `params` is an object of type `RunViewParams` which contains the information necessary to run the view. The `RunView` method will return a `Promise<RunViewResult>` which will contain the result of running the view.
|
|
107
|
-
|
|
1
|
+
# @memberjunction/core
|
|
2
|
+
|
|
3
|
+
The `@memberjunction/core` library provides a comprehensive interface for accessing and managing metadata within MemberJunction, along with facilities for working with entities, applications, and various other aspects central to the MemberJunction ecosystem. This library primarily exports a `Metadata` class which acts as the gateway to many functionalities.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @memberjunction/core
|
|
9
|
+
|
|
10
|
+
```markdown
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Importing the Library
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { Metadata } from '@memberjunction/core';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Working with the Metadata Class
|
|
20
|
+
|
|
21
|
+
The `Metadata` class is a crucial part of this library, providing access to a wide array of metadata, instantiating derived classes of `BaseEntity` for record access and manipulation, and more.
|
|
22
|
+
|
|
23
|
+
#### Instantiating the Metadata Class
|
|
24
|
+
|
|
25
|
+
```javascript
|
|
26
|
+
const md = new Metadata();
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### Refreshing Cached Metadata
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
await md.Refresh();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
#### Getting Applications, Entities, and Other Info
|
|
36
|
+
|
|
37
|
+
```javascript
|
|
38
|
+
const applications = md.Applications;
|
|
39
|
+
const entities = md.Entities;
|
|
40
|
+
const currentUser = md.CurrentUser;
|
|
41
|
+
// ... and so on for other properties
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
#### Helper Functions
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
// Get Entity ID from name
|
|
48
|
+
const entityId = md.EntityIDFromName('EntityName');
|
|
49
|
+
|
|
50
|
+
// Get Entity name from ID
|
|
51
|
+
const entityName = md.EntityNameFromID(1);
|
|
52
|
+
|
|
53
|
+
// ... and other helper functions as defined in the class
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
#### Working with Datasets
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
// Example: Getting a dataset by name
|
|
60
|
+
const dataset = await md.GetDatasetByName('DatasetName');
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
This is a brief overview of how to interact with the `Metadata` class. The methods and properties provided by the `Metadata` class serve as a bridge to access and manage data in a structured and coherent manner within the MemberJunction ecosystem.
|
|
64
|
+
|
|
65
|
+
## RunView and RunViewParams
|
|
66
|
+
|
|
67
|
+
The `@memberjunction/core` library also provides a mechanism for running either a stored or dynamic view through the `RunView` class. The parameters for running these views are specified through the `RunViewParams` type.
|
|
68
|
+
|
|
69
|
+
### Importing Necessary Classes and Types
|
|
70
|
+
|
|
71
|
+
```javascript
|
|
72
|
+
import { RunView, RunViewParams } from '@memberjunction/core';
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Using RunViewParams
|
|
76
|
+
|
|
77
|
+
`RunViewParams` is a type that helps in specifying the parameters required to run a view. The fields in `RunViewParams` allow you to specify whether you want to run a stored or dynamic view, and provide additional filters, sorting, and other options. Here's an example of how you might create a `RunViewParams` object:
|
|
78
|
+
|
|
79
|
+
```javascript
|
|
80
|
+
const params: RunViewParams = {
|
|
81
|
+
ViewName: 'MyView',
|
|
82
|
+
ExtraFilter: 'Age > 25',
|
|
83
|
+
OrderBy: 'LastName ASC',
|
|
84
|
+
Fields: ['FirstName', 'LastName'],
|
|
85
|
+
UserSearchString: 'Smith'
|
|
86
|
+
// ... other optional properties as needed
|
|
87
|
+
};
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Using the RunView Class
|
|
91
|
+
|
|
92
|
+
The `RunView` class provides a method to run a view based on the provided parameters.
|
|
93
|
+
|
|
94
|
+
#### Instantiating the RunView Class
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
const rv = new RunView();
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### Running a View
|
|
101
|
+
|
|
102
|
+
```javascript
|
|
103
|
+
const result = await rv.RunView(params);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
In this example, `params` is an object of type `RunViewParams` which contains the information necessary to run the view. The `RunView` method will return a `Promise<RunViewResult>` which will contain the result of running the view.
|
|
107
|
+
|