@memberjunction/server 0.9.246 → 0.9.248

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.246",
3
+ "version": "0.9.248",
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.67",
25
+ "@memberjunction/aiengine": "^0.9.69",
26
26
  "@memberjunction/core": "^0.9.177",
27
- "@memberjunction/core-entities": "^0.9.166",
28
- "@memberjunction/data-context": "^0.9.53",
29
- "@memberjunction/data-context-server": "^0.9.49",
27
+ "@memberjunction/core-entities": "^0.9.168",
28
+ "@memberjunction/data-context": "^0.9.55",
29
+ "@memberjunction/data-context-server": "^0.9.51",
30
30
  "@memberjunction/global": "^0.9.156",
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",
31
+ "@memberjunction/storage": "^0.9.13",
32
+ "@memberjunction/queue": "^0.9.190",
33
+ "@memberjunction/sqlserver-dataprovider": "^0.9.205",
34
+ "@memberjunction/skip-types": "^0.9.80",
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, 4:22:49 PM
5
+ * GENERATED: 3/29/2024, 3:49:37 PM
6
6
  *
7
7
  * >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
8
8
  * >>> YOUR CHANGES WILL BE OVERWRITTEN
@@ -20,7 +20,7 @@ import { mj_core_schema } from '../config';
20
20
 
21
21
  import * as mj_core_schema_server_object_types from '@memberjunction/server'
22
22
 
23
- import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity } from '@memberjunction/core-entities';
23
+ import { CompanyEntity, EmployeeEntity, UserFavoriteEntity, EmployeeCompanyIntegrationEntity, EmployeeRoleEntity, EmployeeSkillEntity, RoleEntity, SkillEntity, IntegrationURLFormatEntity, IntegrationEntity, CompanyIntegrationEntity, EntityFieldEntity, EntityEntity, UserEntity, EntityRelationshipEntity, UserRecordLogEntity, UserViewEntity, CompanyIntegrationRunEntity, CompanyIntegrationRunDetailEntity, ErrorLogEntity, ApplicationEntity, ApplicationEntityEntity, EntityPermissionEntity, UserApplicationEntityEntity, UserApplicationEntity, CompanyIntegrationRunAPILogEntity, ListEntity, ListDetailEntity, UserViewRunEntity, UserViewRunDetailEntity, WorkflowRunEntity, WorkflowEntity, WorkflowEngineEntity, RecordChangeEntity, UserRoleEntity, RowLevelSecurityFilterEntity, AuditLogEntity, AuthorizationEntity, AuthorizationRoleEntity, AuditLogTypeEntity, EntityFieldValueEntity, AIModelEntity, AIActionEntity, AIModelActionEntity, EntityAIActionEntity, AIModelTypeEntity, QueueTypeEntity, QueueEntity, QueueTaskEntity, DashboardEntity, OutputTriggerTypeEntity, OutputFormatTypeEntity, OutputDeliveryTypeEntity, ReportEntity, ReportSnapshotEntity, ResourceTypeEntity, TagEntity, TaggedItemEntity, WorkspaceEntity, WorkspaceItemEntity, DatasetEntity, DatasetItemEntity, ConversationDetailEntity, ConversationEntity, UserNotificationEntity, SchemaInfoEntity, CompanyIntegrationRecordMapEntity, RecordMergeLogEntity, RecordMergeDeletionLogEntity, QueryFieldEntity, QueryCategoryEntity, QueryEntity, QueryPermissionEntity, VectorIndexEntity, EntityDocumentTypeEntity, EntityDocumentRunEntity, VectorDatabaseEntity, EntityRecordDocumentEntity, EntityDocumentEntity, DataContextItemEntity, DataContextEntity, UserViewCategoryEntity, DashboardCategoryEntity, ReportCategoryEntity, FileStorageProviderEntity, FileEntity, FileCategoryEntity, FileEntityRecordLinkEntity, VersionInstallationEntity } from '@memberjunction/core-entities';
24
24
 
