@memberjunction/server 0.9.244 → 0.9.246

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/server",
3
- "version": "0.9.244",
3
+ "version": "0.9.246",
4
4
  "description": "MemberJunction: This project provides API access via GraphQL to the common data store.",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
@@ -22,16 +22,16 @@
22
22
  "@apollo/server": "^4.9.1",
23
23
  "@graphql-tools/utils": "^10.0.1",
24
24
  "@memberjunction/ai": "^0.9.163",
25
- "@memberjunction/aiengine": "^0.9.65",
25
+ "@memberjunction/aiengine": "^0.9.67",
26
26
  "@memberjunction/core": "^0.9.177",
27
- "@memberjunction/core-entities": "^0.9.164",
28
- "@memberjunction/data-context": "^0.9.51",
29
- "@memberjunction/data-context-server": "^0.9.47",
27
+ "@memberjunction/core-entities": "^0.9.166",
28
+ "@memberjunction/data-context": "^0.9.53",
29
+ "@memberjunction/data-context-server": "^0.9.49",
30
30
  "@memberjunction/global": "^0.9.156",
31
- "@memberjunction/storage": "^0.9.9",
32
- "@memberjunction/queue": "^0.9.186",
33
- "@memberjunction/sqlserver-dataprovider": "^0.9.201",
34
- "@memberjunction/skip-types": "^0.9.76",
31
+ "@memberjunction/storage": "^0.9.11",
32
+ "@memberjunction/queue": "^0.9.188",
33
+ "@memberjunction/sqlserver-dataprovider": "^0.9.203",
34
+ "@memberjunction/skip-types": "^0.9.78",
35
35
  "@types/cors": "^2.8.13",
36
36
  "@types/jsonwebtoken": "^8.5.9",
37
37
  "@types/node": "^18.11.14",
@@ -2,7 +2,7 @@
2
2
  * ALL ENTITIES - TypeGraphQL Type Class Definition - AUTO GENERATED FILE
3
3
  * Generated Entities and Resolvers for Server
4
4
  *
5
- * GENERATED: 3/23/2024, 10:15:37 AM
5
+ * GENERATED: 3/23/2024, 4:22:49 PM
6
6
  *
7
7
  * >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
8
8
  * >>> YOUR CHANGES WILL BE OVERWRITTEN
@@ -26,7 +26,7 @@ import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyInteg
26
26
  //****************************************************************************
27
27
  // ENTITY CLASS for Companies
28
28
  //****************************************************************************