25
25
 
26
26
  //****************************************************************************
@@ -5531,6 +5531,19 @@ export class Application_ {
5531
5531
 
5532
5532
  }
5533
5533
 
5534
+ //****************************************************************************
5535
+ // INPUT TYPE for Applications
5536
+ //****************************************************************************
5537
+ @InputType()
5538
+ export class CreateApplicationInput {
5539
+ @Field()
5540
+ Name: string;
5541
+
5542
+ @Field({ nullable: true })
5543
+ Description: string;
5544
+ }
5545
+
5546
+
5534
5547
  //****************************************************************************
5535
5548
  // INPUT TYPE for Applications
5536
5549
  //****************************************************************************
@@ -5622,6 +5635,36 @@ export class ApplicationResolver extends ResolverBase {
5622
5635
  return result;
5623
5636
  }
5624
5637
 
5638
+ @Mutation(() => Application_)
5639
+ async CreateApplication(
5640
+ @Arg('input', () => CreateApplicationInput) input: CreateApplicationInput,
5641
+ @Ctx() { dataSource, userPayload }: AppContext,
5642
+ @PubSub() pubSub: PubSubEngine
5643
+ ) {
5644
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
5645
+ const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
5646
+ await entityObject.NewRecord();
5647
+ entityObject.SetMany(input);
5648
+ if (await entityObject.Save()) {
5649
+ // save worked, fire the AfterCreate event and then return all the data
5650
+ await this.AfterCreate(dataSource, input); // fire event
5651
+ return entityObject.GetAll();
5652
+ }
5653
+ else
5654
+ // save failed, return null
5655
+ return null;
5656
+ }
5657
+ else
5658
+ return null;
5659
+ }
5660
+
5661
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
5662
+ protected async BeforeCreate(dataSource: DataSource, input: CreateApplicationInput): Promise<boolean> {
5663
+ return true;
5664
+ }
5665
+ protected async AfterCreate(dataSource: DataSource, input: CreateApplicationInput) {
5666
+ }
5667
+
5625
5668
  @Mutation(() => Application_)
5626
5669
  async UpdateApplication(
5627
5670
  @Arg('input', () => UpdateApplicationInput) input: UpdateApplicationInput,
@@ -5630,9 +5673,9 @@ export class ApplicationResolver extends ResolverBase {
5630
5673
  ) {
5631
5674
  if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
5632
5675
  const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
5633
- entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Applications
5634
-
5635
- if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
5676
+ await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
5677
+ entityObject.SetMany(input);
5678
+ if (await entityObject.Save()) {
5636
5679
  // save worked, fire afterevent and return all the data
5637
5680
  await this.AfterUpdate(dataSource, input); // fire event
5638
5681
  return entityObject.GetAll();
@@ -5653,6 +5696,32 @@ export class ApplicationResolver extends ResolverBase {
5653
5696
  const i = input, d = dataSource; // prevent error
5654
5697
  }
5655
5698
 
5699
+ @Mutation(() => Application_)
5700
+ async DeleteApplication(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
5701
+ if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
5702
+ const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
5703
+ await entityObject.Load(ID);
5704
+ const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
5705
+ if (await entityObject.Delete()) {
5706
+ await this.AfterDelete(dataSource, ID); // fire event
5707
+ return returnValue;
5708
+ }
5709
+ else
5710
+ return null; // delete failed, this will cause an exception
5711
+ }
5712
+ else
5713
+ return null; // BeforeDelete canceled the operation, this will cause an exception
5714
+ }
5715
+
5716
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
5717
+ protected async BeforeDelete(dataSource: DataSource, ID: number): Promise<boolean> {
5718
+ const i = ID, d = dataSource; // prevent error;
5719
+ return true;
5720
+ }
5721
+ protected async AfterDelete(dataSource: DataSource, ID: number) {
5722
+ const i = ID, d = dataSource; // prevent error
5723
+ }
5724
+
5656
5725
  }
5657
5726
 
5658
5727
  //****************************************************************************
@@ -7696,6 +7765,20 @@ export class Workflow_ {
7696
7765
  @Field()
7697
7766
  @MaxLength(8)
7698
7767
  UpdatedAt: Date;
7768
+
7769
+ @Field(() => Boolean, {description: 'If set to 1, the workflow will be run automatically on the interval specified by the AutoRunIntervalType and AutoRunInterval fields'})
7770
+ AutoRunEnabled: boolean;
7771
+
7772
+ @Field({nullable: true, description: 'Minutes, Hours, Days, Weeks, Months, Years'})
7773
+ @MaxLength(40)
7774
+ AutoRunIntervalUnits?: string;
7775
+
7776
+ @Field(() => Int, {nullable: true, description: 'The interval, denominated in the units specified in the AutoRunIntervalUnits column, between auto runs of this workflow.'})
7777
+ AutoRunInterval?: number;
7778
+
7779
+ @Field({nullable: true, description: 'If specified, this subclass key, via the ClassFactory, will be instantiated, to execute this workflow. If not specified the WorkflowBase class will be used by default.'})
7780
+ @MaxLength(400)
7781
+ SubclassName?: string;
7699
7782
 
7700
7783
  @Field(() => [mj_core_schema_server_object_types.Report_])
7701
7784
  ReportsArray: mj_core_schema_server_object_types.Report_[]; // Link to Reports
@@ -7727,6 +7810,18 @@ export class UpdateWorkflowInput {
7727
7810
 
7728
7811
  @Field()
7729
7812
  ExternalSystemRecordID: string;
7813
+
7814
+ @Field(() => Boolean)
7815
+ AutoRunEnabled: boolean;
7816
+
7817
+ @Field({ nullable: true })
7818
+ AutoRunIntervalUnits: string;
7819
+
7820
+ @Field(() => Int, { nullable: true })
7821
+ AutoRunInterval: number;
7822
+
7823
+ @Field({ nullable: true })
7824
+ SubclassName: string;
7730
7825
  }
7731
7826
 
7732
7827
  //****************************************************************************
@@ -18357,4 +18452,228 @@ export class FileEntityRecordLinkResolver extends ResolverBase {
18357
18452
  const i = input, d = dataSource; // prevent error
18358
18453
  }
18359
18454
 
18455
+ }
18456
+
18457
+ //****************************************************************************
18458
+ // ENTITY CLASS for Version Installations
18459
+ //****************************************************************************
18460
+ @ObjectType()
18461
+ export class VersionInstallation_ {
18462
+ @Field(() => Int)
18463
+ ID: number;
18464
+
18465
+ @Field(() => Int)
18466
+ MajorVersion: number;
18467
+
18468
+ @Field(() => Int)
18469
+ MinorVersion: number;
18470
+
18471
+ @Field(() => Int)
18472
+ PatchVersion: number;
18473
+
18474
+ @Field({nullable: true, description: 'What type of installation was applied'})
18475
+ @MaxLength(40)
18476
+ Type?: string;
18477
+
18478
+ @Field()
18479
+ @MaxLength(8)
18480
+ InstalledAt: Date;
18481
+
18482
+ @Field({description: 'Pending, Complete, Failed'})
18483
+ @MaxLength(40)
18484
+ Status: string;
18485
+
18486
+ @Field({nullable: true, description: 'Any logging that was saved from the installation process'})
18487
+ InstallLog?: string;
18488
+
18489
+ @Field({nullable: true, description: 'Optional, comments the administrator wants to save for each installed version'})
18490
+ Comments?: string;
18491
+
18492
+ @Field()
18493
+ @MaxLength(8)
18494
+ CreatedAt: Date;
18495
+
18496
+ @Field()
18497
+ @MaxLength(8)
18498
+ UpdatedAt: Date;
18499
+
18500
+ }
18501
+
18502
+ //****************************************************************************
18503
+ // INPUT TYPE for Version Installations
18504
+ //****************************************************************************
18505
+ @InputType()
18506
+ export class CreateVersionInstallationInput {
18507
+ @Field(() => Int)
18508
+ MajorVersion: number;
18509
+
18510
+ @Field(() => Int)
18511
+ MinorVersion: number;
18512
+
18513
+ @Field(() => Int)
18514
+ PatchVersion: number;
18515
+
18516
+ @Field({ nullable: true })
18517
+ Type: string;
18518
+
18519
+ @Field()
18520
+ InstalledAt: Date;
18521
+
18522
+ @Field()
18523
+ Status: string;
18524
+
18525
+ @Field({ nullable: true })
18526
+ InstallLog: string;
18527
+
18528
+ @Field({ nullable: true })
18529
+ Comments: string;
18530
+ }
18531
+
18532
+
18533
+ //****************************************************************************
18534
+ // INPUT TYPE for Version Installations
18535
+ //****************************************************************************
18536
+ @InputType()
18537
+ export class UpdateVersionInstallationInput {
18538
+ @Field(() => Int)
18539
+ ID: number;
18540
+
18541
+ @Field(() => Int)
18542
+ MajorVersion: number;
18543
+
18544
+ @Field(() => Int)
18545
+ MinorVersion: number;
18546
+
18547
+ @Field(() => Int)
18548
+ PatchVersion: number;
18549
+
18550
+ @Field({ nullable: true })
18551
+ Type: string;
18552
+
18553
+ @Field()
18554
+ InstalledAt: Date;
18555
+
18556
+ @Field()
18557
+ Status: string;
18558
+
18559
+ @Field({ nullable: true })
18560
+ InstallLog: string;
18561
+
18562
+ @Field({ nullable: true })
18563
+ Comments: string;
18564
+ }
18565
+
18566
+ //****************************************************************************
18567
+ // RESOLVER for Version Installations
18568
+ //****************************************************************************
18569
+ @ObjectType()
18570
+ export class RunVersionInstallationViewResult {
18571
+ @Field(() => [VersionInstallation_])
18572
+ Results: VersionInstallation_[];
18573
+
18574
+ @Field(() => Int, {nullable: true})
18575
+ UserViewRunID?: number;
18576
+
18577
+ @Field(() => Int, {nullable: true})
18578
+ RowCount: number;
18579
+
18580
+ @Field(() => Int, {nullable: true})
18581
+ TotalRowCount: number;
18582
+
18583
+ @Field(() => Int, {nullable: true})
18584
+ ExecutionTime: number;
18585
+
18586
+ @Field({nullable: true})
18587
+ ErrorMessage?: string;
18588
+
18589
+ @Field(() => Boolean, {nullable: false})
18590
+ Success: boolean;
18591
+ }
18592
+
18593
+ @Resolver(VersionInstallation_)
18594
+ export class VersionInstallationResolver extends ResolverBase {
18595
+ @Query(() => RunVersionInstallationViewResult)
18596
+ async RunVersionInstallationViewByID(@Arg('input', () => RunViewByIDInput) input: RunViewByIDInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
18597
+ return super.RunViewByIDGeneric(input, dataSource, userPayload, pubSub);
18598
+ }
18599
+
18600
+ @Query(() => RunVersionInstallationViewResult)
18601
+ async RunVersionInstallationViewByName(@Arg('input', () => RunViewByNameInput) input: RunViewByNameInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
18602
+ return super.RunViewByNameGeneric(input, dataSource, userPayload, pubSub);
18603
+ }
18604
+
18605
+ @Query(() => RunVersionInstallationViewResult)
18606
+ async RunVersionInstallationDynamicView(@Arg('input', () => RunDynamicViewInput) input: RunDynamicViewInput, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
18607
+ input.EntityName = 'Version Installations';
18608
+ return super.RunDynamicViewGeneric(input, dataSource, userPayload, pubSub);
18609
+ }
18610
+ @Query(() => VersionInstallation_, { nullable: true })
18611
+ async VersionInstallation(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine): Promise<VersionInstallation_ | null> {
18612
+ this.CheckUserReadPermissions('Version Installations', userPayload);
18613
+ const sSQL = `SELECT * FROM [${mj_core_schema}].[vwVersionInstallations] WHERE [ID]=${ID} ` + this.getRowLevelSecurityWhereClause('Version Installations', userPayload, EntityPermissionType.Read, 'AND');
18614
+ const result = this.MapFieldNamesToCodeNames('Version Installations', await dataSource.query(sSQL).then((r) => r && r.length > 0 ? r[0] : {}))
18615
+ return result;
18616
+ }
18617
+
18618
+ @Mutation(() => VersionInstallation_)
18619
+ async CreateVersionInstallation(
18620
+ @Arg('input', () => CreateVersionInstallationInput) input: CreateVersionInstallationInput,
18621
+ @Ctx() { dataSource, userPayload }: AppContext,
18622
+ @PubSub() pubSub: PubSubEngine
18623
+ ) {
18624
+ if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
18625
+ const entityObject = <VersionInstallationEntity>await new Metadata().GetEntityObject('Version Installations', this.GetUserFromPayload(userPayload));
18626
+ await entityObject.NewRecord();
18627
+ entityObject.SetMany(input);
18628
+ if (await entityObject.Save()) {
18629
+ // save worked, fire the AfterCreate event and then return all the data
18630
+ await this.AfterCreate(dataSource, input); // fire event
18631
+ return entityObject.GetAll();
18632
+ }
18633
+ else
18634
+ // save failed, return null
18635
+ return null;
18636
+ }
18637
+ else
18638
+ return null;
18639
+ }
18640
+
18641
+ // Before/After CREATE Event Hooks for Sub-Classes to Override
18642
+ protected async BeforeCreate(dataSource: DataSource, input: CreateVersionInstallationInput): Promise<boolean> {
18643
+ return true;
18644
+ }
18645
+ protected async AfterCreate(dataSource: DataSource, input: CreateVersionInstallationInput) {
18646
+ }
18647
+
18648
+ @Mutation(() => VersionInstallation_)
18649
+ async UpdateVersionInstallation(
18650
+ @Arg('input', () => UpdateVersionInstallationInput) input: UpdateVersionInstallationInput,
18651
+ @Ctx() { dataSource, userPayload }: AppContext,
18652
+ @PubSub() pubSub: PubSubEngine
18653
+ ) {
18654
+ if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
18655
+ const entityObject = <VersionInstallationEntity>await new Metadata().GetEntityObject('Version Installations', this.GetUserFromPayload(userPayload));
18656
+ entityObject.LoadFromData(input) // using the input instead of loading from DB because TrackChanges is turned off for Version Installations
18657
+
18658
+ if (await entityObject.Save({ IgnoreDirtyState: true /*flag used because of LoadFromData() call above*/ })) {
18659
+ // save worked, fire afterevent and return all the data
18660
+ await this.AfterUpdate(dataSource, input); // fire event
18661
+ return entityObject.GetAll();
18662
+ }
18663
+ else
18664
+ return null; // save failed, return null
18665
+ }
18666
+ else
18667
+ return null;
18668
+ }
18669
+
18670
+ // Before/After UPDATE Event Hooks for Sub-Classes to Override
18671
+ protected async BeforeUpdate(dataSource: DataSource, input: UpdateVersionInstallationInput): Promise<boolean> {
18672
+ const i = input, d = dataSource; // prevent error
18673
+ return true;
18674
+ }
18675
+ protected async AfterUpdate(dataSource: DataSource, input: UpdateVersionInstallationInput) {
18676
+ const i = input, d = dataSource; // prevent error
18677
+ }
18678
+
18360
18679
  }