29
- @ObjectType()
29
+ @ObjectType({ description: 'A list of organizational units within your business. These can be subsidiaries or divisions or other units. Companies are used to organizae employee records and also for separating integrations if you have multiple integrations of the same type of system.' })
30
30
  export class Company_ {
31
31
  @Field(() => Int)
32
32
  ID: number;
@@ -292,7 +292,7 @@ export class CompanyResolver extends ResolverBase {
292
292
  //****************************************************************************
293
293
  // ENTITY CLASS for Employees
294
294
  //****************************************************************************
295
- @ObjectType()
295
+ @ObjectType({ description: 'A list of employees across all units of your organization' })
296
296
  export class Employee_ {
297
297
  @Field(() => Int)
298
298
  ID: number;
@@ -620,7 +620,7 @@ export class EmployeeResolver extends ResolverBase {
620
620
  //****************************************************************************
621
621
  // ENTITY CLASS for User Favorites
622
622
  //****************************************************************************
623
- @ObjectType()
623
+ @ObjectType({ description: 'Records that each user can mark as a favorite for easy access' })
624
624
  export class UserFavorite_ {
625
625
  @Field(() => Int)
626
626
  ID: number;
@@ -1228,7 +1228,7 @@ export class EmployeeSkillResolver extends ResolverBase {
1228
1228
  //****************************************************************************
1229
1229
  // ENTITY CLASS for Roles
1230
1230
  //****************************************************************************
1231
- @ObjectType()
1231
+ @ObjectType({ description: 'Roles are used for security administration and can have zero to many Users as members' })
1232
1232
  export class Role_ {
1233
1233
  @Field(() => Int)
1234
1234
  ID: number;
@@ -1273,6 +1273,25 @@ export class Role_ {
1273
1273
 
1274
1274
  }
1275
1275
 
1276
+ //****************************************************************************
1277
+ // INPUT TYPE for Roles
1278
+ //****************************************************************************
1279
+ @InputType()
1280
+ export class CreateRoleInput {
1281
+ @Field()
1282
+ Name: string;
1283
+
1284
+ @Field({ nullable: true })
1285
+ Description: string;
1286
+
1287
+ @Field({ nullable: true })
1288
+ DirectoryID: string;
1289
+
1290
+ @Field({ nullable: true })
1291
+ SQLName: string;
1292
+ }
1293
+
1294
+
1276
1295
  //****************************************************************************
1277
1296
  // INPUT TYPE for Roles
1278
1297
  //****************************************************************************
@@ -1394,6 +1413,36 @@ export class RoleResolver extends ResolverBase {
1394
1413
  return result;
1395
1414
  }
1396
1415
 
1416
+ @Mutation(() => Role_)
1417
+ async CreateRole(
1418
+ @Arg('input', () => CreateRoleInput) input: CreateRoleInput,
1419
+ @Ctx() { dataSource, userPayload }: AppContext,
1420
+ @PubSub() pubSub: PubSubEngine
1421
+ ) {
1422
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
1423
+ const entityObject = <RoleEntity>await new Metadata().GetEntityObject('Roles', this.GetUserFromPayload(userPayload));
1424
+ await entityObject.NewRecord();
1425
+ entityObject.SetMany(input);
1426
+ if (await entityObject.Save()) {
1427
+ // save worked, fire the AfterCreate event and then return all the data
1428
+ await this.AfterCreate(dataSource, input); // fire event
1429
+ return entityObject.GetAll();
1430
+ }
1431
+ else
1432
+ // save failed, return null
1433
+ return null;
1434
+ }
1435
+ else
1436
+ return null;
1437
+ }
1438
+
1439
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
1440
+ protected async BeforeCreate(dataSource: DataSource, input: CreateRoleInput): Promise<boolean> {
1441
+ return true;
1442
+ }
1443
+ protected async AfterCreate(dataSource: DataSource, input: CreateRoleInput) {
1444
+ }
1445
+
1397
1446
  @Mutation(() => Role_)
1398
1447
  async UpdateRole(
1399
1448
  @Arg('input', () => UpdateRoleInput) input: UpdateRoleInput,
@@ -1425,12 +1474,38 @@ export class RoleResolver extends ResolverBase {
1425
1474
  const i = input, d = dataSource; // prevent error
1426
1475
  }
1427
1476
 
1477
+ @Mutation(() => Role_)
1478
+ async DeleteRole(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
1479
+ if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
1480
+ const entityObject = <RoleEntity>await new Metadata().GetEntityObject('Roles', this.GetUserFromPayload(userPayload));
1481
+ await entityObject.Load(ID);
1482
+ const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
1483
+ if (await entityObject.Delete()) {
1484
+ await this.AfterDelete(dataSource, ID); // fire event
1485
+ return returnValue;
1486
+ }
1487
+ else
1488
+ return null; // delete failed, this will cause an exception
1489
+ }
1490
+ else
1491
+ return null; // BeforeDelete canceled the operation, this will cause an exception
1492
+ }
1493
+
1494
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
1495
+ protected async BeforeDelete(dataSource: DataSource, ID: number): Promise<boolean> {
1496
+ const i = ID, d = dataSource; // prevent error;
1497
+ return true;
1498
+ }
1499
+ protected async AfterDelete(dataSource: DataSource, ID: number) {
1500
+ const i = ID, d = dataSource; // prevent error
1501
+ }
1502
+
1428
1503
  }
1429
1504
 
1430
1505
  //****************************************************************************
1431
1506
  // ENTITY CLASS for Skills
1432
1507
  //****************************************************************************
1433
- @ObjectType()
1508
+ @ObjectType({ description: 'A hierarchical list of possible skills that are linked to Employees and can also be linked to any other entity' })
1434
1509
  export class Skill_ {
1435
1510
  @Field(() => Int)
1436
1511
  ID: number;
@@ -1542,7 +1617,7 @@ export class SkillResolver extends ResolverBase {
1542
1617
  //****************************************************************************
1543
1618
  // ENTITY CLASS for Integration URL Formats
1544
1619
  //****************************************************************************
1545
- @ObjectType()
1620
+ @ObjectType({ description: 'Used to generate web links for end users to easily access resources in a source system. URL Formats support templating to inject various field values at run-time to take a user directly to a resource in a source system.' })
1546
1621
  export class IntegrationURLFormat_ {
1547
1622
  @Field(() => Int)
1548
1623
  ID: number;
@@ -1689,7 +1764,7 @@ export class IntegrationURLFormatResolver extends ResolverBase {
1689
1764
  //****************************************************************************
1690
1765
  // ENTITY CLASS for Integrations
1691
1766
  //****************************************************************************
1692
- @ObjectType()
1767
+ @ObjectType({ description: 'Catalog of all integrations that have been configured in the system.' })
1693
1768
  export class Integration_ {
1694
1769
  @Field(() => Int)
1695
1770
  ID: number;
@@ -1878,7 +1953,7 @@ export class IntegrationResolver extends ResolverBase {
1878
1953
  //****************************************************************************
1879
1954
  // ENTITY CLASS for Company Integrations
1880
1955
  //****************************************************************************
1881
- @ObjectType()
1956
+ @ObjectType({ description: 'Links individual company records to specific integrations' })
1882
1957
  export class CompanyIntegration_ {
1883
1958
  @Field(() => Int)
1884
1959
  ID: number;
@@ -2149,7 +2224,7 @@ export class CompanyIntegrationResolver extends ResolverBase {
2149
2224
  //****************************************************************************
2150
2225
  // ENTITY CLASS for Entity Fields
2151
2226
  //****************************************************************************
2152
- @ObjectType()
2227
+ @ObjectType({ description: 'List of all fields within each entity with metadata about each field' })
2153
2228
  export class EntityField_ {
2154
2229
  @Field(() => Int)
2155
2230
  ID: number;
@@ -2642,7 +2717,7 @@ export class EntityFieldResolver extends ResolverBase {
2642
2717
  //****************************************************************************
2643
2718
  // ENTITY CLASS for Entities
2644
2719
  //****************************************************************************
2645
- @ObjectType()
2720
+ @ObjectType({ description: 'Catalog of all entities across all schemas' })
2646
2721
  export class Entity_ {
2647
2722
  @Field(() => Int)
2648
2723
  ID: number;
@@ -3492,7 +3567,7 @@ export class EntityResolverBase extends ResolverBase {
3492
3567
  //****************************************************************************
3493
3568
  // ENTITY CLASS for Users
3494
3569
  //****************************************************************************
3495
- @ObjectType()
3570
+ @ObjectType({ description: 'A list of all users who have or had access to the system' })
3496
3571
  export class User_ {
3497
3572
  @Field(() => Int)
3498
3573
  ID: number;
@@ -4003,7 +4078,7 @@ export class UserResolverBase extends ResolverBase {
4003
4078
  //****************************************************************************
4004
4079
  // ENTITY CLASS for Entity Relationships
4005
4080
  //****************************************************************************
4006
- @ObjectType()
4081
+ @ObjectType({ description: 'Metadata about relationships between entities including display preferences for the UI' })
4007
4082
  export class EntityRelationship_ {
4008
4083
  @Field(() => Int)
4009
4084
  ID: number;
@@ -4524,7 +4599,7 @@ export class UserRecordLogResolver extends ResolverBase {
4524
4599
  //****************************************************************************
4525
4600
  // ENTITY CLASS for User Views
4526
4601
  //****************************************************************************
4527
- @ObjectType()
4602
+ @ObjectType({ description: 'Views are sets of records within a given entity defined by filtering rules. Views can be used programatically to retrieve dynamic sets of data and in user interfaces like MJ Explorer for end-user consumption.' })
4528
4603
  export class UserView_ {
4529
4604
  @Field(() => Int)
4530
4605
  ID: number;
@@ -5427,7 +5502,7 @@ export class ErrorLogResolver extends ResolverBase {
5427
5502
  //****************************************************************************
5428
5503
  // ENTITY CLASS for Applications
5429
5504
  //****************************************************************************
5430
- @ObjectType()
5505
+ @ObjectType({ description: 'Applications are used to group entities in the user interface for ease of user access' })
5431
5506
  export class Application_ {
5432
5507
  @Field(() => Int)
5433
5508
  ID: number;
@@ -5583,7 +5658,7 @@ export class ApplicationResolver extends ResolverBase {
5583
5658
  //****************************************************************************
5584
5659
  // ENTITY CLASS for Application Entities
5585
5660
  //****************************************************************************
5586
- @ObjectType()
5661
+ @ObjectType({ description: 'List of entities within each application. An application can have any number of entities and an entity can be part of any number of applications.' })
5587
5662
  export class ApplicationEntity_ {
5588
5663
  @Field(() => Int)
5589
5664
  ID: number;
@@ -5819,7 +5894,7 @@ export class ApplicationEntityResolver extends ResolverBase {
5819
5894
  //****************************************************************************
5820
5895
  // ENTITY CLASS for Entity Permissions
5821
5896
  //****************************************************************************
5822
- @ObjectType()
5897
+ @ObjectType({ description: 'Security settings for each entity' })
5823
5898
  export class EntityPermission_ {
5824
5899
  @Field(() => Int)
5825
5900
  ID: number;
@@ -6638,7 +6713,7 @@ export class CompanyIntegrationRunAPILogResolver extends ResolverBase {
6638
6713
  //****************************************************************************
6639
6714
  // ENTITY CLASS for Lists
6640
6715
  //****************************************************************************
6641
- @ObjectType()
6716
+ @ObjectType({ description: 'Static lists are useful for controlling a set of data for a given entity. These can be used programatically for applications like logging and tracking long-running tasks and also by end users for tracking any particular list of records they want to directly control the set.' })
6642
6717
  export class List_ {
6643
6718
  @Field(() => Int)
6644
6719
  ID: number;
@@ -6888,7 +6963,7 @@ export class ListResolver extends ResolverBase {
6888
6963
  //****************************************************************************
6889
6964
  // ENTITY CLASS for List Details
6890
6965
  //****************************************************************************
6891
- @ObjectType()
6966
+ @ObjectType({ description: 'Tracks the records within each list.' })
6892
6967
  export class ListDetail_ {
6893
6968
  @Field(() => Int)
6894
6969
  ID: number;
@@ -7083,7 +7158,7 @@ export class ListDetailResolver extends ResolverBase {
7083
7158
  //****************************************************************************
7084
7159
  // ENTITY CLASS for User View Runs
7085
7160
  //****************************************************************************
7086
- @ObjectType()
7161
+ @ObjectType({ description: 'User Views can be logged when run to capture the date and user that ran the view as well as the output results.' })
7087
7162
  export class UserViewRun_ {
7088
7163
  @Field(() => Int)
7089
7164
  ID: number;
@@ -7271,7 +7346,7 @@ export class UserViewRunResolver extends ResolverBase {
7271
7346
  //****************************************************************************
7272
7347
  // ENTITY CLASS for User View Run Details
7273
7348
  //****************************************************************************
7274
- @ObjectType()
7349
+ @ObjectType({ description: 'Tracks the set of records that were included in each run of a given user view.' })
7275
7350
  export class UserViewRunDetail_ {
7276
7351
  @Field(() => Int)
7277
7352
  ID: number;
@@ -7908,7 +7983,7 @@ export class WorkflowEngineResolver extends ResolverBase {
7908
7983
  //****************************************************************************
7909
7984
  // ENTITY CLASS for Record Changes
7910
7985
  //****************************************************************************
7911
- @ObjectType()
7986
+ @ObjectType({ description: 'For entities that have TrackRecordChanges=1, Record Changes will store the history of all changes made within the system. For integrations you can directly add values here if you have inbound signals indicating records were changed in a source system. This entity only automatically captures Record Changes if they were made within the system.' })
7912
7987
  export class RecordChange_ {
7913
7988
  @Field(() => Int)
7914
7989
  ID: number;
@@ -9018,7 +9093,7 @@ export class EntityFieldValueResolver extends ResolverBase {
9018
9093
  //****************************************************************************
9019
9094
  // ENTITY CLASS for AI Models
9020
9095
  //****************************************************************************
9021
- @ObjectType()
9096
+ @ObjectType({ description: 'Catalog of all AI Models configured in the system.' })
9022
9097
  export class AIModel_ {
9023
9098
  @Field(() => Int)
9024
9099
  ID: number;
@@ -9228,7 +9303,7 @@ export class AIModelResolver extends ResolverBase {
9228
9303
  //****************************************************************************
9229
9304
  // ENTITY CLASS for AI Actions
9230
9305
  //****************************************************************************
9231
- @ObjectType()
9306
+ @ObjectType({ description: 'List of all actions that are possible across all AI Models' })
9232
9307
  export class AIAction_ {
9233
9308
  @Field(() => Int)
9234
9309
  ID: number;
@@ -9405,7 +9480,7 @@ export class AIActionResolver extends ResolverBase {
9405
9480
  //****************************************************************************
9406
9481
  // ENTITY CLASS for AI Model Actions
9407
9482
  //****************************************************************************
9408
- @ObjectType()
9483
+ @ObjectType({ description: 'Tracks the actions supported by each AI Model' })
9409
9484
  export class AIModelAction_ {
9410
9485
  @Field(() => Int)
9411
9486
  ID: number;
@@ -9551,7 +9626,7 @@ export class AIModelActionResolver extends ResolverBase {
9551
9626
  //****************************************************************************
9552
9627
  // ENTITY CLASS for Entity AI Actions
9553
9628
  //****************************************************************************
9554
- @ObjectType()
9629
+ @ObjectType({ description: 'Tracks the AI actions that should be invoked based on changes to records within a given entity.' })
9555
9630
  export class EntityAIAction_ {
9556
9631
  @Field(() => Int)
9557
9632
  ID: number;
@@ -9755,7 +9830,7 @@ export class EntityAIActionResolver extends ResolverBase {
9755
9830
  //****************************************************************************
9756
9831
  // ENTITY CLASS for AI Model Types
9757
9832
  //****************************************************************************
9758
- @ObjectType()
9833
+ @ObjectType({ description: 'Types of AI Models' })
9759
9834
  export class AIModelType_ {
9760
9835
  @Field(() => Int)
9761
9836
  ID: number;
@@ -9983,7 +10058,7 @@ export class QueueTypeResolver extends ResolverBase {
9983
10058
  //****************************************************************************
9984
10059
  // ENTITY CLASS for Queues
9985
10060
  //****************************************************************************
9986
- @ObjectType()
10061
+ @ObjectType({ description: 'Queues can be used to async execute long running tasks' })
9987
10062
  export class Queue_ {
9988
10063
  @Field(() => Int)
9989
10064
  ID: number;
@@ -10528,7 +10603,7 @@ export class QueueTaskResolver extends ResolverBase {
10528
10603
  //****************************************************************************
10529
10604
  // ENTITY CLASS for Dashboards
10530
10605
  //****************************************************************************
10531
- @ObjectType()
10606
+ @ObjectType({ description: 'Dashboards are used to group resources into a single display pane for an end-user' })
10532
10607
  export class Dashboard_ {
10533
10608
  @Field(() => Int)
10534
10609
  ID: number;
@@ -11676,7 +11751,7 @@ export class ResourceTypeResolver extends ResolverBase {
11676
11751
  //****************************************************************************
11677
11752
  // ENTITY CLASS for Tags
11678
11753
  //****************************************************************************
11679
- @ObjectType()
11754
+ @ObjectType({ description: 'Tags are used to arbitrarily associate any record in any entity with addtional information.' })
11680
11755
  export class Tag_ {
11681
11756
  @Field(() => Int)
11682
11757
  ID: number;
@@ -11780,7 +11855,7 @@ export class TagResolver extends ResolverBase {
11780
11855
  //****************************************************************************
11781
11856
  // ENTITY CLASS for Tagged Items
11782
11857
  //****************************************************************************
11783
- @ObjectType()
11858
+ @ObjectType({ description: 'Tracks the links between any record in any entity with Tags' })
11784
11859
  export class TaggedItem_ {
11785
11860
  @Field(() => Int)
11786
11861
  ID: number;
@@ -11862,7 +11937,7 @@ export class TaggedItemResolver extends ResolverBase {
11862
11937
  //****************************************************************************
11863
11938
  // ENTITY CLASS for Workspaces
11864
11939
  //****************************************************************************
11865
- @ObjectType()
11940
+ @ObjectType({ description: 'A user can have one or more workspaces' })
11866
11941
  export class Workspace_ {
11867
11942
  @Field(() => Int)
11868
11943
  ID: number;
@@ -12073,7 +12148,7 @@ export class WorkspaceResolver extends ResolverBase {
12073
12148
  //****************************************************************************
12074
12149
  // ENTITY CLASS for Workspace Items
12075
12150
  //****************************************************************************
12076
- @ObjectType()
12151
+ @ObjectType({ description: 'Tracks the resources that are active within a given worksapce' })
12077
12152
  export class WorkspaceItem_ {
12078
12153
  @Field(() => Int)
12079
12154
  ID: number;
@@ -12314,7 +12389,7 @@ export class WorkspaceItemResolver extends ResolverBase {
12314
12389
  //****************************************************************************
12315
12390
  // ENTITY CLASS for Datasets
12316
12391
  //****************************************************************************
12317
- @ObjectType()
12392
+ @ObjectType({ description: 'Cacheable sets of data that can span one or more items' })
12318
12393
  export class Dataset_ {
12319
12394
  @Field(() => Int)
12320
12395
  ID: number;
@@ -12403,7 +12478,7 @@ export class DatasetResolver extends ResolverBase {
12403
12478
  //****************************************************************************
12404
12479
  // ENTITY CLASS for Dataset Items
12405
12480
  //****************************************************************************
12406
- @ObjectType()
12481
+ @ObjectType({ description: 'A single item in a Dataset and can be sourced from multiple methods.' })
12407
12482
  export class DatasetItem_ {
12408
12483
  @Field(() => Int)
12409
12484
  ID: number;
@@ -13290,7 +13365,7 @@ export class UserNotificationResolver extends ResolverBase {
13290
13365
  //****************************************************************************
13291
13366
  // ENTITY CLASS for Schema Info
13292
13367
  //****************************************************************************
13293
- @ObjectType()
13368
+ @ObjectType({ description: 'Tracks the schemas in the system and the ID ranges that are valid for entities within each schema.' })
13294
13369
  export class SchemaInfo_ {
13295
13370
  @Field(() => Int)
13296
13371
  ID: number;
@@ -14615,7 +14690,7 @@ export class QueryCategoryResolver extends ResolverBase {
14615
14690
  //****************************************************************************
14616
14691
  // ENTITY CLASS for Queries
14617
14692
  //****************************************************************************
14618
- @ObjectType()
14693
+ @ObjectType({ description: 'Catalog of stored queries. This is useful for any arbitrary query that is known to be performant and correct and can be reused. Queries can be viewed/run by a user, used programatically via RunQuery, and also used by AI systems for improved reliability instead of dynamically generated SQL. Queries can also improve security since they store the SQL instead of using dynamic SQL.' })
14619
14694
  export class Query_ {
14620
14695
  @Field(() => Int)
14621
14696
  ID: number;